on xenial help sign in
fix header
commitc4f0dc176ec732d00e58fba278a5d5d362266e3d authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 1 Oct 2013, 19:49 (13 years ago) parentc7b2c49
3 files changed+15−52
Dash/Generic/GenericPreview.qml+10−10 Dash/Movie/MoviePreview.qml+3−42 Dash/Previews/Header.qml+2
Dash/Generic/GenericPreview.qml+10−10
@@ -28,7 +28,7 @@ DashPreview {
2828
2929 previewImages: previewImagesComponent
3030 header: headerComponent
31− actions: root.previewData.infoMap["show_progressbar"] ? progressComponent : actionsComponent
31+ actions: previewData.infoMap["show_progressbar"] ? progressComponent : actionsComponent
3232 description: descriptionComponent
3333
3434 Component {
@@ -53,10 +53,10 @@ DashPreview {
5353 id: headerComponent
5454 Header {
5555 title: previewData.title
56− rating: Math.round(root.previewData.rating * 10)
56+ rating: Math.round(previewData.rating * 10)
5757 subtitle: previewData.subtitle.replace(/[\r\n]+/g, "<br />")
58− reviews: root.previewData.numRatings
59− rated: root.previewData.infoMap["rated"] ? root.previewData.infoMap["rated"].value : 0
58+ reviews: previewData.numRatings
59+ rated: previewData.infoMap["rated"] ? previewData.infoMap["rated"].value : 0
6060 }
6161 }
6262
@@ -68,7 +68,7 @@ DashPreview {
6868 objectName: "buttonList"
6969 spacing: units.gu(1)
7070 Repeater {
71− model: root.previewData.actions
71+ model: previewData.actions
7272
7373 delegate: Button {
7474 width: parent.width
@@ -77,7 +77,7 @@ DashPreview {
7777 text: modelData.displayName
7878 iconSource: modelData.iconHint
7979 iconPosition: "right"
80− onClicked: root.previewData.execute(modelData.id, { })
80+ onClicked: previewData.execute(modelData.id, { })
8181 }
8282 }
8383 }
@@ -93,11 +93,11 @@ DashPreview {
9393 maximumValue: 100
9494 height: units.gu(5)
9595
96− property var model: root.previewData.actions
96+ property var model: previewData.actions
9797
9898 DownloadTracker {
9999 service: "com.canonical.applications.Downloader"
100− dbusPath: root.previewData.infoMap["progressbar_source"] ? root.previewData.infoMap["progressbar_source"].value : ""
100+ dbusPath: previewData.infoMap["progressbar_source"] ? previewData.infoMap["progressbar_source"].value : ""
101101
102102 onProgress: {
103103 var percentage = parseInt(received * 100 / total);
@@ -105,11 +105,11 @@ DashPreview {
105105 }
106106
107107 onFinished: {
108− root.previewData.execute(progressBar.model[0].id, { })
108+ previewData.execute(progressBar.model[0].id, { })
109109 }
110110
111111 onError: {
112− root.previewData.execute(progressBar.model[1].id, { "error": error });
112+ previewData.execute(progressBar.model[1].id, { "error": error });
113113 }
114114 }
115115
Dash/Movie/MoviePreview.qml+3−42
@@ -29,8 +29,6 @@ GenericPreview {
2929
3030 previewImages: previewImageComponent
3131 header: headerComponent
32− actions: actionsComponent
33− ratings: ratingsComponent
3432
3533 Component {
3634 id: previewImageComponent
@@ -71,46 +69,9 @@ GenericPreview {
7169 id: headerComponent
7270 Header {
7371 title: previewData.title
74− rating: Math.round(root.previewData.rating * 10)
75− reviews: root.previewData.numRatings
76− rated: root.previewData.infoMap["rated"] ? root.previewData.infoMap["rated"].value : 0
77− }
78− }
79−
80− Component {
81− id: actionsComponent
82− GridView {
83− id: buttons
84− objectName: "gridButtons"
85− model: root.previewData.actions
86− interactive: false
87−
88− anchors.left: parent.left
89− anchors.right: parent.right
90−
91− property int numOfRows: (count + numOfColumns - 1) / numOfColumns
92− property int numOfColumns: Math.max(1, Math.floor(width / (buttonWidth + spacing)))
93− property int spacing: units.gu(1)
94− height: Math.max(units.gu(4), units.gu(4)*numOfRows + spacing*(numOfRows - 1))
95−
96− cellWidth: width / buttons.numOfColumns
97− cellHeight: buttonHeight + buttons.spacing
98− property int buttonWidth: units.gu(17) - spacing
99− property int buttonHeight: units.gu(4)
100−
101− delegate: Button {
102− width: Math.max(units.gu(4), buttons.buttonWidth)
103− height: buttons.buttonHeight
104− color: "#dd4814"
105− text: modelData.displayName
106− iconSource: modelData.iconHint
107− iconPosition: "right"
108− visible: true
109− onClicked: {
110− root.previewData.execute(modelData.id, { })
111− }
112− }
113− focus: false
72+ rating: Math.round(previewData.rating * 10)
73+ reviews: previewData.numRatings
74+ rated: previewData.infoMap["rated"] ? previewData.infoMap["rated"].value : 0
11475 }
11576 }
11677}
Dash/Previews/Header.qml+2
@@ -28,6 +28,7 @@ Row {
2828 property int reviews: 0
2929
3030 spacing: units.gu(2)
31+ height: imageShape.visible ? imageShape.height : contentColumn.height
3132
3233 UbuntuShape {
3334 id: imageShape
@@ -45,6 +46,7 @@ Row {
4546 Column {
4647 id: contentColumn
4748 spacing: units.gu(1)
49+ width: parent.width - x
4850
4951 Label {
5052 id: titleLabel