Merge lp:~cimi/unity8/dash-filtergrid-renderers into lp:unity8

Proposed by Andrea Cimitan
Status: Superseded
Proposed branch: lp:~cimi/unity8/dash-filtergrid-renderers
Merge into: lp:unity8
Prerequisite: lp:~mhr3/unity8/expose-renderer-hint
Diff against target: 450 lines (+301/-66)
9 files modified
Components/Tile.qml (+6/-63)
Components/TileStyle.qml (+87/-0)
Dash/Apps/DashPluginFilterGrid.qml (+50/-0)
Dash/Generic/FlatTileStyle.qml (+90/-0)
Dash/Generic/GenericFilterGrid.qml (+0/-2)
Dash/Generic/WeatherFilterGrid.qml (+47/-0)
Dash/GenericScopeView.qml (+7/-0)
plugins/Unity/categoryresults.cpp (+12/-0)
plugins/Unity/categoryresults.h (+2/-1)
To merge this branch: bzr merge lp:~cimi/unity8/dash-filtergrid-renderers
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+189128@code.launchpad.net

This proposal has been superseded by a proposal from 2013-10-03.

Commit message

Make Tile themeable, add renderers for Dash Plugins and weather

Description of the change

Make Tile themeable, add renderers for Dash Plugins and weather

To post a comment you must log in.
377. By Andrea Cimitan

