qt: daemon now operates in the background thread; added Quit GUI button

This commit is contained in:
hypnosis-i2p 2016-06-17 21:49:49 +08:00
parent 3e912c6198
commit 1b35f68de9
12 changed files with 360 additions and 43 deletions

View file

@ -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