Merge lp:~paulliu/unity8/previewattribute20140918 into lp:unity8

Proposed by Ying-Chun Liu
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 1289
Merged at revision: 1326
Proposed branch: lp:~paulliu/unity8/previewattribute20140918
Merge into: lp:unity8
Diff against target: 65 lines (+17/-2)
2 files modified
qml/Dash/Previews/PreviewHeader.qml (+13/-0)
tests/qmltests/Dash/Previews/tst_PreviewHeader.qml (+4/-2)
To merge this branch: bzr merge lp:~paulliu/unity8/previewattribute20140918
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+236127@code.launchpad.net

Commit message

Add attributes to Preview.

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
No
 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
 * Did you make sure that your branch does not contain spurious tags?
Yes
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
No
 * If you changed the UI, has there been a design review?
Need a design review.

To post a comment you must log in.
Albert Astals Cid (aacid) wrote :

Not a fan of the hardcoded height/width we have in mascotShapeLoader but that was already there so it's not fair to ask you to change it with this.

* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
Passed as much as it can

 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve
1290. By Ying-Chun Liu on 2014-09-29

merge trunk

1291. By Ying-Chun Liu on 2014-10-02

merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Dash/Previews/PreviewHeader.qml'
2--- qml/Dash/Previews/PreviewHeader.qml 2014-09-18 07:23:35 +0000
3+++ qml/Dash/Previews/PreviewHeader.qml 2014-10-02 14:06:19 +0000
4@@ -16,12 +16,14 @@
5
6 import QtQuick 2.0
7 import Ubuntu.Components 0.1
8+import Dash 0.1
9 import "../"
10
11 /*! This preview widget shows a header
12 * The title comes in widgetData["title"]
13 * The mascot comes in widgetData["mascot"]
14 * The subtitle comes in widgetData["subtitle"]
15+ * The attributes comes in widgetData["attributes"]
16 */
17
18 PreviewWidget {
19@@ -35,6 +37,7 @@
20 readonly property url mascot: root.widgetData["mascot"] || ""
21 readonly property string title: root.widgetData["title"] || ""
22 readonly property string subtitle: root.widgetData["subtitle"] || ""
23+ readonly property var attributes: root.widgetData["attributes"] || null
24 readonly property color fontColor: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText
25
26 implicitHeight: row.height + row.margins * 2
27@@ -114,6 +117,16 @@
28 text: headerRoot.subtitle
29 }
30 }
31+
32+ Loader {
33+ active: titleLabel.text && headerRoot.attributes
34+ anchors { left: parent.left; right: parent.right }
35+ sourceComponent: CardAttributes {
36+ id: previewAttributes
37+ objectName: "previewAttributes"
38+ model: headerRoot.attributes
39+ }
40+ }
41 }
42 }
43 }
44
45=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewHeader.qml'
46--- tests/qmltests/Dash/Previews/tst_PreviewHeader.qml 2014-05-14 11:21:32 +0000
47+++ tests/qmltests/Dash/Previews/tst_PreviewHeader.qml 2014-10-02 14:06:19 +0000
48@@ -27,13 +27,15 @@
49 property var origHeaderjson: {
50 "title": "THE TITLE",
51 "subtitle": "Something catchy",
52- "mascot": "../graphics/play_button.png"
53+ "mascot": "../graphics/play_button.png",
54+ "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}]
55 }
56
57 property var headerjson: {
58 "title": "THE TITLE",
59 "subtitle": "Something catchy",
60- "mascot": "../graphics/play_button.png"
61+ "mascot": "../graphics/play_button.png",
62+ "attributes": [{"value":"text1","icon":"image://theme/ok"},{"value":"text2","icon":"image://theme/cancel"}]
63 }
64
65 PreviewHeader {

Subscribers

People subscribed via source and target branches