on xenial help sign in
Added support for image.
29019dfFlorian Boucault
qml/Stages/Splash.qml+21−10
@@ -22,8 +22,13 @@ import "../Components"
22StyledItem {
22StyledItem {
23 id: root
23 id: root
24
24
25− property string name: ""
25+ property string title: ""
26 property url image: ""
26 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
27
32
28 // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
33 // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
29 property var theme: QtObject {
34 property var theme: QtObject {
@@ -36,12 +41,6 @@ StyledItem {
36 source: "%1Palette.qml".arg(theme.name)
41 source: "%1Palette.qml".arg(theme.name)
37 }
42 }
38
43
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−
45 // FIXME: should instead use to be created API from toolkit
44 // FIXME: should instead use to be created API from toolkit
46 // style: theme.createStyleComponent("MainViewStyle.qml", root)
45 // style: theme.createStyleComponent("MainViewStyle.qml", root)
47 style: Component { MainViewStyle {theme: root.theme} }
46 style: Component { MainViewStyle {theme: root.theme} }
@@ -53,10 +52,12 @@ StyledItem {
53 right: parent.right
52 right: parent.right
54 }
53 }
55
54
55+ visible: root.showHeader
56+
56 // mimic API of toolkit's AppHeader component required by PageHeadStyle
57 // mimic API of toolkit's AppHeader component required by PageHeadStyle
57 property Item pageStack
58 property Item pageStack
58 property Item contents
59 property Item contents
59− property string title: root.name
60+ property string title: root.title
60 property var tabsModel
61 property var tabsModel
61 property var config: QtObject {
62 property var config: QtObject {
62 property color foregroundColor: theme.palette.selected.backgroundText
63 property color foregroundColor: theme.palette.selected.backgroundText
@@ -68,10 +69,20 @@ StyledItem {
68 style: Component { PageHeadStyle {theme: root.theme} }
69 style: Component { PageHeadStyle {theme: root.theme} }
69 }
70 }
70
71
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+
71 ActivityIndicator {
82 ActivityIndicator {
72 anchors.centerIn: parent
83 anchors.centerIn: parent
73− anchors.verticalCenterOffset: header.height / 2
84+ anchors.verticalCenterOffset: root.showHeader ? header.height / 2 : 0
74− running: true
85+ running: root.image === ""
75 }
86 }
76
87
77 MouseArea {
88 MouseArea {
qml/Stages/SpreadDelegate.qml+20−1
@@ -147,6 +147,9 @@ Item {
147 }
147 }
148 }
148 }
149
149
150+ property color modelBackgroundColor: "transparent"
151+ property color modelHeaderColor: "transparent"
152+ property color modelFooterColor: "transparent"
150
153
151 StateGroup {
154 StateGroup {
152 id: appSurfaceState
155 id: appSurfaceState
@@ -155,7 +158,23 @@ Item {
155 name: "noSurfaceYet"
158 name: "noSurfaceYet"
156 when: !surfaceContainer.appHasCreatedASurface
159 when: !surfaceContainer.appHasCreatedASurface
157 StateChangeScript {
160 StateChangeScript {
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+ }
158− script: { splashLoader.setSource("Splash.qml", { "name": model.name, "image": model.icon }); }
176+ splashLoader.setSource("Splash.qml", properties);
177+ }
159 }
178 }
160 },
179 },
161 State {
180 State {