Add running state

pull/2/head
wh201906 5 years ago
parent a65bcffffd
commit 526bd89873

@ -36,6 +36,7 @@ void MainWindow::initUI() // will be called by main.app
ui->retranslateUi(this); ui->retranslateUi(this);
uiInit(); uiInit();
signalInit(); signalInit();
setState(false);
} }
// ******************** basic functions ******************** // ******************** basic functions ********************
@ -78,6 +79,7 @@ void MainWindow::on_PM3_connectButton_clicked()
void MainWindow::onPM3StateChanged(bool st, QString info) void MainWindow::onPM3StateChanged(bool st, QString info)
{ {
pm3state = st; pm3state = st;
setState(st);
if(st == true) if(st == true)
{ {
setStatusBar(PM3VersionBar, info); setStatusBar(PM3VersionBar, info);
@ -92,6 +94,7 @@ void MainWindow::onPM3StateChanged(bool st, QString info)
void MainWindow::on_PM3_disconnectButton_clicked() void MainWindow::on_PM3_disconnectButton_clicked()
{ {
pm3state = false; pm3state = false;
setState(false);
emit killPM3(); emit killPM3();
emit setSerialListener("", false); emit setSerialListener("", false);
setStatusBar(connectStatusBar, tr("Not Connected")); setStatusBar(connectStatusBar, tr("Not Connected"));
@ -344,12 +347,16 @@ void MainWindow::on_MF_Attack_infoButton_clicked()
void MainWindow::on_MF_Attack_chkButton_clicked() void MainWindow::on_MF_Attack_chkButton_clicked()
{ {
setState(false);
mifare->chk(); mifare->chk();
setState(true);
} }
void MainWindow::on_MF_Attack_nestedButton_clicked() void MainWindow::on_MF_Attack_nestedButton_clicked()
{ {
setState(false);
mifare->nested(); mifare->nested();
setState(true);
} }
void MainWindow::on_MF_Attack_hardnestedButton_clicked() void MainWindow::on_MF_Attack_hardnestedButton_clicked()
@ -359,22 +366,30 @@ void MainWindow::on_MF_Attack_hardnestedButton_clicked()
void MainWindow::on_MF_RW_readAllButton_clicked() void MainWindow::on_MF_RW_readAllButton_clicked()
{ {
setState(false);
mifare->readAll(); mifare->readAll();
setState(true);
} }
void MainWindow::on_MF_RW_readBlockButton_clicked() void MainWindow::on_MF_RW_readBlockButton_clicked()
{ {
setState(false);
mifare->read(); mifare->read();
setState(true);
} }
void MainWindow::on_MF_RW_writeBlockButton_clicked() void MainWindow::on_MF_RW_writeBlockButton_clicked()
{ {
setState(false);
mifare->write(); mifare->write();
setState(true);
} }
void MainWindow::on_MF_RW_writeAllButton_clicked() void MainWindow::on_MF_RW_writeAllButton_clicked()
{ {
setState(false);
mifare->writeAll(); mifare->writeAll();
setState(true);
} }
void MainWindow::on_MF_RW_dumpButton_clicked() void MainWindow::on_MF_RW_dumpButton_clicked()
@ -389,22 +404,30 @@ void MainWindow::on_MF_RW_restoreButton_clicked()
void MainWindow::on_MF_UID_readAllButton_clicked() void MainWindow::on_MF_UID_readAllButton_clicked()
{ {
setState(false);
mifare->readAllC(); mifare->readAllC();
setState(true);
} }
void MainWindow::on_MF_UID_readBlockButton_clicked() void MainWindow::on_MF_UID_readBlockButton_clicked()
{ {
setState(false);
mifare->readC(); mifare->readC();
setState(true);
} }
void MainWindow::on_MF_UID_writeAllButton_clicked() void MainWindow::on_MF_UID_writeAllButton_clicked()
{ {
setState(false);
mifare->writeAllC(); mifare->writeAllC();
setState(true);
} }
void MainWindow::on_MF_UID_writeBlockButton_clicked() void MainWindow::on_MF_UID_writeBlockButton_clicked()
{ {
setState(false);
mifare->writeC(); mifare->writeC();
setState(true);
} }
void MainWindow::on_MF_UID_wipeButton_clicked() void MainWindow::on_MF_UID_wipeButton_clicked()
@ -435,7 +458,9 @@ void MainWindow::on_MF_UID_aboutUIDButton_clicked()
void MainWindow::on_MF_UID_setParaButton_clicked() void MainWindow::on_MF_UID_setParaButton_clicked()
{ {
setState(false);
mifare->setParameterC(); mifare->setParameterC();
setState(true);
} }
void MainWindow::on_MF_UID_lockButton_clicked() void MainWindow::on_MF_UID_lockButton_clicked()
@ -445,7 +470,9 @@ void MainWindow::on_MF_UID_lockButton_clicked()
void MainWindow::on_MF_Sniff_sniffButton_clicked() void MainWindow::on_MF_Sniff_sniffButton_clicked()
{ {
setState(false);
mifare->sniff(); mifare->sniff();
setState(true);
} }
void MainWindow::on_MF_Sniff_listButton_clicked() void MainWindow::on_MF_Sniff_listButton_clicked()
@ -599,4 +626,23 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event) // drag support
return QMainWindow::eventFilter(watched, event); return QMainWindow::eventFilter(watched, event);
} }
void MainWindow::setState(bool st)
{
if(!st && pm3state)
{
setStatusBar(programStatusBar, tr("Running"));
}
else
{
setStatusBar(programStatusBar, tr("Idle"));
}
ui->MF_attackGroupBox->setEnabled(st);
ui->MF_normalGroupBox->setEnabled(st);
ui->MF_UIDGroupBox->setEnabled(st);
ui->MF_simGroupBox->setEnabled(st);
ui->MF_sniffGroupBox->setEnabled(st);
ui->Raw_CMDEdit->setEnabled(st);
ui->Raw_sendCMDButton->setEnabled(st);
}
// *********************************************** // ***********************************************

@ -137,6 +137,7 @@ private:
void signalInit(); void signalInit();
void MF_widgetReset(); void MF_widgetReset();
void setTableItem(QTableWidget *widget, int row, int column, const QString &text); void setTableItem(QTableWidget *widget, int row, int column, const QString &text);
void setState(bool st);
signals: signals:
void connectPM3(const QString path, const QString port); void connectPM3(const QString path, const QString port);
void killPM3(); void killPM3();

@ -618,7 +618,7 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="MF_NormalGroupBox"> <widget class="QGroupBox" name="MF_normalGroupBox">
<property name="title"> <property name="title">
<string>Normal(Require Password)</string> <string>Normal(Require Password)</string>
</property> </property>

Loading…
Cancel
Save