on xenial help sign in
various tweaks to fonts inside previews

Approved by: Albert Astals Cid

commitf91b0837a734c3acd95ff27216457369f5bf3471 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateWed 9 Nov 2016, 15:04 (10 years ago) parent75d3855f29d912
11 files changed+40−22
qml/Dash/Previews/PreviewAudioPlayback.qml+3−1 qml/Dash/Previews/PreviewComment.qml+3 qml/Dash/Previews/PreviewHeader.qml+5−3 qml/Dash/Previews/PreviewIconActions.qml+1 qml/Dash/Previews/PreviewRatingInput.qml+1 qml/Dash/Previews/PreviewRatingSingleDisplay.qml+12−9 qml/Dash/Previews/PreviewTable.qml+2−1 qml/Dash/Previews/PreviewTextSummary.qml+7−2 tests/qmltests/Dash/Previews/tst_Preview.qml+3−3 tests/qmltests/Dash/Previews/tst_PreviewHeader.qml+1−1 tests/qmltests/Dash/Previews/tst_PreviewTextSummary.qml+2−2
qml/Dash/Previews/PreviewAudioPlayback.qml+3−1
@@ -105,7 +105,8 @@ PreviewWidget {
105105 anchors { top: parent.top; left: parent.left; right: parent.right }
106106 opacity: 0.9
107107 color: scopeStyle ? scopeStyle.foreground : theme.palette.normal.baseText
108− fontSize: "small"
108+ fontSize: "medium"
109+ font.weight: Font.Light
109110 horizontalAlignment: Text.AlignLeft
110111 text: modelData["title"]
111112 elide: Text.ElideRight
@@ -140,6 +141,7 @@ PreviewWidget {
140141 opacity: 0.9
141142 color: scopeStyle ? scopeStyle.foreground : theme.palette.normal.baseText
142143 fontSize: "small"
144+ font.weight: Font.Light
143145 horizontalAlignment: Text.AlignRight
144146 text: DashAudioPlayer.lengthToString(modelData["length"])
145147 }
qml/Dash/Previews/PreviewComment.qml+3
@@ -41,6 +41,7 @@ PreviewWidget {
4141 source: widgetData["source"]
4242 }
4343 radius: "medium"
44+ aspect: UbuntuShape.Flat
4445 opacity: source.status === Image.Ready ? 1 : 0
4546 visible: widgetData["source"] !== ""
4647 }
@@ -70,6 +71,7 @@ PreviewWidget {
7071 visible: text !== ""
7172 text: widgetData["subtitle"] || ""
7273 fontSize: "xx-small"
74+ font.weight: Font.Light
7375 maximumLineCount: 1
7476 elide: Text.ElideRight
7577 }
@@ -77,6 +79,7 @@ PreviewWidget {
7779 width: parent.width
7880 text: widgetData["comment"] || ""
7981 fontSize: "small"
82+ font.weight: Font.Light
8083 wrapMode: Text.Wrap
8184 }
8285 }
qml/Dash/Previews/PreviewHeader.qml+5−3
@@ -60,7 +60,8 @@ PreviewWidget {
6060 anchors {
6161 top: parent.top; left: parent.left; right: parent.right
6262 margins: margins
63− leftMargin: spacing
63+ topMargin: 0
64+ leftMargin: 0
6465 rightMargin: spacing
6566 }
6667
@@ -83,6 +84,7 @@ PreviewWidget {
8384 sourceFillMode: UbuntuShape.PreserveAspectCrop
8485 sourceHorizontalAlignment: UbuntuShape.AlignHCenter
8586 sourceVerticalAlignment: UbuntuShape.AlignVCenter
87+ aspect: UbuntuShape.Flat
8688 source: Image {
8789 source: headerRoot.mascot
8890 width: source ? mascotShapeLoader.width : 0
@@ -113,8 +115,8 @@ PreviewWidget {
113115 rightMargin: iconLoader.width > 0 ? units.gu(0.5) : 0
114116 }
115117 elide: Text.ElideRight
116− font.weight: Font.Normal
117118 fontSize: "large"
119+ font.weight: Font.Light
118120 wrapMode: Text.Wrap
119121 color: headerRoot.fontColor
120122 text: headerRoot.title
@@ -145,7 +147,7 @@ PreviewWidget {
145147 id: subtitleLabel
146148 objectName: "subtitleLabel"
147149 elide: Text.ElideRight
148− fontSize: "small"
150+ fontSize: "x-small"
149151 font.weight: Font.Light
150152 color: headerRoot.fontColor
151153 text: headerRoot.subtitle
qml/Dash/Previews/PreviewIconActions.qml+1
@@ -71,6 +71,7 @@ PreviewWidget {
7171 anchors.left: icon.right
7272 anchors.leftMargin: visible ? units.gu(0.5) : 0
7373 text: modelData.label
74+ font.weight: Font.Light
7475 visible: text !== ""
7576 }
7677
qml/Dash/Previews/PreviewRatingInput.qml+1
@@ -103,6 +103,7 @@ PreviewWidget {
103103 objectName: "ratingLabel"
104104 anchors { left: parent.left; right: parent.right; }
105105 fontSize: "large"
106+ font.weight: Font.Light
106107 color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText
107108 opacity: .8
108109 text: widgetData["rating-label"] || i18n.tr("Rate this")
qml/Dash/Previews/PreviewRatingSingleDisplay.qml+12−9
@@ -30,6 +30,16 @@ Column {
3030 property alias urlIconHalf: ratingItem.urlIconHalf
3131 property alias labelColor: authorLabel.color
3232
33+ Label {
34+ id: authorLabel
35+ objectName: "authorLabel"
36+ anchors { left: parent.left; right: parent.right }
37+ opacity: .8
38+ fontSize: "small"
39+ visible: text !== ""
40+ wrapMode: Text.Wrap
41+ }
42+
3343 Rating {
3444 id: ratingItem
3545 objectName: "rating"
@@ -42,21 +52,14 @@ Column {
4252 property var urlIconHalf
4353 }
4454
45− Label {
46− id: authorLabel
47− objectName: "authorLabel"
48− anchors { left: parent.left; right: parent.right }
49− opacity: .8
50− visible: text !== ""
51− wrapMode: Text.Wrap
52− }
53−
5455 Label {
5556 id: reviewLabel
5657 objectName: "reviewLabel"
5758 anchors { left: parent.left; right: parent.right }
5859 color: authorLabel.color
5960 opacity: .8
61+ fontSize: "x-small"
62+ font.weight: Font.Light
6063 visible: text !== ""
6164 wrapMode: Text.Wrap
6265 }
qml/Dash/Previews/PreviewTable.qml+2−1
@@ -48,6 +48,7 @@ PreviewWidget {
4848 }
4949 height: visible ? implicitHeight : 0
5050 fontSize: "large"
51+ font.weight: Font.Light
5152 color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText
5253 visible: text !== ""
5354 opacity: .8
@@ -73,7 +74,7 @@ PreviewWidget {
7374 text: perRowRepeater.model[index]
7475 visible: root.expanded || rowIndex < maximumCollapsedRowCount
7576 color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText
76− font.bold: index == 0
77+ font.weight: index == 0 ? Font.Normal : Font.Light
7778 wrapMode: Text.Wrap
7879 Layout.alignment: Qt.AlignTop
7980 Layout.maximumWidth: column.width - x
qml/Dash/Previews/PreviewTextSummary.qml+7−2
@@ -39,6 +39,7 @@ PreviewWidget {
3939 }
4040 height: visible ? implicitHeight : 0
4141 fontSize: "large"
42+ font.weight: Font.Light
4243 color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText
4344 visible: text !== ""
4445 opacity: .8
@@ -56,17 +57,21 @@ PreviewWidget {
5657 left: parent.left
5758 right: parent.right
5859 top: titleLabel.visible ? titleLabel.bottom : parent.top
60+ topMargin: titleLabel.visible && visible ? units.gu(1.5) : 0
5961 }
60− height: (lineCount <= maximumCollapsedLineCount || root.expanded) ? contentHeight : contentHeight / lineCount * maximumCollapsedLineCount
62+ height: visible ? (lineCount <= maximumCollapsedLineCount || root.expanded) ? contentHeight : contentHeight / lineCount * maximumCollapsedLineCount : 0
6163 clip: true
62− fontSize: "small"
64+ fontSize: "medium"
65+ font.weight: Font.Light
6366 lineHeight: 1.2
6467 color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText
68+ visible: text !== ""
6569 opacity: .8
6670 text: widgetData["text"] || ""
6771 wrapMode: Text.Wrap
6872
6973 Behavior on height {
74+ enabled: textLabel.lineCount > textLabel.maximumCollapsedLineCount
7075 UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration }
7176 }
7277 }
tests/qmltests/Dash/Previews/tst_Preview.qml+3−3
@@ -87,7 +87,7 @@ Rectangle {
8787
8888 tryCompareFunction(function () {
8989 var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
90− return bottomLeft.y <= preview.height
90+ return bottomLeft.y <= preview.height + 1 // FIXME the +1 is to workaround https://bugreports.qt.io/browse/QTBUG-56961
9191 }, true);
9292 }
9393
@@ -102,7 +102,7 @@ Rectangle {
102102
103103 tryCompareFunction(function () {
104104 var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
105− return bottomLeft.y <= preview.height
105+ return bottomLeft.y <= preview.height + 1 // FIXME the +1 is to workaround https://bugreports.qt.io/browse/QTBUG-56961
106106 }, true);
107107 }
108108
@@ -125,7 +125,7 @@ Rectangle {
125125 // Make sure the combo bottom is on the viewport
126126 tryCompareFunction(function () {
127127 var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
128− return bottomLeft.y <= preview.height
128+ return bottomLeft.y <= preview.height + 1 // FIXME the +1 is to workaround https://bugreports.qt.io/browse/QTBUG-56961
129129 }, true);
130130 }
131131 }
tests/qmltests/Dash/Previews/tst_PreviewHeader.qml+1−1
@@ -123,7 +123,7 @@ Rectangle {
123123
124124 function test_dimensions_data() {
125125 return [
126− { tag: "Column width with mascot", object: column, width: previewHeader.width - mascotShapeLoader.width - outerRow.margins * 3, mascot: "artwork/avatar.png" },
126+ { tag: "Column width with mascot", object: column, width: previewHeader.width - mascotShapeLoader.width - outerRow.margins * 2, mascot: "artwork/avatar.png" },
127127 { tag: "Header height", object: previewHeader, height: function() { return outerRow.height + outerRow.margins * 2 } },
128128 ]
129129 }
tests/qmltests/Dash/Previews/tst_PreviewTextSummary.qml+2−2
@@ -64,7 +64,7 @@ Rectangle {
6464 function test_optional_title() {
6565 // verify titleLabel is visible and textLabel is anchored below it
6666 compare(titleLabel.visible, true)
67− tryCompare(textLabel, "y", titleLabel.height)
67+ tryCompare(textLabel, "y", titleLabel.height + textLabel.anchors.topMargin)
6868
6969 // verify titleLabel disappears and textLabel moves up
7070 previewTextSummary.widgetData = widgetDataNoTitle
@@ -81,7 +81,7 @@ Rectangle {
8181 previewTextSummary.widgetData = widgetDataShortText
8282 verify(textLabel.lineCount <= textLabel.maximumCollapsedLineCount)
8383 tryCompare(textLabel, "height", textLabel.contentHeight)
84− tryCompare(previewTextSummary, "height", titleLabel.height + textLabel.height)
84+ tryCompare(previewTextSummary, "height", titleLabel.height + textLabel.height + textLabel.anchors.topMargin)
8585 }
8686 }
8787}