Merge lp:~osomon/unity-2d/move-properties-to-launcheritem into lp:unity-2d/3.0

Proposed by Olivier Tilloy
Status: Merged
Approved by: Florian Boucault
Approved revision: 592
Merged at revision: 592
Proposed branch: lp:~osomon/unity-2d/move-properties-to-launcheritem
Merge into: lp:unity-2d/3.0
Diff against target: 164 lines (+71/-25)
4 files modified
launcher/LauncherList.qml (+6/-7)
libunity-2d-private/Unity2d/launcherapplication.h (+7/-18)
libunity-2d-private/Unity2d/launcheritem.cpp (+37/-0)
libunity-2d-private/Unity2d/launcheritem.h (+21/-0)
To merge this branch: bzr merge lp:~osomon/unity-2d/move-properties-to-launcheritem
Reviewer Review Type Date Requested Status
Florian Boucault (community) Needs Fixing
Review via email: mp+64371@code.launchpad.net

Commit message

[launcher] Moved the progress, counter and emblem properties (and their related visibility properties) to the base LauncherItem class.
The default implementation doesn’t show them, it is meant to be overridden in subclasses.

Description of the change

Note: on top of the refactoring advertised in the commit message, this MR also fixes a bug in the visibility of emblems: in LauncherList.qml, the value of the 'emblem' property was never set correctly, because the condition on noOverlays was the opposite of what is was meant to be.

To post a comment you must log in.
Revision history for this message
Florian Boucault (fboucault) wrote :

Emblems have been deprecated at a design level.

review: Needs Fixing
Revision history for this message
Florian Boucault (fboucault) wrote :

> Emblems have been deprecated at a design level.

But it does not hurt to have correct code :) (ignore the needs fixing)

Revision history for this message
Olivier Tilloy (osomon) wrote :

