on xenial help sign in
Update with new SDK 1.3 MainViewStyle.qml looks
d7dfbd3Albert Astals Cid
qml/Stages/MainViewStyle.qml+33−24
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2012 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
5 * it under the terms of the GNU Lesser General Public License as published by
@@ -13,51 +13,60 @@
13 * You should have received a copy of the GNU Lesser General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16−import QtQuick 2.0
16+import QtQuick 2.4
17import Ubuntu.Components 1.3
17import Ubuntu.Components 1.3
18
18
19// FIXME: copied with slight modifications from Ubuntu UI Toolkit's Ambiance's theme
19// FIXME: copied with slight modifications from Ubuntu UI Toolkit's Ambiance's theme
20Item {
20Item {
21− // styling properties
22 anchors.fill: parent
21 anchors.fill: parent
23 z: -1
22 z: -1
24 id: mainViewStyle
23 id: mainViewStyle
25
24
25+ property var theme
26+
27+ /*!
28+ Color of the header's background.
29+
30+ \sa backgroundColor, footerColor
31+ */
32+ property color headerColor: styledItem.headerColor
33+
26 /*!
34 /*!
27− The background texture of the main view. The image will be drawn over the background color,
35+ Color of the background.
28− so if it has (semi-)transparent pixels, in those pixels the background color will be visible.
36+
37+ The background is usually a single color. However if \l headerColor
38+ or \l footerColor are set then a gradient of colors will be drawn.
39+
40+ \sa footerColor, headerColor
29− */
41+ */
30− property url backgroundSource: "graphics/background_paper.png"
42+ property color backgroundColor: styledItem.backgroundColor
31− property var theme
43+
44+ /*!
45+ Color of the footer's background.
46+
47+ \sa backgroundColor, headerColor
48+ */
49+ property color footerColor: styledItem.footerColor
32
50
33 Gradient {
51 Gradient {
34 id: backgroundGradient
52 id: backgroundGradient
35− GradientStop { position: 0.0; color: styledItem.headerColor }
53+ GradientStop { position: 0.0; color: mainViewStyle.headerColor }
36− GradientStop { position: 0.83; color: styledItem.backgroundColor }
54+ GradientStop { position: 0.83; color: mainViewStyle.backgroundColor }
37− GradientStop { position: 1.0; color: styledItem.footerColor }
55+ GradientStop { position: 1.0; color: mainViewStyle.footerColor }
38 }
56 }
39
57
40 Rectangle {
58 Rectangle {
41 id: backgroundColor
59 id: backgroundColor
42 anchors.fill: parent
60 anchors.fill: parent
43− color: styledItem.backgroundColor
61+ color: mainViewStyle.backgroundColor
44 gradient: internals.isGradient ? backgroundGradient : null
62 gradient: internals.isGradient ? backgroundGradient : null
45 }
63 }
46
64
47− Image {
48− id: backgroundTexture
49− anchors.fill: parent
50− source: mainViewStyle.theme.name === "Ambiance" ? mainViewStyle.backgroundSource : ""
51− fillMode: Image.Tile
52− asynchronous: true
53− cache: false
54− visible: status === Image.Ready
55− }
56−
57 QtObject {
65 QtObject {
58 id: internals
66 id: internals
59− property bool isGradient: styledItem.backgroundColor != styledItem.headerColor ||
67+ property bool isGradient: mainViewStyle.backgroundColor != mainViewStyle.headerColor ||
60− styledItem.backgroundColor != styledItem.footerColor
68+ mainViewStyle.backgroundColor != mainViewStyle.footerColor
69+
61 /*
70 /*
62 As we don't know the order the property bindings and onXXXChanged signals are evaluated
71 As we don't know the order the property bindings and onXXXChanged signals are evaluated
63 we should rely only on one property when changing the theme to avoid intermediate
72 we should rely only on one property when changing the theme to avoid intermediate
qml/Stages/graphics/background_paper@27.pngdeleted

Binary file not shown.