on xenial help sign in
fix header
c4f0dc1Michael Zanetti
Dash/Generic/GenericPreview.qml+10−10
@@ -28,7 +28,7 @@ DashPreview {
28
28
29 previewImages: previewImagesComponent
29 previewImages: previewImagesComponent
30 header: headerComponent
30 header: headerComponent
31− actions: root.previewData.infoMap["show_progressbar"] ? progressComponent : actionsComponent
31+ actions: previewData.infoMap["show_progressbar"] ? progressComponent : actionsComponent
32 description: descriptionComponent
32 description: descriptionComponent
33
33
34 Component {
34 Component {
@@ -53,10 +53,10 @@ DashPreview {
53 id: headerComponent
53 id: headerComponent
54 Header {
54 Header {
55 title: previewData.title
55 title: previewData.title
56− rating: Math.round(root.previewData.rating * 10)
56+ rating: Math.round(previewData.rating * 10)
57 subtitle: previewData.subtitle.replace(/[\r\n]+/g, "<br />")
57 subtitle: previewData.subtitle.replace(/[\r\n]+/g, "<br />")
58− reviews: root.previewData.numRatings
58+ reviews: previewData.numRatings
59− rated: root.previewData.infoMap["rated"] ? root.previewData.infoMap["rated"].value : 0
59+ rated: previewData.infoMap["rated"] ? previewData.infoMap["rated"].value : 0
60 }
60 }
61 }
61 }
62
62
@@ -68,7 +68,7 @@ DashPreview {
68 objectName: "buttonList"
68 objectName: "buttonList"
69 spacing: units.gu(1)
69 spacing: units.gu(1)
70 Repeater {
70 Repeater {
71− model: root.previewData.actions
71+ model: previewData.actions
72
72
73 delegate: Button {
73 delegate: Button {
74 width: parent.width
74 width: parent.width
@@ -77,7 +77,7 @@ DashPreview {
77 text: modelData.displayName
77 text: modelData.displayName
78 iconSource: modelData.iconHint
78 iconSource: modelData.iconHint
79 iconPosition: "right"
79 iconPosition: "right"
80− onClicked: root.previewData.execute(modelData.id, { })
80+ onClicked: previewData.execute(modelData.id, { })
81 }
81 }
82 }
82 }
83 }
83 }
@@ -93,11 +93,11 @@ DashPreview {
93 maximumValue: 100
93 maximumValue: 100
94 height: units.gu(5)
94 height: units.gu(5)
95
95
96− property var model: root.previewData.actions
96+ property var model: previewData.actions
97
97
98 DownloadTracker {
98 DownloadTracker {
99 service: "com.canonical.applications.Downloader"
99 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 : ""
101
101
102 onProgress: {
102 onProgress: {
103 var percentage = parseInt(received * 100 / total);
103 var percentage = parseInt(received * 100 / total);
@@ -105,11 +105,11 @@ DashPreview {
105 }
105 }
106
106
107 onFinished: {
107 onFinished: {
108− root.previewData.execute(progressBar.model[0].id, { })
108+ previewData.execute(progressBar.model[0].id, { })
109 }
109 }
110
110
111 onError: {
111 onError: {
112− root.previewData.execute(progressBar.model[1].id, { "error": error });
112+ previewData.execute(progressBar.model[1].id, { "error": error });
113 }
113 }
114 }
114 }
115
115
Dash/Movie/MoviePreview.qml+3−42
@@ -29,8 +29,6 @@ GenericPreview {
29
29
30 previewImages: previewImageComponent
30 previewImages: previewImageComponent
31 header: headerComponent
31 header: headerComponent
32− actions: actionsComponent
33− ratings: ratingsComponent
34
32
35 Component {
33 Component {
36 id: previewImageComponent
34 id: previewImageComponent
@@ -71,46 +69,9 @@ GenericPreview {
71 id: headerComponent
69 id: headerComponent
72 Header {
70 Header {
73 title: previewData.title
71 title: previewData.title
74− rating: Math.round(root.previewData.rating * 10)
72+ rating: Math.round(previewData.rating * 10)
75− reviews: root.previewData.numRatings
73+ reviews: previewData.numRatings
76− rated: root.previewData.infoMap["rated"] ? root.previewData.infoMap["rated"].value : 0
74+ rated: previewData.infoMap["rated"] ? 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
114 }
75 }
115 }
76 }
116}
77}
Dash/Previews/Header.qml+2
@@ -28,6 +28,7 @@ Row {
28 property int reviews: 0
28 property int reviews: 0
29
29
30 spacing: units.gu(2)
30 spacing: units.gu(2)
31+ height: imageShape.visible ? imageShape.height : contentColumn.height
31
32
32 UbuntuShape {
33 UbuntuShape {
33 id: imageShape
34 id: imageShape
@@ -45,6 +46,7 @@ Row {
45 Column {
46 Column {
46 id: contentColumn
47 id: contentColumn
47 spacing: units.gu(1)
48 spacing: units.gu(1)
49+ width: parent.width - x
48
50
49 Label {
51 Label {
50 id: titleLabel
52 id: titleLabel