#include "cmwparamproduct.h"
#include "ui_cmwparamproduct.h"
#include "logic.h"
CMWParamProduct::CMWParamProduct(QWidget *parent) :
    CMWidget(parent),
    ui(new Ui::CMWParamProduct)
{
    ui->setupUi(this);
	m_sName=tr("Product");
}

CMWParamProduct::~CMWParamProduct()
{
    delete ui;
}

void CMWParamProduct::MInit()
{
    CMProduct* product=GET_CHDIRECT(PRODUCT,CMProduct);
    Q_ASSERT(product);
    Variant* pparams[20];
    pparams[0]=product->m_Variants.get_Variant(Var_Product_Diameter_ID);
	pparams[1]=product->m_Variants.get_Variant(Var_MProduct_MeasureDiameter);
    pparams[2]=product->m_Variants.get_Variant(Var_MProduct_FlatLength_ID);
    pparams[3]=product->m_Variants.get_Variant(Var_MProduct_FlatPos_ID);
    pparams[4]=product->m_Variants.get_Variant(Var_Product_Thick_ID);
    pparams[5]=product->m_Variants.get_Variant(Var_MProduct_FilmThick_ID);
    pparams[6]=product->m_Variants.get_Variant(Var_MProduct_FirstCutb_ID);
	CProcess_Level* pLevel=GET_PROCESS(PROCESS_LEVELING, SM_MAIN, CProcess_Level);
	Q_ASSERT(pLevel);

	pparams[7] = pLevel->m_Variants.get_Variant(Var_Process_Enable_Align_Check);
    pparams[8] = pLevel->m_Variants.get_Variant(Var_Process_EnableHalfcut_Check);
    pparams[9]=product->m_Variants.get_Variant(Var_MProduct_SizeType_ID);
	pparams[10]=product->m_Variants.get_Variant(Var_MProduct_CutType_ID);
	
	pparams[11] = pLevel->m_Variants.get_Variant(Var_Process_ProductSide_CutStartA);
	pparams[12] = pLevel->m_Variants.get_Variant(Var_Process_ProductSide_CutEndA);
	pparams[13] = pLevel->m_Variants.get_Variant(Var_Process_ProductSide_CutStartB);
	pparams[14] = pLevel->m_Variants.get_Variant(Var_Process_ProductSide_CutEndB);

	pparams[15]=product->m_Variants.get_Variant(Var_MProduct_ID);

   ui->widget_product->MParamInit_list(pparams,16);
   mchildwidgets[intptr_t(ui->widget_product)]=ui->widget_product;
}
