on xenial help sign in
Use the icon splash screen by default
2184203Daniel d'Andrada
qml/Stages/ApplicationWindow.qml+1
@@ -113,6 +113,7 @@ Item {
113 id: splash
113 id: splash
114 title: d.splashTitle ? d.splashTitle : d.name
114 title: d.splashTitle ? d.splashTitle : d.name
115 imageSource: d.splashImage
115 imageSource: d.splashImage
116+ icon: d.icon
116 showHeader: d.splashShowHeader
117 showHeader: d.splashShowHeader
117 backgroundColor: d.splashColor
118 backgroundColor: d.splashColor
118 headerColor: d.splashColorHeader
119 headerColor: d.splashColorHeader
qml/Stages/Splash.qml+46−3
@@ -28,6 +28,7 @@ Item {
28 property color headerColor: d.undefinedColor
28 property color headerColor: d.undefinedColor
29 property color footerColor: d.undefinedColor
29 property color footerColor: d.undefinedColor
30 property alias imageSource: overlaidImage.source
30 property alias imageSource: overlaidImage.source
31+ property url icon
31 property alias title: header.title
32 property alias title: header.title
32 property alias showHeader: header.visible
33 property alias showHeader: header.visible
33
34
@@ -42,7 +43,10 @@ Item {
42 // This is also the default value of a color property in QML.
43 // This is also the default value of a color property in QML.
43 readonly property color undefinedColor: "#00000000"
44 readonly property color undefinedColor: "#00000000"
44
45
45− readonly property color defaultBackgroundColor: ambiancePalette.normal.background
46+ readonly property color defaultBackgroundColor: header.visible ? ambiancePalette.normal.background : "black"
47+
48+ // Splash screen that shows the application icon and splashTitle
49+ readonly property bool showIcon: overlaidImage.status == Image.Null && !root.showHeader
46 }
50 }
47
51
48 StyledItem {
52 StyledItem {
@@ -77,6 +81,7 @@ Item {
77 left: parent.left
81 left: parent.left
78 right: parent.right
82 right: parent.right
79 }
83 }
84+ visible: false
80
85
81 // mimic API of toolkit's AppHeader component required by PageHeadStyle
86 // mimic API of toolkit's AppHeader component required by PageHeadStyle
82 property Item pageStack
87 property Item pageStack
@@ -105,10 +110,48 @@ Item {
105 cache: false
110 cache: false
106 }
111 }
107
112
113+ UbuntuShape {
114+ id: iconShape
115+ anchors.horizontalCenter: parent.horizontalCenter
116+ anchors.verticalCenter: parent.verticalCenter
117+ anchors.verticalCenterOffset: -units.gu(4)
118+ width: units.gu(8)
119+ height: units.gu(7.5)
120+
121+ visible: d.showIcon
122+
123+ radius: "medium"
124+ borderSource: "none"
125+
126+ image: Image {
127+ id: iconImage
128+ sourceSize.width: iconShape.width
129+ sourceSize.height: iconShape.height
130+ source: d.showIcon ? root.icon : ""
131+ fillMode: Image.PreserveAspectCrop
132+ }
133+ }
134+
135+ Label {
136+ text: root.title
137+ anchors.horizontalCenter: parent.horizontalCenter
138+ anchors.top: iconShape.bottom
139+ anchors.topMargin: units.gu(2)
140+ fontSize: "large"
141+
142+ color: styledItem.theme.palette.selected.backgroundText
143+ visible: d.showIcon
144+ }
145+
108 ActivityIndicator {
146 ActivityIndicator {
109− anchors.centerIn: parent
147+ anchors.centerIn: header.visible ? parent : undefined
110 anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0
148 anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0
149+
150+ anchors.horizontalCenter: header.visible ? undefined : parent.horizontalCenter
151+ anchors.bottom: header.visible ? undefined : parent.bottom
152+ anchors.bottomMargin: header.visible ? 0 : units.gu(12)
153+
111− running: overlaidImage.status == Image.Error || overlaidImage.status == Image.Null
154+ running: true//overlaidImage.status == Image.Error || overlaidImage.status == Image.Null
112 }
155 }
113
156
114 MouseArea {
157 MouseArea {
tests/mocks/Unity/Application/ApplicationInfo.h+1−1
@@ -70,7 +70,7 @@ public:
70
70
71 QString splashTitle() const override { return QString(); }
71 QString splashTitle() const override { return QString(); }
72 QUrl splashImage() const override { return QUrl(); }
72 QUrl splashImage() const override { return QUrl(); }
73− bool splashShowHeader() const override { return true; }
73+ bool splashShowHeader() const override { return false; }
74 QColor splashColor() const override { return QColor(0,0,0,0); }
74 QColor splashColor() const override { return QColor(0,0,0,0); }
75 QColor splashColorHeader() const override { return QColor(0,0,0,0); }
75 QColor splashColorHeader() const override { return QColor(0,0,0,0); }
76 QColor splashColorFooter() const override { return QColor(0,0,0,0); }
76 QColor splashColorFooter() const override { return QColor(0,0,0,0); }
tests/qmltests/Stages/tst_Splash.qml+9−1
@@ -28,12 +28,20 @@ Rectangle {
28 width: units.gu(70)
28 width: units.gu(70)
29 height: units.gu(70)
29 height: units.gu(70)
30
30
31+ Component.onCompleted: {
32+ root.fakeApplication = ApplicationManager.add("gallery-app");
33+ root.fakeApplication.manualSurfaceCreation = true;
34+ root.fakeApplication.setState(ApplicationInfoInterface.Starting);
35+ }
36+ property QtObject fakeApplication
37+
31 Component {
38 Component {
32 id: splashComponent
39 id: splashComponent
33 Splash {
40 Splash {
34 anchors.fill: parent
41 anchors.fill: parent
35 title: "Splash Title"
42 title: "Splash Title"
36 showHeader: showHeaderCheckbox.checked
43 showHeader: showHeaderCheckbox.checked
44+ icon: fakeApplication ? fakeApplication.icon : ""
37 imageSource: imageSourceCheckbox.checked ? "../UnityLogo.png" : ""
45 imageSource: imageSourceCheckbox.checked ? "../UnityLogo.png" : ""
38 backgroundColor: backgroundColorCheckbox.checked ? "darkorange" : "#00000000"
46 backgroundColor: backgroundColorCheckbox.checked ? "darkorange" : "#00000000"
39 headerColor: headerColorCheckbox.checked ? "mediumseagreen" : "#00000000"
47 headerColor: headerColorCheckbox.checked ? "mediumseagreen" : "#00000000"
@@ -66,7 +74,7 @@ Rectangle {
66
74
67 Row {
75 Row {
68 anchors { left: parent.left; right: parent.right }
76 anchors { left: parent.left; right: parent.right }
69− CheckBox {id: showHeaderCheckbox; checked: true; }
77+ CheckBox {id: showHeaderCheckbox; checked: false; }
70 Label { text: "showHeader"; anchors.verticalCenter: parent.verticalCenter }
78 Label { text: "showHeader"; anchors.verticalCenter: parent.verticalCenter }
71 }
79 }
72 Row {
80 Row {