summaryrefslogtreecommitdiff
path: root/rockwork/servicecontrol.h
diff options
context:
space:
mode:
Diffstat (limited to 'rockwork/servicecontrol.h')
-rw-r--r--rockwork/servicecontrol.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/rockwork/servicecontrol.h b/rockwork/servicecontrol.h
index 4689506..ebab061 100644
--- a/rockwork/servicecontrol.h
+++ b/rockwork/servicecontrol.h
@@ -1,38 +1,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(QString serviceName READ serviceName WRITE setServiceName NOTIFY serviceNameChanged)
- Q_PROPERTY(bool serviceFileInstalled READ serviceFileInstalled NOTIFY serviceFileInstalledChanged)
Q_PROPERTY(bool serviceRunning READ serviceRunning WRITE setServiceRunning NOTIFY serviceRunningChanged)
public:
explicit ServiceControl(QObject *parent = 0);
- QString serviceName() const;
- void setServiceName(const QString &serviceName);
-
- bool serviceFileInstalled() const;
- Q_INVOKABLE bool installServiceFile();
- Q_INVOKABLE bool removeServiceFile();
-
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 serviceNameChanged();
- void serviceFileInstalledChanged();
void serviceRunningChanged();
private:
- QString m_serviceName;
+ QDBusInterface *systemd;
+ QDBusObjectPath unitPath;
+ QVariantMap unitProperties;
+
};
#endif // SERVICECONTROL_H