diff options
author | Olivier Tilloy <olivier.tilloy@canonical.com> | 2012-10-04 12:04:46 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier.tilloy@canonical.com> | 2012-10-04 12:04:46 +0200 |
commit | 36426c5ef4e8d3c8e850996c447d6999e21479c6 (patch) | |
tree | c4d0e3c5572a9e344050ea240ce6d677cc8290e2 /src/common/dbus-enums.h | |
parent | a9416ebfa48082278abd2a237964989334fc24c5 (diff) | |
download | qmenumodel-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/dbus-enums.h')
-rw-r--r-- | src/common/dbus-enums.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/common/dbus-enums.h b/src/common/dbus-enums.h new file mode 100644 index 0000000..76149da --- /dev/null +++ b/src/common/dbus-enums.h @@ -0,0 +1,53 @@ +/* + * Copyright 2012 Canonical Ltd. + * + * 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; version 3. + * + * 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, see <http://www.gnu.org/licenses/>. + * + * Authors: + * Olivier Tilloy <olivier.tilloy@canonical.com> + */ + +#ifndef __DBUS_ENUMS__ +#define __DBUS_ENUMS__ + +#include <QObject> + +// This class acts as a namespace only, with the addition that its enums +// are registered to be exposed on the QML side. +class DBusEnums : public QObject +{ + Q_OBJECT + + Q_ENUMS(BusType) + Q_ENUMS(ConnectionStatus) + +public: + enum BusType { + None = 0, + SessionBus, + SystemBus, + LastBusType + }; + + enum ConnectionStatus { + Disconnected = 0, + Connecting, + Connected + }; + +private: + DBusEnums() {} +}; + +#endif // __DBUS_ENUMS__ + |