1)将G100、G200和G300、G400的工位区分开

2)G100和G200的初检工位中加入烧录界面
This commit is contained in:
luoliangyi 2024-08-20 11:32:38 +08:00
parent 5b8a9fcd15
commit eb837ff167
13 changed files with 447 additions and 610 deletions

View File

@ -6,15 +6,14 @@
#include "app_cfg.h"
#include "dialog_setlogpath.h"
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, Dialog_logIn::LogInType logInType, const QString &devName, const QString &profileName,
const QString &accountName, SANE_Handle handle, const QString &serialNum, const QString &devType) :
QDialog(mainWnd),
Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, const QString &deviceConfig,
const QString &accountName, SANE_Handle handle, const QString &serialNum, const QString &devType, bool canSetSN)
: QDialog(mainWnd),
ui(new Ui::Dialog_InputSerialNum),
m_mainWnd(mainWnd),
m_logInType(logInType),
m_handle(handle),
m_valid(true),
m_profileName(profileName),
m_deviceConfig(deviceConfig),
m_accountName(accountName),
m_serialNum(serialNum),
m_devType(devType),
@ -26,6 +25,7 @@ Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, Dialog_l
{
ui->setupUi(this);
setWindowTitle(devName);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
QFont ft;
@ -35,7 +35,7 @@ Dialog_InputSerialNum::Dialog_InputSerialNum(class MainWindow *mainWnd, Dialog_l
QFont ft2;
ft2.setPointSize(20);
if (m_logInType != Dialog_logIn::LogInType_InitTest)
if (!canSetSN)
{
ui->lineEdit_sn->setEnabled(false);
ui->pbtn_setSn->setEnabled(false);
@ -115,7 +115,7 @@ void Dialog_InputSerialNum::Invalid(const QString &devName)
void Dialog_InputSerialNum::setSpeedMode()
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG;
@ -132,7 +132,7 @@ void Dialog_InputSerialNum::setSpeedMode()
void Dialog_InputSerialNum::setSleepTime()
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG;
@ -149,7 +149,7 @@ void Dialog_InputSerialNum::setSleepTime()
void Dialog_InputSerialNum::setVidPid()
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG;
@ -173,7 +173,7 @@ void Dialog_InputSerialNum::setVidPid()
void Dialog_InputSerialNum::setDevceModel()
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
std::string deviceModel = jsonGlobal.device_model.toStdString();
@ -314,7 +314,7 @@ void Dialog_InputSerialNum::updateTargetCfg()
{
ui->textBrowser_target->clear();
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
int speedMode = jsonGlobal.speed_mode;
@ -362,7 +362,7 @@ void Dialog_InputSerialNum::updateCurDeviceCfg()
int vid_to = getDevVid();
int pid_to = getDevPid();
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
QString devideModel("");
if (!jsonGlobal.device_model.isEmpty())
@ -505,7 +505,7 @@ void Dialog_InputSerialNum::on_pbtn_setSn_clicked()
void Dialog_InputSerialNum::on_pbtn_checkConfig_clicked()
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
int speedMode_to = jsonGlobal.speed_mode;
@ -649,7 +649,7 @@ void Dialog_InputSerialNum::on_pbtn_enterTest_clicked()
void Dialog_InputSerialNum::on_pbtn_setConfig_clicked()
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
bool supportDevModel = false;

View File

@ -16,8 +16,8 @@ class Dialog_InputSerialNum : public QDialog
Q_OBJECT
public:
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, Dialog_logIn::LogInType logInType, const QString &devName, const QString &profileName,
const QString &accountName, SANE_Handle handle, const QString &serialNum, const QString &devType);
explicit Dialog_InputSerialNum(class MainWindow *mainWnd, const QString &devName, const QString &deviceConfig,
const QString &accountName, SANE_Handle handle, const QString &serialNum, const QString &devType, bool canSetSN);
~Dialog_InputSerialNum();
QString GetSn();
@ -81,15 +81,13 @@ private:
Ui::Dialog_InputSerialNum *ui;
class MainWindow *m_mainWnd;
Dialog_logIn::LogInType m_logInType;
SANE_Handle m_handle;
bool m_valid;
QString m_profileName;
QString m_deviceConfig;
QString m_accountName;
QString m_serialNum;
QString m_devType;
QString m_devName;
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
hgscanner *m_hg;
int m_curIndex;

View File

@ -11,16 +11,24 @@
#include "dialog_registeraccount.h"
#include "app_cfg.h"
Dialog_logIn::Dialog_logIn(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog_logIn)
, m_accountName("")
, m_profileName("")
Dialog_logIn::Dialog_logIn(QWidget *parent)
: QDialog(parent)
, ui(new Ui::Dialog_logIn)
, m_accountName("")
, m_deviceType(DeviceType_G100)
, m_deviceConfig("")
, m_loginType(LogInType_Station1)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
ui->comboBox_deviceType->addItem("G100");
ui->comboBox_deviceType->addItem("G200");
ui->comboBox_deviceType->addItem("G300");
ui->comboBox_deviceType->addItem("G400");
ui->comboBox_deviceType->setCurrentIndex(getCfgValue("login", "devType", 0));
QFont ft;
ft.setPointSize(15);
this->setFont(ft);
@ -30,22 +38,21 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->lineEdit_password->setFont(ft2);
ui->pbtn_login->setDefault(true);
ui->radioButton_pressureTest->setVisible(false);
saveCfgValue("admin", "password", getCfgValue("admin", "password", QString("huagaoadmin")));
int type = getCfgValue("login", "station", 0);
if (LogInType_Burn == type)
if (0 == type)
{
ui->radioButton_burn->setChecked(true);
ui->radioButton_station1->setChecked(true);
}
else if (LogInType_InitTest == type)
else if (1 == type)
{
ui->radioButton_initTest->setChecked(true);
ui->radioButton_station2->setChecked(true);
}
else if (LogInType_ImageTest == type)
else if (2 == type)
{
ui->radioButton_imageTest->setChecked(true);
ui->radioButton_station3->setChecked(true);
}
updateProfileFileList();
@ -68,27 +75,6 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->lineEdit_password->setText(cfgPassword);
}
}
ui->stackedWidget->setCurrentIndex(0);
// QString ipStr = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b";
// QString portStr = "[0-9]+$";
// ui->lineEdit_dbHost->setValidator(new QRegExpValidator(QRegExp(ipStr)));
// ui->lineEdit_ftpHost->setValidator(new QRegExpValidator(QRegExp(ipStr)));
// ui->lineEdit_dbPort->setValidator(new QRegExpValidator(QRegExp(portStr)));
// ui->lineEdit_ftpPort->setValidator(new QRegExpValidator(QRegExp(portStr)));
// QString account("root");
// QString dbHost("192.168.1.70");
// QString dbPort("3306");
// QString ftpHost("192.168.1.70");
// QString ftpPort("21");
// ui->lineEdit_dbHost->setText(getCfgValue("login", "dbHost", dbHost));
// ui->lineEdit_dbPort->setText(getCfgValue("login", "dbPort", dbPort));
// ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost));
// ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort));
}
Dialog_logIn::~Dialog_logIn()
@ -96,34 +82,24 @@ Dialog_logIn::~Dialog_logIn()
delete ui;
}
//HGPdtToolDbUserMgr Dialog_logIn::GetUserMgr()
//{
// return m_pdtToolDbuserMgr;
//}
QString Dialog_logIn::GetFtpHost()
{
return ui->lineEdit_ftpHost->text();
}
unsigned short Dialog_logIn::GetFtpPort()
{
return ui->lineEdit_ftpPort->text().toUShort();
}
Dialog_logIn::LogInType Dialog_logIn::GetLogInType()
{
return m_loginType;
}
QString Dialog_logIn::GetAccountName()
{
return m_accountName;
}
QString Dialog_logIn::GetProfileName()
Dialog_logIn::DeviceType Dialog_logIn::GetDeviceType()
{
return m_profileName;
return m_deviceType;
}
QString Dialog_logIn::GetDeviceConfig()
{
return m_deviceConfig;
}
Dialog_logIn::LogInType Dialog_logIn::GetLogInType()
{
return m_loginType;
}
QString Dialog_logIn::getConfigFilePath()
@ -139,9 +115,9 @@ QString Dialog_logIn::getConfigFilePath()
void Dialog_logIn::updateProfileFileList()
{
ui->comboBox_filenameList->clear();
ui->comboBox_deviceConfig->clear();
QString configFilePath = getConfigFilePath();
QString configFilePath = getConfigFilePath() + ui->comboBox_deviceType->currentText();
QDir dir(configFilePath);
if (dir.exists())
{
@ -149,15 +125,15 @@ void Dialog_logIn::updateProfileFileList()
for (int i = 0; i < fileList.size(); ++i)
{
QFileInfo file(fileList[i]);
ui->comboBox_filenameList->addItem(file.baseName());
ui->comboBox_deviceConfig->addItem(file.baseName());
}
}
if (ui->comboBox_filenameList->count() > 0)
if (ui->comboBox_deviceConfig->count() > 0)
{
QString fileName = getCfgValue("login", "profile", QString(""));
QFileInfo file(fileName);
ui->comboBox_filenameList->setCurrentText(file.baseName());
ui->comboBox_deviceConfig->setCurrentText(file.baseName());
}
}
@ -185,62 +161,36 @@ void Dialog_logIn::on_pbtn_login_clicked()
return;
}
if (ui->comboBox_filenameList->currentText().isEmpty() && !ui->radioButton_burn->isChecked())
if (ui->comboBox_deviceConfig->currentText().isEmpty())
{
QMessageBox::information(this, tr("Prompt"), tr("Please select a profile first"));
return;
}
if (ui->radioButton_burn->isChecked())
m_loginType = LogInType_Burn;
else if (ui->radioButton_initTest->isChecked())
m_loginType = LogInType_InitTest;
else if (ui->radioButton_imageTest->isChecked())
m_loginType = LogInType_ImageTest;
else if (ui->radioButton_pressureTest->isChecked())
m_loginType = LogInType_PressureTest;
m_accountName = account;
saveCfgValue("login", "account", account);
saveCfgValue("login", "station", m_loginType);
saveCfgValue("login", "rememberPassword", ui->checkBox_rememberPswd->isChecked());
saveCfgValue("login", "showPassword", ui->checkBox_showPswd->isChecked());
m_profileName = getConfigFilePath() + ui->comboBox_filenameList->currentText() + ".json";
saveCfgValue("login", "profile", m_profileName);
m_deviceType = (DeviceType)ui->comboBox_deviceType->currentIndex();
saveCfgValue("login", "devType", m_deviceType);
m_accountName = account;
m_deviceConfig = getConfigFilePath() + ui->comboBox_deviceType->currentText() + "/" + ui->comboBox_deviceConfig->currentText() + ".json";
saveCfgValue("login", "profile", m_deviceConfig);
m_loginType = LogInType_Station1;
if (ui->radioButton_station2->isChecked())
m_loginType = LogInType_Station2;
else if (ui->radioButton_station3->isChecked())
m_loginType = LogInType_Station3;
saveCfgValue("login", "station", m_loginType);
accept();
// HGPdtToolDbUserMgr pdtToolDbuserMgr = nullptr;
// HGPdtToolDb_CreateUserMgr(dbHost.toStdString().c_str(), dbPort.toInt(), account.toStdString().c_str(), password.toStdString().c_str(),
// &pdtToolDbuserMgr);
// if (NULL != pdtToolDbuserMgr)
// {
// m_pdtToolDbuserMgr = pdtToolDbuserMgr;
// accept();
// }
// else
// {
// QMessageBox msg(QMessageBox::Question, tr("tips"), tr("Login failed, sure to enter offline mode?"), QMessageBox::Yes | QMessageBox::No, this);
// msg.setButtonText(QMessageBox::Yes, tr("yes"));
// msg.setButtonText(QMessageBox::No, tr("no"));
// msg.exec();
// if (msg.clickedButton() == msg.button(QMessageBox::Yes))
// {
// m_pdtToolDbuserMgr = nullptr;
// accept();
// }
// else
// {
// return;
// }
// }
}
void Dialog_logIn::on_pbtn_register_clicked()
{
Dialog_RegisterAccount dlg;
Dialog_RegisterAccount dlg(this);
dlg.exec();
}
@ -249,19 +199,19 @@ void Dialog_logIn::on_checkBox_showPswd_toggled(bool checked)
ui->lineEdit_password->setEchoMode(checked ? QLineEdit::Normal : QLineEdit::Password);
}
void Dialog_logIn::on_pushButton_updateFilename_clicked()
void Dialog_logIn::on_pushButton_updateConfig_clicked()
{
updateProfileFileList();
}
void Dialog_logIn::on_pushButton_viewDirectory_clicked()
{
QString configName = ui->comboBox_filenameList->currentText();
QString configName = ui->comboBox_deviceConfig->currentText();
QString fileName = getConfigFilePath();
if (!configName.isEmpty())
{
fileName = getConfigFilePath() + configName.toLocal8Bit() + ".json";
fileName = getConfigFilePath() + ui->comboBox_deviceType->currentText() + "/" + configName.toLocal8Bit() + ".json";
}
else
{
@ -276,3 +226,21 @@ void Dialog_logIn::on_pushButton_viewDirectory_clicked()
if (!ret)
QMessageBox::information(this, tr("Prompt"), tr("Profile is not exsits"));
}
void Dialog_logIn::on_comboBox_deviceType_currentIndexChanged(const QString &arg1)
{
updateProfileFileList();
if ("G100" == arg1 || "G200" == arg1)
{
ui->radioButton_station1->setText(tr("init test"));
ui->radioButton_station2->setText(tr("image test"));
ui->radioButton_station3->setText(tr("finish test"));
}
else
{
ui->radioButton_station1->setText(tr("burn"));
ui->radioButton_station2->setText(tr("init test"));
ui->radioButton_station3->setText(tr("image test"));
}
}

View File

@ -2,7 +2,6 @@
#define DIALOG_LOGIN_H
#include <QDialog>
//#include "HGPdtToolDb.h"
namespace Ui {
class Dialog_logIn;
@ -16,20 +15,25 @@ public:
explicit Dialog_logIn(QWidget *parent = nullptr);
~Dialog_logIn();
enum LogInType
enum DeviceType
{
LogInType_Burn = 0,
LogInType_InitTest = 1,
LogInType_ImageTest = 2,
LogInType_PressureTest = 3
DeviceType_G100 = 0,
DeviceType_G200 = 1,
DeviceType_G300 = 2,
DeviceType_G400 = 3
};
enum LogInType
{
LogInType_Station1 = 0, // 工位1
LogInType_Station2 = 1, // 工位2
LogInType_Station3 = 2, // 工位3
};
//HGPdtToolDbUserMgr GetUserMgr();
QString GetFtpHost();
unsigned short GetFtpPort();
LogInType GetLogInType();
QString GetAccountName();
QString GetProfileName();
DeviceType GetDeviceType();
QString GetDeviceConfig();
LogInType GetLogInType();
private:
QString getConfigFilePath();
@ -42,20 +46,19 @@ private slots:
void on_checkBox_showPswd_toggled(bool checked);
void on_pushButton_updateFilename_clicked();
void on_pushButton_updateConfig_clicked();
void on_pushButton_viewDirectory_clicked();
void on_comboBox_deviceType_currentIndexChanged(const QString &arg1);
private:
Ui::Dialog_logIn *ui;
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
QPoint m_startPos;
QPoint m_endPos;
bool m_leftMousePressed;
LogInType m_loginType;
QString m_accountName;
QString m_profileName;
DeviceType m_deviceType;
QString m_deviceConfig;
LogInType m_loginType;
};
#endif // DIALOG_LOGIN_H

View File

@ -35,247 +35,53 @@
<attribute name="title">
<string>Login</string>
</attribute>
<widget class="QStackedWidget" name="stackedWidget">
<property name="geometry">
<rect>
<x>60</x>
<y>0</y>
<width>421</width>
<height>141</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QLabel" name="label_user">
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>48</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>account:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_account">
<property name="geometry">
<rect>
<x>140</x>
<y>30</y>
<width>161</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_password">
<property name="geometry">
<rect>
<x>80</x>
<y>90</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>password:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_password">
<property name="geometry">
<rect>
<x>140</x>
<y>90</y>
<width>161</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_rememberPswd">
<property name="geometry">
<rect>
<x>310</x>
<y>80</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>remember password</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_showPswd">
<property name="geometry">
<rect>
<x>310</x>
<y>100</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>show password</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_2">
<widget class="QLabel" name="label_dbHost">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>dbHost:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_dbHost">
<property name="geometry">
<rect>
<x>150</x>
<y>20</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_dbPort">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>dbPort:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_dbPort">
<property name="geometry">
<rect>
<x>150</x>
<y>50</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_ftpHost">
<property name="geometry">
<rect>
<x>50</x>
<y>80</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>ftpHost:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_ftpHost">
<property name="geometry">
<rect>
<x>150</x>
<y>80</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_ftpPort">
<property name="geometry">
<rect>
<x>50</x>
<y>110</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>ftpPort:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_ftpPort">
<property name="geometry">
<rect>
<x>150</x>
<y>110</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_pressureTest">
<property name="geometry">
<rect>
<x>80</x>
<y>40</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>PressureTest</string>
</property>
</widget>
</widget>
</widget>
<widget class="QRadioButton" name="radioButton_burn">
<widget class="QRadioButton" name="radioButton_station1">
<property name="geometry">
<rect>
<x>40</x>
<y>150</y>
<y>220</y>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Burn</string>
<string>station1</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_initTest">
<widget class="QRadioButton" name="radioButton_station2">
<property name="geometry">
<rect>
<x>190</x>
<y>150</y>
<y>220</y>
<width>141</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>InitTest</string>
<string>station2</string>
</property>
</widget>
<widget class="QRadioButton" name="radioButton_imageTest">
<widget class="QRadioButton" name="radioButton_station3">
<property name="geometry">
<rect>
<x>340</x>
<y>150</y>
<y>220</y>
<width>151</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>ImageTest</string>
<string>station3</string>
</property>
</widget>
<widget class="QPushButton" name="pbtn_login">
<property name="geometry">
<rect>
<x>160</x>
<y>210</y>
<y>260</y>
<width>75</width>
<height>31</height>
</rect>
@ -294,7 +100,7 @@
<property name="geometry">
<rect>
<x>280</x>
<y>210</y>
<y>260</y>
<width>75</width>
<height>31</height>
</rect>
@ -303,58 +109,148 @@
<string>Register</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_selectProfile">
<attribute name="title">
<string>Select Profile</string>
</attribute>
<widget class="QComboBox" name="comboBox_filenameList">
<widget class="QCheckBox" name="checkBox_showPswd">
<property name="geometry">
<rect>
<x>20</x>
<y>90</y>
<width>481</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>251</width>
<height>31</height>
<x>380</x>
<y>80</y>
<width>111</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Select config file:</string>
<string>show password</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_updateFilename">
<widget class="QLineEdit" name="lineEdit_account">
<property name="geometry">
<rect>
<x>280</x>
<y>160</y>
<width>121</width>
<height>41</height>
<x>140</x>
<y>30</y>
<width>191</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_rememberPswd">
<property name="geometry">
<rect>
<x>380</x>
<y>60</y>
<width>131</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Update</string>
<string>remember password</string>
</property>
</widget>
<widget class="QLabel" name="label_user">
<property name="geometry">
<rect>
<x>70</x>
<y>30</y>
<width>48</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>account:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_password">
<property name="geometry">
<rect>
<x>140</x>
<y>70</y>
<width>191</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_password">
<property name="geometry">
<rect>
<x>70</x>
<y>70</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>password:</string>
</property>
</widget>
<widget class="QLabel" name="label_deviceType">
<property name="geometry">
<rect>
<x>50</x>
<y>130</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>device type:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_deviceType">
<property name="geometry">
<rect>
<x>140</x>
<y>130</y>
<width>271</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_deviceConfig">
<property name="geometry">
<rect>
<x>40</x>
<y>170</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>device config:</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_deviceConfig">
<property name="geometry">
<rect>
<x>140</x>
<y>170</y>
<width>271</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="pushButton_viewDirectory">
<property name="geometry">
<rect>
<x>60</x>
<y>160</y>
<width>171</width>
<height>41</height>
<x>420</x>
<y>150</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>View directory</string>
<string>view directory</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_updateConfig">
<property name="geometry">
<rect>
<x>420</x>
<y>180</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>update connfig</string>
</property>
</widget>
</widget>

View File

@ -27,6 +27,8 @@ Form_BurnMode::Form_BurnMode(class MainWindow *mainwnd, QWidget *parent) :
Form_BurnMode::~Form_BurnMode()
{
clearDevice();
delete ui;
}
@ -74,6 +76,22 @@ void Form_BurnMode::deleteDevice(QString devName)
updatetablewidget();
}
void Form_BurnMode::clearDevice()
{
for(int i = ui->tableWidget->rowCount() - 1; i >= 0; --i)
{
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
if (item != nullptr)
{
DeviceManager *devManager = (DeviceManager*)item->data(Qt::UserRole).value<void*>();
delete devManager;
ui->tableWidget->removeRow(i);
}
}
m_curIndex = 0;
updatetablewidget();
}
DeviceManager *Form_BurnMode::getDevManager()
{
for(int i = 0; i < ui->tableWidget->rowCount(); i++)
@ -186,12 +204,12 @@ void Form_BurnMode::on_pbtn_enterBurnMode_clicked()
}
DeviceManager::DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle,
const QString &profileName, const QString & devName, const QString &serialNum)
const QString &deviceConfig, const QString & devName, const QString &serialNum)
{
m_mainwnd = mainwnd;
m_burnMode = burnMode;
m_handle = handle;
m_profileName = profileName;
m_deviceConfig = deviceConfig;
m_devName = devName;
m_serialNum = serialNum;
@ -230,7 +248,7 @@ void DeviceManager::setBurnMode()
void DeviceManager::setSpeedMode()
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG;
@ -244,7 +262,7 @@ void DeviceManager::setSpeedMode()
void DeviceManager::setSleepTime()
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG;
@ -258,7 +276,7 @@ void DeviceManager::setSleepTime()
void DeviceManager::setVidPid()
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG lp = new WRITECFG;

View File

@ -15,7 +15,7 @@ class DeviceManager
{
public:
DeviceManager(class MainWindow *mainwnd, class Form_BurnMode *burnMode, SANE_Handle handle,
const QString &profileName, const QString &devName, const QString &serialNum);
const QString &deviceConfig, const QString &devName, const QString &serialNum);
~DeviceManager();
QString getDevName();
@ -50,7 +50,7 @@ private:
class Form_BurnMode *m_burnMode;
QString m_devName;
QString m_serialNum;
QString m_profileName;
QString m_deviceConfig;
hgscanner *m_hg;
};
@ -65,6 +65,7 @@ public:
void addDevice(DeviceManager *devManager);
void deleteDevice(QString devName);
void clearDevice();
DeviceManager *getDevManager();

