on xenial help sign in
add count and progress overlay information to real model
0b425d1Michael Zanetti
plugins/Unity/Launcher/launchermodel.cpp+21
@@ -67,6 +67,10 @@ QVariant LauncherModel::data(const QModelIndex &index, int role) const
67 return item->icon();
67 return item->icon();
68 case RolePinned:
68 case RolePinned:
69 return item->pinned();
69 return item->pinned();
70+ case RoleCount:
71+ return item->count();
72+ case RoleProgress:
73+ return item->progress();
70 }
74 }
71
75
72 return QVariant();
76 return QVariant();
@@ -198,3 +202,20 @@ int LauncherModel::findApplication(const QString &appId)
198 }
202 }
199 return -1;
203 return -1;
200}
204}
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:
53 void storeAppList();
53 void storeAppList();
54 int findApplication(const QString &appId);
54 int findApplication(const QString &appId);
55
55
56+private Q_SLOTS:
57+ void progressChanged(const QString &appId, int progress);
58+ void countChanged(const QString &appId, int count);
59+
56private:
60private:
57 QList<LauncherItem*> m_list;
61 QList<LauncherItem*> m_list;
58 LauncherBackend *m_backend;
62 LauncherBackend *m_backend;