on xenial help sign in
Added indication for running apps. Fixes: #1471577

Approved by: Albert Astals Cid

commit0d73d6999c7e58c25c0b9e2a525f2dab4876ce11 authorhandsome_feng <445865575@qq.com> dateWed 12 Aug 2015, 08:40 (11 years ago) parentab7130b6ae5fda
5 files changed+38−1
plugins/Unity/Launcher/launchermodel.cpp−1 qml/Launcher/LauncherDelegate.qml+12 qml/Launcher/LauncherPanel.qml+1 tests/plugins/Unity/Launcher/launchermodeltest.cpp+16 tests/qmltests/Launcher/tst_Launcher.qml+9
plugins/Unity/Launcher/launchermodel.cpp−1
@@ -516,7 +516,6 @@ void LauncherModel::applicationAdded(const QModelIndex &parent, int row)
516516 Q_EMIT dataChanged(index(itemIndex), index(itemIndex), {RoleRecent});
517517 }
518518 item->setRunning(true);
519− // TODO Shall we paint some running/recent app highlight? If yes, do it here.
520519 } else {
521520 LauncherItem *item = new LauncherItem(app->appId(), app->name(), app->icon().toString(), this);
522521 item->setRecent(true);
qml/Launcher/LauncherDelegate.qml+12
@@ -24,6 +24,7 @@ Item {
2424 property int count: 0
2525 property bool countVisible: false
2626 property int progress: -1
27+ property bool itemRunning: false
2728 property bool itemFocused: false
2829 property real maxAngle: 0
2930 property bool inverted: false
@@ -216,6 +217,17 @@ Item {
216217 }
217218 }
218219
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+
219231 Image {
220232 objectName: "focusedHighlight"
221233 anchors {
qml/Launcher/LauncherPanel.qml+1
@@ -193,6 +193,7 @@ Rectangle {
193193 count: model.count
194194 countVisible: model.countVisible
195195 progress: model.progress
196+ itemRunning: model.running
196197 itemFocused: model.focused
197198 inverted: root.inverted
198199 alerting: model.alerting
tests/plugins/Unity/Launcher/launchermodeltest.cpp+16
@@ -298,6 +298,22 @@ private Q_SLOTS:
298298 QCOMPARE(launcherModel->rowCount(QModelIndex()), 1);
299299 }
300300
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+
301317 void testApplicationFocused() {
302318 // all apps unfocused at beginning...
303319 QCOMPARE(launcherModel->get(0)->focused(), false);
tests/qmltests/Launcher/tst_Launcher.qml+9
@@ -382,6 +382,15 @@ Item {
382382 }
383383 }
384384
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+
385394 function test_focusedHighlight() {
386395 dragLauncherIntoView();
387396 var launcherListView = findChild(launcher, "launcherListView");