增加刷新设备列表功能

This commit is contained in:
yangjiaxuan 2023-01-05 19:16:17 +08:00
parent 4572fc445f
commit 254a54d159
6 changed files with 61 additions and 12 deletions

View File

@ -746,7 +746,7 @@
</message>
<message>
<location filename="form_maininterface.cpp" line="139"/>
<location filename="form_maininterface.cpp" line="494"/>
<location filename="form_maininterface.cpp" line="497"/>
<source>tips</source>
<translation></translation>
</message>
@ -796,7 +796,7 @@
<translation></translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="494"/>
<location filename="form_maininterface.cpp" line="497"/>
<source>no image</source>
<translation></translation>
</message>
@ -822,45 +822,50 @@
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="35"/>
<location filename="mainwindow.ui" line="36"/>
<source>menu_user</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="51"/>
<location filename="mainwindow.ui" line="52"/>
<source>act_newDevice</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="56"/>
<location filename="mainwindow.ui" line="57"/>
<source>act_manage</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="61"/>
<location filename="mainwindow.ui" line="62"/>
<source>act_changePwd</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="66"/>
<location filename="mainwindow.ui" line="67"/>
<source>act_export</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="71"/>
<location filename="mainwindow.ui" line="72"/>
<source>act_logOut</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="76"/>
<location filename="mainwindow.ui" line="77"/>
<source>act_close</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="81"/>
<location filename="mainwindow.ui" line="82"/>
<source>act_upload</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.ui" line="87"/>
<source>act_refreshDevice</source>
<translation></translation>
</message>
<message>
<location filename="mainwindow.cpp" line="476"/>
<source>Account login elsewhere</source>
@ -891,6 +896,7 @@
<location filename="mainwindow.cpp" line="539"/>
<location filename="mainwindow.cpp" line="548"/>
<location filename="mainwindow.cpp" line="560"/>
<location filename="mainwindow.cpp" line="620"/>
<source>tips</source>
<translation></translation>
</message>
@ -919,6 +925,7 @@
<message>
<location filename="mainwindow.cpp" line="430"/>
<location filename="mainwindow.cpp" line="510"/>
<location filename="mainwindow.cpp" line="620"/>
<source>cannot create more table</source>
<translation></translation>
</message>

View File

@ -341,8 +341,8 @@ void Form_BurnMode::on_pbtn_close_clicked()
return;
}
int i = 0;
while(ui->tableWidget->rowCount() > i)
int rowCount = ui->tableWidget->rowCount();
for (int i = rowCount - 1; i >= 0; --i)
{
QTableWidgetItem *item = ui->tableWidget->item(i, 1);
if (item != nullptr && Qt::Checked == item->checkState())

View File

@ -596,3 +596,35 @@ void MainWindow::on_act_upload_triggered()
Dialog_uploadCfgFile dlg(m_pdtToolDbuserMgr, this);
dlg.exec();
}
void MainWindow::on_act_refreshDevice_triggered()
{
std::vector<std::string> name;
name = getDevices();
for (int i = 0; i < name.size(); ++i)
{
SANE_Handle devHandle = nullptr;
sane_open(name[i].c_str(), &devHandle);
if (nullptr != devHandle)
{
Dialog_InputSerialNum dlg(this, devHandle, getDevSn(devHandle), getDevType(devHandle));
if (dlg.exec())
{
HGPdtToolDbDevice pdtToolDbDevice = nullptr;
HGPdtToolDb_OpenDevice(m_pdtToolDbuserMgr, dlg.GetSn().toStdString().c_str(), &pdtToolDbDevice);
Form_mainInterface *mainInterface = new Form_mainInterface(this, m_loginType, devHandle, m_pdtToolDbuserMgr, pdtToolDbDevice,
dlg.GetSn(), dlg.GetDevType(), name[i].c_str(), getDevFwNum(devHandle));
if (!AddInterface(mainInterface))
{
QMessageBox::information(this, tr("tips"), tr("cannot create more table"));
delete mainInterface;
}
}
else
{
sane_close(devHandle);
}
}
}
}

View File

@ -70,6 +70,8 @@ private slots:
void on_act_upload_triggered();
void on_act_refreshDevice_triggered();
private:
QSplitter *m_top_splitter;
QSplitter *m_bot_splitter;

View File

@ -28,6 +28,9 @@
<string>menu_device</string>
</property>
<addaction name="act_newDevice"/>
<addaction name="separator"/>
<addaction name="act_refreshDevice"/>
<addaction name="separator"/>
<addaction name="act_close"/>
</widget>
<widget class="QMenu" name="menu_user">
@ -81,6 +84,11 @@
<string>act_upload</string>
</property>
</action>
<action name="act_refreshDevice">
<property name="text">
<string>act_refreshDevice</string>
</property>
</action>
</widget>
<resources/>
<connections/>