on xenial help sign in
add count and progress overlay information to real model
commit0b425d1c30c478c014d00c7264e5d253ac21a808 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 22 Aug 2013, 14:08 (13 years ago) parent2563253
2 files changed+25
plugins/Unity/Launcher/launchermodel.cpp+21 plugins/Unity/Launcher/launchermodel.h+4
plugins/Unity/Launcher/launchermodel.cpp+21
@@ -67,6 +67,10 @@ QVariant LauncherModel::data(const QModelIndex &index, int role) const
6767 return item->icon();
6868 case RolePinned:
6969 return item->pinned();
70+ case RoleCount:
71+ return item->count();
72+ case RoleProgress:
73+ return item->progress();
7074 }
7175
7276 return QVariant();
@@ -198,3 +202,20 @@ int LauncherModel::findApplication(const QString &appId)
198202 }
199203 return -1;
200204}
205+
206+void LauncherModel::progressChanged(const QString &appId, int progress)
207+{
208+ int idx = findApplication(appId);
209+ LauncherItem *item = m_list.at(idx);
210+ item->setProgress(progress);
211+ Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleProgress);
212+}
213+
214+
215+void LauncherModel::countChanged(const QString &appId, int count)
216+{
217+ int idx = findApplication(appId);
218+ LauncherItem *item = m_list.at(idx);
219+ item->setCount(count);
220+ Q_EMIT dataChanged(index(idx), index(idx), QVector<int>() << RoleCount);
221+}
plugins/Unity/Launcher/launchermodel.h+4
@@ -53,6 +53,10 @@ private:
5353 void storeAppList();
5454 int findApplication(const QString &appId);
5555
56+private Q_SLOTS:
57+ void progressChanged(const QString &appId, int progress);
58+ void countChanged(const QString &appId, int count);
59+
5660private:
5761 QList<LauncherItem*> m_list;
5862 LauncherBackend *m_backend;