mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
qt: daemon now operates in the background thread; added Quit GUI button
This commit is contained in:
parent
3e912c6198
commit
1b35f68de9
12 changed files with 360 additions and 43 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue