|
@@ -1,80 +0,0 @@
|
|
|
-/*
|
|
|
- * Copyright (C) 2015 Malte Veerman <maldela@halloarsch.de>
|
|
|
- *
|
|
|
- * This program is free software; you can redistribute it and/or modify
|
|
|
- * it under the terms of the GNU Lesser General Public License as published by
|
|
|
- * the Free Software Foundation; either version 2 of the License, or
|
|
|
- * (at your option) any later version.
|
|
|
- *
|
|
|
- * This program is distributed in the hope that it will be useful,
|
|
|
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
- * GNU Lesser General Public License for more details.
|
|
|
- *
|
|
|
- * You should have received a copy of the GNU Lesser General Public License along
|
|
|
- * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
- *
|
|
|
- */
|
|
|
-
|
|
|
-#ifndef SYSTEMDCOMMUNICATOR_H
|
|
|
-#define SYSTEMDCOMMUNICATOR_H
|
|
|
-
|
|
|
-#include <QObject>
|
|
|
-#include <QtDBus/QtDBus>
|
|
|
-
|
|
|
-#include "export.h"
|
|
|
-
|
|
|
-class FANCONTROL_GUI_EXPORT SystemdCommunicator : public QObject
|
|
|
-{
|
|
|
- Q_OBJECT
|
|
|
- Q_PROPERTY(QString serviceName READ serviceName WRITE setServiceName NOTIFY serviceNameChanged)
|
|
|
- Q_PROPERTY(QString error READ error NOTIFY errorChanged)
|
|
|
- Q_PROPERTY(bool serviceExists READ serviceExists NOTIFY serviceNameChanged)
|
|
|
- Q_PROPERTY(bool serviceEnabled READ serviceEnabled WRITE setServiceEnabled NOTIFY serviceEnabledChanged)
|
|
|
-
|
|
|
-public:
|
|
|
-
|
|
|
- explicit SystemdCommunicator(QObject *parent = 0);
|
|
|
-
|
|
|
- QString serviceName() const { return m_serviceName; }
|
|
|
- void setServiceName(const QString &name);
|
|
|
- bool serviceExists();
|
|
|
- bool serviceEnabled();
|
|
|
- void setServiceEnabled(bool enabled);
|
|
|
- Q_INVOKABLE bool serviceActive();
|
|
|
- void setServiceActive(bool active);
|
|
|
- QString error() const { return m_error; }
|
|
|
- Q_INVOKABLE void dbusAction(const QString &method, const QVariantList &arguments = QVariantList());
|
|
|
-
|
|
|
-
|
|
|
-signals:
|
|
|
-
|
|
|
- void serviceNameChanged();
|
|
|
- void serviceEnabledChanged();
|
|
|
- void errorChanged();
|
|
|
-
|
|
|
-
|
|
|
-protected:
|
|
|
-
|
|
|
- QString m_serviceName;
|
|
|
- QString m_serviceObjectPath;
|
|
|
- QString m_error;
|
|
|
- QDBusInterface *m_managerInterface;
|
|
|
- QDBusInterface *m_serviceInterface;
|
|
|
-};
|
|
|
-
|
|
|
-typedef struct
|
|
|
-{
|
|
|
- QString path;
|
|
|
- QString state;
|
|
|
-} SystemdUnitFile;
|
|
|
-Q_DECLARE_METATYPE(SystemdUnitFile)
|
|
|
-
|
|
|
-typedef QList<SystemdUnitFile> SystemdUnitFileList;
|
|
|
-Q_DECLARE_METATYPE(SystemdUnitFileList)
|
|
|
-
|
|
|
-QDBusArgument &operator <<(QDBusArgument &argument, const SystemdUnitFile &unitFile);
|
|
|
-const QDBusArgument &operator >>(const QDBusArgument &argument, SystemdUnitFile &unitFile);
|
|
|
-
|
|
|
-#endif // SYSTEMDCOMMUNICATOR_H
|