调整登录界面,接收校正信息

This commit is contained in:
yangjiaxuan 2022-12-30 16:49:55 +08:00
parent 8800fb2c5b
commit 3ba8bb532e
10 changed files with 243 additions and 331 deletions

View File

@ -50,7 +50,9 @@ AnalysisJson::json_global AnalysisJson::GetGlobal()
return json_global{obj["vid-org"].toInt(), return json_global{obj["vid-org"].toInt(),
obj["pid-org"].toInt(), obj["pid-org"].toInt(),
obj["vid-to"].toInt(), obj["vid-to"].toInt(),
obj["pid-to"].toInt()}; obj["pid-to"].toInt(),
obj["speed-mode"].toInt(),
obj["sleep-time"].toInt()};
} }

View File

@ -20,6 +20,8 @@ public:
std::int32_t pid_org; std::int32_t pid_org;
std::int32_t vid_to; std::int32_t vid_to;
std::int32_t pid_to; std::int32_t pid_to;
std::int32_t speed_mode;
std::int32_t sleep_time;
}; };
AnalysisJson() = delete ; AnalysisJson() = delete ;

View File

@ -39,15 +39,7 @@ Dialog_logIn::Dialog_logIn(QWidget *parent) :
ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost)); ui->lineEdit_ftpHost->setText(getCfgValue("login", "ftpHost", ftpHost));
ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort)); ui->lineEdit_ftpPort->setText(getCfgValue("login", "ftpPort", ftpPort));
ui->label_dbHost->setVisible(false); ui->stackedWidget->setCurrentIndex(0);
ui->label_dbPort->setVisible(false);
ui->lineEdit_dbHost->setVisible(false);
ui->lineEdit_dbPort->setVisible(false);
ui->label_ftpHost->setVisible(false);
ui->label_ftpPort->setVisible(false);
ui->lineEdit_ftpHost->setVisible(false);
ui->lineEdit_ftpPort->setVisible(false);
} }
Dialog_logIn::~Dialog_logIn() Dialog_logIn::~Dialog_logIn()
@ -133,20 +125,14 @@ void Dialog_logIn::on_pushButton_exit_clicked()
void Dialog_logIn::on_pbtn_setting_clicked(bool checked) void Dialog_logIn::on_pbtn_setting_clicked(bool checked)
{ {
ui->label_user->setVisible(!checked); if (checked)
ui->label_password->setVisible(!checked); {
ui->lineEdit_account->setVisible(!checked); ui->stackedWidget->setCurrentIndex(1);
ui->lineEdit_password->setVisible(!checked); }
else
ui->label_dbHost->setVisible(checked); {
ui->label_dbPort->setVisible(checked); ui->stackedWidget->setCurrentIndex(0);
ui->lineEdit_dbHost->setVisible(checked); }
ui->lineEdit_dbPort->setVisible(checked);
ui->label_ftpHost->setVisible(checked);
ui->label_ftpPort->setVisible(checked);
ui->lineEdit_ftpHost->setVisible(checked);
ui->lineEdit_ftpPort->setVisible(checked);
} }
void Dialog_logIn::on_pbtn_minum_clicked() void Dialog_logIn::on_pbtn_minum_clicked()

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>389</width> <width>455</width>
<height>268</height> <height>278</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -18,7 +18,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>391</width> <width>451</width>
<height>30</height> <height>30</height>
</rect> </rect>
</property> </property>
@ -141,31 +141,183 @@ QPushButton#pbtn_close::hover
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="layoutWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>70</x> <x>40</x>
<y>230</y> <y>40</y>
<width>250</width> <width>381</width>
<height>25</height> <height>141</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <property name="currentIndex">
<item> <number>1</number>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <widget class="QWidget" name="page">
<size> <widget class="QLabel" name="label_user">
<width>40</width> <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>151</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>151</width>
<height>22</height>
</rect>
</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>151</width>
<height>20</height> <height>20</height>
</size> </rect>
</property> </property>
</spacer> </widget>
</item> <widget class="QLabel" name="label_dbPort">
<item> <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>151</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>151</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>151</width>
<height>20</height>
</rect>
</property>
</widget>
</widget>
</widget>
<widget class="QPushButton" name="pushButton_exit">
<property name="geometry">
<rect>
<x>260</x>
<y>210</y>
<width>75</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>EXIT</string>
</property>
</widget>
<widget class="QPushButton" name="pbtn_login"> <widget class="QPushButton" name="pbtn_login">
<property name="geometry">
<rect>
<x>140</x>
<y>210</y>
<width>75</width>
<height>31</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>LOG IN</string> <string>LOG IN</string>
</property> </property>
@ -176,284 +328,6 @@ QPushButton#pbtn_close::hover
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_exit">
<property name="text">
<string>EXIT</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>50</x>
<y>50</y>
<width>289</width>
<height>164</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_user">
<property name="text">
<string>account:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_account"/>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_password">
<property name="text">
<string>password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_password"/>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_dbHost">
<property name="text">
<string>dbHost:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_dbHost"/>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_dbPort">
<property name="text">
<string>dbPort:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_dbPort"/>
</item>
<item>
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_ftpHost">
<property name="text">
<string>ftpHost:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_ftpHost"/>
</item>
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_ftpPort">
<property name="text">
<string>ftpPort:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_ftpPort"/>
</item>
<item>
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -81,6 +81,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, SANE_Handle ha
connect(this, SIGNAL(testResult(QString)), this, SLOT(on_testResult(QString)), Qt::QueuedConnection); connect(this, SIGNAL(testResult(QString)), this, SLOT(on_testResult(QString)), Qt::QueuedConnection);
connect(this, SIGNAL(testResultImg(void*)), this, SLOT(on_testResultImg(void*)), Qt::QueuedConnection); connect(this, SIGNAL(testResultImg(void*)), this, SLOT(on_testResultImg(void*)), Qt::QueuedConnection);
connect(this, SIGNAL(testCorrectInfo(QString)), this, SLOT(on_testCorrectInfo(QString)), Qt::QueuedConnection);
connect(this, SIGNAL(testFinish()), this, SLOT(on_testFinish()), Qt::QueuedConnection); connect(this, SIGNAL(testFinish()), this, SLOT(on_testFinish()), Qt::QueuedConnection);
QString str; QString str;
@ -192,6 +193,11 @@ void Form_mainInterface::on_testFinish()
m_isTesting = false; m_isTesting = false;
} }
void Form_mainInterface::on_testCorrectInfo(QString info)
{
m_textTips->addContent(info);
}
void Form_mainInterface::on_pbtn_preStep_clicked() void Form_mainInterface::on_pbtn_preStep_clicked()
{ {
int row = ui->tableWidget->currentRow(); int row = ui->tableWidget->currentRow();
@ -317,6 +323,8 @@ void Form_mainInterface::initTableWidgetUi()
{ {
AnalysisJson analysisJson(QString::fromStdString(cfgPath)); AnalysisJson analysisJson(QString::fromStdString(cfgPath));
setGlobalCfg(analysisJson);
std::map<HGUInt, bool> dbEntryItems; std::map<HGUInt, bool> dbEntryItems;
for (int i = HGPDTTOOLDB_ENTRYNAME_DIAL_SWITCH; i <= HGPDTTOOLDB_ENTRYNAME_SCANNING_SENSOR; ++i) for (int i = HGPDTTOOLDB_ENTRYNAME_DIAL_SWITCH; i <= HGPDTTOOLDB_ENTRYNAME_SCANNING_SENSOR; ++i)
dbEntryItems[i] = false; dbEntryItems[i] = false;
@ -473,6 +481,32 @@ void Form_mainInterface::updateUiEnabled(bool enable)
ui->pbtn_stop->setEnabled(enable); ui->pbtn_stop->setEnabled(enable);
} }
void Form_mainInterface::setGlobalCfg(AnalysisJson analysisJson)
{
AnalysisJson::json_global jsonGlobal = analysisJson.GetGlobal();
LPWRITECFG p;
p->cat = WRITE_CAT_VID;
p->val = &jsonGlobal.vid_to;
func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
p->cat = WRITE_CAT_PID;
p->val = &jsonGlobal.pid_to;
func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
p->cat = WRITE_CAT_SPEED;
p->val = &jsonGlobal.speed_mode;
func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
p->cat = WRITE_CAT_SLEEP;
p->val = &jsonGlobal.sleep_time;
func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
p->cat = WRITE_CAT_SERIALNUM;
p->val = &m_serialNum;
func_test_go((const wchar_t*)WRITE_CFG_NAME, (const wchar_t*)p, m_hg);
}
void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous) void Form_mainInterface::on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
{ {
(void)previous; (void)previous;

View File

@ -37,6 +37,7 @@ signals:
void testResult(QString text); void testResult(QString text);
void testResultImg(void* img); void testResultImg(void* img);
void testDistortion(QString title, void *data); void testDistortion(QString title, void *data);
void testCorrectInfo(QString info);
void testFinish(); void testFinish();
private slots: private slots:
@ -44,6 +45,7 @@ private slots:
void on_testResultImg(void* img); void on_testResultImg(void* img);
void on_testDistortion(QString title, void *data); void on_testDistortion(QString title, void *data);
void on_testFinish(); void on_testFinish();
void on_testCorrectInfo(QString info);
private slots: private slots:
void on_pbtn_preStep_clicked(); void on_pbtn_preStep_clicked();
@ -75,6 +77,7 @@ private:
QString getCachePath(); QString getCachePath();
QString getCacheFileName(); QString getCacheFileName();
void updateUiEnabled(bool enable); void updateUiEnabled(bool enable);
void setGlobalCfg(AnalysisJson analysisJson);
private: private:
Ui::Form_mainInterface *ui; Ui::Form_mainInterface *ui;

View File

@ -9,6 +9,7 @@ Form_textTips::Form_textTips(QWidget *parent)
QFont ft; QFont ft;
ft.setPointSize(20); ft.setPointSize(20);
ui->textBrowser->setFont(ft); ui->textBrowser->setFont(ft);
} }
Form_textTips::~Form_textTips() Form_textTips::~Form_textTips()
@ -21,6 +22,11 @@ void Form_textTips::setViewContent(QString content)
ui->textBrowser->setText(content); ui->textBrowser->setText(content);
} }
void Form_textTips::addContent(QString content)
{
ui->textBrowser->insertPlainText(content);
}

View File

@ -16,6 +16,7 @@ public:
~Form_textTips(); ~Form_textTips();
void setViewContent(QString content); void setViewContent(QString content);
void addContent(QString content);
private: private:
Ui::Form_textTips *ui; Ui::Form_textTips *ui;

View File

@ -78,7 +78,11 @@ void hgscanner::test_callback(const wchar_t* name, test_event ev, void* data, si
} }
else if (ev == TEST_EVENT_FALT_INFO) else if (ev == TEST_EVENT_FALT_INFO)
{ {
std::string str = (char *)data; if (data != nullptr)
{
QString info = QString::fromStdWString((const wchar_t*)data);
emit m_interface->testCorrectInfo(info);
}
} }
else if (ev == TEST_EVENT_HAVE_IMAGE) else if (ev == TEST_EVENT_HAVE_IMAGE)
{ {