diff options
author | 2016-12-12 17:11:06 +0100 | |
---|---|---|
committer | 2016-12-12 17:11:06 +0100 | |
commit | 4088de47844451c7b331a612d41a0ec5fc7db53a (patch) | |
tree | cd98d3fdf946faa4e1915103ea3d51bbdc57fc0c /HomeScreenNG/statusbarmodel.cpp | |
parent | 3b66010c1f381f397e827209727742daf642e7fd (diff) |
Remove HomeScreenNG
This was already integrated into the main
HomeScreen app
Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
Diffstat (limited to 'HomeScreenNG/statusbarmodel.cpp')
-rw-r--r-- | HomeScreenNG/statusbarmodel.cpp | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/HomeScreenNG/statusbarmodel.cpp b/HomeScreenNG/statusbarmodel.cpp deleted file mode 100644 index b844525..0000000 --- a/HomeScreenNG/statusbarmodel.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "statusbarmodel.h" -#include "statusbarserver.h" - -#include <QtDBus/QDBusConnection> - -class StatusBarModel::Private -{ -public: - Private(StatusBarModel *parent); - -private: - StatusBarModel *q; -public: - StatusBarServer server; - QString iconList[StatusBarServer::SupportedCount]; -}; - -StatusBarModel::Private::Private(StatusBarModel *parent) - : q(parent) -{ - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerObject("/StatusBar", &server); - dbus.registerService("org.agl.homescreen"); - connect(&server, &StatusBarServer::statusIconChanged, [&](int placeholderIndex, const QString &icon) { - if (placeholderIndex < 0 || StatusBarServer::SupportedCount <= placeholderIndex) return; - if (iconList[placeholderIndex] == icon) return; - iconList[placeholderIndex] = icon; - emit q->dataChanged(q->index(placeholderIndex), q->index(placeholderIndex)); - }); - for (int i = 0; i < StatusBarServer::SupportedCount; i++) { - iconList[i] = server.getStatusIcon(i); - } -} - -StatusBarModel::StatusBarModel(QObject *parent) - : QAbstractListModel(parent) - , d(new Private(this)) -{ -} - -StatusBarModel::~StatusBarModel() -{ - delete d; -} - -int StatusBarModel::rowCount(const QModelIndex &parent) const -{ - if (parent.isValid()) - return 0; - - return StatusBarServer::SupportedCount; -} - -QVariant StatusBarModel::data(const QModelIndex &index, int role) const -{ - QVariant ret; - if (!index.isValid()) - return ret; - - switch (role) { - case Qt::DisplayRole: - ret = d->iconList[index.row()]; - break; - default: - break; - } - - return ret; -} - -QHash<int, QByteArray> StatusBarModel::roleNames() const -{ - QHash<int, QByteArray> roles; - roles[Qt::DisplayRole] = "icon"; - return roles; -} |