Sure, we can remove them in a subsequent merge request, that should be trivial (and removing dead code is always a pleasure).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/LauncherList.qml'
2--- launcher/LauncherList.qml 2011-06-07 16:34:46 +0000
3+++ launcher/LauncherList.qml 2011-06-13 08:51:14 +0000
4@@ -89,13 +89,12 @@
5 launching: item.launching
6 pips: Math.min(item.windowCount, 3)
7
8- property bool noOverlays: item.counter == undefined
9- counter: (noOverlays) ? 0 : item.counter
10- counterVisible: (noOverlays) ? false : item.counterVisible
11- progress: (noOverlays) ? 0.0 : item.progress
12- progressBarVisible: (noOverlays) ? false : item.progressBarVisible
13- emblem: (noOverlays && item.emblem) ? "image://icons/" + item.emblem : ""
14- emblemVisible: (noOverlays) ? false : item.emblemVisible
15+ counter: item.counter
16+ counterVisible: item.counterVisible
17+ progress: item.progress
18+ progressBarVisible: item.progressBarVisible
19+ emblem: item.emblem ? "image://icons/" + item.emblem : ""
20+ emblemVisible: item.emblemVisible
21
22 shortcutVisible: launcherView.superKeyHeld &&
23 ((item.toString().indexOf("LauncherApplication") == 0 && index <= 9) ||
24
25=== modified file 'libunity-2d-private/Unity2d/launcherapplication.h'
26--- libunity-2d-private/Unity2d/launcherapplication.h 2011-06-07 16:34:46 +0000
27+++ libunity-2d-private/Unity2d/launcherapplication.h 2011-06-13 08:51:14 +0000
28@@ -63,12 +63,6 @@
29 Q_PROPERTY(QString desktop_file READ desktop_file WRITE setDesktopFile NOTIFY desktopFileChanged)
30 Q_PROPERTY(QString executable READ executable NOTIFY executableChanged)
31 Q_PROPERTY(bool has_visible_window READ has_visible_window NOTIFY hasVisibleWindowChanged)
32- Q_PROPERTY(float progress READ progress NOTIFY progressChanged)
33- Q_PROPERTY(bool progressBarVisible READ progressBarVisible NOTIFY progressBarVisibleChanged)
34- Q_PROPERTY(int counter READ counter NOTIFY counterChanged)
35- Q_PROPERTY(QString emblem READ emblem NOTIFY emblemChanged)
36- Q_PROPERTY(bool counterVisible READ counterVisible NOTIFY counterVisibleChanged)
37- Q_PROPERTY(bool emblemVisible READ emblemVisible NOTIFY emblemVisibleChanged)
38
39 public:
40 LauncherApplication();
41@@ -88,12 +82,13 @@
42 QString executable() const;
43 virtual bool launching() const;
44 bool has_visible_window() const;
45- float progress() const;
46- int counter() const;
47- QString emblem() const;
48- bool counterVisible() const;
49- bool progressBarVisible() const;
50- bool emblemVisible() const;
51+
52+ virtual bool progressBarVisible() const;
53+ virtual float progress() const;
54+ virtual bool counterVisible() const;
55+ virtual int counter() const;
56+ virtual bool emblemVisible() const;
57+ virtual QString emblem() const;
58
59 /* setters */
60 void setDesktopFile(const QString& desktop_file);
61@@ -118,12 +113,6 @@
62 void desktopFileChanged(QString);
63 void executableChanged(QString);
64 void hasVisibleWindowChanged(bool);
65- void progressBarVisibleChanged(bool);
66- void counterVisibleChanged(bool);
67- void emblemVisibleChanged(bool);
68- void progressChanged(float);
69- void counterChanged(int);
70- void emblemChanged(QString);
71
72 void closed();
73
74
75=== modified file 'libunity-2d-private/Unity2d/launcheritem.cpp'
76--- libunity-2d-private/Unity2d/launcheritem.cpp 2011-06-07 16:34:46 +0000
77+++ libunity-2d-private/Unity2d/launcheritem.cpp 2011-06-13 08:51:14 +0000
78@@ -85,3 +85,40 @@
79 {
80 /* Default to doing nothing. */
81 }
82+
83+bool
84+LauncherItem::progressBarVisible() const
85+{
86+ return false;
87+}
88+
89+float
90+LauncherItem::progress() const
91+{
92+ return 0.0;
93+}
94+
95+bool
96+LauncherItem::counterVisible() const
97+{
98+ return false;
99+}
100+
101+int
102+LauncherItem::counter() const
103+{
104+ return 0;
105+}
106+
107+bool
108+LauncherItem::emblemVisible() const
109+{
110+ return false;
111+}
112+
113+QString
114+LauncherItem::emblem() const
115+{
116+ return QString();
117+}
118+
119
120=== modified file 'libunity-2d-private/Unity2d/launcheritem.h'
121--- libunity-2d-private/Unity2d/launcheritem.h 2011-06-07 16:34:46 +0000
122+++ libunity-2d-private/Unity2d/launcheritem.h 2011-06-13 08:51:14 +0000
123@@ -43,6 +43,13 @@
124 /* Export the menu as a plain QObject so that it can be used from QML */
125 Q_PROPERTY(QObject* menu READ menu NOTIFY menuChanged)
126
127+ Q_PROPERTY(bool progressBarVisible READ progressBarVisible NOTIFY progressBarVisibleChanged)
128+ Q_PROPERTY(float progress READ progress NOTIFY progressChanged)
129+ Q_PROPERTY(bool counterVisible READ counterVisible NOTIFY counterVisibleChanged)
130+ Q_PROPERTY(int counter READ counter NOTIFY counterChanged)
131+ Q_PROPERTY(bool emblemVisible READ emblemVisible NOTIFY emblemVisibleChanged)
132+ Q_PROPERTY(QString emblem READ emblem NOTIFY emblemChanged)
133+
134 public:
135 LauncherItem(QObject* parent = 0);
136 ~LauncherItem();
137@@ -58,6 +65,13 @@
138 Qt::Key shortcutKey() const;
139 QObject* menu() const;
140
141+ virtual bool progressBarVisible() const;
142+ virtual float progress() const;
143+ virtual bool counterVisible() const;
144+ virtual int counter() const;
145+ virtual bool emblemVisible() const;
146+ virtual QString emblem() const;
147+
148 /* setters */
149 void setShortcutKey(Qt::Key);
150
151@@ -80,6 +94,13 @@
152 void shortcutKeyChanged(Qt::Key);
153 void menuChanged(QObject*);
154
155+ void progressBarVisibleChanged(bool);
156+ void progressChanged(float);
157+ void counterVisibleChanged(bool);
158+ void counterChanged(int);
159+ void emblemVisibleChanged(bool);
160+ void emblemChanged(QString);
161+
162 public Q_SLOTS:
163 /* Default implementation of drag’n’drop handling, should be overridden in
164 subclasses to implement custom behaviours. */

Subscribers

People subscribed via source and target branches