Merge lp:~3v1n0/unity/icon-classs-enum+quit-fix into lp:unity
- icon-classs-enum+quit-fix
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2546 |
Proposed branch: | lp:~3v1n0/unity/icon-classs-enum+quit-fix |
Merge into: | lp:unity |
Diff against target: |
1613 lines (+308/-268) 23 files modified
launcher/AbstractLauncherIcon.h (+37/-37) launcher/BFBLauncherIcon.cpp (+4/-4) launcher/BamfLauncherIcon.cpp (+18/-18) launcher/BamfLauncherIcon.h (+3/-3) launcher/DesktopLauncherIcon.cpp (+3/-3) launcher/DeviceLauncherIcon.cpp (+8/-8) launcher/HudLauncherIcon.cpp (+8/-8) launcher/Launcher.cpp (+109/-100) launcher/LauncherController.cpp (+15/-15) launcher/LauncherIcon.cpp (+38/-38) launcher/LauncherIcon.h (+2/-2) launcher/LauncherModel.cpp (+4/-4) launcher/MockLauncherIcon.h (+5/-5) launcher/SoftwareCenterLauncherIcon.cpp (+6/-6) launcher/SpacerLauncherIcon.cpp (+3/-3) launcher/SwitcherController.cpp (+3/-3) launcher/SwitcherModel.cpp (+1/-1) launcher/TrashLauncherIcon.cpp (+4/-4) plugins/unityshell/src/unity-launcher-icon-accessible.cpp (+1/-1) plugins/unityshell/src/unityshell.cpp (+1/-1) tests/test_favorite_store_gsettings.cpp (+0/-1) tests/test_launcher.cpp (+3/-3) tests/test_launcher_controller.cpp (+32/-0) |
To merge this branch: | bzr merge lp:~3v1n0/unity/icon-classs-enum+quit-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Pending | ||
jenkins | continuous-integration | Pending | |
Andrea Azzarone | Pending | ||
Review via email: mp+119101@code.launchpad.net |
This proposal supersedes a proposal from 2012-08-03.
Commit message
AbstractLaunche
Plus don't close an application when its desktop is removed from favorite store, just unstick it.
Description of the change
Big diff, little change: just switched from the old-style C enums of AbstractLaunche
Also, fixed bug #1032157 (see rev 2533 to just see what it changed) that caused an application to be closed, when removed from the gsettings store.
Tests for the enum's change are covered by old code, added new unit test for application icon removal.
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal | # |
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2536
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal | # |
+ virtual void Stick(bool save = true);
Please don't use virtual function with default parameters. I know that ATM we just need it for testing but this is not a good excuse :)
835 +/*
836 if (progress >= 1.0f)
837 _model-
Why did you comment this code? Please add a comment.
1069 + for (unsigned i = 0; i < unsigned(
Why not a C++ cast here?
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal | # |
> + virtual void Stick(bool save = true);
>
> Please don't use virtual function with default parameters. I know that ATM we
> just need it for testing but this is not a good excuse :)
It was already a virtual function... Should I change it?
> 835 +/*
> 836 if (progress >= 1.0f)
> 837 _model-
>
> Why did you comment this code? Please add a comment.
For testing purposes, and I forgot to put it back, I already noticed it btw.
> 1069 + for (unsigned i = 0; i < unsigned(
>
> Why not a C++ cast here?
Naaa... I used them, but for this purpose they're quite too long :P
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal | # |
> > + virtual void Stick(bool save = true);
> >
> > Please don't use virtual function with default parameters. I know that ATM
> we
> > just need it for testing but this is not a good excuse :)
>
> It was already a virtual function... Should I change it?
If you want. Not blocking.
>
> > 835 +/*
> > 836 if (progress >= 1.0f)
> > 837 _model-
> >
> > Why did you comment this code? Please add a comment.
>
> For testing purposes, and I forgot to put it back, I already noticed it btw.
>
Cool.
> > 1069 + for (unsigned i = 0; i < unsigned(
> >
> > Why not a C++ cast here?
>
> Naaa... I used them, but for this purpose they're quite too long :P
:(
Unity Merger (unity-merger) wrote : Posted in a previous version of this proposal | # |
No proposals found for merge of lp:~3v1n0/unity/favorite-store-gsettings-clean into lp:unity.
Unity Merger (unity-merger) wrote : Posted in a previous version of this proposal | # |
No proposals found for merge of lp:~3v1n0/unity/favorite-store-gsettings-clean into lp:unity.
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal | # |
Approving myself, as it was alredy approved on superseeded proposal.
Unity Merger (unity-merger) wrote : Posted in a previous version of this proposal | # |
No proposals found for merge of lp:~3v1n0/unity/favorite-store-gsettings-clean into lp:unity.
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Self-approving, since it was already approved on superseded proposal by andyrock
Preview Diff
1 | === modified file 'launcher/AbstractLauncherIcon.h' |
2 | --- launcher/AbstractLauncherIcon.h 2012-06-14 09:48:15 +0000 |
3 | +++ launcher/AbstractLauncherIcon.h 2012-08-10 10:01:20 +0000 |
4 | @@ -80,41 +80,41 @@ |
5 | typedef nux::ObjectPtr<AbstractLauncherIcon> Ptr; |
6 | typedef std::vector<nux::Vector4> TransformVector; |
7 | |
8 | - typedef enum |
9 | - { |
10 | - TYPE_NONE, |
11 | - TYPE_BEGIN, |
12 | - TYPE_HOME, |
13 | - TYPE_HUD, |
14 | - TYPE_FAVORITE, |
15 | - TYPE_APPLICATION, |
16 | - TYPE_EXPO, |
17 | - TYPE_DESKTOP, |
18 | - TYPE_PLACE, |
19 | - TYPE_DEVICE, |
20 | - TYPE_TRASH, |
21 | - TYPE_END, |
22 | - } IconType; |
23 | - |
24 | - typedef enum |
25 | - { |
26 | - QUIRK_VISIBLE, |
27 | - QUIRK_ACTIVE, |
28 | - QUIRK_RUNNING, |
29 | - QUIRK_URGENT, |
30 | - QUIRK_PRESENTED, |
31 | - QUIRK_STARTING, |
32 | - QUIRK_SHIMMER, |
33 | - QUIRK_CENTER_SAVED, |
34 | - QUIRK_PROGRESS, |
35 | - QUIRK_DROP_PRELIGHT, |
36 | - QUIRK_DROP_DIM, |
37 | - QUIRK_DESAT, |
38 | - QUIRK_PULSE_ONCE, |
39 | - QUIRK_LAST_ACTION, |
40 | - |
41 | - QUIRK_LAST, |
42 | - } Quirk; |
43 | + enum class IconType |
44 | + { |
45 | + NONE, |
46 | + BEGIN, |
47 | + HOME, |
48 | + HUD, |
49 | + FAVORITE, |
50 | + APPLICATION, |
51 | + EXPO, |
52 | + DESKTOP, |
53 | + PLACE, |
54 | + DEVICE, |
55 | + TRASH, |
56 | + END |
57 | + }; |
58 | + |
59 | + enum class Quirk |
60 | + { |
61 | + VISIBLE = 0, |
62 | + ACTIVE, |
63 | + RUNNING, |
64 | + URGENT, |
65 | + PRESENTED, |
66 | + STARTING, |
67 | + SHIMMER, |
68 | + CENTER_SAVED, |
69 | + PROGRESS, |
70 | + DROP_PRELIGHT, |
71 | + DROP_DIM, |
72 | + DESAT, |
73 | + PULSE_ONCE, |
74 | + LAST_ACTION, |
75 | + |
76 | + LAST |
77 | + }; |
78 | |
79 | virtual ~AbstractLauncherIcon() {} |
80 | |
81 | @@ -205,9 +205,9 @@ |
82 | virtual void SetVisibleOnMonitor(int monitor, bool visible) = 0; |
83 | |
84 | virtual void AboutToRemove() = 0; |
85 | - |
86 | + |
87 | virtual void Stick(bool save = true) = 0; |
88 | - |
89 | + |
90 | virtual void UnStick() = 0; |
91 | |
92 | sigc::signal<void, int, int, unsigned long> mouse_down; |
93 | |
94 | === modified file 'launcher/BFBLauncherIcon.cpp' |
95 | --- launcher/BFBLauncherIcon.cpp 2012-05-28 16:16:06 +0000 |
96 | +++ launcher/BFBLauncherIcon.cpp 2012-08-10 10:01:20 +0000 |
97 | @@ -39,9 +39,9 @@ |
98 | { |
99 | tooltip_text = _("Dash Home"); |
100 | icon_name = PKGDATADIR"/launcher_bfb.png"; |
101 | - SetQuirk(QUIRK_VISIBLE, true); |
102 | - SetQuirk(QUIRK_RUNNING, false); |
103 | - SetIconType(TYPE_HOME); |
104 | + SetQuirk(Quirk::VISIBLE, true); |
105 | + SetQuirk(Quirk::RUNNING, false); |
106 | + SetIconType(IconType::HOME); |
107 | |
108 | background_color_ = nux::color::White; |
109 | |
110 | @@ -66,7 +66,7 @@ |
111 | if (overlay_identity.Str() == "dash" && IsVisibleOnMonitor(overlay_monitor)) |
112 | { |
113 | tooltip_enabled = !visible; |
114 | - SetQuirk(QUIRK_ACTIVE, visible); |
115 | + SetQuirk(Quirk::ACTIVE, visible); |
116 | EmitNeedsRedraw(); |
117 | } |
118 | // If the hud is open, we hide the BFB if we have a locked launcher |
119 | |
120 | === modified file 'launcher/BamfLauncherIcon.cpp' |
121 | --- launcher/BamfLauncherIcon.cpp 2012-07-10 22:18:50 +0000 |
122 | +++ launcher/BamfLauncherIcon.cpp 2012-08-10 10:01:20 +0000 |
123 | @@ -71,15 +71,15 @@ |
124 | |
125 | tooltip_text = BamfName(); |
126 | icon_name = (icon ? icon.Str() : DEFAULT_ICON); |
127 | - SetIconType(TYPE_APPLICATION); |
128 | + SetIconType(IconType::APPLICATION); |
129 | |
130 | if (IsSticky()) |
131 | - SetQuirk(QUIRK_VISIBLE, true); |
132 | + SetQuirk(Quirk::VISIBLE, true); |
133 | else |
134 | - SetQuirk(QUIRK_VISIBLE, bamf_view_user_visible(bamf_view)); |
135 | + SetQuirk(Quirk::VISIBLE, bamf_view_user_visible(bamf_view)); |
136 | |
137 | - SetQuirk(QUIRK_ACTIVE, bamf_view_is_active(bamf_view)); |
138 | - SetQuirk(QUIRK_RUNNING, bamf_view_is_running(bamf_view)); |
139 | + SetQuirk(Quirk::ACTIVE, bamf_view_is_active(bamf_view)); |
140 | + SetQuirk(Quirk::RUNNING, bamf_view_is_running(bamf_view)); |
141 | |
142 | glib::SignalBase* sig; |
143 | |
144 | @@ -97,19 +97,19 @@ |
145 | |
146 | sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "urgent-changed", |
147 | [&] (BamfView*, gboolean urgent) { |
148 | - SetQuirk(QUIRK_URGENT, urgent); |
149 | + SetQuirk(Quirk::URGENT, urgent); |
150 | }); |
151 | _gsignals.Add(sig); |
152 | |
153 | sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "active-changed", |
154 | [&] (BamfView*, gboolean active) { |
155 | - SetQuirk(QUIRK_ACTIVE, active); |
156 | + SetQuirk(Quirk::ACTIVE, active); |
157 | }); |
158 | _gsignals.Add(sig); |
159 | |
160 | sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "running-changed", |
161 | [&] (BamfView*, gboolean running) { |
162 | - SetQuirk(QUIRK_RUNNING, running); |
163 | + SetQuirk(Quirk::RUNNING, running); |
164 | |
165 | if (running) |
166 | { |
167 | @@ -123,7 +123,7 @@ |
168 | sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "user-visible-changed", |
169 | [&] (BamfView*, gboolean visible) { |
170 | if (!IsSticky()) |
171 | - SetQuirk(QUIRK_VISIBLE, visible); |
172 | + SetQuirk(Quirk::VISIBLE, visible); |
173 | }); |
174 | _gsignals.Add(sig); |
175 | |
176 | @@ -131,7 +131,7 @@ |
177 | [&] (BamfView*) { |
178 | if (!IsSticky()) |
179 | { |
180 | - SetQuirk(QUIRK_VISIBLE, false); |
181 | + SetQuirk(Quirk::VISIBLE, false); |
182 | |
183 | /* Use a timeout to remove the icon, this avoids |
184 | * that we remove an application that is going |
185 | @@ -196,22 +196,22 @@ |
186 | |
187 | bool BamfLauncherIcon::IsVisible() const |
188 | { |
189 | - return GetQuirk(QUIRK_VISIBLE); |
190 | + return GetQuirk(Quirk::VISIBLE); |
191 | } |
192 | |
193 | bool BamfLauncherIcon::IsActive() const |
194 | { |
195 | - return GetQuirk(QUIRK_ACTIVE); |
196 | + return GetQuirk(Quirk::ACTIVE); |
197 | } |
198 | |
199 | bool BamfLauncherIcon::IsRunning() const |
200 | { |
201 | - return GetQuirk(QUIRK_RUNNING); |
202 | + return GetQuirk(Quirk::RUNNING); |
203 | } |
204 | |
205 | bool BamfLauncherIcon::IsUrgent() const |
206 | { |
207 | - return GetQuirk(QUIRK_URGENT); |
208 | + return GetQuirk(Quirk::URGENT); |
209 | } |
210 | |
211 | void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg) |
212 | @@ -303,7 +303,7 @@ |
213 | |
214 | if (!IsRunning() || (IsRunning() && !user_visible)) // #1 above |
215 | { |
216 | - if (GetQuirk(QUIRK_STARTING)) |
217 | + if (GetQuirk(Quirk::STARTING)) |
218 | return; |
219 | |
220 | if (scaleWasActive) |
221 | @@ -311,7 +311,7 @@ |
222 | wm->TerminateScale(); |
223 | } |
224 | |
225 | - SetQuirk(QUIRK_STARTING, true); |
226 | + SetQuirk(Quirk::STARTING, true); |
227 | OpenInstanceLauncherIcon(ActionArg()); |
228 | } |
229 | else // app is running |
230 | @@ -455,7 +455,7 @@ |
231 | return; |
232 | |
233 | Present(0.5f, 600); |
234 | - UpdateQuirkTimeDelayed(300, QUIRK_SHIMMER); |
235 | + UpdateQuirkTimeDelayed(300, Quirk::SHIMMER); |
236 | } |
237 | |
238 | void BamfLauncherIcon::OnWindowMoved(guint32 moved_win) |
239 | @@ -610,7 +610,7 @@ |
240 | if (error) |
241 | g_warning("%s\n", error.Message().c_str()); |
242 | |
243 | - UpdateQuirkTime(QUIRK_STARTING); |
244 | + UpdateQuirkTime(Quirk::STARTING); |
245 | } |
246 | |
247 | void BamfLauncherIcon::OpenInstanceLauncherIcon(ActionArg arg) |
248 | |
249 | === modified file 'launcher/BamfLauncherIcon.h' |
250 | --- launcher/BamfLauncherIcon.h 2012-07-04 07:02:00 +0000 |
251 | +++ launcher/BamfLauncherIcon.h 2012-08-10 10:01:20 +0000 |
252 | @@ -53,9 +53,9 @@ |
253 | bool IsRunning() const; |
254 | bool IsUrgent() const; |
255 | |
256 | - void Quit(); |
257 | - void Stick(bool save = true); |
258 | - void UnStick(); |
259 | + virtual void Quit(); |
260 | + virtual void Stick(bool save = true); |
261 | + virtual void UnStick(); |
262 | |
263 | virtual bool ShowInSwitcher(bool current); |
264 | virtual unsigned long long SwitcherPriority(); |
265 | |
266 | === modified file 'launcher/DesktopLauncherIcon.cpp' |
267 | --- launcher/DesktopLauncherIcon.cpp 2012-05-07 19:52:54 +0000 |
268 | +++ launcher/DesktopLauncherIcon.cpp 2012-08-10 10:01:20 +0000 |
269 | @@ -33,9 +33,9 @@ |
270 | { |
271 | tooltip_text = _("Show Desktop"); |
272 | icon_name = "desktop"; |
273 | - SetQuirk(QUIRK_VISIBLE, true); |
274 | - SetQuirk(QUIRK_RUNNING, false); |
275 | - SetIconType(TYPE_DESKTOP); |
276 | + SetQuirk(Quirk::VISIBLE, true); |
277 | + SetQuirk(Quirk::RUNNING, false); |
278 | + SetIconType(IconType::DESKTOP); |
279 | } |
280 | |
281 | DesktopLauncherIcon::~DesktopLauncherIcon() |
282 | |
283 | === modified file 'launcher/DeviceLauncherIcon.cpp' |
284 | --- launcher/DeviceLauncherIcon.cpp 2012-06-21 06:55:53 +0000 |
285 | +++ launcher/DeviceLauncherIcon.cpp 2012-08-10 10:01:20 +0000 |
286 | @@ -80,21 +80,21 @@ |
287 | switch (DevicesSettings::GetDefault().GetDevicesOption()) |
288 | { |
289 | case DevicesSettings::NEVER: |
290 | - SetQuirk(QUIRK_VISIBLE, false); |
291 | + SetQuirk(Quirk::VISIBLE, false); |
292 | break; |
293 | case DevicesSettings::ONLY_MOUNTED: |
294 | if (keep_in_launcher_) |
295 | { |
296 | - SetQuirk(QUIRK_VISIBLE, true); |
297 | + SetQuirk(Quirk::VISIBLE, true); |
298 | } |
299 | else |
300 | { |
301 | glib::Object<GMount> mount(g_volume_get_mount(volume_)); |
302 | - SetQuirk(QUIRK_VISIBLE, mount); |
303 | + SetQuirk(Quirk::VISIBLE, mount); |
304 | } |
305 | break; |
306 | case DevicesSettings::ALWAYS: |
307 | - SetQuirk(QUIRK_VISIBLE, true); |
308 | + SetQuirk(Quirk::VISIBLE, true); |
309 | break; |
310 | } |
311 | } |
312 | @@ -109,8 +109,8 @@ |
313 | tooltip_text = name_; |
314 | icon_name = icon_string.Str(); |
315 | |
316 | - SetIconType(TYPE_DEVICE); |
317 | - SetQuirk(QUIRK_RUNNING, false); |
318 | + SetIconType(IconType::DEVICE); |
319 | + SetQuirk(Quirk::RUNNING, false); |
320 | } |
321 | |
322 | bool |
323 | @@ -262,7 +262,7 @@ |
324 | void DeviceLauncherIcon::ActivateLauncherIcon(ActionArg arg) |
325 | { |
326 | SimpleLauncherIcon::ActivateLauncherIcon(arg); |
327 | - SetQuirk(QUIRK_STARTING, true); |
328 | + SetQuirk(Quirk::STARTING, true); |
329 | |
330 | glib::Object<GMount> mount(g_volume_get_mount(volume_)); |
331 | |
332 | @@ -351,7 +351,7 @@ |
333 | glib::Object<GMount> mount(g_volume_get_mount(self->volume_)); |
334 | |
335 | if (!mount) |
336 | - self->SetQuirk(QUIRK_VISIBLE, false); |
337 | + self->SetQuirk(Quirk::VISIBLE, false); |
338 | |
339 | // Remove from favorites |
340 | if (!uuid.Str().empty()) |
341 | |
342 | === modified file 'launcher/HudLauncherIcon.cpp' |
343 | --- launcher/HudLauncherIcon.cpp 2012-05-28 16:16:06 +0000 |
344 | +++ launcher/HudLauncherIcon.cpp 2012-08-10 10:01:20 +0000 |
345 | @@ -44,10 +44,10 @@ |
346 | { |
347 | tooltip_text = _("HUD"); |
348 | icon_name = PKGDATADIR"/launcher_bfb.png"; |
349 | - SetQuirk(QUIRK_VISIBLE, false); |
350 | - SetQuirk(QUIRK_RUNNING, false); |
351 | - SetQuirk(QUIRK_ACTIVE, true); |
352 | - SetIconType(TYPE_HUD); |
353 | + SetQuirk(Quirk::VISIBLE, false); |
354 | + SetQuirk(Quirk::RUNNING, false); |
355 | + SetQuirk(Quirk::ACTIVE, true); |
356 | + SetIconType(IconType::HUD); |
357 | |
358 | background_color_ = nux::color::White; |
359 | |
360 | @@ -82,7 +82,7 @@ |
361 | launcher_hide_mode_ = hide_mode; |
362 | |
363 | if (launcher_hide_mode_ == LAUNCHER_HIDE_AUTOHIDE) |
364 | - SetQuirk(QUIRK_VISIBLE, false); |
365 | + SetQuirk(Quirk::VISIBLE, false); |
366 | } |
367 | } |
368 | |
369 | @@ -99,8 +99,8 @@ |
370 | launcher_hide_mode_ == LAUNCHER_HIDE_NEVER) |
371 | { |
372 | SetMonitor(overlay_monitor); |
373 | - SetQuirk(QUIRK_VISIBLE, visible); |
374 | - SetQuirk(QUIRK_ACTIVE, visible); |
375 | + SetQuirk(Quirk::VISIBLE, visible); |
376 | + SetQuirk(Quirk::ACTIVE, visible); |
377 | tooltip_enabled = !visible; |
378 | EmitNeedsRedraw(); |
379 | } |
380 | @@ -118,7 +118,7 @@ |
381 | |
382 | void HudLauncherIcon::ActivateLauncherIcon(ActionArg arg) |
383 | { |
384 | - if (GetQuirk(QUIRK_VISIBLE)) |
385 | + if (GetQuirk(Quirk::VISIBLE)) |
386 | { |
387 | ubus_manager_.SendMessage(UBUS_HUD_CLOSE_REQUEST); |
388 | } |
389 | |
390 | === modified file 'launcher/Launcher.cpp' |
391 | --- launcher/Launcher.cpp 2012-08-03 13:43:50 +0000 |
392 | +++ launcher/Launcher.cpp 2012-08-10 10:01:20 +0000 |
393 | @@ -373,51 +373,51 @@ |
394 | |
395 | bool Launcher::IconNeedsAnimation(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
396 | { |
397 | - struct timespec time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE); |
398 | - if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION_SHORT) |
399 | - return true; |
400 | - |
401 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_RUNNING); |
402 | - if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION_SHORT) |
403 | - return true; |
404 | - |
405 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING); |
406 | + struct timespec time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::VISIBLE); |
407 | + if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION_SHORT) |
408 | + return true; |
409 | + |
410 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::RUNNING); |
411 | + if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION_SHORT) |
412 | + return true; |
413 | + |
414 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::STARTING); |
415 | if (unity::TimeUtil::TimeDelta(¤t, &time) < (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2)) |
416 | return true; |
417 | |
418 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_URGENT); |
419 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::URGENT); |
420 | if (unity::TimeUtil::TimeDelta(¤t, &time) < (ANIM_DURATION_LONG * URGENT_BLINKS * 2)) |
421 | return true; |
422 | |
423 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PULSE_ONCE); |
424 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::PULSE_ONCE); |
425 | if (unity::TimeUtil::TimeDelta(¤t, &time) < (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2)) |
426 | return true; |
427 | |
428 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PRESENTED); |
429 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::PRESENTED); |
430 | if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION) |
431 | return true; |
432 | |
433 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_SHIMMER); |
434 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::SHIMMER); |
435 | if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION_LONG) |
436 | return true; |
437 | |
438 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_CENTER_SAVED); |
439 | - if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION) |
440 | - return true; |
441 | - |
442 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PROGRESS); |
443 | - if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION) |
444 | - return true; |
445 | - |
446 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_DIM); |
447 | - if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION) |
448 | - return true; |
449 | - |
450 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DESAT); |
451 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::CENTER_SAVED); |
452 | + if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION) |
453 | + return true; |
454 | + |
455 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::PROGRESS); |
456 | + if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION) |
457 | + return true; |
458 | + |
459 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::DROP_DIM); |
460 | + if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION) |
461 | + return true; |
462 | + |
463 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::DESAT); |
464 | if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION_SHORT_SHORT) |
465 | return true; |
466 | |
467 | - time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_PRELIGHT); |
468 | + time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::DROP_PRELIGHT); |
469 | if (unity::TimeUtil::TimeDelta(¤t, &time) < ANIM_DURATION) |
470 | return true; |
471 | |
472 | @@ -496,20 +496,20 @@ |
473 | if (!icon->IsVisibleOnMonitor(monitor)) |
474 | return 0.0f; |
475 | |
476 | - if (icon->GetIconType() == AbstractLauncherIcon::TYPE_HUD) |
477 | + if (icon->GetIconType() == AbstractLauncherIcon::IconType::HUD) |
478 | { |
479 | - return (icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE)) ? 1.0f : 0.0f; |
480 | + return (icon->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE)) ? 1.0f : 0.0f; |
481 | } |
482 | |
483 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE)) |
484 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE)) |
485 | { |
486 | - struct timespec icon_visible_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE); |
487 | + struct timespec icon_visible_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::VISIBLE); |
488 | int enter_ms = unity::TimeUtil::TimeDelta(¤t, &icon_visible_time); |
489 | return CLAMP((float) enter_ms / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f); |
490 | } |
491 | else |
492 | { |
493 | - struct timespec icon_hide_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE); |
494 | + struct timespec icon_hide_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::VISIBLE); |
495 | int hide_ms = unity::TimeUtil::TimeDelta(¤t, &icon_hide_time); |
496 | return 1.0f - CLAMP((float) hide_ms / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f); |
497 | } |
498 | @@ -542,11 +542,11 @@ |
499 | |
500 | float Launcher::IconPresentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
501 | { |
502 | - struct timespec icon_present_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PRESENTED); |
503 | + struct timespec icon_present_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::PRESENTED); |
504 | int ms = unity::TimeUtil::TimeDelta(¤t, &icon_present_time); |
505 | float result = CLAMP((float) ms / (float) ANIM_DURATION, 0.0f, 1.0f); |
506 | |
507 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_PRESENTED)) |
508 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::PRESENTED)) |
509 | return result; |
510 | else |
511 | return 1.0f - result; |
512 | @@ -554,7 +554,7 @@ |
513 | |
514 | float Launcher::IconUrgentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
515 | { |
516 | - struct timespec urgent_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_URGENT); |
517 | + struct timespec urgent_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::URGENT); |
518 | int urgent_ms = unity::TimeUtil::TimeDelta(¤t, &urgent_time); |
519 | float result; |
520 | |
521 | @@ -563,7 +563,7 @@ |
522 | else |
523 | result = CLAMP((float) urgent_ms / (float)(ANIM_DURATION_LONG * URGENT_BLINKS * 2), 0.0f, 1.0f); |
524 | |
525 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT)) |
526 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT)) |
527 | return result; |
528 | else |
529 | return 1.0f - result; |
530 | @@ -571,11 +571,11 @@ |
531 | |
532 | float Launcher::IconDropDimValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
533 | { |
534 | - struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_DIM); |
535 | + struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::DROP_DIM); |
536 | int dim_ms = unity::TimeUtil::TimeDelta(¤t, &dim_time); |
537 | float result = CLAMP((float) dim_ms / (float) ANIM_DURATION, 0.0f, 1.0f); |
538 | |
539 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_DROP_DIM)) |
540 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::DROP_DIM)) |
541 | return 1.0f - result; |
542 | else |
543 | return result; |
544 | @@ -583,11 +583,11 @@ |
545 | |
546 | float Launcher::IconDesatValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
547 | { |
548 | - struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DESAT); |
549 | + struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::DESAT); |
550 | int ms = unity::TimeUtil::TimeDelta(¤t, &dim_time); |
551 | float result = CLAMP((float) ms / (float) ANIM_DURATION_SHORT_SHORT, 0.0f, 1.0f); |
552 | |
553 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_DESAT)) |
554 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::DESAT)) |
555 | return 1.0f - result; |
556 | else |
557 | return result; |
558 | @@ -595,21 +595,21 @@ |
559 | |
560 | float Launcher::IconShimmerProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
561 | { |
562 | - struct timespec shimmer_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_SHIMMER); |
563 | + struct timespec shimmer_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::SHIMMER); |
564 | int shimmer_ms = unity::TimeUtil::TimeDelta(¤t, &shimmer_time); |
565 | return CLAMP((float) shimmer_ms / (float) ANIM_DURATION_LONG, 0.0f, 1.0f); |
566 | } |
567 | |
568 | float Launcher::IconCenterTransitionProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
569 | { |
570 | - struct timespec save_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_CENTER_SAVED); |
571 | + struct timespec save_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::CENTER_SAVED); |
572 | int save_ms = unity::TimeUtil::TimeDelta(¤t, &save_time); |
573 | return CLAMP((float) save_ms / (float) ANIM_DURATION, 0.0f, 1.0f); |
574 | } |
575 | |
576 | float Launcher::IconUrgentPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
577 | { |
578 | - if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT)) |
579 | + if (!icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT)) |
580 | return 1.0f; // we are full on in a normal condition |
581 | |
582 | double urgent_progress = (double) IconUrgentProgress(icon, current); |
583 | @@ -618,19 +618,19 @@ |
584 | |
585 | float Launcher::IconPulseOnceValue(AbstractLauncherIcon::Ptr icon, struct timespec const ¤t) const |
586 | { |
587 | - struct timespec pulse_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PULSE_ONCE); |
588 | + struct timespec pulse_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::PULSE_ONCE); |
589 | int pulse_ms = unity::TimeUtil::TimeDelta(¤t, &pulse_time); |
590 | double pulse_progress = (double) CLAMP((float) pulse_ms / (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2), 0.0f, 1.0f); |
591 | |
592 | if (pulse_progress == 1.0f) |
593 | - icon->SetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE, false); |
594 | + icon->SetQuirk(AbstractLauncherIcon::Quirk::PULSE_ONCE, false); |
595 | |
596 | return 0.5f + (float) (std::cos(M_PI * 2.0 * pulse_progress)) * 0.5f; |
597 | } |
598 | |
599 | float Launcher::IconUrgentWiggleValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
600 | { |
601 | - if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT)) |
602 | + if (!icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT)) |
603 | return 0.0f; // we are full on in a normal condition |
604 | |
605 | double urgent_progress = (double) IconUrgentProgress(icon, current); |
606 | @@ -639,7 +639,7 @@ |
607 | |
608 | float Launcher::IconStartingBlinkValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
609 | { |
610 | - struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING); |
611 | + struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::STARTING); |
612 | int starting_ms = unity::TimeUtil::TimeDelta(¤t, &starting_time); |
613 | double starting_progress = (double) CLAMP((float) starting_ms / (float)(ANIM_DURATION_LONG * STARTING_BLINK_LAMBDA), 0.0f, 1.0f); |
614 | double val = IsBackLightModeToggles() ? 3.0f : 4.0f; |
615 | @@ -648,14 +648,14 @@ |
616 | |
617 | float Launcher::IconStartingPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
618 | { |
619 | - struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING); |
620 | + struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::STARTING); |
621 | int starting_ms = unity::TimeUtil::TimeDelta(¤t, &starting_time); |
622 | double starting_progress = (double) CLAMP((float) starting_ms / (float)(ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2), 0.0f, 1.0f); |
623 | |
624 | - if (starting_progress == 1.0f && !icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING)) |
625 | + if (starting_progress == 1.0f && !icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING)) |
626 | { |
627 | - icon->SetQuirk(AbstractLauncherIcon::QUIRK_STARTING, false); |
628 | - icon->ResetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING); |
629 | + icon->SetQuirk(AbstractLauncherIcon::Quirk::STARTING, false); |
630 | + icon->ResetQuirkTime(AbstractLauncherIcon::Quirk::STARTING); |
631 | } |
632 | |
633 | return 0.5f + (float)(std::cos(M_PI * (float)(MAX_STARTING_BLINKS * 2) * starting_progress)) * 0.5f; |
634 | @@ -665,16 +665,16 @@ |
635 | { |
636 | float result = 0.0f; |
637 | |
638 | - struct timespec running_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_RUNNING); |
639 | + struct timespec running_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::RUNNING); |
640 | int running_ms = unity::TimeUtil::TimeDelta(¤t, &running_time); |
641 | float running_progress = CLAMP((float) running_ms / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f); |
642 | |
643 | - if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING)) |
644 | + if (!icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING)) |
645 | running_progress = 1.0f - running_progress; |
646 | |
647 | // After we finish a fade in from running, we can reset the quirk |
648 | - if (running_progress == 1.0f && icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING)) |
649 | - icon->SetQuirk(AbstractLauncherIcon::QUIRK_STARTING, false); |
650 | + if (running_progress == 1.0f && icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING)) |
651 | + icon->SetQuirk(AbstractLauncherIcon::Quirk::STARTING, false); |
652 | |
653 | float backlight_strength; |
654 | if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON) |
655 | @@ -698,8 +698,8 @@ |
656 | result = backlight_strength; // The blink concept is a failure in this case (it just doesn't work right) |
657 | break; |
658 | case LAUNCH_ANIMATION_PULSE: |
659 | - if (running_progress == 1.0f && icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING)) |
660 | - icon->ResetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING); |
661 | + if (running_progress == 1.0f && icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING)) |
662 | + icon->ResetQuirkTime(AbstractLauncherIcon::Quirk::STARTING); |
663 | |
664 | result = backlight_strength; |
665 | if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON) |
666 | @@ -711,7 +711,7 @@ |
667 | break; |
668 | } |
669 | |
670 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE)) |
671 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::PULSE_ONCE)) |
672 | { |
673 | if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON) |
674 | result *= CLAMP(running_progress + IconPulseOnceValue(icon, current), 0.0f, 1.0f); |
675 | @@ -722,7 +722,7 @@ |
676 | } |
677 | |
678 | // urgent serves to bring the total down only |
679 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT) && options()->urgent_animation() == URGENT_ANIMATION_PULSE) |
680 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT) && options()->urgent_animation() == URGENT_ANIMATION_PULSE) |
681 | result *= 0.2f + 0.8f * IconUrgentPulseValue(icon, current); |
682 | |
683 | return result; |
684 | @@ -730,11 +730,11 @@ |
685 | |
686 | float Launcher::IconProgressBias(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const |
687 | { |
688 | - struct timespec icon_progress_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PROGRESS); |
689 | + struct timespec icon_progress_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::PROGRESS); |
690 | int ms = unity::TimeUtil::TimeDelta(¤t, &icon_progress_time); |
691 | float result = CLAMP((float) ms / (float) ANIM_DURATION, 0.0f, 1.0f); |
692 | |
693 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_PROGRESS)) |
694 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::PROGRESS)) |
695 | return -1.0f + result; |
696 | else |
697 | return result; |
698 | @@ -758,8 +758,8 @@ |
699 | arg.alpha = 0.2f + 0.8f * desat_value; |
700 | arg.saturation = desat_value; |
701 | arg.colorify = nux::color::White; |
702 | - arg.running_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING); |
703 | - arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT); |
704 | + arg.running_arrow = icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING); |
705 | + arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT); |
706 | arg.draw_edge_only = IconDrawEdgeOnly(icon); |
707 | arg.active_colored = false; |
708 | arg.x_rotation = 0.0f; |
709 | @@ -771,14 +771,14 @@ |
710 | arg.progress_bias = IconProgressBias(icon, current); |
711 | arg.progress = CLAMP(icon->GetProgress(), 0.0f, 1.0f); |
712 | arg.draw_shortcut = _shortcuts_shown && !_hide_machine.GetQuirk(LauncherHideMachine::PLACES_VISIBLE); |
713 | - arg.system_item = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME || |
714 | - icon->GetIconType() == AbstractLauncherIcon::TYPE_HUD; |
715 | - arg.colorify_background = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME || |
716 | - icon->GetIconType() == AbstractLauncherIcon::TYPE_HUD || |
717 | - icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH || |
718 | - icon->GetIconType() == AbstractLauncherIcon::TYPE_DESKTOP || |
719 | - icon->GetIconType() == AbstractLauncherIcon::TYPE_DEVICE || |
720 | - icon->GetIconType() == AbstractLauncherIcon::TYPE_EXPO; |
721 | + arg.system_item = icon->GetIconType() == AbstractLauncherIcon::IconType::HOME || |
722 | + icon->GetIconType() == AbstractLauncherIcon::IconType::HUD; |
723 | + arg.colorify_background = icon->GetIconType() == AbstractLauncherIcon::IconType::HOME || |
724 | + icon->GetIconType() == AbstractLauncherIcon::IconType::HUD || |
725 | + icon->GetIconType() == AbstractLauncherIcon::IconType::TRASH || |
726 | + icon->GetIconType() == AbstractLauncherIcon::IconType::DESKTOP || |
727 | + icon->GetIconType() == AbstractLauncherIcon::IconType::DEVICE || |
728 | + icon->GetIconType() == AbstractLauncherIcon::IconType::EXPO; |
729 | |
730 | // trying to protect against flickering when icon is dragged from dash LP: #863230 |
731 | if (arg.alpha < 0.2) |
732 | @@ -787,13 +787,13 @@ |
733 | arg.saturation = 0.0; |
734 | } |
735 | |
736 | - arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE); |
737 | + arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::Quirk::ACTIVE); |
738 | |
739 | /* BFB or HUD icons don't need the active arrow if the overaly is opened |
740 | * in another monitor */ |
741 | if (arg.active_arrow && !IsOverlayOpen() && |
742 | - (icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME || |
743 | - icon->GetIconType() == AbstractLauncherIcon::TYPE_HUD)) |
744 | + (icon->GetIconType() == AbstractLauncherIcon::IconType::HOME || |
745 | + icon->GetIconType() == AbstractLauncherIcon::IconType::HUD)) |
746 | { |
747 | arg.active_arrow = false; |
748 | } |
749 | @@ -810,9 +810,9 @@ |
750 | arg.shortcut_label = 0; |
751 | |
752 | // we dont need to show strays |
753 | - if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING)) |
754 | + if (!icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING)) |
755 | { |
756 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT)) |
757 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT)) |
758 | { |
759 | arg.running_arrow = true; |
760 | arg.window_indicators = 1; |
761 | @@ -833,13 +833,13 @@ |
762 | |
763 | float urgent_progress = IconUrgentProgress(icon, current); |
764 | |
765 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT)) |
766 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT)) |
767 | urgent_progress = CLAMP(urgent_progress * 3.0f, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle |
768 | else |
769 | urgent_progress = CLAMP(urgent_progress * 3.0f - 2.0f, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle |
770 | arg.glow_intensity = urgent_progress; |
771 | |
772 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT) && options()->urgent_animation() == URGENT_ANIMATION_WIGGLE) |
773 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT) && options()->urgent_animation() == URGENT_ANIMATION_WIGGLE) |
774 | { |
775 | arg.z_rotation = IconUrgentWiggleValue(icon, current); |
776 | } |
777 | @@ -1181,10 +1181,10 @@ |
778 | { |
779 | for (auto icon : *_model) |
780 | { |
781 | - if (icon->GetIconType () != AbstractLauncherIcon::TYPE_HOME && |
782 | - icon->GetIconType () != AbstractLauncherIcon::TYPE_HUD) |
783 | + if (icon->GetIconType () != AbstractLauncherIcon::IconType::HOME && |
784 | + icon->GetIconType () != AbstractLauncherIcon::IconType::HUD) |
785 | { |
786 | - icon->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true); |
787 | + icon->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, true); |
788 | } |
789 | |
790 | icon->HideTooltip(); |
791 | @@ -1195,7 +1195,7 @@ |
792 | { |
793 | for (auto icon : *_model) |
794 | { |
795 | - icon->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, false); |
796 | + icon->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, false); |
797 | } |
798 | } |
799 | |
800 | @@ -1712,7 +1712,7 @@ |
801 | int natural_y = 0; |
802 | for (auto icon : *_model) |
803 | { |
804 | - if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) || !icon->IsVisibleOnMonitor(monitor)) |
805 | + if (!icon->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE) || !icon->IsVisibleOnMonitor(monitor)) |
806 | continue; |
807 | |
808 | if (icon == selection) |
809 | @@ -2015,7 +2015,7 @@ |
810 | |
811 | // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying |
812 | // on an internal Launcher property then |
813 | - if (drag_icon && (_last_button_press == 1) && _model->IconHasSister(drag_icon)) |
814 | + if (drag_icon && _last_button_press == 1 && _model->IconHasSister(drag_icon)) |
815 | { |
816 | SetActionState(ACTION_DRAG_ICON); |
817 | StartIconDrag(drag_icon); |
818 | @@ -2065,9 +2065,9 @@ |
819 | { |
820 | AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y); |
821 | |
822 | - if (hovered_icon && hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH) |
823 | + if (hovered_icon && hovered_icon->GetIconType() == AbstractLauncherIcon::IconType::TRASH) |
824 | { |
825 | - hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE, true); |
826 | + hovered_icon->SetQuirk(AbstractLauncherIcon::Quirk::PULSE_ONCE, true); |
827 | |
828 | launcher_removerequest.emit(_drag_icon); |
829 | |
830 | @@ -2126,7 +2126,7 @@ |
831 | LauncherModel::iterator prevIt = _model->end(); |
832 | for (it = _model->begin(); it != _model->end(); ++it) |
833 | { |
834 | - if (!(*it)->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) || !(*it)->IsVisibleOnMonitor(monitor)) |
835 | + if (!(*it)->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE) || !(*it)->IsVisibleOnMonitor(monitor)) |
836 | continue; |
837 | |
838 | if ((*it) == hovered_icon) { |
839 | @@ -2144,6 +2144,15 @@ |
840 | } |
841 | } |
842 | } |
843 | + |
844 | + if (progress >= 1.0f) |
845 | + { |
846 | + _model->ReorderSmart(_drag_icon, hovered_icon, true); |
847 | + } |
848 | + else if (progress == 0.0f) |
849 | + { |
850 | + _model->ReorderBefore(_drag_icon, hovered_icon, false); |
851 | + } |
852 | } |
853 | } |
854 | } |
855 | @@ -2470,7 +2479,7 @@ |
856 | |
857 | for (it = _model->begin(); it != _model->end(); ++it) |
858 | { |
859 | - if (!(*it)->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) || !(*it)->IsVisibleOnMonitor(monitor)) |
860 | + if (!(*it)->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE) || !(*it)->IsVisibleOnMonitor(monitor)) |
861 | continue; |
862 | |
863 | nux::Point2 screen_coord [4]; |
864 | @@ -2587,13 +2596,13 @@ |
865 | { |
866 | if (it->ShouldHighlightOnDrag(_dnd_data)) |
867 | { |
868 | - it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, false); |
869 | - it->SetQuirk(AbstractLauncherIcon::QUIRK_PRESENTED, true); |
870 | + it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, false); |
871 | + it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, true); |
872 | } |
873 | else |
874 | { |
875 | - it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true); |
876 | - it->SetQuirk(AbstractLauncherIcon::QUIRK_PRESENTED, false); |
877 | + it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, true); |
878 | + it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, false); |
879 | } |
880 | } |
881 | } |
882 | @@ -2624,8 +2633,8 @@ |
883 | |
884 | for (auto it : *_model) |
885 | { |
886 | - it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, is_overlay_open); |
887 | - it->SetQuirk(AbstractLauncherIcon::QUIRK_PRESENTED, false); |
888 | + it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, is_overlay_open); |
889 | + it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, false); |
890 | } |
891 | |
892 | DndHoveredIconReset(); |
893 | @@ -2638,7 +2647,7 @@ |
894 | |
895 | if (_steal_drag && _dnd_hovered_icon) |
896 | { |
897 | - _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, false); |
898 | + _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, false); |
899 | _dnd_hovered_icon->remove.emit(_dnd_hovered_icon); |
900 | } |
901 | |
902 | @@ -2695,9 +2704,9 @@ |
903 | for (auto it : *_model) |
904 | { |
905 | if (it->ShouldHighlightOnDrag(_dnd_data)) |
906 | - it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, false); |
907 | + it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, false); |
908 | else |
909 | - it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true); |
910 | + it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, true); |
911 | } |
912 | } |
913 | } |
914 | @@ -2726,10 +2735,10 @@ |
915 | bool hovered_icon_is_appropriate = false; |
916 | if (hovered_icon) |
917 | { |
918 | - if (hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH) |
919 | + if (hovered_icon->GetIconType() == AbstractLauncherIcon::IconType::TRASH) |
920 | _steal_drag = false; |
921 | |
922 | - if (hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_APPLICATION || hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_EXPO) |
923 | + if (hovered_icon->GetIconType() == AbstractLauncherIcon::IconType::APPLICATION || hovered_icon->GetIconType() == AbstractLauncherIcon::IconType::EXPO) |
924 | hovered_icon_is_appropriate = true; |
925 | } |
926 | |
927 | @@ -2753,7 +2762,7 @@ |
928 | } |
929 | else |
930 | { |
931 | - _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, false); |
932 | + _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, false); |
933 | _dnd_hovered_icon->remove.emit(_dnd_hovered_icon); |
934 | _dnd_hovered_icon = nullptr; |
935 | } |
936 | |
937 | === modified file 'launcher/LauncherController.cpp' |
938 | --- launcher/LauncherController.cpp 2012-08-03 11:58:29 +0000 |
939 | +++ launcher/LauncherController.cpp 2012-08-10 10:01:20 +0000 |
940 | @@ -361,7 +361,7 @@ |
941 | |
942 | if (result) |
943 | { |
944 | - result->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, false); |
945 | + result->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, false); |
946 | result->Animate(CurrentLauncher(), icon_x, icon_y, icon_size); |
947 | RegisterIcon(result); |
948 | Save(); |
949 | @@ -370,7 +370,7 @@ |
950 | |
951 | void Controller::Impl::OnSCIconAnimationComplete(AbstractLauncherIcon::Ptr icon) |
952 | { |
953 | - icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true); |
954 | + icon->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, true); |
955 | launcher_->ForceReveal(false); |
956 | } |
957 | |
958 | @@ -410,7 +410,7 @@ |
959 | { |
960 | switch (icon->GetIconType()) |
961 | { |
962 | - case AbstractLauncherIcon::TYPE_APPLICATION: |
963 | + case AbstractLauncherIcon::IconType::APPLICATION: |
964 | { |
965 | BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon.GetPointer()); |
966 | |
967 | @@ -422,7 +422,7 @@ |
968 | |
969 | break; |
970 | } |
971 | - case AbstractLauncherIcon::TYPE_DEVICE: |
972 | + case AbstractLauncherIcon::IconType::DEVICE: |
973 | { |
974 | DeviceLauncherIcon* device_icon = dynamic_cast<DeviceLauncherIcon*>(icon.GetPointer()); |
975 | |
976 | @@ -469,7 +469,7 @@ |
977 | { |
978 | for (auto it : bamf_list) |
979 | { |
980 | - if (it->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) && pos == it->DesktopFile()) |
981 | + if (it->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE) && pos == it->DesktopFile()) |
982 | other = it; |
983 | } |
984 | } |
985 | @@ -502,13 +502,13 @@ |
986 | |
987 | void Controller::Impl::OnFavoriteStoreFavoriteRemoved(std::string const& entry) |
988 | { |
989 | - for (auto it : model_->GetSublist<BamfLauncherIcon> ()) |
990 | + for (auto icon : model_->GetSublist<BamfLauncherIcon> ()) |
991 | { |
992 | - if (it->DesktopFile() == entry) |
993 | + if (icon->DesktopFile() == entry) |
994 | { |
995 | - OnLauncherRemoveRequest(it); |
996 | + icon->UnStick(); |
997 | break; |
998 | - } |
999 | + } |
1000 | } |
1001 | } |
1002 | |
1003 | @@ -570,9 +570,9 @@ |
1004 | SimpleLauncherIcon* icon = static_cast<SimpleLauncherIcon*>(expo_icon_.GetPointer()); |
1005 | icon->tooltip_text = _("Workspace Switcher"); |
1006 | icon->icon_name = "workspace-switcher"; |
1007 | - icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true); |
1008 | - icon->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, false); |
1009 | - icon->SetIconType(AbstractLauncherIcon::TYPE_EXPO); |
1010 | + icon->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, true); |
1011 | + icon->SetQuirk(AbstractLauncherIcon::Quirk::RUNNING, false); |
1012 | + icon->SetIconType(AbstractLauncherIcon::IconType::EXPO); |
1013 | icon->SetShortcut('s'); |
1014 | |
1015 | on_expoicon_activate_connection_ = icon->activate.connect(sigc::mem_fun(this, &Impl::OnExpoActivated)); |
1016 | @@ -788,7 +788,7 @@ |
1017 | if (icon->ShowInSwitcher(current)) |
1018 | { |
1019 | //otherwise we get two desktop icons in the switcher. |
1020 | - if (icon->GetIconType() != AbstractLauncherIcon::IconType::TYPE_DESKTOP) |
1021 | + if (icon->GetIconType() != AbstractLauncherIcon::IconType::DESKTOP) |
1022 | { |
1023 | results.push_back(icon); |
1024 | } |
1025 | @@ -946,7 +946,7 @@ |
1026 | if ((XKeysymToKeycode(display, (*it)->GetShortcut()) == key_code) || |
1027 | ((gchar)((*it)->GetShortcut()) == key_string[0])) |
1028 | { |
1029 | - struct timespec last_action_time = (*it)->GetQuirkTime(AbstractLauncherIcon::QUIRK_LAST_ACTION); |
1030 | + struct timespec last_action_time = (*it)->GetQuirkTime(AbstractLauncherIcon::Quirk::LAST_ACTION); |
1031 | struct timespec current; |
1032 | TimeUtil::SetTimeStruct(¤t); |
1033 | if (TimeUtil::TimeDelta(¤t, &last_action_time) > local::ignore_repeat_shortcut_duration) |
1034 | @@ -1052,7 +1052,7 @@ |
1035 | { |
1036 | /* If the selected icon is running, we must not restore the input to the old */ |
1037 | AbstractLauncherIcon::Ptr const& icon = pimpl->model_->Selection(); |
1038 | - pimpl->keynav_restore_window_ = !icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING); |
1039 | + pimpl->keynav_restore_window_ = !icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING); |
1040 | } |
1041 | |
1042 | pimpl->keyboard_launcher_->ExitKeyNavMode(); |
1043 | |
1044 | === modified file 'launcher/LauncherIcon.cpp' |
1045 | --- launcher/LauncherIcon.cpp 2012-07-10 15:51:59 +0000 |
1046 | +++ launcher/LauncherIcon.cpp 2012-08-10 10:01:20 +0000 |
1047 | @@ -81,14 +81,14 @@ |
1048 | , _background_color(nux::color::White) |
1049 | , _glow_color(nux::color::White) |
1050 | , _shortcut(0) |
1051 | - , _icon_type(TYPE_NONE) |
1052 | + , _icon_type(IconType::NONE) |
1053 | , _center(max_num_monitors) |
1054 | , _has_visible_window(max_num_monitors) |
1055 | , _last_stable(max_num_monitors) |
1056 | , _parent_geo(max_num_monitors) |
1057 | , _saved_center(max_num_monitors) |
1058 | { |
1059 | - for (int i = 0; i < QUIRK_LAST; i++) |
1060 | + for (unsigned i = 0; i < unsigned(Quirk::LAST); i++) |
1061 | { |
1062 | _quirks[i] = false; |
1063 | _quirk_times[i].tv_sec = 0; |
1064 | @@ -119,7 +119,7 @@ |
1065 | |
1066 | LauncherIcon::~LauncherIcon() |
1067 | { |
1068 | - SetQuirk(QUIRK_URGENT, false); |
1069 | + SetQuirk(Quirk::URGENT, false); |
1070 | |
1071 | // clean up the whole signal-callback mess |
1072 | if (needs_redraw_connection.connected()) |
1073 | @@ -190,19 +190,19 @@ |
1074 | .add("center_x", _center[0].x) |
1075 | .add("center_y", _center[0].y) |
1076 | .add("center_z", _center[0].z) |
1077 | - .add("related_windows", static_cast<unsigned int>(Windows().size())) |
1078 | - .add("icon_type", _icon_type) |
1079 | + .add("related_windows", Windows().size()) |
1080 | + .add("icon_type", unsigned(_icon_type)) |
1081 | .add("tooltip_text", tooltip_text()) |
1082 | .add("sort_priority", _sort_priority) |
1083 | .add("shortcut", _shortcut) |
1084 | .add("monitors_visibility", g_variant_builder_end(&monitors_builder)) |
1085 | - .add("active", GetQuirk(QUIRK_ACTIVE)) |
1086 | - .add("visible", GetQuirk(QUIRK_VISIBLE)) |
1087 | - .add("urgent", GetQuirk(QUIRK_URGENT)) |
1088 | - .add("running", GetQuirk(QUIRK_RUNNING)) |
1089 | - .add("starting", GetQuirk(QUIRK_STARTING)) |
1090 | - .add("desaturated", GetQuirk(QUIRK_DESAT)) |
1091 | - .add("presented", GetQuirk(QUIRK_PRESENTED)); |
1092 | + .add("active", GetQuirk(Quirk::ACTIVE)) |
1093 | + .add("visible", GetQuirk(Quirk::VISIBLE)) |
1094 | + .add("urgent", GetQuirk(Quirk::URGENT)) |
1095 | + .add("running", GetQuirk(Quirk::RUNNING)) |
1096 | + .add("starting", GetQuirk(Quirk::STARTING)) |
1097 | + .add("desaturated", GetQuirk(Quirk::DESAT)) |
1098 | + .add("presented", GetQuirk(Quirk::PRESENTED)); |
1099 | } |
1100 | |
1101 | void |
1102 | @@ -215,7 +215,7 @@ |
1103 | |
1104 | ActivateLauncherIcon(arg); |
1105 | |
1106 | - UpdateQuirkTime(QUIRK_LAST_ACTION); |
1107 | + UpdateQuirkTime(Quirk::LAST_ACTION); |
1108 | } |
1109 | |
1110 | void |
1111 | @@ -226,7 +226,7 @@ |
1112 | |
1113 | OpenInstanceLauncherIcon(arg); |
1114 | |
1115 | - UpdateQuirkTime(QUIRK_LAST_ACTION); |
1116 | + UpdateQuirkTime(Quirk::LAST_ACTION); |
1117 | } |
1118 | |
1119 | nux::Color LauncherIcon::BackgroundColor() const |
1120 | @@ -715,7 +715,7 @@ |
1121 | LauncherIcon::SaveCenter() |
1122 | { |
1123 | _saved_center = _center; |
1124 | - UpdateQuirkTime(QUIRK_CENTER_SAVED); |
1125 | + UpdateQuirkTime(Quirk::CENTER_SAVED); |
1126 | } |
1127 | |
1128 | void |
1129 | @@ -747,7 +747,7 @@ |
1130 | bool |
1131 | LauncherIcon::OnPresentTimeout() |
1132 | { |
1133 | - if (!GetQuirk(QUIRK_PRESENTED)) |
1134 | + if (!GetQuirk(Quirk::PRESENTED)) |
1135 | return false; |
1136 | |
1137 | Unpresent(); |
1138 | @@ -763,7 +763,7 @@ |
1139 | void |
1140 | LauncherIcon::Present(float present_urgency, int length) |
1141 | { |
1142 | - if (GetQuirk(QUIRK_PRESENTED)) |
1143 | + if (GetQuirk(Quirk::PRESENTED)) |
1144 | return; |
1145 | |
1146 | if (length >= 0) |
1147 | @@ -773,17 +773,17 @@ |
1148 | } |
1149 | |
1150 | _present_urgency = CLAMP(present_urgency, 0.0f, 1.0f); |
1151 | - SetQuirk(QUIRK_PRESENTED, true); |
1152 | + SetQuirk(Quirk::PRESENTED, true); |
1153 | } |
1154 | |
1155 | void |
1156 | LauncherIcon::Unpresent() |
1157 | { |
1158 | - if (!GetQuirk(QUIRK_PRESENTED)) |
1159 | + if (!GetQuirk(Quirk::PRESENTED)) |
1160 | return; |
1161 | |
1162 | _source_manager.Remove(PRESENT_TIMEOUT); |
1163 | - SetQuirk(QUIRK_PRESENTED, false); |
1164 | + SetQuirk(Quirk::PRESENTED, false); |
1165 | } |
1166 | |
1167 | void |
1168 | @@ -792,7 +792,7 @@ |
1169 | if (_quicklist && _quicklist->IsVisible()) |
1170 | _quicklist->Hide(); |
1171 | |
1172 | - SetQuirk(QUIRK_VISIBLE, false); |
1173 | + SetQuirk(Quirk::VISIBLE, false); |
1174 | EmitRemove(); |
1175 | } |
1176 | |
1177 | @@ -823,26 +823,26 @@ |
1178 | bool |
1179 | LauncherIcon::GetQuirk(LauncherIcon::Quirk quirk) const |
1180 | { |
1181 | - return _quirks[quirk]; |
1182 | + return _quirks[unsigned(quirk)]; |
1183 | } |
1184 | |
1185 | void |
1186 | LauncherIcon::SetQuirk(LauncherIcon::Quirk quirk, bool value) |
1187 | { |
1188 | - if (_quirks[quirk] == value) |
1189 | + if (_quirks[unsigned(quirk)] == value) |
1190 | return; |
1191 | |
1192 | - _quirks[quirk] = value; |
1193 | - if (quirk == QUIRK_VISIBLE) |
1194 | - TimeUtil::SetTimeStruct(&(_quirk_times[quirk]), &(_quirk_times[quirk]), Launcher::ANIM_DURATION_SHORT); |
1195 | + _quirks[unsigned(quirk)] = value; |
1196 | + if (quirk == Quirk::VISIBLE) |
1197 | + TimeUtil::SetTimeStruct(&(_quirk_times[unsigned(quirk)]), &(_quirk_times[unsigned(quirk)]), Launcher::ANIM_DURATION_SHORT); |
1198 | else |
1199 | - clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk])); |
1200 | + clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[unsigned(quirk)])); |
1201 | EmitNeedsRedraw(); |
1202 | |
1203 | // Present on urgent as a general policy |
1204 | - if (quirk == QUIRK_VISIBLE && value) |
1205 | + if (quirk == Quirk::VISIBLE && value) |
1206 | Present(0.5f, 1500); |
1207 | - if (quirk == QUIRK_URGENT) |
1208 | + if (quirk == Quirk::URGENT) |
1209 | { |
1210 | if (value) |
1211 | { |
1212 | @@ -853,7 +853,7 @@ |
1213 | ubus_server_send_message(ubus, UBUS_LAUNCHER_ICON_URGENT_CHANGED, g_variant_new_boolean(value)); |
1214 | } |
1215 | |
1216 | - if (quirk == QUIRK_VISIBLE) |
1217 | + if (quirk == Quirk::VISIBLE) |
1218 | { |
1219 | visibility_changed.emit(); |
1220 | } |
1221 | @@ -871,21 +871,21 @@ |
1222 | void |
1223 | LauncherIcon::UpdateQuirkTime(LauncherIcon::Quirk quirk) |
1224 | { |
1225 | - clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk])); |
1226 | + clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[unsigned(quirk)])); |
1227 | EmitNeedsRedraw(); |
1228 | } |
1229 | |
1230 | void |
1231 | LauncherIcon::ResetQuirkTime(LauncherIcon::Quirk quirk) |
1232 | { |
1233 | - _quirk_times[quirk].tv_sec = 0; |
1234 | - _quirk_times[quirk].tv_nsec = 0; |
1235 | + _quirk_times[unsigned(quirk)].tv_sec = 0; |
1236 | + _quirk_times[unsigned(quirk)].tv_nsec = 0; |
1237 | } |
1238 | |
1239 | struct timespec |
1240 | LauncherIcon::GetQuirkTime(LauncherIcon::Quirk quirk) |
1241 | { |
1242 | - return _quirk_times[quirk]; |
1243 | + return _quirk_times[unsigned(quirk)]; |
1244 | } |
1245 | |
1246 | void |
1247 | @@ -1072,10 +1072,10 @@ |
1248 | RemoveChild(remote.get()); |
1249 | |
1250 | DeleteEmblem(); |
1251 | - SetQuirk(QUIRK_PROGRESS, false); |
1252 | + SetQuirk(Quirk::PROGRESS, false); |
1253 | |
1254 | if (_remote_urgent) |
1255 | - SetQuirk(QUIRK_URGENT, false); |
1256 | + SetQuirk(Quirk::URGENT, false); |
1257 | |
1258 | _menuclient_dynamic_quicklist = nullptr; |
1259 | } |
1260 | @@ -1084,7 +1084,7 @@ |
1261 | LauncherIcon::OnRemoteUrgentChanged(LauncherEntryRemote* remote) |
1262 | { |
1263 | _remote_urgent = remote->Urgent(); |
1264 | - SetQuirk(QUIRK_URGENT, remote->Urgent()); |
1265 | + SetQuirk(Quirk::URGENT, remote->Urgent()); |
1266 | } |
1267 | |
1268 | void |
1269 | @@ -1151,7 +1151,7 @@ |
1270 | void |
1271 | LauncherIcon::OnRemoteProgressVisibleChanged(LauncherEntryRemote* remote) |
1272 | { |
1273 | - SetQuirk(QUIRK_PROGRESS, remote->ProgressVisible()); |
1274 | + SetQuirk(Quirk::PROGRESS, remote->ProgressVisible()); |
1275 | |
1276 | if (remote->ProgressVisible()) |
1277 | SetProgress(remote->Progress()); |
1278 | |
1279 | === modified file 'launcher/LauncherIcon.h' |
1280 | --- launcher/LauncherIcon.h 2012-06-18 02:57:23 +0000 |
1281 | +++ launcher/LauncherIcon.h 2012-08-10 10:01:20 +0000 |
1282 | @@ -336,8 +336,8 @@ |
1283 | |
1284 | BaseTexturePtr _emblem; |
1285 | |
1286 | - bool _quirks[QUIRK_LAST]; |
1287 | - struct timespec _quirk_times[QUIRK_LAST]; |
1288 | + bool _quirks[unsigned(Quirk::LAST)]; |
1289 | + struct timespec _quirk_times[unsigned(Quirk::LAST)]; |
1290 | |
1291 | std::list<LauncherEntryRemote::Ptr> _entry_list; |
1292 | |
1293 | |
1294 | === modified file 'launcher/LauncherModel.cpp' |
1295 | --- launcher/LauncherModel.cpp 2012-07-30 16:30:53 +0000 |
1296 | +++ launcher/LauncherModel.cpp 2012-08-10 10:01:20 +0000 |
1297 | @@ -56,7 +56,7 @@ |
1298 | |
1299 | bool LauncherModel::IconShouldShelf(AbstractLauncherIcon::Ptr icon) const |
1300 | { |
1301 | - return icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH; |
1302 | + return icon->GetIconType() == AbstractLauncherIcon::IconType::TRASH; |
1303 | } |
1304 | |
1305 | bool LauncherModel::CompareIcons(AbstractLauncherIcon::Ptr first, AbstractLauncherIcon::Ptr second) |
1306 | @@ -161,7 +161,7 @@ |
1307 | const_iterator it; |
1308 | const_iterator end; |
1309 | |
1310 | - if (icon && icon->GetIconType() == AbstractLauncherIcon::TYPE_DEVICE) |
1311 | + if (icon && icon->GetIconType() == AbstractLauncherIcon::IconType::DEVICE) |
1312 | return true; |
1313 | |
1314 | if (IconShouldShelf(icon)) |
1315 | @@ -357,7 +357,7 @@ |
1316 | if (temp >= Size()) |
1317 | temp = 0; |
1318 | |
1319 | - if (_inner[temp]->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE)) |
1320 | + if (_inner[temp]->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE)) |
1321 | { |
1322 | selection_ = temp; |
1323 | selection_changed.emit(Selection()); |
1324 | @@ -377,7 +377,7 @@ |
1325 | if (temp < 0) |
1326 | temp = Size() - 1; |
1327 | |
1328 | - if (_inner[temp]->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE)) |
1329 | + if (_inner[temp]->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE)) |
1330 | { |
1331 | selection_ = temp; |
1332 | selection_changed.emit(Selection()); |
1333 | |
1334 | === modified file 'launcher/MockLauncherIcon.h' |
1335 | --- launcher/MockLauncherIcon.h 2012-07-12 19:01:51 +0000 |
1336 | +++ launcher/MockLauncherIcon.h 2012-08-10 10:01:20 +0000 |
1337 | @@ -49,9 +49,9 @@ |
1338 | { |
1339 | tooltip_text = "Mock Icon"; |
1340 | sort_priority_ = 0; |
1341 | - type_ = TYPE_APPLICATION; |
1342 | + type_ = IconType::APPLICATION; |
1343 | |
1344 | - for (int i = 0; i < QUIRK_LAST; ++i) |
1345 | + for (unsigned i = 0; i < unsigned(Quirk::LAST); ++i) |
1346 | { |
1347 | quirks_[i] = false; |
1348 | } |
1349 | @@ -206,12 +206,12 @@ |
1350 | |
1351 | bool GetQuirk(Quirk quirk) const |
1352 | { |
1353 | - return quirks_[quirk]; |
1354 | + return quirks_[unsigned(quirk)]; |
1355 | } |
1356 | |
1357 | void SetQuirk(Quirk quirk, bool value) |
1358 | { |
1359 | - quirks_[quirk] = value; |
1360 | + quirks_[unsigned(quirk)] = value; |
1361 | } |
1362 | |
1363 | void ResetQuirkTime(Quirk quirk) {}; |
1364 | @@ -344,7 +344,7 @@ |
1365 | nux::BaseTexture* icon_; |
1366 | int sort_priority_; |
1367 | IconType type_; |
1368 | - bool quirks_[QUIRK_LAST]; |
1369 | + bool quirks_[unsigned(Quirk::LAST)]; |
1370 | }; |
1371 | |
1372 | } |
1373 | |
1374 | === modified file 'launcher/SoftwareCenterLauncherIcon.cpp' |
1375 | --- launcher/SoftwareCenterLauncherIcon.cpp 2012-07-25 03:11:05 +0000 |
1376 | +++ launcher/SoftwareCenterLauncherIcon.cpp 2012-08-10 10:01:20 +0000 |
1377 | @@ -49,7 +49,7 @@ |
1378 | aptdaemon_trans_.Connect("PropertyChanged", sigc::mem_fun(this, &SoftwareCenterLauncherIcon::OnPropertyChanged)); |
1379 | aptdaemon_trans_.Connect("Finished", sigc::mem_fun(this, &SoftwareCenterLauncherIcon::OnFinished)); |
1380 | |
1381 | - SetIconType(TYPE_APPLICATION); |
1382 | + SetIconType(IconType::APPLICATION); |
1383 | icon_name = icon_path; |
1384 | if (!aptdaemon_trans_id_.empty()) // Application is being installed, or hasn't been installed yet |
1385 | tooltip_text = _("Waiting to install"); |
1386 | @@ -114,13 +114,13 @@ |
1387 | { |
1388 | if (needs_urgent_) |
1389 | { |
1390 | - SetQuirk(QUIRK_URGENT, false); |
1391 | + SetQuirk(Quirk::URGENT, false); |
1392 | needs_urgent_ = false; |
1393 | } |
1394 | BamfLauncherIcon::ActivateLauncherIcon(arg); |
1395 | } |
1396 | else |
1397 | - SetQuirk(QUIRK_STARTING, false); |
1398 | + SetQuirk(Quirk::STARTING, false); |
1399 | } |
1400 | |
1401 | void SoftwareCenterLauncherIcon::OnFinished(GVariant *params) |
1402 | @@ -131,8 +131,8 @@ |
1403 | if (exit_state.Str() == "exit-success") |
1404 | { |
1405 | tooltip_text = BamfName(); |
1406 | - SetQuirk(QUIRK_PROGRESS, false); |
1407 | - SetQuirk(QUIRK_URGENT, true); |
1408 | + SetQuirk(Quirk::PROGRESS, false); |
1409 | + SetQuirk(Quirk::URGENT, true); |
1410 | SetProgress(0.0f); |
1411 | finished_ = true; |
1412 | needs_urgent_ = true; |
1413 | @@ -157,7 +157,7 @@ |
1414 | |
1415 | if (progress < 100) |
1416 | { |
1417 | - SetQuirk(QUIRK_PROGRESS, true); |
1418 | + SetQuirk(Quirk::PROGRESS, true); |
1419 | finished_ = false; |
1420 | } |
1421 | |
1422 | |
1423 | === modified file 'launcher/SpacerLauncherIcon.cpp' |
1424 | --- launcher/SpacerLauncherIcon.cpp 2012-05-07 19:52:54 +0000 |
1425 | +++ launcher/SpacerLauncherIcon.cpp 2012-08-10 10:01:20 +0000 |
1426 | @@ -30,9 +30,9 @@ |
1427 | SpacerLauncherIcon::SpacerLauncherIcon(int monitor) |
1428 | : SingleMonitorLauncherIcon(monitor) |
1429 | { |
1430 | - SetQuirk(QUIRK_VISIBLE, true); |
1431 | - SetQuirk(QUIRK_RUNNING, false); |
1432 | - SetIconType(TYPE_APPLICATION); |
1433 | + SetQuirk(Quirk::VISIBLE, true); |
1434 | + SetQuirk(Quirk::RUNNING, false); |
1435 | + SetIconType(IconType::APPLICATION); |
1436 | |
1437 | tooltip_text = _("Drop To Add Application"); |
1438 | } |
1439 | |
1440 | === modified file 'launcher/SwitcherController.cpp' |
1441 | --- launcher/SwitcherController.cpp 2012-08-02 02:14:22 +0000 |
1442 | +++ launcher/SwitcherController.cpp 2012-08-10 10:01:20 +0000 |
1443 | @@ -226,7 +226,7 @@ |
1444 | } |
1445 | else |
1446 | { |
1447 | - if (selection->GetQuirk (AbstractLauncherIcon::QUIRK_ACTIVE) && |
1448 | + if (selection->GetQuirk(AbstractLauncherIcon::Quirk::ACTIVE) && |
1449 | !model_->DetailXids().empty ()) |
1450 | { |
1451 | selection->Activate(ActionArg (ActionArg::SWITCHER, 0, model_->DetailXids()[0])); |
1452 | @@ -414,10 +414,10 @@ |
1453 | if (first->GetIconType() == second->GetIconType()) |
1454 | return first->SwitcherPriority() > second->SwitcherPriority(); |
1455 | |
1456 | - if (first->GetIconType() == AbstractLauncherIcon::IconType::TYPE_DESKTOP) |
1457 | + if (first->GetIconType() == AbstractLauncherIcon::IconType::DESKTOP) |
1458 | return true; |
1459 | |
1460 | - if (second->GetIconType() == AbstractLauncherIcon::IconType::TYPE_DESKTOP) |
1461 | + if (second->GetIconType() == AbstractLauncherIcon::IconType::DESKTOP) |
1462 | return false; |
1463 | |
1464 | return first->GetIconType() < second->GetIconType(); |
1465 | |
1466 | === modified file 'launcher/SwitcherModel.cpp' |
1467 | --- launcher/SwitcherModel.cpp 2012-07-26 02:02:00 +0000 |
1468 | +++ launcher/SwitcherModel.cpp 2012-08-10 10:01:20 +0000 |
1469 | @@ -42,7 +42,7 @@ |
1470 | for (auto icon : _inner) |
1471 | { |
1472 | AddChild(icon.GetPointer()); |
1473 | - if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE)) |
1474 | + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::ACTIVE)) |
1475 | _last_active_icon = icon; |
1476 | } |
1477 | } |
1478 | |
1479 | === modified file 'launcher/TrashLauncherIcon.cpp' |
1480 | --- launcher/TrashLauncherIcon.cpp 2012-08-09 13:57:15 +0000 |
1481 | +++ launcher/TrashLauncherIcon.cpp 2012-08-10 10:01:20 +0000 |
1482 | @@ -44,9 +44,9 @@ |
1483 | { |
1484 | tooltip_text = _("Trash"); |
1485 | icon_name = "user-trash"; |
1486 | - SetQuirk(QUIRK_VISIBLE, true); |
1487 | - SetQuirk(QUIRK_RUNNING, false); |
1488 | - SetIconType(TYPE_TRASH); |
1489 | + SetQuirk(Quirk::VISIBLE, true); |
1490 | + SetQuirk(Quirk::RUNNING, false); |
1491 | + SetIconType(IconType::TRASH); |
1492 | SetShortcut('t'); |
1493 | |
1494 | glib::Object<GFile> location(g_file_new_for_uri("trash:///")); |
1495 | @@ -161,7 +161,7 @@ |
1496 | g_file_trash(file, NULL, NULL); |
1497 | } |
1498 | |
1499 | - SetQuirk(LauncherIcon::QUIRK_PULSE_ONCE, true); |
1500 | + SetQuirk(LauncherIcon::Quirk::PULSE_ONCE, true); |
1501 | } |
1502 | |
1503 | std::string TrashLauncherIcon::GetName() const |
1504 | |
1505 | === modified file 'plugins/unityshell/src/unity-launcher-icon-accessible.cpp' |
1506 | --- plugins/unityshell/src/unity-launcher-icon-accessible.cpp 2012-01-03 16:07:41 +0000 |
1507 | +++ plugins/unityshell/src/unity-launcher-icon-accessible.cpp 2012-08-10 10:01:20 +0000 |
1508 | @@ -281,7 +281,7 @@ |
1509 | |
1510 | icon = dynamic_cast<LauncherIcon*>(nux_object); |
1511 | |
1512 | - if (icon->GetQuirk(LauncherIcon::QUIRK_VISIBLE)) |
1513 | + if (icon->GetQuirk(LauncherIcon::Quirk::VISIBLE)) |
1514 | { |
1515 | atk_state_set_add_state(state_set, ATK_STATE_VISIBLE); |
1516 | atk_state_set_add_state(state_set, ATK_STATE_SHOWING); |
1517 | |
1518 | === modified file 'plugins/unityshell/src/unityshell.cpp' |
1519 | --- plugins/unityshell/src/unityshell.cpp 2012-08-03 13:26:32 +0000 |
1520 | +++ plugins/unityshell/src/unityshell.cpp 2012-08-10 10:01:20 +0000 |
1521 | @@ -1895,7 +1895,7 @@ |
1522 | auto results = launcher_controller_->GetAltTabIcons(show_mode == switcher::ShowMode::CURRENT_VIEWPORT, |
1523 | switcher_controller_->IsShowDesktopDisabled()); |
1524 | |
1525 | - if (!(results.size() == 1 && results[0]->GetIconType() == AbstractLauncherIcon::IconType::TYPE_DESKTOP) && !results.empty()) |
1526 | + if (!(results.size() == 1 && results[0]->GetIconType() == AbstractLauncherIcon::IconType::DESKTOP) && !results.empty()) |
1527 | switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results); |
1528 | |
1529 | return true; |
1530 | |
1531 | === modified file 'tests/test_favorite_store_gsettings.cpp' |
1532 | --- tests/test_favorite_store_gsettings.cpp 2012-08-01 18:09:05 +0000 |
1533 | +++ tests/test_favorite_store_gsettings.cpp 2012-08-10 10:01:20 +0000 |
1534 | @@ -88,7 +88,6 @@ |
1535 | |
1536 | // Setting the test values |
1537 | gsettings_client = g_settings_new(SETTINGS_NAME); |
1538 | - g_settings_set_strv(gsettings_client, SETTINGS_KEY, NULL); |
1539 | g_settings_set_strv(gsettings_client, SETTINGS_KEY, base_store_favs); |
1540 | } |
1541 | |
1542 | |
1543 | === modified file 'tests/test_launcher.cpp' |
1544 | --- tests/test_launcher.cpp 2012-07-12 19:01:51 +0000 |
1545 | +++ tests/test_launcher.cpp 2012-08-10 10:01:20 +0000 |
1546 | @@ -84,9 +84,9 @@ |
1547 | |
1548 | Utils::WaitForTimeout(1); |
1549 | |
1550 | - EXPECT_FALSE(first->GetQuirk(launcher::AbstractLauncherIcon::QUIRK_DESAT)); |
1551 | - EXPECT_FALSE(second->GetQuirk(launcher::AbstractLauncherIcon::QUIRK_DESAT)); |
1552 | - EXPECT_TRUE(third->GetQuirk(launcher::AbstractLauncherIcon::QUIRK_DESAT)); |
1553 | + EXPECT_FALSE(first->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT)); |
1554 | + EXPECT_FALSE(second->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT)); |
1555 | + EXPECT_TRUE(third->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT)); |
1556 | } |
1557 | |
1558 | } |
1559 | |
1560 | === modified file 'tests/test_launcher_controller.cpp' |
1561 | --- tests/test_launcher_controller.cpp 2012-07-27 20:20:29 +0000 |
1562 | +++ tests/test_launcher_controller.cpp 2012-08-10 10:01:20 +0000 |
1563 | @@ -49,6 +49,17 @@ |
1564 | FavoriteList fav_list_; |
1565 | }; |
1566 | |
1567 | +class MockBamfLauncherIcon : public BamfLauncherIcon |
1568 | +{ |
1569 | +public: |
1570 | + //typedef nux::ObjectPtr<MockMockLauncherIcon> Ptr; |
1571 | + MockBamfLauncherIcon(BamfApplication* app) |
1572 | + : BamfLauncherIcon(app) {} |
1573 | + |
1574 | + MOCK_METHOD0(UnStick, void()); |
1575 | + MOCK_METHOD0(Quit, void()); |
1576 | +}; |
1577 | + |
1578 | namespace launcher |
1579 | { |
1580 | class TestLauncherController : public testing::Test |
1581 | @@ -70,6 +81,11 @@ |
1582 | return lc.pimpl->edge_barriers_; |
1583 | } |
1584 | |
1585 | + LauncherModel::Ptr GetLauncherModel() |
1586 | + { |
1587 | + return lc.pimpl->model_; |
1588 | + } |
1589 | + |
1590 | MockUScreen uscreen; |
1591 | Settings settings; |
1592 | panel::Style panel_style; |
1593 | @@ -198,4 +214,20 @@ |
1594 | } |
1595 | } |
1596 | |
1597 | +TEST_F(TestLauncherController, OnlyUnstickIconOnFavoriteRemoval) |
1598 | +{ |
1599 | + const std::string USC_DESKTOP = BUILDDIR"/tests/data/ubuntu-software-center.desktop"; |
1600 | + |
1601 | + glib::Object<BamfMatcher> matcher(bamf_matcher_get_default()); |
1602 | + |
1603 | + auto bamf_app = bamf_matcher_get_application_for_desktop_file(matcher, USC_DESKTOP.c_str(), TRUE); |
1604 | + MockBamfLauncherIcon *bamf_icon = new MockBamfLauncherIcon(bamf_app); |
1605 | + GetLauncherModel()->AddIcon(AbstractLauncherIcon::Ptr(bamf_icon)); |
1606 | + |
1607 | + EXPECT_CALL(*bamf_icon, UnStick()); |
1608 | + EXPECT_CALL(*bamf_icon, Quit()).Times(0); |
1609 | + |
1610 | + favorite_store.favorite_removed.emit(USC_DESKTOP); |
1611 | +} |
1612 | + |
1613 | } |
FAILED: Continuous integration, rev:2535 jenkins. qa.ubuntu. com/job/ unity-ci/ 135/ jenkins. qa.ubuntu. com/job/ unity-ci/ ./distribution= quantal, flavor= amd64/135/ console jenkins. qa.ubuntu. com/job/ unity-ci/ ./distribution= quantal, flavor= i386/135/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://