mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-07 15:32:13 +00:00
cleanup AnalThread
- removed MainWindow dependency - initalized members - added custom start function - handle thread running on destruction - hide QThread::start
This commit is contained in:
parent
a68d22f608
commit
df72be09a5
@ -1,18 +1,33 @@
|
|||||||
#include "analthread.h"
|
#include "analthread.h"
|
||||||
|
#include "qrcore.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "mainwindow.h"
|
|
||||||
|
|
||||||
AnalThread::AnalThread(MainWindow *w, QWidget *parent) :
|
AnalThread::AnalThread(QWidget *parent) :
|
||||||
QThread(parent)
|
QThread(parent),
|
||||||
|
core(nullptr),
|
||||||
|
level(2)
|
||||||
{
|
{
|
||||||
// Radare core found in:
|
}
|
||||||
this->w = w;
|
|
||||||
//this->level = 2;
|
AnalThread::~AnalThread()
|
||||||
|
{
|
||||||
|
if (isRunning()) {
|
||||||
|
quit();
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnalThread::start(QRCore *core, int level)
|
||||||
|
{
|
||||||
|
this->core = core;
|
||||||
|
this->level = level;
|
||||||
|
|
||||||
|
QThread::start();
|
||||||
}
|
}
|
||||||
|
|
||||||
// run() will be called when a thread starts
|
// run() will be called when a thread starts
|
||||||
void AnalThread::run()
|
void AnalThread::run()
|
||||||
{
|
{
|
||||||
//qDebug() << "Anal level: " << this->level;
|
//qDebug() << "Anal level: " << this->level;
|
||||||
this->w->core->analyze(this->level);
|
core->analyze(this->level);
|
||||||
}
|
}
|
||||||
|
@ -3,19 +3,25 @@
|
|||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
class MainWindow;
|
class QRCore;
|
||||||
|
|
||||||
class AnalThread : public QThread
|
class AnalThread : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AnalThread(MainWindow *w, QWidget *parent = 0);
|
explicit AnalThread(QWidget *parent = 0);
|
||||||
|
~AnalThread();
|
||||||
|
|
||||||
|
void start(QRCore *core, int level);
|
||||||
|
|
||||||
|
protected:
|
||||||
void run();
|
void run();
|
||||||
int level;
|
|
||||||
|
using QThread::start;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QRCore *core;
|
||||||
MainWindow *w;
|
int level;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ANALTHREAD_H
|
#endif // ANALTHREAD_H
|
||||||
|
Loading…
Reference in New Issue
Block a user