-
Notifications
You must be signed in to change notification settings - Fork 543
Expand file tree
/
Copy pathdbus.hpp
More file actions
40 lines (30 loc) · 957 Bytes
/
dbus.hpp
File metadata and controls
40 lines (30 loc) · 957 Bytes
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
38
39
40
#pragma once
#if defined OTR_DBUS_CONTROL
#include "export.hpp"
#include "pipeline.hpp"
#include <QDBusAbstractAdaptor>
#include <QDBusConnection>
#include <QDBusError>
class OTR_LOGIC_EXPORT DBus final : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.github.opentrack.Tracker")
Q_PROPERTY(bool IsEnabled READ is_enabled)
Q_PROPERTY(bool IsZeroed READ is_zero)
pipeline* pipeline_;
public:
static constexpr const char* SERVICE_NAME = "com.github.opentrack";
static constexpr const char* SERVICE_PATH = "/com/github/opentrack/Tracker";
DBus(QObject* obj, pipeline* pipeline)
: QDBusAbstractAdaptor(obj)
, pipeline_(pipeline)
{ }
~DBus() = default;
bool is_enabled() const;
bool is_zero() const;
public slots:
Q_SCRIPTABLE Q_NOREPLY void Center();
Q_SCRIPTABLE Q_NOREPLY void ToggleEnabled();
Q_SCRIPTABLE Q_NOREPLY void ToggleZero();
};
#endif