on xenial help sign in
Move Title under Icon.

Make title as a component in DashPreview so the previews can customize it.

commit4c43d6e262319cd613f7855b11bf5f30e2eb0789 authorYing-Chun Liu <paul.liu@canonical.com> dateWed 25 Sep 2013, 20:45 (13 years ago) parenta5a966b
4 files changed+87−63
Dash/Apps/AppPreview.qml+18−2 Dash/DashPreview.qml+28−59 Dash/Generic/GenericPreview.qml+23−1 Dash/Video/VideoPreview.qml+18−1
Dash/Apps/AppPreview.qml+18−2
@@ -26,8 +26,6 @@ DashPreview {
2626
2727 signal sendUserReview(string review)
2828
29− title: root.previewData.title
30−
3129 header: ListView {
3230 spacing: units.gu(1)
3331 orientation: ListView.Horizontal
@@ -57,6 +55,24 @@ DashPreview {
5755 }
5856 }
5957
58+ title: Label {
59+ id: title
60+ objectName: "titleLabel"
61+ anchors {
62+ left: parent.left
63+ right: parent.right
64+ }
65+
66+ elide: Text.ElideRight
67+ fontSize: "x-large"
68+ font.weight: Font.Light
69+ color: Theme.palette.selected.backgroundText
70+ opacity: 0.9
71+ text: root.previewData.title
72+ style: Text.Raised
73+ styleColor: "black"
74+ }
75+
6076 Component {
6177 id: buttonsComponent
6278
Dash/DashPreview.qml+28−59
@@ -23,10 +23,10 @@ Rectangle {
2323 property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
2424 property var previewData
2525
26− property string title: ""
2726 property real previewWidthRatio: 0.5
2827
2928 property Component header
29+ property Component title
3030 property Component buttons
3131 property Component body
3232
@@ -62,64 +62,39 @@ Rectangle {
6262 }
6363
6464 Item {
65− id: headerRow
66− height: units.gu(4)
65+ id: headerIcon
6766 anchors {
68− top: parent.top
6967 left: parent.left
7068 right: parent.right
71− margins: root.contentSpacing
69+ top: parent.top
70+ leftMargin: root.contentSpacing
71+ topMargin: root.contentSpacing
72+ rightMargin: root.contentSpacing
7273 }
73−
74− MouseArea {
75− anchors {
76− fill: parent
77− leftMargin: -root.contentSpacing
78− rightMargin: -root.contentSpacing
79− topMargin: -root.contentSpacing
80− }
81−
82− onClicked: root.close();
74+ height: childrenRect.height
75+ Loader {
76+ id: headerLoader
77+ anchors.left: parent.left
78+ anchors.right: parent.right
79+ sourceComponent: root.header
8380 }
81+ }
8482
85− Item {
86− id: labelItem
87− anchors {
88− fill: parent
89− rightMargin: closePreviewImage.width + spacing
90− }
91−
92− property int spacing: units.gu(2)
93−
94− Label {
95− id: title
96− objectName: "titleLabel"
97− anchors {
98− left: parent.left
99− right: parent.right
100− }
101−
102− elide: Text.ElideRight
103− fontSize: "x-large"
104− font.weight: Font.Light
105− color: Theme.palette.selected.backgroundText
106− opacity: 0.9
107− text: root.title
108− style: Text.Raised
109− styleColor: "black"
110− }
111− Image {
112− id: closePreviewImage
113− source: "graphics/tablet/icon_close_preview.png"
114− width: units.gu(4)
115− height: units.gu(1.5)
116− anchors {
117− bottom: title.bottom
118− bottomMargin: units.dp(7)
119− left: parent.left
120− leftMargin: title.paintedWidth + labelItem.spacing
121− }
122− }
83+ Item {
84+ id: headerRow
85+ height: childrenRect.height
86+ anchors {
87+ top: headerIcon.bottom
88+ left: parent.left
89+ right: parent.right
90+ leftMargin: root.contentSpacing
91+ rightMargin: root.contentSpacing
92+ }
93+ Loader {
94+ id: titleLoader
95+ anchors.left: parent.left
96+ anchors.right: parent.right
97+ sourceComponent: root.title
12398 }
12499 }
125100
@@ -157,12 +132,6 @@ Rectangle {
157132 height: childrenRect.height
158133 spacing: units.gu(1)
159134
160− Loader {
161− id: headerLoader
162− anchors.left: parent.left
163− anchors.right: parent.right
164− sourceComponent: root.header
165− }
166135 Loader {
167136 id: buttonLoader
168137 anchors.left: parent.left
Dash/Generic/GenericPreview.qml+23−1
@@ -23,7 +23,6 @@ import ".."
2323DashPreview {
2424 id: genericPreview
2525
26− title: previewData.title
2726 previewWidthRatio: 0.6
2827
2928 property url url: previewData.image
@@ -42,6 +41,28 @@ DashPreview {
4241 }
4342 }
4443
44+ title: Label {
45+ id: title
46+ objectName: "titleLabel"
47+ anchors {
48+ top: parent.top
49+ topMargin: units.gu(2)
50+ left: parent.left
51+ right: parent.right
52+ }
53+
54+ elide: Text.ElideRight
55+ fontSize: "x-large"
56+ font.weight: Font.Light
57+ color: Theme.palette.selected.backgroundText
58+ opacity: 0.9
59+ text: previewData.title
60+ style: Text.Raised
61+ styleColor: "black"
62+ maximumLineCount: 2
63+ wrapMode: Text.WordWrap
64+ }
65+
4566 buttons: GridView {
4667 id: buttons
4768 model: genericPreview.previewData.actions
@@ -69,6 +90,7 @@ DashPreview {
6990 }
7091 focus: false
7192 }
93+
7294 body: Column {
7395 spacing: units.gu(2)
7496
Dash/Video/VideoPreview.qml+18−1
@@ -33,7 +33,6 @@ DashPreview {
3333 source: item ? item.nfoUri : ""
3434 }
3535
36− title: nfo.ready ? nfo.video.title : ""
3736 previewWidthRatio: 0.6
3837
3938 onPreviewImageClicked: {
@@ -74,6 +73,24 @@ DashPreview {
7473 }
7574 }
7675
76+ title: Label {
77+ id: title
78+ objectName: "titleLabel"
79+ anchors {
80+ left: parent.left
81+ right: parent.right
82+ }
83+
84+ elide: Text.ElideRight
85+ fontSize: "x-large"
86+ font.weight: Font.Light
87+ color: Theme.palette.selected.backgroundText
88+ opacity: 0.9
89+ text: nfo.ready ? nfo.video.title : ""
90+ style: Text.Raised
91+ styleColor: "black"
92+ }
93+
7794 buttons: Row {
7895 spacing: units.gu(2)
7996