2016-11-05 09:47:17 +00:00
|
|
|
#ifndef DAEMONMANAGER_H
|
|
|
|
#define DAEMONMANAGER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QProcess>
|
|
|
|
|
|
|
|
class DaemonManager : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-11-26 23:16:09 +00:00
|
|
|
static DaemonManager * instance(const QStringList *args);
|
2016-11-05 09:47:17 +00:00
|
|
|
|
|
|
|
Q_INVOKABLE bool start();
|
|
|
|
Q_INVOKABLE bool stop();
|
|
|
|
|
|
|
|
// return true if daemon process is started
|
|
|
|
Q_INVOKABLE bool running() const;
|
|
|
|
|
|
|
|
signals:
|
2016-11-25 20:09:32 +00:00
|
|
|
void daemonStarted();
|
2016-11-05 09:47:17 +00:00
|
|
|
void daemonStopped();
|
2016-11-07 12:10:10 +00:00
|
|
|
void daemonConsoleUpdated(QString message);
|
2016-11-05 09:47:17 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void printOutput();
|
|
|
|
void printError();
|
2016-11-07 22:06:18 +00:00
|
|
|
void closing();
|
2016-11-26 10:54:06 +00:00
|
|
|
void stateChanged(QProcess::ProcessState state);
|
2016-11-05 09:47:17 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
explicit DaemonManager(QObject *parent = 0);
|
|
|
|
static DaemonManager * m_instance;
|
2016-11-26 23:16:09 +00:00
|
|
|
static QStringList m_clArgs;
|
2016-11-05 09:47:17 +00:00
|
|
|
QProcess *m_daemon;
|
2016-11-07 12:10:10 +00:00
|
|
|
bool initialized = false;
|
2016-11-05 09:47:17 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DAEMONMANAGER_H
|