Merge lp:~unity-2d-team/unity-2d/hud-redesign into lp:unity-2d

Proposed by Gerry Boland
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1020
Merged at revision: 1029
Proposed branch: lp:~unity-2d-team/unity-2d/hud-redesign
Merge into: lp:unity-2d
Diff against target: 432 lines (+250/-30)
7 files modified
shell/HudLoader.qml (+8/-2)
shell/Shell.qml (+3/-3)
shell/hud/Hud.qml (+36/-21)
shell/launcher/Launcher.qml (+3/-1)
shell/launcher/LauncherItem.qml (+9/-3)
tests/hud/hud_show_hide_tests.rb (+8/-0)
tests/hud/hud_show_hide_tests_hide-mode0.rb (+183/-0)
To merge this branch: bzr merge lp:~unity-2d-team/unity-2d/hud-redesign
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) desing Approve
Albert Astals Cid (community) Approve
Review via email: mp+100096@code.launchpad.net

Commit message

[hud] Redesign for hide-mode=0 case. Launcher's BFB icon replaced with one specified by HUD.

BFB icon animation left for later commit.

Description of the change

[hud] Redesign for hide-mode=0 case. Launcher's BFB icon replaced with one specified by HUD.

BFB icon animation left for later commit.

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

Tests are missing

There is a behaviour change, previous if:
 * Focus firefox
 * Show hud
 * Type some of the firefox menu items
 * Press down arrow
 * Firefox icon shown
But if you do this with this code i get the "unknown icon"

Revision history for this message
Albert Astals Cid (aacid) wrote :

One more thing: Is it the left pip you have to enable when opening the hud? With the dash we enable the right one

Revision history for this message
Albert Astals Cid (aacid) wrote :

Set as need fixing as per previous comments

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :
Revision history for this message
Albert Astals Cid (aacid) wrote :
Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good from a code POV, needs design approval

review: Approve
Revision history for this message
Andrea Cimitan (cimi) wrote :

I think design is definitely an improvement.
In case we will notice something that requires tweak we will file new bugs for them.

