Refactor project structure

pull/2/head
wh201906 5 years ago
parent a6a699d33c
commit ed1e9cb1d6

@ -17,22 +17,22 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
main.cpp \
mainwindow.cpp \
mf_attack_hardnesteddialog.cpp \
mifare.cpp \
pm3process.cpp \
util.cpp
common/pm3process.cpp \
common/util.cpp \
module/mifare.cpp \
ui/mainwindow.cpp \
ui/mf_attack_hardnesteddialog.cpp \
HEADERS += \
mainwindow.h \
mf_attack_hardnesteddialog.h \
mifare.h \
pm3process.h \
util.h
common/pm3process.h \
common/util.h \
module/mifare.h \
ui/mainwindow.h \
ui/mf_attack_hardnesteddialog.h \
FORMS += \
mainwindow.ui \
mf_attack_hardnesteddialog.ui
ui/mainwindow.ui \
ui/mf_attack_hardnesteddialog.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin

@ -98,3 +98,15 @@ qint64 PM3Process::write(QString data)
{
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);
private slots:
void onTimeout();
void onReadyRead();
private:
bool isRequiringOutput;
QString* requiredOutput;
@ -34,6 +35,7 @@ private:
QSerialPortInfo* portInfo;
signals:
void PM3StatedChanged(bool st, QString info="");
void newOutput(QString output);
};
#endif // PM3PROCESS_H

@ -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
#include <QObject>
@ -11,6 +11,8 @@ public:
signals:
private slots:
void processOutput();
};
#endif // UTIL_H

@ -1,4 +1,4 @@
#include "mainwindow.h"
#include "ui/mainwindow.h"
#include <QApplication>

@ -1,7 +1,8 @@
#include "mifare.h"
Mifare::Mifare(QObject *parent) : QObject(parent)
Mifare::Mifare(Util *addr,QObject *parent) : QObject(parent)
{
util=addr;
isProcessingData=false;
isProcessingKey=false;
}

@ -1,13 +1,14 @@
#ifndef MIFARE_H
#define MIFARE_H
#include "common/util.h"
#include <QObject>
class Mifare : public QObject
{
Q_OBJECT
public:
explicit Mifare(QObject *parent = nullptr);
explicit Mifare(Util *addr,QObject *parent = nullptr);
enum ProcessingState
{
NONE,
@ -30,6 +31,7 @@ public slots:
signals:
private:
Util* util;
bool isProcessingData=false;
bool isProcessingKey=false;
InputType inputType;

@ -14,7 +14,9 @@ MainWindow::MainWindow(QWidget *parent)
pm3Thread->start();
pm3state=false;
mifare = new Mifare;
util = new Util(this);
mifare = new Mifare(util,this);
uiInit();
signalInit();
@ -456,7 +458,7 @@ void MainWindow::uiInit()
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::connectPM3,pm3,&PM3Process::connectPM3);

@ -10,9 +10,10 @@
#include <QtSerialPort/QSerialPortInfo>
#include <QtSerialPort/QSerialPort>
#include "pm3process.h"
#include "mifare.h"
#include "mf_attack_hardnesteddialog.h"
#include "common/pm3process.h"
#include "module/mifare.h"
#include "common/util.h"
#include "ui/mf_attack_hardnesteddialog.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
@ -79,6 +80,7 @@ private:
bool pm3state;
QThread* pm3Thread;
Mifare* mifare;
Util* util;
void uiInit();
QLabel* connectStatusBar;
QLabel* programStatusBar;

@ -1,6 +0,0 @@
#include "util.h"
Util::Util(QObject *parent) : QObject(parent)
{
}
Loading…
Cancel
Save