on xenial help sign in
Use direct defaults instead of grouped in the default object
commite55cd60c7d5aa1f0a0813d50499e7199349bd7a7 authorMichał Sawicz <michal.sawicz@canonical.com> dateTue 8 Jul 2014, 13:08 (12 years ago) parent1f6d9ab
10 files changed+35−37
plugins/Dash/CardCreator.js+4−4 qml/Components/PageHeader.qml+5−8 qml/Dash/DashDepartments.qml+3−3 qml/Dash/DashDepartmentsList.qml+11−10 qml/Dash/GenericScopeView.qml+2−2 qml/Dash/Previews/PreviewAudioPlayback.qml+3−3 qml/Dash/Previews/PreviewRatingDisplay.qml+2−2 qml/Dash/Previews/PreviewRatingInput.qml+2−2 qml/Dash/Previews/PreviewTextSummary.qml+2−2 qml/Dash/Previews/PreviewWidget.qml+1−1
plugins/Dash/CardCreator.js+4−4
@@ -289,7 +289,7 @@ function cardString(template, components) {
289289 property var cardData; \n\
290290 property var artShapeBorderSource: undefined; \n\
291291 property real fontScale: 1.0; \n\
292− property var scopeStyle: Object({ foreground: "grey" }) \n\
292+ property var scopeStyle: null \n\
293293 property int headerAlignment: Text.AlignLeft; \n\
294294 property int fixedHeaderHeight: -1; \n\
295295 property size fixedArtShapeSize: Qt.size(-1, -1); \n\
@@ -408,7 +408,7 @@ function cardString(template, components) {
408408 mascotCode = kMascotImageCode.arg(anchors).arg(mascotImageVisible);
409409 }
410410
411− var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : root.scopeStyle.foreground';
411+ var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey")';
412412
413413 var titleSubtitleCode = "";
414414 if (hasTitle) {
@@ -420,7 +420,7 @@ function cardString(template, components) {
420420 } else if (hasBackground) {
421421 color = summaryColorWithBackground;
422422 } else {
423− color = 'root.scopeStyle.foreground';
423+ color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
424424 }
425425
426426 var titleAnchors;
@@ -496,7 +496,7 @@ function cardString(template, components) {
496496 if (hasBackground) {
497497 color = summaryColorWithBackground;
498498 } else {
499− color = 'root.scopeStyle.foreground';
499+ color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
500500 }
501501
502502 var summaryTopMargin = (hasMascot || hasSubtitle ? 'anchors.margins' : '0');
qml/Components/PageHeader.qml+5−8
@@ -38,10 +38,7 @@ Item {
3838 // TODO We should use foreground for the icons
3939 // of the toolbar but unfortunately Action does not have
4040 // the keyColor property as Icon does :-/
41− property var scopeStyle: QtObject {
42− readonly property color foreground: "grey"
43− readonly property url headerLogo: ""
44− }
41+ property var scopeStyle: null
4542
4643 signal backClicked()
4744
@@ -88,7 +85,7 @@ Item {
8885 }
8986
9087 function refreshLogo() {
91− if (scopeStyle.headerLogo != "") {
88+ if (scopeStyle ? scopeStyle.headerLogo != "" : false) {
9289 header.contents = imageComponent.createObject();
9390 } else if (header.contents) {
9491 header.contents.destroy();
@@ -97,7 +94,7 @@ Item {
9794 }
9895
9996 Connections {
100− target: scopeStyle
97+ target: root.scopeStyle
10198 onHeaderLogoChanged: root.refreshLogo()
10299 }
103100
@@ -226,7 +223,7 @@ Item {
226223 height: headerContainer.height
227224 contentHeight: height
228225 separatorSource: ""
229− textColor: root.scopeStyle.foreground
226+ textColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
230227 property var styledItem: header
231228 property string title: root.title
232229 property var config: PageHeadConfiguration {
@@ -262,7 +259,7 @@ Item {
262259 Image {
263260 objectName: "titleImage"
264261 anchors.fill: parent
265− source: root.scopeStyle.headerLogo
262+ source: root.scopeStyle ? root.scopeStyle.headerLogo : ""
266263 fillMode: Image.PreserveAspectFit
267264 horizontalAlignment: Image.AlignLeft
268265 sourceSize.height: height
qml/Dash/DashDepartments.qml+3−3
@@ -29,7 +29,7 @@ AbstractButton {
2929
3030 property alias windowWidth: blackRect.width
3131 property alias windowHeight: blackRect.height
32− property var scopeStyle: { foreground: "grey" }
32+ property var scopeStyle: null
3333
3434 // Are we drilling down the tree or up?
3535 property bool isGoingBack: false
@@ -79,7 +79,7 @@ AbstractButton {
7979 anchors.margins: units.gu(2)
8080 verticalAlignment: Text.AlignVCenter
8181 text: root.currentDepartment ? root.currentDepartment.label : ""
82− color: root.scopeStyle.foreground
82+ color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
8383 }
8484
8585 Icon {
@@ -89,7 +89,7 @@ AbstractButton {
8989 name: showList ? "up" : "down"
9090 height: units.gu(2)
9191 width: height
92− color: root.scopeStyle.foreground
92+ color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
9393 }
9494
9595 // departmentListView is outside root
qml/Dash/DashDepartmentsList.qml+11−10
@@ -21,16 +21,17 @@ Item {
2121 id: root
2222 property var department: null
2323 property var currentDepartment: null
24− property var scopeStyle: Object({ foreground: "grey", background: "transparent" })
24+ property var scopeStyle: null
2525 signal enterDepartment(var newDepartmentId, bool hasChildren)
2626 signal goBackToParentClicked()
2727 signal allDepartmentClicked()
2828
2929 readonly property int itemHeight: units.gu(5)
30+ readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
3031 implicitHeight: flickable.contentHeight
3132
3233 Rectangle {
33− color: Qt.colorEqual(root.scopeStyle.background, "transparent") ? "white" : root.scopeStyle.background
34+ color: !root.scopeStyle || Qt.colorEqual(root.scopeStyle.background, "transparent") ? "white" : root.scopeStyle.background
3435 anchors.fill: parent
3536 }
3637
@@ -82,7 +83,7 @@ Item {
8283 name: "back"
8384 height: units.gu(2)
8485 width: height
85− color: root.scopeStyle.foreground
86+ color: root.foregroundColor
8687 }
8788
8889 Label {
@@ -92,7 +93,7 @@ Item {
9293 leftMargin: units.gu(0.5)
9394 }
9495 text: department ? department.parentLabel : ""
95− color: root.scopeStyle.foreground
96+ color: root.foregroundColor
9697 }
9798
9899 Rectangle {
@@ -103,7 +104,7 @@ Item {
103104 leftMargin: units.gu(2)
104105 rightMargin: units.gu(2)
105106 }
106− color: root.scopeStyle.foreground
107+ color: root.foregroundColor
107108 opacity: 0.2
108109 height: units.dp(1)
109110 }
@@ -124,7 +125,7 @@ Item {
124125 }
125126 text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
126127 font.bold: true
127− color: root.scopeStyle.foreground
128+ color: root.foregroundColor
128129 }
129130
130131 Rectangle {
@@ -135,7 +136,7 @@ Item {
135136 leftMargin: units.gu(2)
136137 rightMargin: units.gu(2)
137138 }
138− color: root.scopeStyle.foreground
139+ color: root.foregroundColor
139140 opacity: 0.2
140141 height: units.dp(1)
141142 }
@@ -160,7 +161,7 @@ Item {
160161 leftMargin: units.gu(2)
161162 }
162163 text: label
163− color: root.scopeStyle.foreground
164+ color: root.foregroundColor
164165 }
165166
166167 Icon {
@@ -172,7 +173,7 @@ Item {
172173 height: units.gu(2)
173174 width: height
174175 name: hasChildren ? "go-next" : "tick"
175− color: root.scopeStyle.foreground
176+ color: root.foregroundColor
176177 visible: hasChildren || isActive
177178 }
178179
@@ -184,7 +185,7 @@ Item {
184185 leftMargin: units.gu(2)
185186 rightMargin: units.gu(2)
186187 }
187− color: root.scopeStyle.foreground
188+ color: root.foregroundColor
188189 opacity: 0.1
189190 height: units.dp(1)
190191 visible: index != department.count - 1
qml/Dash/GenericScopeView.qml+2−2
@@ -105,7 +105,7 @@ FocusScope {
105105
106106 Rectangle {
107107 anchors.fill: parent
108− color: scopeView.scopeStyle.background
108+ color: scopeView.scopeStyle ? scopeView.scopeStyle.background : "transparent"
109109 visible: color != "transparent"
110110 }
111111
@@ -316,7 +316,7 @@ FocusScope {
316316 property var delegate: categoryView.item(delegateIndex)
317317 width: categoryView.width
318318 text: section
319− textColor: scopeStyle.foreground
319+ textColor: scopeStyle ? scopeStyle.foreground : "grey"
320320 image: {
321321 if (delegate && delegate.expandable)
322322 return delegate.filtered ? "graphics/header_handlearrow.png" : "graphics/header_handlearrow2.png"
qml/Dash/Previews/PreviewAudioPlayback.qml+3−3
@@ -139,7 +139,7 @@ PreviewWidget {
139139 objectName: "trackTitleLabel"
140140 anchors { top: parent.top; left: parent.left; right: parent.right }
141141 opacity: 0.9
142− color: scopeStyle.foreground
142+ color: scopeStyle ? scopeStyle.foreground : "grey"
143143 fontSize: "small"
144144 horizontalAlignment: Text.AlignLeft
145145 text: modelData["title"]
@@ -152,7 +152,7 @@ PreviewWidget {
152152 anchors { top: trackTitleLabel.bottom; left: parent.left; right: parent.right }
153153 visible: text !== ""
154154 opacity: 0.9
155− color: scopeStyle.foreground
155+ color: scopeStyle ? scopeStyle.foreground : "grey"
156156 font.weight: Font.Light
157157 fontSize: "small"
158158 horizontalAlignment: Text.AlignLeft
@@ -193,7 +193,7 @@ PreviewWidget {
193193 anchors.verticalCenter: parent.verticalCenter
194194 width: parent.column3Width
195195 opacity: 0.9
196− color: scopeStyle.foreground
196+ color: scopeStyle ? scopeStyle.foreground : "grey"
197197 fontSize: "small"
198198 horizontalAlignment: Text.AlignRight
199199 text: audio.lengthToString(modelData["length"])
qml/Dash/Previews/PreviewRatingDisplay.qml+2−2
@@ -71,7 +71,7 @@ PreviewWidget {
7171 id: authorLabel
7272 objectName: "authorLabel"
7373 anchors { left: parent.left; right: parent.right }
74− color: root.scopeStyle.foreground
74+ color: scopeStyle ? scopeStyle.foreground : "grey"
7575 opacity: .8
7676 text: modelData["author"] || ""
7777 visible: text !== ""
@@ -82,7 +82,7 @@ PreviewWidget {
8282 id: reviewLabel
8383 objectName: "reviewLabel"
8484 anchors { left: parent.left; right: parent.right }
85− color: root.scopeStyle.foreground
85+ color: scopeStyle ? scopeStyle.foreground : "grey"
8686 opacity: .8
8787 text: modelData["review"] || ""
8888 visible: text !== ""
qml/Dash/Previews/PreviewRatingInput.qml+2−2
@@ -76,7 +76,7 @@ PreviewWidget {
7676 verticalCenter: parent.verticalCenter
7777 left: parent.left
7878 }
79− color: root.scopeStyle.foreground
79+ color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
8080 opacity: .8
8181 text: widgetData["rating-label"] || i18n.tr("Rate this")
8282 }
@@ -121,7 +121,7 @@ PreviewWidget {
121121 left: parent.left
122122 right: parent.right
123123 }
124− color: root.scopeStyle.foreground
124+ color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
125125 opacity: .8
126126 text: widgetData["review-label"] || i18n.tr("Add a review")
127127 }
qml/Dash/Previews/PreviewTextSummary.qml+2−2
@@ -39,7 +39,7 @@ PreviewWidget {
3939 }
4040 height: visible ? implicitHeight : 0
4141 fontSize: "large"
42− color: root.scopeStyle.foreground
42+ color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
4343 visible: text !== ""
4444 opacity: .8
4545 text: widgetData["title"] || ""
@@ -61,7 +61,7 @@ PreviewWidget {
6161 clip: true
6262 fontSize: "small"
6363 lineHeight: 1.2
64− color: root.scopeStyle.foreground
64+ color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
6565 opacity: .8
6666 text: widgetData["text"]
6767 wrapMode: Text.Wrap
qml/Dash/Previews/PreviewWidget.qml+1−1
@@ -29,7 +29,7 @@ Item {
2929 property var widgetData
3030
3131 //! The ScopeStyle component.
32− property var scopeStyle: { foreground: "grey" }
32+ property var scopeStyle: null
3333
3434 /*! \brief This signal should be emitted when a preview action was triggered.
3535 *