review: Approve (desing)
Revision history for this message
Albert Astals Cid (aacid) wrote :
Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shell/HudLoader.qml'
2--- shell/HudLoader.qml 2012-03-30 13:44:54 +0000
3+++ shell/HudLoader.qml 2012-04-02 09:17:20 +0000
4@@ -27,9 +27,15 @@
5
6 source: "hud/Hud.qml"
7 anchors.top: parent != undefined ? parent.top : undefined
8- x: Utils.isLeftToRight() ? 0 : shell.width - width
9+ x: {
10+ if (launcher2dConfiguration.hideMode == 0) {
11+ return Utils.isLeftToRight() ? launcherLoader.width : (parent != undefined ? parent.width - width - launcherLoader.width : 0)
12+ } else {
13+ return Utils.isLeftToRight() ? 0 : (parent != undefined ? parent.width - width : 0)
14+ }
15+ }
16 onLoaded: item.focus = true
17 visible: item.active
18 focus: item.active
19- width: Math.min(shell.width, 1061)
20+ width: Math.min(shell.width, (launcher2dConfiguration.hideMode == 0) ? 1061 - launcherLoader.width : 1061)
21 }
22
23=== modified file 'shell/Shell.qml'
24--- shell/Shell.qml 2012-03-30 13:44:54 +0000
25+++ shell/Shell.qml 2012-04-02 09:17:20 +0000
26@@ -58,7 +58,7 @@
27 }
28
29 onHudLoaderChanged: {
30- if (shellManager.hudActive) {
31+ if (shellManager.hudActive && launcher2dConfiguration.hideMode != 0) {
32 if (hudLoader == undefined)
33 {
34 launcherLoader.visibilityController.endForceHidden("hud")
35@@ -144,11 +144,11 @@
36 if (dashLoader != undefined && dashLoader.item.active) {
37 dashLoader.item.active = false
38 }
39- if (hudLoader != undefined) {
40+ if (hudLoader != undefined && launcher2dConfiguration.hideMode != 0) {
41 launcherLoader.visibilityController.beginForceHidden("hud")
42 }
43 } else {
44- if (hudLoader != undefined) {
45+ if (hudLoader != undefined && launcher2dConfiguration.hideMode != 0) {
46 launcherLoader.visibilityController.endForceHidden("hud")
47 }
48 }
49
50=== modified file 'shell/hud/Hud.qml'
51--- shell/hud/Hud.qml 2012-03-30 13:44:54 +0000
52+++ shell/hud/Hud.qml 2012-04-02 09:17:20 +0000
53@@ -35,6 +35,7 @@
54 property int resultHeight: 42
55
56 property bool animating: heightAnimation.running
57+ property string appIcon: ""
58
59 height: layout.childrenRect.height + layout.anchors.bottomMargin + 10
60
61@@ -56,6 +57,7 @@
62 onActiveChanged: {
63 if (active) {
64 shellManager.hudShell.forceActivateWindow()
65+ appIcon = getActiveWindowIcon()
66 resultList.focus = true
67 } else {
68 hudModel.endSearch()
69@@ -90,6 +92,11 @@
70 active = false
71 }
72
73+ function getActiveWindowIcon() {
74+ return activeWindow.icon ? "image://icons/" + activeWindow.icon
75+ : "image://icons/unknown"
76+ }
77+
78 property variant hudModel: Hud {}
79
80 Background {
81@@ -129,37 +136,37 @@
82
83 anchors.left: parent.left
84 anchors.top: parent.top
85- width: 65
86+ width: (launcher2dConfiguration.hideMode == 0) ? 0 : launcherLoader.width
87+ visible: (launcher2dConfiguration.hideMode != 0)
88+
89+ IconTile {
90+ id: iconTile
91+
92+ anchors.top: parent.top
93+ anchors.topMargin: 5
94+ anchors.left: parent.left
95+ anchors.leftMargin: 5
96+ width: 54
97+ height: 54
98+
99+ source: appIcon
100+
101+ tileBackgroundImage: "../launcher/artwork/squircle_base_54.png"
102+ tileShineImage: "../launcher/artwork/squircle_shine_54.png"
103+ selectedTileBackgroundImage: "../launcher/artwork/squircle_base_selected_54.png"
104+ }
105
106 Image {
107 id: pip
108
109 anchors.verticalCenter: iconTile.verticalCenter
110- anchors.horizontalCenterOffset: -1
111- anchors.left: parent.left
112+ anchors.right: tile.right
113 mirror: Utils.isRightToLeft()
114
115 source: "image://blended/%1color=%2alpha=%3"
116- .arg("launcher/artwork/launcher_arrow_ltr.png")
117+ .arg("launcher/artwork/launcher_arrow_rtl.png")
118 .arg("lightgrey").arg(1.0)
119 }
120-
121- IconTile {
122- id: iconTile
123-
124- anchors.top: parent.top
125- anchors.topMargin: 5
126- anchors.left: parent.left
127- anchors.leftMargin: 5
128- width: 54
129- height: 54
130-
131- source: (resultList.currentItem != null && resultList.count > 0)
132- ? "image://icons/" + resultList.currentItem.icon
133- : (activeWindow.icon
134- ? "image://icons/" + activeWindow.icon
135- : "image://icons/unknown")
136- }
137 }
138
139 /* Unhandled keys will always be forwarded to the search bar. That way
140@@ -229,6 +236,14 @@
141
142 onClicked: executeResult(resultId)
143 }
144+
145+ onCurrentItemChanged: {
146+ if (currentItem != null && count > 0) {
147+ appIcon = "image://icons/" + (currentItem.icon ? currentItem.icon : "unknown")
148+ } else {
149+ appIcon = getActiveWindowIcon()
150+ }
151+ }
152 }
153 }
154 }
155
156=== modified file 'shell/launcher/Launcher.qml'
157--- shell/launcher/Launcher.qml 2012-03-30 13:44:54 +0000
158+++ shell/launcher/Launcher.qml 2012-04-02 09:17:20 +0000
159@@ -83,7 +83,9 @@
160 height: parent.height
161 anchors.right: Utils.isLeftToRight() ? parent.right : undefined
162 anchors.left: Utils.isLeftToRight() ? undefined : parent.left
163- visible: shellManager.dashActive && shellManager.dashShell == declarativeView
164+ visible: (shellManager.hudActive && shellManager.hudShell == declarativeView)
165+ || (shellManager.dashActive && shellManager.dashShell == declarativeView)
166+
167 source: "artwork/border.png"
168 fillMode: Image.Stretch
169 }
170
171=== modified file 'shell/launcher/LauncherItem.qml'
172--- shell/launcher/LauncherItem.qml 2012-03-30 13:44:54 +0000
173+++ shell/launcher/LauncherItem.qml 2012-04-02 09:17:20 +0000
174@@ -61,7 +61,7 @@
175 property int selectionOutlineSize
176 property alias name: looseItem.objectName
177 property string desktopFile: ""
178- property alias icon: icon.source
179+ property string icon: "image://icons/unknown"
180 property alias urgentAnimation: urgentAnimation
181 property bool running: false
182 property bool active: false
183@@ -84,6 +84,9 @@
184 property alias shortcutVisible: shortcut.visible
185 property alias shortcutText: shortcutText.text
186
187+ property bool beHudItem: shellManager.hudActive && shellManager.hudShell == declarativeView
188+ && isBfb && launcher2dConfiguration.hideMode == 0
189+
190 property bool isBeingDragged: false
191 property int dragPosition
192
193@@ -139,11 +142,13 @@
194 mirror: Utils.isRightToLeft()
195
196 source: "image://blended/%1color=%2alpha=%3"
197- .arg("launcher/artwork/launcher_arrow_" + (activeOnThisScreen ? "" : "outline_" ) + "rtl.png")
198+ .arg("launcher/artwork/launcher_arrow_"
199+ + (activeOnThisScreen || beHudItem ? "" : "outline_" )
200+ + "rtl.png")
201 .arg("lightgrey")
202 .arg(1.0)
203
204- visible: active && (looseItem.state != "beingDragged")
205+ visible: (active && (looseItem.state != "beingDragged")) || beHudItem
206 }
207
208 /* This is the area on the left of the tile where the pips/arrow end up.
209@@ -200,6 +205,7 @@
210 activeFocus: item.activeFocus
211 backgroundFromIcon: item.backgroundFromIcon
212
213+ source: (beHudItem && hudLoader) ? hudLoader.item.appIcon : item.icon
214 tileBackgroundImage: (item.isBfb) ? "../launcher/artwork/squircle_base_54.png" : ""
215 tileShineImage: (item.isBfb) ? "../launcher/artwork/squircle_shine_54.png" : ""
216 selectedTileBackgroundImage: (item.isBfb) ? "../launcher/artwork/squircle_base_selected_54.png" : ""
217
218=== modified file 'tests/hud/hud_show_hide_tests.rb'
219--- tests/hud/hud_show_hide_tests.rb 2012-03-07 15:33:29 +0000
220+++ tests/hud/hud_show_hide_tests.rb 2012-04-02 09:17:20 +0000
221@@ -26,15 +26,23 @@
222
223 ############################# Test Suite #############################
224 context "HUD Show and Hide tests" do
225+ hide_mode = 0
226
227 # Run once at the beginning of this test suite
228 startup do
229 $SUT.execute_shell_command 'killall unity-2d-shell'
230 $SUT.execute_shell_command 'killall unity-2d-shell'
231+
232+ # Save current hide-mode
233+ hide_mode = $SUT.execute_shell_command 'gsettings get com.canonical.Unity2d.Launcher hide-mode'
234+ # Set hide-mode to 1 (auto-hide)
235+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode 1'
236 end
237
238 # Run once at the end of this test suite
239 shutdown do
240+ # Restore hide-mode to original setting
241+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode ' + hide_mode
242 end
243
244 # Run before each test case begins
245
246=== added file 'tests/hud/hud_show_hide_tests_hide-mode0.rb'
247--- tests/hud/hud_show_hide_tests_hide-mode0.rb 1970-01-01 00:00:00 +0000
248+++ tests/hud/hud_show_hide_tests_hide-mode0.rb 2012-04-02 09:17:20 +0000
249@@ -0,0 +1,183 @@
250+#!/usr/bin/env ruby1.8
251+=begin
252+/*
253+ * This file is part of unity-2d
254+ *
255+ * Copyright 2012 Canonical Ltd.
256+ *
257+ * This program is free software; you can redistribute it and/or modify
258+ * it under the terms of the GNU General Public License as published by
259+ * the Free Software Foundation; version 3.
260+ *
261+ * This program is distributed in the hope that it will be useful,
262+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
263+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
264+ * GNU General Public License for more details.
265+ *
266+ * You should have received a copy of the GNU General Public License
267+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
268+ */
269+=end
270+
271+require '../run-tests.rb' unless $INIT_COMPLETED
272+require 'xdo/xwindow'
273+require 'xdo/keyboard'
274+require 'xdo/mouse'
275+require 'tmpwindow'
276+
277+############################# Test Suite #############################
278+context "HUD Show and Hide tests" do
279+ hide_mode = 0
280+
281+ # Run once at the beginning of this test suite
282+ startup do
283+ $SUT.execute_shell_command 'killall unity-2d-shell'
284+ $SUT.execute_shell_command 'killall unity-2d-shell'
285+
286+ # Save current hide-mode
287+ hide_mode = $SUT.execute_shell_command 'gsettings get com.canonical.Unity2d.Launcher hide-mode'
288+ # Set hide-mode to 0 (fixed)
289+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode 0'
290+ end
291+
292+ # Run once at the end of this test suite
293+ shutdown do
294+ # Restore hide-mode to original setting
295+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode ' + hide_mode
296+ end
297+
298+ # Run before each test case begins
299+ setup do
300+ #Ensure mouse out of the way
301+ XDo::Mouse.move(500,500,10,true)
302+
303+ # Execute the application
304+ @app = $SUT.run( :name => UNITY_2D_SHELL,
305+ :arguments => "-testability",
306+ :sleeptime => 2 )
307+ # Make certain application is ready for testing
308+ verify{ @app.LauncherLoader() }
309+ end
310+
311+ # Run after each test case completes
312+ teardown do
313+ TmpWindow.close_all_windows
314+ #Need to kill Shell as it does not shutdown when politely asked
315+ $SUT.execute_shell_command 'pkill -nf unity-2d-shell'
316+ end
317+
318+ #####################################################################################
319+ # Test cases
320+
321+ # Test case objectives:
322+ # * Check the HUD displays with the Alt key
323+ # Pre-conditions
324+ # * None
325+ # Test steps
326+ # * Check HUD closed
327+ # * Tap the Alt key
328+ # * Check HUD open
329+ # * Tap Alt key
330+ # * Check HUD closed
331+ # Post-conditions
332+ # * None
333+ # References
334+ # * None
335+ test "HUD reveals and hides with Alt key tap" do
336+ verify_not(1, 'HUD should be hidden at startup') {
337+ @app.Hud()
338+ }
339+
340+ XDo::Keyboard.alt
341+ verify_equal('true', TIMEOUT, 'HUD should be visible, as the Alt key was tapped') {
342+ @app.Hud()['active']
343+ }
344+
345+ XDo::Keyboard.alt
346+ verify_not(1, 'HUD should be hidden, as the Alt key should dismiss it') {
347+ @app.Hud()
348+ }
349+ end
350+
351+ # Test case objectives:
352+ # * Check the Launcher does not hide when the HUD opens
353+ # Pre-conditions
354+ # * None
355+ # Test steps
356+ # * Check HUD closed
357+ # * Tap the Alt key
358+ # * Check Launcher remains on screen
359+ # Post-conditions
360+ # * None
361+ # References
362+ # * None
363+ test "HUD does not make Launcher hide" do
364+ verify_not(1, 'HUD should be hidden at startup') {
365+ @app.Hud()
366+ }
367+
368+ XDo::Keyboard.alt
369+ verify_equal( 0, TIMEOUT, 'Launcher hid when HUD activated, should be visible' ) {
370+ @app.Launcher()['x_absolute'].to_i
371+ }
372+ end
373+
374+ # Test case objectives:
375+ # * Check the Launcher's BFB icon replaced when the HUD opens
376+ # Pre-conditions
377+ # * Terminal window open & focused
378+ # Test steps
379+ # * Check HUD closed
380+ # * Tap the Alt key
381+ # * Check Launcher's BFB icon changes to a squircle with the terminal icon inside
382+ # Post-conditions
383+ # * None
384+ # References
385+ # * None
386+ test "Launcher's BFB icon replaced when HUD opens" do
387+ TmpWindow.open_window_at(100, 100)
388+
389+ verify_not(1, 'HUD should be hidden at startup') {
390+ @app.Hud()
391+ }
392+
393+ XDo::Keyboard.alt
394+ verify_equal('image://icons/utilities-terminal', TIMEOUT, 'BFB icon should have changed to Terminal icon' ) {
395+ @app.LauncherList( :name => 'main' ) \
396+ .LauncherList( :isBfb => true ) \
397+ .QDeclarativeImage( :name => 'icon' )['source']
398+ }
399+ end
400+
401+ # Test case objectives:
402+ # * Check the Launcher's BFB icon replaced by icon for first resuls (not necessarily the active
403+ # application icon) when the HUD opens
404+ # Pre-conditions
405+ # * Terminal window open & focused
406+ # Test steps
407+ # * Check HUD closed
408+ # * Tap the Alt key
409+ # * Type "bluetooth" #assuming as this is a trademark this string is not localised in menus
410+ # * Check Launcher's BFB icon is the bluetooth icon
411+ # Post-conditions
412+ # * None
413+ # References
414+ # * None
415+ test "Launcher's BFB icon replaced when HUD opens" do
416+ TmpWindow.open_window_at(100, 100)
417+
418+ verify_not(1, 'HUD should be hidden at startup') {
419+ @app.Hud()
420+ }
421+
422+ XDo::Keyboard.alt
423+ XDo::Keyboard.simulate 'bluetooth'
424+ verify(TIMEOUT, 'BFB icon should have changed to Bluetooth icon' ) {
425+ icon = @app.LauncherList( :name => 'main' ) \
426+ .LauncherList( :isBfb => true ) \
427+ .QDeclarativeImage( :name => 'icon' )['source']
428+ icon == 'image://icons/bluetooth-active' || icon == 'image://icons/bluetooth-disabled' \
429+ || icon == 'image://icons/bluetooth-paired'
430+ }
431+ end
432+end

Subscribers

People subscribed via source and target branches