mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2025-04-20 11:41:07 +08:00
Refactor project structure
This commit is contained in:
parent
a6a699d33c
commit
ed1e9cb1d6
@ -17,22 +17,22 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
mainwindow.cpp \
|
common/pm3process.cpp \
|
||||||
mf_attack_hardnesteddialog.cpp \
|
common/util.cpp \
|
||||||
mifare.cpp \
|
module/mifare.cpp \
|
||||||
pm3process.cpp \
|
ui/mainwindow.cpp \
|
||||||
util.cpp
|
ui/mf_attack_hardnesteddialog.cpp \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
common/pm3process.h \
|
||||||
mf_attack_hardnesteddialog.h \
|
common/util.h \
|
||||||
mifare.h \
|
module/mifare.h \
|
||||||
pm3process.h \
|
ui/mainwindow.h \
|
||||||
util.h
|
ui/mf_attack_hardnesteddialog.h \
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui \
|
ui/mainwindow.ui \
|
||||||
mf_attack_hardnesteddialog.ui
|
ui/mf_attack_hardnesteddialog.ui
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
|
@ -98,3 +98,15 @@ qint64 PM3Process::write(QString data)
|
|||||||
{
|
{
|
||||||
return QProcess::write(data.toLatin1());
|
return QProcess::write(data.toLatin1());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PM3Process::onReadyRead()
|
||||||
|
{
|
||||||
|
QString btay = readLine();
|
||||||
|
// while(btay != "")
|
||||||
|
// {
|
||||||
|
// qDebug() << btay;
|
||||||
|
// ui->Raw_outputEdit->insertPlainText(btay);
|
||||||
|
// btay = pm3->readLine();
|
||||||
|
// }
|
||||||
|
// ui->Raw_outputEdit->moveCursor(QTextCursor::End);
|
||||||
|
}
|
@ -27,6 +27,7 @@ public slots:
|
|||||||
qint64 write(QString data);
|
qint64 write(QString data);
|
||||||
private slots:
|
private slots:
|
||||||
void onTimeout();
|
void onTimeout();
|
||||||
|
void onReadyRead();
|
||||||
private:
|
private:
|
||||||
bool isRequiringOutput;
|
bool isRequiringOutput;
|
||||||
QString* requiredOutput;
|
QString* requiredOutput;
|
||||||
@ -34,6 +35,7 @@ private:
|
|||||||
QSerialPortInfo* portInfo;
|
QSerialPortInfo* portInfo;
|
||||||
signals:
|
signals:
|
||||||
void PM3StatedChanged(bool st, QString info="");
|
void PM3StatedChanged(bool st, QString info="");
|
||||||
|
void newOutput(QString output);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PM3PROCESS_H
|
#endif // PM3PROCESS_H
|
11
common/util.cpp
Normal file
11
common/util.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
Util::Util(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Util::processOutput()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
#ifndef UTIL_H
|
#ifndef UTIL_H
|
||||||
#define UTIL_H
|
#define UTIL_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@ -11,6 +11,8 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void processOutput();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // UTIL_H
|
#endif // UTIL_H
|
2
main.cpp
2
main.cpp
@ -1,4 +1,4 @@
|
|||||||
#include "mainwindow.h"
|
#include "ui/mainwindow.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "mifare.h"
|
#include "mifare.h"
|
||||||
|
|
||||||
Mifare::Mifare(QObject *parent) : QObject(parent)
|
Mifare::Mifare(Util *addr,QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
util=addr;
|
||||||
isProcessingData=false;
|
isProcessingData=false;
|
||||||
isProcessingKey=false;
|
isProcessingKey=false;
|
||||||
}
|
}
|
@ -1,13 +1,14 @@
|
|||||||
#ifndef MIFARE_H
|
#ifndef MIFARE_H
|
||||||
#define MIFARE_H
|
#define MIFARE_H
|
||||||
|
|
||||||
|
#include "common/util.h"
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
class Mifare : public QObject
|
class Mifare : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Mifare(QObject *parent = nullptr);
|
explicit Mifare(Util *addr,QObject *parent = nullptr);
|
||||||
enum ProcessingState
|
enum ProcessingState
|
||||||
{
|
{
|
||||||
NONE,
|
NONE,
|
||||||
@ -30,6 +31,7 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Util* util;
|
||||||
bool isProcessingData=false;
|
bool isProcessingData=false;
|
||||||
bool isProcessingKey=false;
|
bool isProcessingKey=false;
|
||||||
InputType inputType;
|
InputType inputType;
|
@ -14,7 +14,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
pm3Thread->start();
|
pm3Thread->start();
|
||||||
pm3state=false;
|
pm3state=false;
|
||||||
|
|
||||||
mifare = new Mifare;
|
util = new Util(this);
|
||||||
|
mifare = new Mifare(util,this);
|
||||||
|
|
||||||
|
|
||||||
uiInit();
|
uiInit();
|
||||||
signalInit();
|
signalInit();
|
||||||
@ -456,7 +458,7 @@ void MainWindow::uiInit()
|
|||||||
|
|
||||||
void MainWindow::signalInit()
|
void MainWindow::signalInit()
|
||||||
{
|
{
|
||||||
connect(pm3, &PM3Process::readyRead, this, &MainWindow::refresh);
|
// connect(pm3, &PM3Process::readyRead, util, &MainWindow::refresh);
|
||||||
|
|
||||||
connect(this,&MainWindow::requiringOutput,pm3,&PM3Process::setRequiringOutput);
|
connect(this,&MainWindow::requiringOutput,pm3,&PM3Process::setRequiringOutput);
|
||||||
connect(this,&MainWindow::connectPM3,pm3,&PM3Process::connectPM3);
|
connect(this,&MainWindow::connectPM3,pm3,&PM3Process::connectPM3);
|
@ -10,9 +10,10 @@
|
|||||||
#include <QtSerialPort/QSerialPortInfo>
|
#include <QtSerialPort/QSerialPortInfo>
|
||||||
#include <QtSerialPort/QSerialPort>
|
#include <QtSerialPort/QSerialPort>
|
||||||
|
|
||||||
#include "pm3process.h"
|
#include "common/pm3process.h"
|
||||||
#include "mifare.h"
|
#include "module/mifare.h"
|
||||||
#include "mf_attack_hardnesteddialog.h"
|
#include "common/util.h"
|
||||||
|
#include "ui/mf_attack_hardnesteddialog.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
@ -79,6 +80,7 @@ private:
|
|||||||
bool pm3state;
|
bool pm3state;
|
||||||
QThread* pm3Thread;
|
QThread* pm3Thread;
|
||||||
Mifare* mifare;
|
Mifare* mifare;
|
||||||
|
Util* util;
|
||||||
void uiInit();
|
void uiInit();
|
||||||
QLabel* connectStatusBar;
|
QLabel* connectStatusBar;
|
||||||
QLabel* programStatusBar;
|
QLabel* programStatusBar;
|
Loading…
x
Reference in New Issue
Block a user