CableTestBench/Sources/CableTestPage.cpp
2019-05-02 16:10:58 -04:00

68 lines
2.3 KiB
C++

#include "CableTestPage.h"
#include "ui_CableTestPage.h"
#include "CableTestBench.h"
#include <QTextCodec>
CCableTestPage::CCableTestPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::CCableTestPage)
{
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
ui->setupUi(this);
mProgramHandle = 0;
mInspectionNotDonePixmap = QPixmap("./images/todo.png").scaled(ui->mInspectionDoneIcon->geometry().width(),ui->mInspectionDoneIcon->geometry().height());
mInspectionDonePixmap = QPixmap("./images/done1.png").scaled(ui->mInspectionDoneIcon->geometry().width(),ui->mInspectionDoneIcon->geometry().height());
ui->mInspectionDoneIcon->setPixmap(mInspectionNotDonePixmap);
connect(ui->mExecInspVisuelleBtn,SIGNAL(clicked()),this,SLOT(InspVisuelleBtnClicked()));
connect(ui->mConnectorSelectWidget,SIGNAL(ConnectorSelected(CConnectorDefs::eConnectorType)),this,SLOT(ConnectorSelectionChanged(CConnectorDefs::eConnectorType)));
ui->mInputTestVisualisationWidget->SetConnectorPinCount(0);
ui->mOutputTestVisualisationWidget->SetConnectorPinCount(0);
ui->mVisualInspStepChkBx->setCheckable(false);
}
CCableTestPage::~CCableTestPage()
{
delete ui;
}
void CCableTestPage::InspVisuelleBtnClicked()
{
mProgramHandle->ExecVisualInspectionRequest();
}
int CCableTestPage::SetVisualInspectionDone(bool Done)
{
if(Done)
{
ui->mInspectionDoneIcon->setPixmap(mInspectionDonePixmap);
ui->mExecInspVisuelleBtn->setText(QString("Réviser Inspection").toUtf8());
ui->mVisualInspStepChkBx->setCheckable(true);
ui->mVisualInspStepChkBx->setChecked(true);
ui->mVisualInspStepChkBx->setCheckable(false);
}
else
{
ui->mInspectionDoneIcon->setPixmap(mInspectionNotDonePixmap);
ui->mExecInspVisuelleBtn->setText("Effectuer Inspection");
ui->mVisualInspStepChkBx->setChecked(false);
}
return RET_OK;
}
void CCableTestPage::ConnectorSelectionChanged(CConnectorDefs::eConnectorType ConType)
{
CCable* Cable;
Cable = mProgramHandle->SetSelectedConnector(ConType);
if(Cable != 0)
{
ui->mInputTestVisualisationWidget->SetConnectorPinCount(Cable->GetInputConnector()->GetPinCount());
ui->mOutputTestVisualisationWidget->SetConnectorPinCount(Cable->GetOutputConnector()->GetPinCount());
}
}