aboutsummaryrefslogtreecommitdiff
path: root/src/common/qdbusobject.h
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier.tilloy@canonical.com>2012-10-04 12:04:46 +0200
committerOlivier Tilloy <olivier.tilloy@canonical.com>2012-10-04 12:04:46 +0200
commit36426c5ef4e8d3c8e850996c447d6999e21479c6 (patch)
treec4d0e3c5572a9e344050ea240ce6d677cc8290e2 /src/common/qdbusobject.h
parenta9416ebfa48082278abd2a237964989334fc24c5 (diff)
downloadqmenumodel-36426c5ef4e8d3c8e850996c447d6999e21479c6.tar.gz
qmenumodel-36426c5ef4e8d3c8e850996c447d6999e21479c6.tar.bz2
qmenumodel-36426c5ef4e8d3c8e850996c447d6999e21479c6.zip
Move the enums into a class that inherits QObject, so they can be exposed and used directly from QML.
Diffstat (limited to 'src/common/qdbusobject.h')
-rw-r--r--src/common/qdbusobject.h31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/common/qdbusobject.h b/src/common/qdbusobject.h
index c50d540..cad6658 100644
--- a/src/common/qdbusobject.h
+++ b/src/common/qdbusobject.h
@@ -24,27 +24,16 @@
#include <gio/gio.h>
+#include "dbus-enums.h"
+
class QDBusObject
{
public:
- enum BusType {
- None = 0,
- SessionBus,
- SystemBus,
- LastBusType
- };
-
- enum ConnectionStatus {
- Disconnected = 0,
- Connecting,
- Connected
- };
-
QDBusObject();
~QDBusObject();
- BusType busType() const;
- void setBusType(BusType type);
+ DBusEnums::BusType busType() const;
+ void setBusType(DBusEnums::BusType type);
QString busName() const;
void setBusName(const QString &busName);
@@ -52,7 +41,7 @@ public:
QString objectPath() const;
void setObjectPath(const QString &busName);
- ConnectionStatus status() const;
+ DBusEnums::ConnectionStatus status() const;
void connect();
void disconnect();
@@ -62,19 +51,19 @@ protected:
virtual void serviceVanish(GDBusConnection *connection) = 0;
// notify functions
- virtual void busTypeChanged(BusType type) = 0;
+ virtual void busTypeChanged(DBusEnums::BusType type) = 0;
virtual void busNameChanged(const QString &busNameChanged) = 0;
virtual void objectPathChanged(const QString &objectPath) = 0;
- virtual void statusChanged(ConnectionStatus status) = 0;
+ virtual void statusChanged(DBusEnums::ConnectionStatus status) = 0;
private:
guint m_watchId;
- BusType m_busType;
+ DBusEnums::BusType m_busType;
QString m_busName;
QString m_objectPath;
- ConnectionStatus m_status;
+ DBusEnums::ConnectionStatus m_status;
- void setStatus(ConnectionStatus status);
+ void setStatus(DBusEnums::ConnectionStatus status);
// glib slots
static void onServiceAppeared(GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer data);