#include "cmwviewcam.h"
#include "ui_cmwviewcam.h"
#include "logic.h"
#include <QScreen>
CMWViewCam::CMWViewCam(QWidget *parent, int iCamID) :
    CMWidget(parent),
    ui(new Ui::CMWViewCam)
{
    ui->setupUi(this);
    m_iCamID=iCamID;
    m_iTimerInterval=15;


}

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

void CMWViewCam::MInit()
{
    CCam* pCam=GET_CHDIRECT(m_iCamID,CCam);
    Q_ASSERT(pCam);
    ui->widget_Cam->m_bContainerInside=false;
    ui->widget_Cam->m_pContainer=&(pCam->m_imageContainer);
    ui->widget_Cam->m_pCam=pCam;

    m_pCamLight=new CMWCamLight(this,m_iCamID,true);
    ui->stackedWidget->addWidget(m_pCamLight);
    mchildwidgets[0]=m_pCamLight;

    if(m_iCamID==CAM2X)
    {
        m_gSystem.m_pMWCamLight2X=m_pCamLight;
		ui->widget_Cam->m_bIsCamera = false;
    }
    else if(m_iCamID == CAM6X)
    {
        m_gSystem.m_pMWCamLight6X=m_pCamLight;
    }
	else
	{
#ifdef __USE_THIRD_CAMERA__
		if(m_iCamID == CAMKerf)
			m_gSystem.m_pMWCamLight4X=m_pCamLight;
		else
			m_gSystem.m_pMWCamLight6X=m_pCamLight;
#else
		m_gSystem.m_pMWCamLight6X=m_pCamLight;
#endif
	}
    CMWidget::MInit();
}

void CMWViewCam::MFresh()
{
    CMWidget::MFresh();
}

void CMWViewCam::MTimeFresh()
{
    m_pCamLight->MTimeFresh();
    ui->widget_Cam->MTimeFresh();
    CMWidget::MTimeFresh();
}


