on xenial help sign in
Added support for image.
commit29019df5c5b5569cec7ca3e285a2d8189534a838 authorFlorian Boucault <florian.boucault@canonical.com> dateThu 7 Aug 2014, 14:33 (12 years ago) parent18886ff
2 files changed+41−11
qml/Stages/Splash.qml+21−10 qml/Stages/SpreadDelegate.qml+20−1
qml/Stages/Splash.qml+21−10
@@ -22,8 +22,13 @@ import "../Components"
2222StyledItem {
2323 id: root
2424
25− property string name: ""
25+ property string title: ""
2626 property url image: ""
27+ property bool showHeader: true
28+ // mimic API of toolkit's MainView component required by MainViewStyle
29+ property color backgroundColor: theme.palette.normal.background
30+ property color headerColor: backgroundColor
31+ property color footerColor: backgroundColor
2732
2833 // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
2934 property var theme: QtObject {
@@ -36,12 +41,6 @@ StyledItem {
3641 source: "%1Palette.qml".arg(theme.name)
3742 }
3843
39− // mimic API of toolkit's MainView component required by MainViewStyle
40− property color headerColor: backgroundColor
41− // FIXME: should be read from desktop file and set by SpreadDelegate
42− property color backgroundColor: theme.palette.normal.background
43− property color footerColor: backgroundColor
44−
4544 // FIXME: should instead use to be created API from toolkit
4645 // style: theme.createStyleComponent("MainViewStyle.qml", root)
4746 style: Component { MainViewStyle {theme: root.theme} }
@@ -53,10 +52,12 @@ StyledItem {
5352 right: parent.right
5453 }
5554
55+ visible: root.showHeader
56+
5657 // mimic API of toolkit's AppHeader component required by PageHeadStyle
5758 property Item pageStack
5859 property Item contents
59− property string title: root.name
60+ property string title: root.title
6061 property var tabsModel
6162 property var config: QtObject {
6263 property color foregroundColor: theme.palette.selected.backgroundText
@@ -68,10 +69,20 @@ StyledItem {
6869 style: Component { PageHeadStyle {theme: root.theme} }
6970 }
7071
72+ Image {
73+ anchors.centerIn: parent
74+ anchors.verticalCenterOffset: root.showHeader ? header.height / 2 : 0
75+ sourceSize {
76+ width: 1024
77+ height: 1024
78+ }
79+ source: root.image
80+ }
81+
7182 ActivityIndicator {
7283 anchors.centerIn: parent
73− anchors.verticalCenterOffset: header.height / 2
74− running: true
84+ anchors.verticalCenterOffset: root.showHeader ? header.height / 2 : 0
85+ running: root.image === ""
7586 }
7687
7788 MouseArea {
qml/Stages/SpreadDelegate.qml+20−1
@@ -147,6 +147,9 @@ Item {
147147 }
148148 }
149149
150+ property color modelBackgroundColor: "transparent"
151+ property color modelHeaderColor: "transparent"
152+ property color modelFooterColor: "transparent"
150153
151154 StateGroup {
152155 id: appSurfaceState
@@ -155,7 +158,23 @@ Item {
155158 name: "noSurfaceYet"
156159 when: !surfaceContainer.appHasCreatedASurface
157160 StateChangeScript {
158− script: { splashLoader.setSource("Splash.qml", { "name": model.name, "image": model.icon }); }
161+ script: {
162+ var properties = { "title": model.name,
163+ "image": "",
164+ "showHeader": true
165+ };
166+
167+ if (root.modelBackgroundColor.a == 1) {
168+ properties["backgroundColor"] = root.modelBackgroundColor;
169+ }
170+ if (root.modelHeaderColor.a == 1) {
171+ properties["headerColor"] = root.modelHeaderColor;
172+ }
173+ if (root.modelFooterColor.a == 1) {
174+ properties["footerColor"] = root.modelFooterColor;
175+ }
176+ splashLoader.setSource("Splash.qml", properties);
177+ }
159178 }
160179 },
161180 State {