mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
qt: daemon now operates in the background thread; added Quit GUI button
This commit is contained in:
@@ -1,4 +1,66 @@
|
||||
#ifndef DAEMONQT_H
|
||||
#define DAEMONQT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
namespace DaemonQt
|
||||
{
|
||||
class Worker : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
void startDaemon();
|
||||
void restartDaemon();
|
||||
void stopDaemon();
|
||||
|
||||
signals:
|
||||
void resultReady();
|
||||
};
|
||||
|
||||
class DaemonQTImpl
|
||||
{
|
||||
public:
|
||||
typedef void (*runningChangedCallback)();
|
||||
|
||||
/**
|
||||
* @brief init
|
||||
* @param argc
|
||||
* @param argv
|
||||
* @return success
|
||||
*/
|
||||
bool static init(int argc, char* argv[]);
|
||||
void static deinit();
|
||||
void static start();
|
||||
void static stop();
|
||||
void static restart();
|
||||
void static setRunningCallback(runningChangedCallback cb);
|
||||
bool static isRunning();
|
||||
private:
|
||||
void static setRunning(bool running);
|
||||
};
|
||||
|
||||
class Controller : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QThread workerThread;
|
||||
public:
|
||||
Controller();
|
||||
~Controller();
|
||||
public slots:
|
||||
void handleResults(){}
|
||||
signals:
|
||||
void startDaemon();
|
||||
void stopDaemon();
|
||||
void restartDaemon();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DAEMONQT_H
|
||||
|
||||
Reference in New Issue
Block a user