60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
#include "OptionsPage.h"
|
|
#include "ui_OptionsPage.h"
|
|
#include "GlobalDefine.h"
|
|
#include "CableTestBench.h"
|
|
#include <QHostAddress>
|
|
|
|
COptionsPage::COptionsPage(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::COptionsPage)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
mProgramHandle = 0;
|
|
|
|
connect(ui->mApplyAndSaveBtn,SIGNAL(clicked()),this,SLOT(OptionChanged()));
|
|
}
|
|
|
|
COptionsPage::~COptionsPage()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
|
|
int COptionsPage::GetCurrentOptions(CTestBenchSettings *Settings)
|
|
{
|
|
Settings->mPinHoldTime = ui->mTestHoldTimeHighSpinBx->value();
|
|
Settings->mIgnoreVisualInspection = ui->mIgnoreVisualInspChkBx->isChecked();
|
|
Settings->mIOModuleIPAddress = QString("%1.%2.%3.%4").arg(ui->mIPAdd1SpinBox->value()).arg(ui->mIPAdd2SpinBox->value()).arg(ui->mIPAdd3SpinBox->value()).arg(ui->mIPAdd4SpinBox->value());
|
|
Settings->mIncludeLogInReport = ui->mIncludeLogInReportChkBx->isChecked();
|
|
|
|
|
|
|
|
return RET_OK;
|
|
|
|
}
|
|
|
|
int COptionsPage::SetCurrentOptions(CTestBenchSettings *Settings)
|
|
{
|
|
ui->mTestHoldTimeHighSpinBx->setValue(Settings->mPinHoldTime);
|
|
ui->mIgnoreVisualInspChkBx->setChecked(Settings->mIgnoreVisualInspection);
|
|
ui->mIncludeLogInReportChkBx->setChecked(Settings->mIncludeLogInReport);
|
|
QHostAddress IPAddres(Settings->mIOModuleIPAddress);
|
|
|
|
int IPV4 = IPAddres.toIPv4Address();
|
|
|
|
ui->mIPAdd4SpinBox->setValue(IPV4 & 0x000000FF);
|
|
IPV4 >>= 8;
|
|
ui->mIPAdd3SpinBox->setValue(IPV4 & 0x000000FF);
|
|
IPV4 >>= 8;
|
|
ui->mIPAdd2SpinBox->setValue(IPV4 & 0x000000FF);
|
|
IPV4 >>= 8;
|
|
ui->mIPAdd1SpinBox->setValue(IPV4 & 0x000000FF);
|
|
|
|
}
|
|
|
|
void COptionsPage::OptionChanged()
|
|
{
|
|
mProgramHandle->TestBenchOptionsChanged();
|
|
}
|