on xenial help sign in
Added indication for running apps. Fixes: #1471577
0d73d69handsome_feng
plugins/Unity/Launcher/launchermodel.cpp−1
@@ -516,7 +516,6 @@ void LauncherModel::applicationAdded(const QModelIndex &parent, int row)
516 Q_EMIT dataChanged(index(itemIndex), index(itemIndex), {RoleRecent});
516 Q_EMIT dataChanged(index(itemIndex), index(itemIndex), {RoleRecent});
517 }
517 }
518 item->setRunning(true);
518 item->setRunning(true);
519− // TODO Shall we paint some running/recent app highlight? If yes, do it here.
520 } else {
519 } else {
521 LauncherItem *item = new LauncherItem(app->appId(), app->name(), app->icon().toString(), this);
520 LauncherItem *item = new LauncherItem(app->appId(), app->name(), app->icon().toString(), this);
522 item->setRecent(true);
521 item->setRecent(true);
qml/Launcher/LauncherDelegate.qml+12
@@ -24,6 +24,7 @@ Item {
24 property int count: 0
24 property int count: 0
25 property bool countVisible: false
25 property bool countVisible: false
26 property int progress: -1
26 property int progress: -1
27+ property bool itemRunning: false
27 property bool itemFocused: false
28 property bool itemFocused: false
28 property real maxAngle: 0
29 property real maxAngle: 0
29 property bool inverted: false
30 property bool inverted: false
@@ -216,6 +217,17 @@ Item {
216 }
217 }
217 }
218 }
218
219
220+ Image {
221+ objectName: "runningHighlight"
222+ anchors {
223+ left: parent.left
224+ verticalCenter: parent.verticalCenter
225+ }
226+ visible: root.itemRunning
227+ rotation: 180
228+ source: "graphics/focused_app_arrow.png"
229+ }
230+
219 Image {
231 Image {
220 objectName: "focusedHighlight"
232 objectName: "focusedHighlight"
221 anchors {
233 anchors {
qml/Launcher/LauncherPanel.qml+1
@@ -193,6 +193,7 @@ Rectangle {
193 count: model.count
193 count: model.count
194 countVisible: model.countVisible
194 countVisible: model.countVisible
195 progress: model.progress
195 progress: model.progress
196+ itemRunning: model.running
196 itemFocused: model.focused
197 itemFocused: model.focused
197 inverted: root.inverted
198 inverted: root.inverted
198 alerting: model.alerting
199 alerting: model.alerting
tests/plugins/Unity/Launcher/launchermodeltest.cpp+16
@@ -298,6 +298,22 @@ private Q_SLOTS:
298 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
298 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
299 }
299 }
300
300
301+ void testApplicationRunning() {
302+ launcherModel->pin("abs-icon");
303+ launcherModel->pin("no-icon");
304+
305+ QCOMPARE(launcherModel->get(0)->running(), true);
306+ QCOMPARE(launcherModel->get(1)->running(), true);
307+
308+ appManager->stopApplication("abs-icon");
309+ QCOMPARE(launcherModel->get(0)->running(), false);
310+ QCOMPARE(launcherModel->get(1)->running(), true);
311+
312+ appManager->stopApplication("no-icon");
313+ QCOMPARE(launcherModel->get(0)->running(), false);
314+ QCOMPARE(launcherModel->get(1)->running(), false);
315+ }
316+
301 void testApplicationFocused() {
317 void testApplicationFocused() {
302 // all apps unfocused at beginning...
318 // all apps unfocused at beginning...
303 QCOMPARE(launcherModel->get(0)->focused(), false);
319 QCOMPARE(launcherModel->get(0)->focused(), false);
tests/qmltests/Launcher/tst_Launcher.qml+9
@@ -382,6 +382,15 @@ Item {
382 }
382 }
383 }
383 }
384
384
385+ function test_runningHighlight() {
386+ dragLauncherIntoView();
387+ var launcherListView = findChild(launcher, "launcherListView");
388+ for (var i = 0; i < launcherListView.count; ++i) {
389+ var delegate = findChild(launcherListView, "launcherDelegate" + i)
390+ compare(findChild(delegate, "runningHighlight").visible, LauncherModel.get(i).running)
391+ }
392+ }
393+
385 function test_focusedHighlight() {
394 function test_focusedHighlight() {
386 dragLauncherIntoView();
395 dragLauncherIntoView();
387 var launcherListView = findChild(launcher, "launcherListView");
396 var launcherListView = findChild(launcher, "launcherListView");