Complete Mifare Simulate function

pull/3/head
wh201906 5 years ago
parent afe2474fe3
commit fe8b9d6161

@ -564,8 +564,10 @@ void Mifare::wipeE()
void Mifare::simulate() void Mifare::simulate()
{ {
MF_Sim_simDialog dialog; MF_Sim_simDialog dialog(cardType.type);
dialog.exec(); connect(&dialog, &MF_Sim_simDialog::sendCMD, util, &Util::execCMD);
if(dialog.exec() == QDialog::Accepted)
ui->funcTab->setCurrentIndex(1);
} }

@ -1,11 +1,12 @@
#include "mf_sim_simdialog.h" #include "mf_sim_simdialog.h"
#include "ui_mf_sim_simdialog.h" #include "ui_mf_sim_simdialog.h"
MF_Sim_simDialog::MF_Sim_simDialog(QWidget *parent) : MF_Sim_simDialog::MF_Sim_simDialog(int cardType, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::MF_Sim_simDialog) ui(new Ui::MF_Sim_simDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
this->cardType = cardType;
} }
MF_Sim_simDialog::~MF_Sim_simDialog() MF_Sim_simDialog::~MF_Sim_simDialog()
@ -50,3 +51,16 @@ void MF_Sim_simDialog::on_fBox_clicked(bool checked)
ui->xBox->setEnabled(false); ui->xBox->setEnabled(false);
} }
} }
void MF_Sim_simDialog::on_buttonBox_accepted()
{
QString paras;
paras += (ui->uBox->isChecked() ? "u " + ui->uEdit->text() + " " : "");
paras += (ui->nBox->isChecked() ? "n " + ui->nEdit->text() + " " : "");
paras += (ui->iBox->isChecked() ? "i " : "");
paras += (ui->xBox->isChecked() ? "x " : "");
paras += (ui->eBox->isChecked() ? "e " : "");
paras += (ui->fBox->isChecked() ? "f " + ui->fEdit->text() + " " : "");
paras += (ui->rBox->isChecked() ? "r " : "");
emit sendCMD(QString("hf mf sim ") + "*" + QString::number(cardType) + " " + paras.trimmed());
}

@ -2,6 +2,7 @@
#define MF_SIM_SIMDIALOG_H #define MF_SIM_SIMDIALOG_H
#include <QDialog> #include <QDialog>
#include <QDebug>
namespace Ui namespace Ui
{ {
@ -13,7 +14,7 @@ class MF_Sim_simDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit MF_Sim_simDialog(QWidget *parent = nullptr); explicit MF_Sim_simDialog(int cardType, QWidget *parent = nullptr);
~MF_Sim_simDialog(); ~MF_Sim_simDialog();
private slots: private slots:
@ -23,6 +24,11 @@ private slots:
private: private:
Ui::MF_Sim_simDialog *ui; Ui::MF_Sim_simDialog *ui;
int cardType;
signals:
void sendCMD(QString cmd);
private slots:
void on_buttonBox_accepted();
}; };
#endif // MF_SIM_SIMDIALOG_H #endif // MF_SIM_SIMDIALOG_H

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>461</width> <width>461</width>
<height>351</height> <height>456</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -46,6 +46,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -90,6 +96,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -236,6 +248,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget> </widget>
</item> </item>
<item> <item>

Loading…
Cancel
Save