blob: ebab061a14c76e61b306166060af40024df1a305 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#ifndef SERVICECONTROL_H
#define SERVICECONTROL_H
#include <QDBusInterface>
#include <QObject>
static const QString ROCKPOOLD_SYSTEMD_UNIT("rockpoold.service");
class ServiceControl : public QObject
{
Q_OBJECT
Q_PROPERTY(bool serviceRunning READ serviceRunning WRITE setServiceRunning NOTIFY serviceRunningChanged)
public:
explicit ServiceControl(QObject *parent = 0);
bool serviceRunning() const;
bool setServiceRunning(bool running);
Q_INVOKABLE bool startService();
Q_INVOKABLE bool stopService();
Q_INVOKABLE bool restartService();
private slots:
void getUnitProperties();
void onPropertiesChanged(QString interface, QMap<QString, QVariant> changed, QStringList invalidated);
signals:
void serviceRunningChanged();
private:
QDBusInterface *systemd;
QDBusObjectPath unitPath;
QVariantMap unitProperties;
};
#endif // SERVICECONTROL_H
|