Merge lp:~fboucault/unity-2d/dash_proper_hover into lp:unity-2d/3.0

Proposed by Florian Boucault on 2011-08-23
Status: Merged
Approved by: Gerry Boland on 2011-08-23
Approved revision: 684
Merged at revision: 685
Proposed branch: lp:~fboucault/unity-2d/dash_proper_hover
Merge into: lp:unity-2d/3.0
Diff against target: 322 lines (+92/-75) 9 files modified
To merge this branch: bzr merge lp:~fboucault/unity-2d/dash_proper_hover
Reviewer Review Type Date Requested Status
Gerry Boland 2011-08-23 Approve on 2011-08-23
Review via email: mp+72604@code.launchpad.net

Description of the Change

[dash] Removed 'hover' state everywhere but in search results and home screen shortctus.
In these 2 places the style was adapted to look better and also closer to Unity's.
HomeButton now expands its label when focused.

To post a comment you must log in.
683. By Florian Boucault on 2011-08-23

Added missing ButtonBackground.

684. By Florian Boucault on 2011-08-23

Merged trunk

Gerry Boland (gerboland) wrote :

Works ok, accepted.

review: Approve

Preview Diff

1=== removed file 'places/Button.qml'
2--- places/Button.qml 2011-08-09 16:18:45 +0000
3+++ places/Button.qml 1970-01-01 00:00:00 +0000
4@@ -1,43 +0,0 @@
5-/*
6- * This file is part of unity-2d
7- *
8- * Copyright 2010-2011 Canonical Ltd.
9- *
10- * This program is free software; you can redistribute it and/or modify
11- * it under the terms of the GNU General Public License as published by
12- * the Free Software Foundation; version 3.
13- *
14- * This program is distributed in the hope that it will be useful,
15- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17- * GNU General Public License for more details.
18- *
19- * You should have received a copy of the GNU General Public License
20- * along with this program. If not, see <http://www.gnu.org/licenses/>.
21- */
22-
23-import QtQuick 1.0
24-
25-AbstractButton {
26- Rectangle {
27- anchors.fill: parent
28- anchors.bottomMargin: 1
29- anchors.rightMargin: 1
30- opacity: ( parent.state == "selected" || parent.state == "pressed"
31- || parent.state == "hovered" ) ? 1.0 : 0.0
32-
33- color: parent.state == "pressed" ? "#ffffffff" : "#00000000"
34- border.color: "#cccccc"
35- border.width: 1
36- radius: 3
37-
38- Behavior on opacity {NumberAnimation {duration: 100}}
39-
40- Image {
41- fillMode: Image.Tile
42- anchors.fill: parent
43- source: "artwork/button_background.png"
44- smooth: false
45- }
46- }
47-}
48
49=== added file 'places/ButtonBackground.qml'
50--- places/ButtonBackground.qml 1970-01-01 00:00:00 +0000
51+++ places/ButtonBackground.qml 2011-08-23 17:40:25 +0000
52@@ -0,0 +1,31 @@
53+import QtQuick 1.0
54+
55+Item {
56+ id: background
57+
58+ property string state
59+
60+ opacity: ( state == "selected" || state == "pressed"
61+ || state == "hovered" ) ? 1.0 : 0.0
62+ Behavior on opacity {NumberAnimation {duration: 100}}
63+
64+ Rectangle {
65+
66+ /* FIXME: */
67+ anchors.fill: parent
68+ anchors.bottomMargin: 1
69+ anchors.rightMargin: 1
70+
71+ color: background.state == "pressed" ? "#ffffffff" : "#00000000"
72+ border.color: "#cccccc"
73+ border.width: 1
74+ radius: 3
75+
76+ Image {
77+ fillMode: Image.Tile
78+ anchors.fill: parent
79+ source: "artwork/button_background.png"
80+ smooth: false
81+ }
82+ }
83+}
84
85=== modified file 'places/Home.qml'
86--- places/Home.qml 2011-08-10 10:01:52 +0000
87+++ places/Home.qml 2011-08-23 17:40:25 +0000
88@@ -56,7 +56,7 @@
89 /* Used by dash.qml to bind to dashView "expanded" property */
90 property bool expanded: globalSearchActive || shortcutsActive
91
92- Button {
93+ AbstractButton {
94 id: openShortcutsButton
95
96 anchors.bottom: parent.top
97@@ -146,7 +146,7 @@
98 color: Qt.rgba(0, 0, 0, 0.3)
99 }
100
101- Button {
102+ AbstractButton {
103 id: closeShortcutsButton
104
105 anchors.left: parent.left
106
107=== modified file 'places/HomeButton.qml'
108--- places/HomeButton.qml 2011-08-23 15:47:49 +0000
109+++ places/HomeButton.qml 2011-08-23 17:40:25 +0000
110@@ -18,7 +18,9 @@
111
112 import QtQuick 1.0
113
114-Button {
115+AbstractButton {
116+ id: button
117+
118 property alias icon: icon.source
119 property alias label: label.text
120 property alias iconSourceSize: icon.sourceSize
121@@ -26,37 +28,38 @@
122 width: 160
123 height: 172
124
125- Item {
126- anchors.right: parent.right
127- anchors.left: parent.left
128+ ButtonBackground {
129+ anchors.fill: icon
130+ anchors.margins: -5
131+ state: button.state
132+ }
133+
134+ Image {
135+ id: icon
136+
137+ width: sourceSize.width
138+ height: sourceSize.height
139+
140+ anchors.horizontalCenter: parent.horizontalCenter
141 anchors.top: parent.top
142- anchors.bottom: label.bottom
143- anchors.bottomMargin: 30
144-
145- Image {
146- id: icon
147-
148- width: sourceSize.width
149- height: sourceSize.height
150-
151- anchors.centerIn: parent
152- fillMode: Image.PreserveAspectFit
153-
154- asynchronous: true
155- opacity: status == Image.Ready ? 1 : 0
156- Behavior on opacity {NumberAnimation {duration: 200; easing.type: Easing.InOutQuad}}
157- }
158+ anchors.topMargin: 5
159+ fillMode: Image.PreserveAspectFit
160+
161+ asynchronous: true
162+ opacity: status == Image.Ready ? 1 : 0
163+ Behavior on opacity {NumberAnimation {duration: 200; easing.type: Easing.InOutQuad}}
164 }
165
166 TextMultiLine {
167 id: label
168
169- color: parent.state == "pressed" ? "#444444" : "#ffffff"
170+ color: "#ffffff"
171+ state: ( parent.state == "selected" || parent.state == "hovered" ) ? "expanded" : ""
172 horizontalAlignment: Text.AlignHCenter
173- anchors.bottom: parent.bottom
174+ anchors.top: icon.bottom
175 anchors.right: parent.right
176 anchors.left: parent.left
177- anchors.bottomMargin: 3
178+ anchors.topMargin: 8
179 anchors.rightMargin: 5
180 anchors.leftMargin: 7
181 height: 40
182
183=== modified file 'places/UnityDefaultRenderer.qml'
184--- places/UnityDefaultRenderer.qml 2011-08-23 16:27:12 +0000
185+++ places/UnityDefaultRenderer.qml 2011-08-23 17:40:25 +0000
186@@ -21,12 +21,14 @@
187
188 RendererGrid {
189 cellWidth: 100
190- cellHeight: 108
191+ cellHeight: 112
192 horizontalSpacing: 42
193 verticalSpacing: 20
194
195 cellRenderer: Component {
196- Button {
197+ AbstractButton {
198+ id: button
199+
200 property string uri
201 property string iconHint
202 property string mimetype
203@@ -66,6 +68,12 @@
204 onDrop: parent.pressed = false
205 }
206
207+ ButtonBackground {
208+ anchors.fill: icon
209+ anchors.margins: -4
210+ state: button.state
211+ }
212+
213 Image {
214 id: icon
215
216@@ -74,6 +82,7 @@
217 height: 64
218 anchors.horizontalCenter: parent.horizontalCenter
219 anchors.top: parent.top
220+ anchors.topMargin: 4
221 fillMode: Image.PreserveAspectFit
222 sourceSize.width: width
223 sourceSize.height: height
224@@ -87,7 +96,7 @@
225 id: label
226
227 text: displayName
228- color: parent.state == "pressed" ? "#5e5e5e" : "#ffffff"
229+ color: "#ffffff"
230 state: ( parent.state == "selected" || parent.state == "hovered" ) ? "expanded" : ""
231 horizontalAlignment: Text.AlignHCenter
232 anchors.top: icon.bottom
233
234=== modified file 'places/UnityEmptySearchRenderer.qml'
235--- places/UnityEmptySearchRenderer.qml 2011-07-24 16:23:00 +0000
236+++ places/UnityEmptySearchRenderer.qml 2011-08-23 17:40:25 +0000
237@@ -41,7 +41,9 @@
238 orientation: ListView.Vertical
239
240 model: renderer.group_model
241- delegate: Button {
242+ delegate: AbstractButton {
243+ id: button
244+
245 property string uri: column_0
246 property string iconHint: column_1
247 property string groupId: column_2
248@@ -59,6 +61,11 @@
249 placeEntryModel.place.activate(uri)
250 }
251
252+ ButtonBackground {
253+ anchors.fill: parent
254+ state: button.state
255+ }
256+
257 TextCustom {
258 text: displayName
259 font.pixelSize: 16
260
261=== modified file 'places/UnityFileInfoRenderer.qml'
262--- places/UnityFileInfoRenderer.qml 2011-08-23 15:47:49 +0000
263+++ places/UnityFileInfoRenderer.qml 2011-08-23 17:40:25 +0000
264@@ -25,7 +25,7 @@
265 verticalSpacing: 26
266
267 cellRenderer: Component {
268- Button {
269+ AbstractButton {
270 id: button
271
272 property url uri
273@@ -50,6 +50,11 @@
274
275 onClicked: placeEntryModel.place.activate(decodeURIComponent(uri.toString()))
276
277+ ButtonBackground {
278+ anchors.fill: parent
279+ state: button.state
280+ }
281+
282 Image {
283 id: icon
284
285
286=== modified file 'places/UnityHorizontalTileRenderer.qml'
287--- places/UnityHorizontalTileRenderer.qml 2011-06-22 12:47:52 +0000
288+++ places/UnityHorizontalTileRenderer.qml 2011-08-23 17:40:25 +0000
289@@ -26,7 +26,7 @@
290 verticalSpacing: 10
291
292 cellRenderer: Component {
293- Button {
294+ AbstractButton {
295 id: button
296
297 property string uri
298@@ -68,6 +68,11 @@
299 onDrop: parent.pressed = false
300 }
301
302+ ButtonBackground {
303+ anchors.fill: parent
304+ state: button.state
305+ }
306+
307 Image {
308 id: icon
309
310
311=== modified file 'places/dash.qml'
312--- places/dash.qml 2011-08-23 15:00:31 +0000
313+++ places/dash.qml 2011-08-23 17:40:25 +0000
314@@ -232,7 +232,7 @@
315 }
316 }
317
318- Button {
319+ AbstractButton {
320 id: fullScreenButton
321 anchors.bottom: parent.bottom
322 anchors.right: parent.right

Subscribers

People subscribed via source and target branches