Add fixme

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Components/Tile.qml'
2--- Components/Tile.qml 2013-08-05 15:02:05 +0000
3+++ Components/Tile.qml 2013-10-03 16:28:24 +0000
4@@ -18,70 +18,13 @@
5 import Ubuntu.Components 0.1
6
7 AbstractButton {
8- id: root
9- property alias source: image.source
10- property alias fillMode: image.fillMode
11- property alias horizontalAlignment: image.horizontalAlignment
12- property alias verticalAlignment: image.verticalAlignment
13- property alias text: label.text
14+ property url source
15+ property int fillMode
16+ property int horizontalAlignment
17+ property int verticalAlignment
18+ property string text
19 property int imageWidth
20 property int imageHeight
21
22- UbuntuShape {
23- id: icon
24- anchors {
25- top: parent.top
26- horizontalCenter: parent.horizontalCenter
27- }
28- radius: "medium"
29- width: imageWidth
30- height: imageHeight
31- image: Image {
32- id: image
33- objectName: "image"
34- sourceSize { width: icon.width; height: icon.height }
35- asynchronous: true
36- cache: false
37- }
38- }
39-
40- UbuntuShape {
41- id: borderPressed
42- objectName: "borderPressed"
43-
44- anchors.fill: icon
45- radius: "medium"
46- borderSource: "radius_pressed.sci"
47- opacity: root.pressed ? 1.0 : 0.0
48- Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
49- }
50-
51- Item {
52- anchors {
53- left: parent.left
54- right: parent.right
55- top: icon.bottom
56- }
57- height: units.gu(2)
58-
59- Label {
60- id: label
61- objectName: "label"
62- anchors {
63- baseline: parent.bottom
64- left: parent.left
65- right: parent.right
66- leftMargin: units.gu(1)
67- rightMargin: units.gu(1)
68- }
69-
70- color: Theme.palette.selected.backgroundText
71- opacity: 0.9
72- style: Text.Raised
73- styleColor: "black"
74- fontSize: "small"
75- elide: Text.ElideMiddle
76- horizontalAlignment: Text.AlignHCenter
77- }
78- }
79+ style: TileStyle {}
80 }
81
82=== added file 'Components/TileStyle.qml'
83--- Components/TileStyle.qml 1970-01-01 00:00:00 +0000
84+++ Components/TileStyle.qml 2013-10-03 16:28:24 +0000
85@@ -0,0 +1,87 @@
86+/*
87+ * Copyright (C) 2013 Canonical, Ltd.
88+ *
89+ * This program is free software; you can redistribute it and/or modify
90+ * it under the terms of the GNU General Public License as published by
91+ * the Free Software Foundation; version 3.
92+ *
93+ * This program is distributed in the hope that it will be useful,
94+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
95+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96+ * GNU General Public License for more details.
97+ *
98+ * You should have received a copy of the GNU General Public License
99+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
100+ */
101+
102+import QtQuick 2.0
103+import Ubuntu.Components 0.1
104+
105+Item {
106+ id: tile
107+
108+ anchors.fill: parent
109+
110+ UbuntuShape {
111+ id: icon
112+ anchors {
113+ top: parent.top
114+ horizontalCenter: parent.horizontalCenter
115+ }
116+ radius: "medium"
117+ width: styledItem.imageWidth
118+ height: styledItem.imageHeight
119+ image: Image {
120+ id: image
121+ objectName: "image"
122+ sourceSize { width: icon.width; height: icon.height }
123+ asynchronous: true
124+ cache: false
125+ source: styledItem.source
126+ fillMode: styledItem.fillMode
127+ horizontalAlignment: styledItem.horizontalAlignment
128+ verticalAlignment: styledItem.verticalAlignment
129+ }
130+ }
131+
132+ UbuntuShape {
133+ id: borderPressed
134+ objectName: "borderPressed"
135+
136+ anchors.fill: icon
137+ radius: "medium"
138+ borderSource: "radius_pressed.sci"
139+ opacity: styledItem.pressed ? 1.0 : 0.0
140+ Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
141+ }
142+
143+ Item {
144+ anchors {
145+ left: parent.left
146+ right: parent.right
147+ top: icon.bottom
148+ }
149+ height: units.gu(2)
150+
151+ Label {
152+ id: label
153+ objectName: "label"
154+ anchors {
155+ baseline: parent.bottom
156+ left: parent.left
157+ right: parent.right
158+ leftMargin: units.gu(1)
159+ rightMargin: units.gu(1)
160+ }
161+
162+ color: Theme.palette.selected.backgroundText
163+ opacity: 0.9
164+ style: Text.Raised
165+ styleColor: "black"
166+ fontSize: "small"
167+ elide: Text.ElideMiddle
168+ horizontalAlignment: Text.AlignHCenter
169+ text: styledItem.text
170+ }
171+ }
172+}
173
174=== added file 'Dash/Apps/DashPluginFilterGrid.qml'
175--- Dash/Apps/DashPluginFilterGrid.qml 1970-01-01 00:00:00 +0000
176+++ Dash/Apps/DashPluginFilterGrid.qml 2013-10-03 16:28:24 +0000
177@@ -0,0 +1,50 @@
178+/*
179+ * Copyright (C) 2013 Canonical, Ltd.
180+ *
181+ * This program is free software; you can redistribute it and/or modify
182+ * it under the terms of the GNU General Public License as published by
183+ * the Free Software Foundation; version 3.
184+ *
185+ * This program is distributed in the hope that it will be useful,
186+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
187+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
188+ * GNU General Public License for more details.
189+ *
190+ * You should have received a copy of the GNU General Public License
191+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
192+ */
193+
194+import QtQuick 2.0
195+import Ubuntu.Components 0.1
196+import "../../Components"
197+import "../Generic"
198+
199+GenericFilterGrid {
200+ id: filtergrid
201+
202+ delegate: Tile {
203+ id: tile
204+ objectName: "delegate" + index
205+ width: filtergrid.cellWidth
206+ height: filtergrid.cellHeight
207+ text: model.title
208+ imageWidth: filtergrid.iconWidth
209+ imageHeight: filtergrid.iconHeight
210+ source: model.icon
211+ fillMode: Image.PreserveAspectCrop
212+
213+ style: FlatTileStyle {
214+ disabled: model.scopeDisabled
215+ }
216+
217+ onClicked: {
218+ var data = { model: model }
219+ filtergrid.clicked(index, data, tile.y)
220+ }
221+
222+ onPressAndHold: {
223+ var data = { model: model }
224+ filtergrid.pressAndHold(index, data, tile.y)
225+ }
226+ }
227+}
228
229=== added file 'Dash/Generic/FlatTileStyle.qml'
230--- Dash/Generic/FlatTileStyle.qml 1970-01-01 00:00:00 +0000
231+++ Dash/Generic/FlatTileStyle.qml 2013-10-03 16:28:24 +0000
232@@ -0,0 +1,90 @@
233+/*
234+ * Copyright (C) 2013 Canonical, Ltd.
235+ *
236+ * This program is free software; you can redistribute it and/or modify
237+ * it under the terms of the GNU General Public License as published by
238+ * the Free Software Foundation; version 3.
239+ *
240+ * This program is distributed in the hope that it will be useful,
241+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
242+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
243+ * GNU General Public License for more details.
244+ *
245+ * You should have received a copy of the GNU General Public License
246+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
247+ */
248+
249+import QtQuick 2.0
250+import Ubuntu.Components 0.1
251+
252+Item {
253+ id: tile
254+
255+ property bool disabled: false
256+
257+ anchors.fill: parent
258+
259+ Item {
260+ id: icon
261+ anchors {
262+ top: parent.top
263+ horizontalCenter: parent.horizontalCenter
264+ }
265+ width: styledItem.imageWidth
266+ height: styledItem.imageHeight
267+
268+ Image {
269+ id: image
270+ objectName: "image"
271+ sourceSize { width: icon.width; height: icon.height }
272+ asynchronous: true
273+ cache: false
274+ source: styledItem.source
275+ fillMode: styledItem.fillMode
276+ opacity: tile.disabled ? 0.5 : 1.0
277+ horizontalAlignment: styledItem.horizontalAlignment
278+ verticalAlignment: styledItem.verticalAlignment
279+ }
280+ }
281+
282+ UbuntuShape {
283+ id: borderPressed
284+ objectName: "borderPressed"
285+
286+ anchors.fill: icon
287+ radius: "medium"
288+ borderSource: "radius_pressed.sci"
289+ opacity: styledItem.pressed ? 1.0 : 0.0
290+ Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuint } }
291+ }
292+
293+ Item {
294+ anchors {
295+ left: parent.left
296+ right: parent.right
297+ top: icon.bottom
298+ }
299+ height: units.gu(2)
300+
301+ Label {
302+ id: label
303+ objectName: "label"
304+ anchors {
305+ baseline: parent.bottom
306+ left: parent.left
307+ right: parent.right
308+ leftMargin: units.gu(1)
309+ rightMargin: units.gu(1)
310+ }
311+
312+ color: Theme.palette.selected.backgroundText
313+ opacity: 0.9
314+ style: Text.Raised
315+ styleColor: "black"
316+ fontSize: "small"
317+ elide: Text.ElideMiddle
318+ horizontalAlignment: Text.AlignHCenter
319+ text: styledItem.text
320+ }
321+ }
322+}
323
324=== modified file 'Dash/Generic/GenericFilterGrid.qml'
325--- Dash/Generic/GenericFilterGrid.qml 2013-09-05 10:02:00 +0000
326+++ Dash/Generic/GenericFilterGrid.qml 2013-10-03 16:28:24 +0000
327@@ -39,9 +39,7 @@
328 text: model.title
329 imageWidth: filtergrid.iconWidth
330 imageHeight: filtergrid.iconHeight
331-
332 source: model.icon
333-
334 fillMode: Image.PreserveAspectCrop
335
336 onClicked: {
337
338=== added file 'Dash/Generic/WeatherFilterGrid.qml'
339--- Dash/Generic/WeatherFilterGrid.qml 1970-01-01 00:00:00 +0000
340+++ Dash/Generic/WeatherFilterGrid.qml 2013-10-03 16:28:24 +0000
341@@ -0,0 +1,47 @@
342+/*
343+ * Copyright (C) 2013 Canonical, Ltd.
344+ *
345+ * This program is free software; you can redistribute it and/or modify
346+ * it under the terms of the GNU General Public License as published by
347+ * the Free Software Foundation; version 3.
348+ *
349+ * This program is distributed in the hope that it will be useful,
350+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
351+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
352+ * GNU General Public License for more details.
353+ *
354+ * You should have received a copy of the GNU General Public License
355+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
356+ */
357+
358+import QtQuick 2.0
359+import Ubuntu.Components 0.1
360+import "../../Components"
361+
362+GenericFilterGrid {
363+ id: filtergrid
364+
365+ delegate: Tile {
366+ id: tile
367+ objectName: "delegate" + index
368+ width: filtergrid.cellWidth
369+ height: filtergrid.cellHeight
370+ text: model.title
371+ imageWidth: filtergrid.iconWidth
372+ imageHeight: filtergrid.iconHeight
373+ source: model.icon
374+ fillMode: Image.PreserveAspectCrop
375+
376+ style: FlatTileStyle {}
377+
378+ onClicked: {
379+ var data = { model: model }
380+ filtergrid.clicked(index, data, tile.y)
381+ }
382+
383+ onPressAndHold: {
384+ var data = { model: model }
385+ filtergrid.pressAndHold(index, data, tile.y)
386+ }
387+ }
388+}
389
390=== modified file 'Dash/GenericScopeView.qml'
391--- Dash/GenericScopeView.qml 2013-10-03 16:28:24 +0000
392+++ Dash/GenericScopeView.qml 2013-10-03 16:28:24 +0000
393@@ -209,6 +209,13 @@
394 switch (contentType) {
395 case "video": return "Generic/GenericFilterGridPotrait.qml";
396 case "music": return "Music/MusicFilterGrid.qml";
397+ case "apps": {
398+ if (rendererHint == "toggled")
399+ return "Apps/DashPluginFilterGrid.qml";
400+ else
401+ return "Generic/GenericFilterGrid.qml";
402+ }
403+ case "weather": return "Generic/WeatherFilterGrid.qml";
404 default: return "Generic/GenericFilterGrid.qml";
405 }
406 }
407
408=== modified file 'plugins/Unity/categoryresults.cpp'
409--- plugins/Unity/categoryresults.cpp 2013-10-01 15:46:09 +0000
410+++ plugins/Unity/categoryresults.cpp 2013-10-03 16:28:24 +0000
411@@ -46,6 +46,7 @@
412 m_roles[CategoryResults::RoleComment] = "comment";
413 m_roles[CategoryResults::RoleDndUri] = "dndUri";
414 m_roles[CategoryResults::RoleMetadata] = "metadata";
415+ m_roles[CategoryResults::RoleMetadataScopeDisabled] = "scopeDisabled";
416 }
417
418 int CategoryResults::categoryIndex() const
419@@ -100,6 +101,17 @@
420 return DeeListModel::data(index, ResultsColumn::DND_URI);
421 case RoleMetadata:
422 return DeeListModel::data(index, ResultsColumn::METADATA);
423+ // FIXME nasty hack while we don't support annotated icons
424+ case RoleMetadataScopeDisabled: {
425+ QVariantHash hash(DeeListModel::data(index, ResultsColumn::METADATA).toHash());
426+ if (hash.contains("content")) {
427+ QVariantHash innerHash(hash["content"].toHash());
428+ if (innerHash.contains("scope_disabled")) {
429+ return innerHash["scope_disabled"];
430+ }
431+ }
432+ return QVariant();
433+ }
434 default:
435 return QVariant();
436 }
437
438=== modified file 'plugins/Unity/categoryresults.h'
439--- plugins/Unity/categoryresults.h 2013-09-05 11:48:57 +0000
440+++ plugins/Unity/categoryresults.h 2013-10-03 16:28:24 +0000
441@@ -43,7 +43,8 @@
442 RoleTitle,
443 RoleComment,
444 RoleDndUri,
445- RoleMetadata
446+ RoleMetadata,
447+ RoleMetadataScopeDisabled
448 };
449
450 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;

Subscribers

People subscribed via source and target branches