summaryrefslogtreecommitdiff
path: root/rockwork/servicecontrol.h
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2016-02-17 20:41:52 +0100
committerAndrew Branson <andrew.branson@cern.ch>2016-02-17 20:41:52 +0100
commit0f3d090bd1dc9a6b912eb0b1e587602573304b4a (patch)
treeaa52d58d9ba119d20d491a37595c3fa4f3458980 /rockwork/servicecontrol.h
parent07fb609095291f8d8544441925dea3d60d636f87 (diff)
First attempt at QML hacking.
Main and ServiceControl adapted. Project files
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