View File

@ -15,14 +15,14 @@
#include "dialog_excepdesc.h"
#include "huagao/hgscanner_error.h"
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &profileName, const QString &accountName, SANE_Handle handle,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum)
Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, const QString &deviceConfig, const QString &accountName, SANE_Handle handle,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum,
const QString &logInTypeStr)
: QWidget(mainwnd)
, ui(new Ui::Form_mainInterface)
, m_mainwnd(mainwnd)
, m_logInType(logInType)
, m_accountName(accountName)
, m_profileName(profileName)
, m_deviceConfig(deviceConfig)
, m_hg(nullptr)
, m_handle(handle)
, m_disconnect(false)
@ -30,6 +30,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
, m_devType(devType)
, m_devName(devName)
, m_devFwNum(devFwNum)
, m_logInTypeStr(logInTypeStr)
, m_curItemName("")
, m_isTesting(false)
, m_isCorrectNormal(true)
@ -90,13 +91,6 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
connect(m_view, SIGNAL(doubleClicked()), this, SLOT(on_viewerDblClick()));
initTableWidgetUi();
// if(!m_devType.isEmpty())
// HGPdtToolDb_SetDeviceType(m_pdtToolDbDevice, m_devType.toStdString().c_str());
// if(!m_devFwNum.isEmpty())
// HGPdtToolDb_SetDeviceVersion(m_pdtToolDbDevice, m_devFwNum.toStdString().c_str());
// if(!m_devName.isEmpty())
// HGPdtToolDb_SetDeviceName(m_pdtToolDbDevice, m_devName.toStdString().c_str());
}
Form_mainInterface::~Form_mainInterface()
@ -361,7 +355,7 @@ void Form_mainInterface::on_testGetDevCfgInfo(int vid, int pid, int sleepTime, i
void Form_mainInterface::on_testGetDevCpuDisk(int cpu, int disk)
{
AnalysisJson analysisJson(m_profileName);
AnalysisJson analysisJson(m_deviceConfig);
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
float cpu_size = jsonGlobal.cpu_size;
float disk_size = jsonGlobal.disk_size;
@ -557,11 +551,7 @@ void Form_mainInterface::initTableWidgetUi()
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableWidget->setStyleSheet("selection-background-color:rgb(193,210,240)");
//HGPdtToolDb_DownloadFile(m_pdtToolDbuserMgr, m_devType.toStdString().c_str(), cfgPath);
AnalysisJson analysisJson(m_profileName);
const QString stationStr[] = {"烧录工位", "初检工位", "图像测试工位", "压力测试工位"};
AnalysisJson analysisJson(m_deviceConfig);
std::vector<AnalysisJson::json_node> list_jsonNode = analysisJson.GetNode();
int count = list_jsonNode.size();
@ -572,10 +562,8 @@ void Form_mainInterface::initTableWidgetUi()
AnalysisJson::json_node node = list_jsonNode[i];
m_map_title_name.insert(node.title, node);
if (stationStr[m_logInType] == node.station)
if (m_logInTypeStr == node.station)
{
//HGPdtToolDb_SetEntryNameCnStr(m_pdtToolDbuserMgr, node.name.toStdString().c_str(), node.title.toStdString().c_str());
ui->tableWidget->setItem(index, 0, new QTableWidgetItem(QString::number(index+1)));
ui->tableWidget->item(index, 0)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
ui->tableWidget->setItem(index, 1, new QTableWidgetItem(node.title));

View File

@ -21,8 +21,9 @@ class Form_mainInterface : public QWidget
Q_OBJECT
public:
explicit Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::LogInType logInType, const QString &profileName, const QString &accountName, SANE_Handle handle,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum);
explicit Form_mainInterface(class MainWindow *mainwnd, const QString &deviceConfig, const QString &accountName, SANE_Handle handle,
const QString &serialNum, const QString &devType, const QString &devName, const QString &devFwNum,
const QString &logInTypeStr);
~Form_mainInterface();
bool isTesting();
@ -122,9 +123,8 @@ private:
HGImgView *m_view;
class MainWindow *m_mainwnd;
Dialog_logIn::LogInType m_logInType;
QString m_accountName;
QString m_profileName;
QString m_deviceConfig;
hgscanner *m_hg;
SANE_Handle m_handle;
bool m_disconnect;
@ -134,6 +134,7 @@ private:
QString m_devType;
QString m_devName;
QString m_devFwNum;
QString m_logInTypeStr;
QString m_curItemName;
bool m_isTesting;
bool m_isCorrectNormal;

View File

@ -18,7 +18,7 @@ int main(int argc, char *argv[])
Dialog_logIn login;
if (login.exec())
{
MainWindow w(login.GetLogInType(), login.GetProfileName(), login.GetAccountName(), login.GetFtpHost(), login.GetFtpPort());
MainWindow w(login.GetAccountName(), login.GetDeviceType(), login.GetDeviceConfig(), login.GetLogInType());
a.exec();
if (w.isExitApp())
{

View File

@ -1,4 +1,4 @@
#include "mainwindow.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QVBoxLayout>
#include <QTimer>
@ -14,20 +14,22 @@
#include "dialog_inputserialnum.h"
#include "dialog_hgmessagebox.h"
MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profileName, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent)
MainWindow::MainWindow(const QString &accountName, Dialog_logIn::DeviceType deviceType, const QString &deviceConfig,
Dialog_logIn::LogInType loginType, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, m_ftpHost(ftpHost)
, m_ftpPort(ftpPort)
, m_lock(nullptr)
, m_testingRef(0)
, m_loginType(loginType)
, m_accountName(accountName)
, m_profileName(profileName)
, m_deviceType(deviceType)
, m_deviceConfig(deviceConfig)
, m_loginType(loginType)
, m_formBurnMode(nullptr)
, m_top_splitter(nullptr)
, m_bot_splitter(nullptr)
, m_isLogOut(false)
, m_burnDlg(nullptr)
, m_burnForm(nullptr)
, m_inputSnDlg(nullptr)
, m_tmpDevType("")
{
@ -57,11 +59,9 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
connect(this, SIGNAL(sane_dev_remove(QString)), this, SLOT(on_sane_dev_remove(QString)), Qt::QueuedConnection);
connect(this, &MainWindow::sane_create_interface, this, &MainWindow::on_sane_create_interface, Qt::QueuedConnection);
if (m_loginType == Dialog_logIn::LogInType_Burn)
if ((m_deviceType == Dialog_logIn::DeviceType_G300 || m_deviceType == Dialog_logIn::DeviceType_G400)
&& m_loginType == Dialog_logIn::LogInType_Station1)
{
setWindowTitle(tr("production tool-burn station"));
// ui->act_newDevice->setVisible(false);
m_formBurnMode = new Form_BurnMode(this, this);
QVBoxLayout *vLayout = new QVBoxLayout;
@ -71,8 +71,6 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
}
else
{
// ui->act_refreshDevice->setVisible(true);
m_top_splitter = new QSplitter(Qt::Horizontal);
m_bot_splitter = new QSplitter(Qt::Horizontal);
m_top_splitter->setMinimumWidth(600);
@ -90,24 +88,24 @@ MainWindow::MainWindow(Dialog_logIn::LogInType loginType, const QString &profile
showMaximized();
}
QTimer *timer = new QTimer(this);
timer->start(1000);
connect(timer, SIGNAL(timeout()), this, SLOT(on_update_userStatus()));
HGUInt userType = 0;
//HGPdtToolDb_GetUserType(m_pdtToolDbuserMgr, &userType);
// if (userType == HGPDTTOOLDB_USERTYPE_NORMAL)
// {
// ui->act_manage->setVisible(false);
// ui->act_upload->setVisible(false);
// }
if (m_loginType == Dialog_logIn::LogInType_InitTest)
setWindowTitle(tr("production tool-init test station"));
else if (m_loginType == Dialog_logIn::LogInType_ImageTest)
setWindowTitle(tr("production tool-image test station"));
if (m_loginType == Dialog_logIn::LogInType_PressureTest)
setWindowTitle(tr("production tool-pressure test station"));
if (m_deviceType == Dialog_logIn::DeviceType_G300 || m_deviceType == Dialog_logIn::DeviceType_G400)
{
if (m_loginType == Dialog_logIn::LogInType_Station1)
setWindowTitle(tr("production tool-burn station"));
else if (m_loginType == Dialog_logIn::LogInType_Station2)
setWindowTitle(tr("production tool-init test station"));
else if (m_loginType == Dialog_logIn::LogInType_Station3)
setWindowTitle(tr("production tool-image test station"));
}
else
{
if (m_loginType == Dialog_logIn::LogInType_Station1)
setWindowTitle(tr("production tool-init test station"));
else if (m_loginType == Dialog_logIn::LogInType_Station2)
setWindowTitle(tr("production tool-image test station"));
else if (m_loginType == Dialog_logIn::LogInType_Station3)
setWindowTitle(tr("production tool-finish test station"));
}
SANE_Int v = 0;
sane_init_ex(&v, sane_ex_callback, this);
@ -138,9 +136,6 @@ MainWindow::~MainWindow()
sane_exit();
//HGPdtToolDb_DestroyUserMgr(m_pdtToolDbuserMgr);
//m_pdtToolDbuserMgr = nullptr;
delete m_formBurnMode;
m_formBurnMode = nullptr;
@ -346,7 +341,7 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void *data, unsigne
}
else if (SANE_EVENT_IMAGE_OK == code)
{
if (p->m_loginType != Dialog_logIn::LogInType_Burn)
if (nullptr == p->m_formBurnMode)
{
Form_mainInterface* mainInterface = p->FindInterface(hdev);
if (nullptr != mainInterface)
@ -433,74 +428,22 @@ QString MainWindow::getDevFwNum(SANE_Handle handle)
void MainWindow::on_sane_dev_arrive(QString devName)
{
//// QTime curTimer = QTime::currentTime().addMSecs(5000);
//// while (QTime::currentTime() < curTimer)
//// {
//// QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
//// }
// if (m_loginType == Dialog_logIn::LogInType_Burn)
// {
// SANE_Handle devHandle = nullptr;
// sane_open(devName.toStdString().c_str(), &devHandle);
// if (nullptr != devHandle)
// {
// DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, devName);
// m_formBurnMode->addDevice(devManager);
// }
// return;
// }
// // QString str = tr("Confirm whether the device is reset");
// // Dialog_HGMessageBox dlg(str, this);
// // if (!dlg.exec())
// // {
// // return;
// // }
// SANE_Handle devHandle = nullptr;
// sane_open(devName.toStdString().c_str(), &devHandle);
// if (nullptr == devHandle)
// {
// QMessageBox::information(this, tr("tips"), tr("Open device failed"));
// return;
// }
// m_inputSnDlg = new Dialog_InputSerialNum(this, devName, m_pdtToolDbuserMgr, devHandle, getDevSn(devHandle), getDevType(devHandle));
// if (!m_inputSnDlg->exec())
// {
// sane_close(devHandle);
// return ;
// }
// HGPdtToolDbDevice pdtToolDbDevice = nullptr;
// HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
// Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
// m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), devName, getDevFwNum(devHandle));
// if (!AddInterface(mainInterface))
// {
// QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
// delete mainInterface;
// }
// if (m_inputSnDlg != nullptr)
// {
// delete m_inputSnDlg;
// m_inputSnDlg = nullptr;
// }
}
void MainWindow::on_sane_dev_remove(QString devName)
{
if (m_loginType == Dialog_logIn::LogInType_Burn)
if (nullptr != m_formBurnMode)
{
m_formBurnMode->deleteDevice(devName);
}
else
{
if (nullptr != m_burnForm)
{
m_burnForm->deleteDevice(devName);
}
if (nullptr != m_inputSnDlg)
{
m_inputSnDlg->Invalid(devName);
@ -520,7 +463,7 @@ void MainWindow::on_sane_dev_remove(QString devName)
void MainWindow::on_sane_create_interface(SaneParams *saneParams)
{
if (m_loginType != Dialog_logIn::LogInType_Burn)
if (nullptr == m_formBurnMode)
{
Form_mainInterface* mainInterface = FindInterface(saneParams->hdev);
if (nullptr != mainInterface)
@ -555,58 +498,34 @@ void MainWindow::on_sane_create_interface(SaneParams *saneParams)
saneParams = nullptr;
}
void MainWindow::on_update_userStatus()
void MainWindow::on_burnmode_refresh_clicked()
{
QString tips;
HGUInt userStatus = 0;
//HGPdtToolDb_GetUserStatus(m_pdtToolDbuserMgr, &userStatus);
// switch (userStatus)
// {
// case HGPDTTOOLDB_USERSTATUS_CONFLICT:
// tips = tr("Account login elsewhere");
// break;
// case HGPDTTOOLDB_USERSTATUS_REFUSE:
// tips = tr("You have been forced offline by the administrator account");
// break;
// case HGPDTTOOLDB_USERSTATUS_DBERROR:
// tips = tr("Data base error");
// break;
// default:
// break;
// }
// if (!tips.isEmpty())
// {
// if (!isTesting())
// {
// QMessageBox::information(this, (tr("tips")), tips);
// m_isLogOut = true;
// close();
// }
// }
}
void MainWindow::on_act_newDevice_triggered()
{
m_inputSnDlg = new Dialog_InputSerialNum(this, m_loginType, "", m_profileName, m_accountName, nullptr, "", "");
if (m_inputSnDlg->exec())
if (nullptr != m_burnForm)
{
//HGPdtToolDbDevice pdtToolDbDevice = nullptr;
//HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
std::vector<std::string> name;
name = getDevices();
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_profileName, m_accountName, nullptr,
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), nullptr, nullptr);
if (!AddInterface(mainInterface))
m_burnForm->clearDevice();
for (int i = 0; i < name.size(); ++i)
{
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
delete mainInterface;
SANE_Handle devHandle = nullptr;
sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
DeviceManager *devManager = new DeviceManager(this, m_burnForm, devHandle, m_deviceConfig, name[i].c_str(), getDevSn(devHandle));
m_burnForm->addDevice(devManager);
}
}
}
delete m_inputSnDlg;
m_inputSnDlg = nullptr;
}
void MainWindow::on_burnmode_ok_clicked()
{
if (nullptr != m_burnDlg)
m_burnDlg->accept();
}
void MainWindow::on_act_manage_triggered()
{
Dialog_accountManage dlg(this);
@ -619,22 +538,6 @@ void MainWindow::on_act_changePwd_triggered()
dlg.exec();
}
void MainWindow::on_act_export_triggered()
{
// QString filename = QFileDialog::getSaveFileName(this, tr("save"), "test.xls", tr("xls(*.xls)"));
// if (!filename.isEmpty())
// {
// if (HGBASE_ERR_OK == HGPdtToolDb_Export(m_pdtToolDbuserMgr, getStdString(filename).c_str()))
// {
// QMessageBox::information(this, tr("tips"), tr("export succeed"));
// }
// else
// {
// QMessageBox::information(this, tr("tips"), tr("export failed"));
// }
// }
}
void MainWindow::on_act_logOut_triggered()
{
if (isTesting())
@ -658,33 +561,6 @@ void MainWindow::on_act_close_triggered()
close();
}
QString MainWindow::getLogInfo(HGResult ret)
{
QString str;
// if (HGPDTTOOLDB_ERR_INVALID_USER == ret)
// {
// str = tr("Illegal user");
// }
// else if (HGPDTTOOLDB_ERR_WRONG_PASSWORD == ret)
// {
// str = tr("Wrong password");
// }
// else if (HGPDTTOOLDB_ERR_DATABASE == ret)
// {
// str = tr("Database error");
// }
// else if (HGPDTTOOLDB_ERR_CONNECT == ret)
// {
// str = tr("connect error");
// }
// else
// {
// str = tr("Failed");
// }
return str;
}
void MainWindow::on_act_upload_triggered()
{
Dialog_uploadCfgFile dlg(this);
@ -696,36 +572,128 @@ void MainWindow::on_act_refreshDevice_triggered()
std::vector<std::string> name;
name = getDevices();
if (m_loginType == Dialog_logIn::LogInType_Burn)
if (nullptr != m_formBurnMode)
{
m_formBurnMode->clearDevice();
for (int i = 0; i < name.size(); ++i)
{
SANE_Handle devHandle = nullptr;
sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, m_profileName, name[i].c_str(), getDevSn(devHandle));
DeviceManager *devManager = new DeviceManager(this, m_formBurnMode, devHandle, m_deviceConfig, name[i].c_str(), getDevSn(devHandle));
m_formBurnMode->addDevice(devManager);
}
}
return;
}
if (m_top_splitter->count() > 0 || m_bot_splitter->count() > 0)
{
return;
}
// G100和G200的初检工位
if (m_loginType == Dialog_logIn::LogInType_Station1)
{
m_burnDlg = new QDialog(this);
m_burnDlg->setWindowTitle(tr("burn mode"));
m_burnDlg->setFixedSize(800, 600);
m_burnDlg->setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint);
QFont ft;
ft.setPointSize(15);
m_burnDlg->setFont(ft);
QVBoxLayout *vLayout = new QVBoxLayout(m_burnDlg);
m_burnForm = new Form_BurnMode(this, m_burnDlg);
vLayout->addWidget(m_burnForm);
QHBoxLayout *hLayout = new QHBoxLayout(m_burnDlg);
hLayout->addStretch();
QPushButton *refreshBtn = new QPushButton(tr("Refresh(F5)"));
refreshBtn->setFixedSize(186, 35);
refreshBtn->setShortcut(QKeySequence("F5"));
connect(refreshBtn, &QPushButton::clicked, this, &MainWindow::on_burnmode_refresh_clicked);
QPushButton *okBtn = new QPushButton(tr("Start Init Test"));
okBtn->setFixedSize(186, 35);
connect(okBtn, &QPushButton::clicked, this, &MainWindow::on_burnmode_ok_clicked);
hLayout->addWidget(refreshBtn);
hLayout->addWidget(okBtn);
vLayout->addLayout(hLayout);
m_burnDlg->setLayout(vLayout);
for (int i = 0; i < name.size(); ++i)
{
SANE_Handle devHandle = nullptr;
sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
DeviceManager *devManager = new DeviceManager(this, m_burnForm, devHandle, m_deviceConfig, name[i].c_str(), getDevSn(devHandle));
m_burnForm->addDevice(devManager);
}
}
bool ok = true;
if (!m_burnDlg->exec())
ok = false;
delete m_burnForm;
m_burnForm = nullptr;
delete m_burnDlg;
m_burnDlg = nullptr;
if (!ok)
{
return;
}
}
for (int i = 0; i < name.size(); ++i)
{
SANE_Handle devHandle = nullptr;
sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
m_inputSnDlg = new Dialog_InputSerialNum(this, m_loginType, name[i].c_str(), m_profileName, m_accountName, devHandle, getDevSn(devHandle), getDevType(devHandle));
bool canSetSN = false;
if (m_deviceType == Dialog_logIn::DeviceType_G300 || m_deviceType == Dialog_logIn::DeviceType_G400)
{
if (m_loginType == Dialog_logIn::LogInType_Station2)
canSetSN = true;
}
else
{
if (m_loginType == Dialog_logIn::LogInType_Station1)
canSetSN = true;
}
m_inputSnDlg = new Dialog_InputSerialNum(this, name[i].c_str(), m_deviceConfig, m_accountName,
devHandle, getDevSn(devHandle), getDevType(devHandle), canSetSN);
if (m_inputSnDlg->exec())
{
//HGPdtToolDbDevice pdtToolDbDevice = nullptr;
//HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, m_inputSnDlg->GetSn().toStdString().c_str(), &pdtToolDbDevice);
QString logInTypeStr;
if (m_deviceType == Dialog_logIn::DeviceType_G300 || m_deviceType == Dialog_logIn::DeviceType_G400)
{
if (m_loginType == Dialog_logIn::LogInType_Station1)
logInTypeStr = QStringLiteral("烧录工位");
else if (m_loginType == Dialog_logIn::LogInType_Station2)
logInTypeStr = QStringLiteral("初检工位");
else if (m_loginType == Dialog_logIn::LogInType_Station3)
logInTypeStr = QStringLiteral("图像测试工位");
}
else
{
if (m_loginType == Dialog_logIn::LogInType_Station1)
logInTypeStr = QStringLiteral("初检工位");
else if (m_loginType == Dialog_logIn::LogInType_Station2)
logInTypeStr = QStringLiteral("图像测试工位");
else if (m_loginType == Dialog_logIn::LogInType_Station3)
logInTypeStr = QStringLiteral("成品检验工位");
}
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, m_profileName, m_accountName, devHandle,
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle));
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_deviceConfig, m_accountName, devHandle,
m_inputSnDlg->GetSn(), m_inputSnDlg->GetDevType(), name[i].c_str(), getDevFwNum(devHandle), logInTypeStr);
if (!AddInterface(mainInterface))
{
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));

View File

@ -6,7 +6,6 @@
#include "form_maininterface.h"
#include <QtWidgets>
#include <QSplitter>
//#include "HGPdtToolDb.h"
#include "sane/sane_ex.h"
#include "base/HGLock.h"
#include "hgscanner.h"
@ -21,9 +20,9 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
MainWindow(Dialog_logIn::LogInType loginType, const QString &profileName, const QString &accountName, const QString &ftpHost, unsigned short ftpPort, QWidget *parent = nullptr);
MainWindow(const QString &accountName, Dialog_logIn::DeviceType deviceType, const QString &deviceConfig,
Dialog_logIn::LogInType loginType, QWidget *parent = nullptr);
~MainWindow();
static QString getLogInfo(HGResult ret);
bool isExitApp();
void updateSplitter();
@ -64,17 +63,15 @@ private slots:
void on_sane_dev_arrive(QString devName);
void on_sane_dev_remove(QString devName);
void on_sane_create_interface(SaneParams *saneParams);
void on_update_userStatus();
void on_burnmode_refresh_clicked();
void on_burnmode_ok_clicked();
private slots:
void on_act_newDevice_triggered();
void on_act_manage_triggered();
void on_act_changePwd_triggered();
void on_act_export_triggered();
void on_act_logOut_triggered();
void on_act_close_triggered();
@ -95,19 +92,19 @@ private:
private:
Ui::MainWindow *ui;
//HGPdtToolDbUserMgr m_pdtToolDbuserMgr;
HGLock m_lock;
int m_testingRef;
Dialog_logIn::LogInType m_loginType;
QString m_accountName;
QString m_profileName;
Dialog_logIn::DeviceType m_deviceType;
QString m_deviceConfig;
Dialog_logIn::LogInType m_loginType;
class QDialog *m_burnDlg;
Form_BurnMode *m_burnForm;
class Dialog_InputSerialNum *m_inputSnDlg;
Form_BurnMode *m_formBurnMode;
public:
QString m_ftpHost;
unsigned short m_ftpPort;
QString m_tmpDevType;
};
#endif // MAINWINDOW_H

View File

@ -27,7 +27,6 @@
<property name="title">
<string>menu_device</string>
</property>
<addaction name="act_newDevice"/>
<addaction name="separator"/>
<addaction name="act_refreshDevice"/>
<addaction name="separator"/>