on xenial help sign in
Use the icon splash screen by default
commit2184203fd82b7e868e546d2180ccc2647c977a8f authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 15 Sep 2014, 16:05 (12 years ago) parent42e2041
4 files changed+57−5
qml/Stages/ApplicationWindow.qml+1 qml/Stages/Splash.qml+46−3 tests/mocks/Unity/Application/ApplicationInfo.h+1−1 tests/qmltests/Stages/tst_Splash.qml+9−1
qml/Stages/ApplicationWindow.qml+1
@@ -113,6 +113,7 @@ Item {
113113 id: splash
114114 title: d.splashTitle ? d.splashTitle : d.name
115115 imageSource: d.splashImage
116+ icon: d.icon
116117 showHeader: d.splashShowHeader
117118 backgroundColor: d.splashColor
118119 headerColor: d.splashColorHeader
qml/Stages/Splash.qml+46−3
@@ -28,6 +28,7 @@ Item {
2828 property color headerColor: d.undefinedColor
2929 property color footerColor: d.undefinedColor
3030 property alias imageSource: overlaidImage.source
31+ property url icon
3132 property alias title: header.title
3233 property alias showHeader: header.visible
3334
@@ -42,7 +43,10 @@ Item {
4243 // This is also the default value of a color property in QML.
4344 readonly property color undefinedColor: "#00000000"
4445
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
4650 }
4751
4852 StyledItem {
@@ -77,6 +81,7 @@ Item {
7781 left: parent.left
7882 right: parent.right
7983 }
84+ visible: false
8085
8186 // mimic API of toolkit's AppHeader component required by PageHeadStyle
8287 property Item pageStack
@@ -105,10 +110,48 @@ Item {
105110 cache: false
106111 }
107112
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+
108146 ActivityIndicator {
109− anchors.centerIn: parent
147+ anchors.centerIn: header.visible ? parent : undefined
110148 anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0
111− running: overlaidImage.status == Image.Error || overlaidImage.status == Image.Null
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+
154+ running: true//overlaidImage.status == Image.Error || overlaidImage.status == Image.Null
112155 }
113156
114157 MouseArea {
tests/mocks/Unity/Application/ApplicationInfo.h+1−1
@@ -70,7 +70,7 @@ public:
7070
7171 QString splashTitle() const override { return QString(); }
7272 QUrl splashImage() const override { return QUrl(); }
73− bool splashShowHeader() const override { return true; }
73+ bool splashShowHeader() const override { return false; }
7474 QColor splashColor() const override { return QColor(0,0,0,0); }
7575 QColor splashColorHeader() const override { return QColor(0,0,0,0); }
7676 QColor splashColorFooter() const override { return QColor(0,0,0,0); }
tests/qmltests/Stages/tst_Splash.qml+9−1
@@ -28,12 +28,20 @@ Rectangle {
2828 width: units.gu(70)
2929 height: units.gu(70)
3030
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+
3138 Component {
3239 id: splashComponent
3340 Splash {
3441 anchors.fill: parent
3542 title: "Splash Title"
3643 showHeader: showHeaderCheckbox.checked
44+ icon: fakeApplication ? fakeApplication.icon : ""
3745 imageSource: imageSourceCheckbox.checked ? "../UnityLogo.png" : ""
3846 backgroundColor: backgroundColorCheckbox.checked ? "darkorange" : "#00000000"
3947 headerColor: headerColorCheckbox.checked ? "mediumseagreen" : "#00000000"
@@ -66,7 +74,7 @@ Rectangle {
6674
6775 Row {
6876 anchors { left: parent.left; right: parent.right }
69− CheckBox {id: showHeaderCheckbox; checked: true; }
77+ CheckBox {id: showHeaderCheckbox; checked: false; }
7078 Label { text: "showHeader"; anchors.verticalCenter: parent.verticalCenter }
7179 }
7280 Row {