on xenial help sign in
Put the branch into shape
18c5740Daniel d'Andrada
debian/control+2−2
@@ -112,7 +112,7 @@ Depends: qml-module-qtquick-layouts,
112 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.49) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.49),
112 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 0.1.49) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 0.1.49),
113 qtdeclarative5-unity-notifications-plugin (>= 0.1.2) | unity-notifications-impl,
113 qtdeclarative5-unity-notifications-plugin (>= 0.1.2) | unity-notifications-impl,
114 ubuntu-thumbnailer-impl-0,
114 ubuntu-thumbnailer-impl-0,
115− unity-application-impl-3,
115+ unity-application-impl-4,
116 unity-notifications-impl-3,
116 unity-notifications-impl-3,
117 unity-plugin-scopes | unity-scopes-impl,
117 unity-plugin-scopes | unity-scopes-impl,
118 unity-scopes-impl-4,
118 unity-scopes-impl-4,
@@ -159,7 +159,7 @@ Pre-Depends: ${misc:Pre-Depends},
159Depends: ${misc:Depends},
159Depends: ${misc:Depends},
160 ${shlibs:Depends},
160 ${shlibs:Depends},
161Provides: unity-application-impl,
161Provides: unity-application-impl,
162− unity-application-impl-3,
162+ unity-application-impl-4,
163Description: Fake environment for running Unity 8 shell
163Description: Fake environment for running Unity 8 shell
164 Provides fake implementations of some QML modules used by Unity 8 shell
164 Provides fake implementations of some QML modules used by Unity 8 shell
165 (e.g Ubuntu.Application) so that you can run it in a sandboxed environment.
165 (e.g Ubuntu.Application) so that you can run it in a sandboxed environment.
plugins/Unity/Launcher/CMakeLists.txt+1−1
@@ -1,6 +1,6 @@
1include(FindPkgConfig)
1include(FindPkgConfig)
2pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
2pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
3−pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=3)
3+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=4)
4pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
4pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
5
5
6add_definitions(-DSM_BUSNAME=systemBus)
6add_definitions(-DSM_BUSNAME=systemBus)
qml/Stages/ApplicationWindow.qml+10−13
@@ -36,6 +36,12 @@ Item {
36 readonly property string name: root.application ? root.application.name : ""
36 readonly property string name: root.application ? root.application.name : ""
37 readonly property url icon: root.application ? root.application.icon : ""
37 readonly property url icon: root.application ? root.application.icon : ""
38 readonly property int applicationState: root.application ? root.application.state : -1
38 readonly property int applicationState: root.application ? root.application.state : -1
39+ readonly property string splashTitle: root.application ? root.application.splashTitle : ""
40+ readonly property url splashImage: root.application ? root.application.splashImage : ""
41+ readonly property bool splashShowHeader: root.application ? root.application.splashShowHeader : true
42+ readonly property color splashColor: root.application ? root.application.splashColor : "#00000000"
43+ readonly property color splashColorHeader: root.application ? root.application.splashColorHeader : "#00000000"
44+ readonly property color splashColorFooter: root.application ? root.application.splashColorFooter : "#00000000"
39
45
40 // Whether the Application had a surface before but lost it.
46 // Whether the Application had a surface before but lost it.
41 property bool hadSurface: sessionContainer.surfaceContainer.hadSurface
47 property bool hadSurface: sessionContainer.surfaceContainer.hadSurface
@@ -106,20 +112,11 @@ Item {
106 Splash {
112 Splash {
107 id: splash
113 id: splash
108 title: d.splashTitle ? d.splashTitle : d.name
114 title: d.splashTitle ? d.splashTitle : d.name
109− image: d.splashImage
115+ imageSource: d.splashImage
110 showHeader: d.splashShowHeader
116 showHeader: d.splashShowHeader
111−
112− Component.onCompleted: {
113− if (d.splashColor.a == 1.0) {
114− splash.backgroundColor = d.splashColor
117+ backgroundColor: d.splashColor
115− }
116− if (d.splashColorHeader.a == 1.0) {
117− splash.headerColor = d.splashColorHeader
118+ headerColor: d.splashColorHeader
118− }
119− if (d.splashColorFooter.a == 1.0) {
120− splash.footerColor = d.splashColorFooter
119+ footerColor: d.splashColorFooter
121− }
122− }
123 }
120 }
124 }
121 }
125 }
122 }
qml/Stages/MainViewStyle.qml+3−2
@@ -27,7 +27,7 @@ Item {
27 The background texture of the main view. The image will be drawn over the background color,
27 The background texture of the main view. The image will be drawn over the background color,
28 so if it has (semi-)transparent pixels, in those pixels the background color will be visible.
28 so if it has (semi-)transparent pixels, in those pixels the background color will be visible.
29 */
29 */
30− property url backgroundSource: "artwork/background_paper.png"
30+ property url backgroundSource: "graphics/background_paper.png"
31 property var theme
31 property var theme
32
32
33 Gradient {
33 Gradient {
@@ -47,10 +47,11 @@ Item {
47 Image {
47 Image {
48 id: backgroundTexture
48 id: backgroundTexture
49 anchors.fill: parent
49 anchors.fill: parent
50− source: mainViewStyle.backgroundSource
50+ source: mainViewStyle.theme.name === "Ambiance" ? mainViewStyle.backgroundSource : ""
51 fillMode: Image.Tile
51 fillMode: Image.Tile
52 asynchronous: true
52 asynchronous: true
53 cache: false
53 cache: false
54+ visible: status === Image.Ready
54 }
55 }
55
56
56 QtObject {
57 QtObject {
qml/Stages/Splash.qml+53−25
@@ -19,26 +19,57 @@ import Ubuntu.Components 1.1
19import Ubuntu.Components.Themes 0.1
19import Ubuntu.Components.Themes 0.1
20import "../Components"
20import "../Components"
21
21
22−StyledItem {
22+import Ubuntu.Components.Themes.Ambiance 1.1 as Ambiance
23+
24+Item {
23 id: root
25 id: root
24
26
25− property string title: ""
26− property string 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
27+ property color backgroundColor: d.undefinedColor
30− property color headerColor: backgroundColor
28+ property color headerColor: d.undefinedColor
31− property color footerColor: backgroundColor
29+ property color footerColor: d.undefinedColor
32−
30+ property alias imageSource: overlaidImage.source
33− // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
31+ property alias title: header.title
34− property var theme: QtObject {
32+ property alias showHeader: header.visible
35− property string name: "Ambiance"
33+
36− property Palette palette: Qt.createQmlObject("import QtQuick 2.2; import Ubuntu.Components.Themes.%1 1.1; Palette {}".arg(theme.name), root, "dynamicPalette");
34+ Ambiance.Palette {
35+ id: ambiancePalette
37 }
36 }
38
37
38+ QtObject {
39+ id: d
40+
41+ // As specified in qtmir, it will set the color value to this for fields left undefined
42+ // This is also the default value of a color property in QML.
43+ readonly property color undefinedColor: "#00000000"
44+
45+ readonly property color defaultBackgroundColor: ambiancePalette.normal.background
46+ }
47+
48+ StyledItem {
49+ id: styledItem
50+ anchors.fill: parent
51+
52+ // mimic API of toolkit's MainView component required by MainViewStyle
53+ property color backgroundColor: Qt.colorEqual(root.backgroundColor, d.undefinedColor) ? d.defaultBackgroundColor
54+ : root.backgroundColor
55+ property color headerColor: Qt.colorEqual(root.headerColor, d.undefinedColor) ? styledItem.backgroundColor
56+ : root.headerColor
57+ property color footerColor: Qt.colorEqual(root.footerColor, d.undefinedColor) ? styledItem.backgroundColor
58+ : root.footerColor
59+
60+ // FIXME: fake a Theme object as to expose the Palette corresponding to the backgroundColor (see MainViewStyle.qml)
61+ property var theme: QtObject {
62+ property string name
63+ property Palette palette: Qt.createQmlObject("import QtQuick 2.2;\
64+ import Ubuntu.Components.Themes.%1 1.1;\
65+ Palette {}".arg(styledItem.theme.name),
66+ styledItem, "dynamicPalette");
67+ }
68+
39− // FIXME: should instead use future toolkit API:
69+ // FIXME: should instead use future toolkit API:
40− // style: theme.createStyleComponent("MainViewStyle.qml", root)
70+ // style: theme.createStyleComponent("MainViewStyle.qml", styledItem)
41− style: Component { MainViewStyle {theme: root.theme} }
71+ style: Component { MainViewStyle {theme: styledItem.theme} }
72+ }
42
73
43 StyledItem {
74 StyledItem {
44 id: header
75 id: header
@@ -47,39 +78,36 @@ StyledItem {
47 right: parent.right
78 right: parent.right
48 }
79 }
49
80
50− visible: root.showHeader
51−
52 // mimic API of toolkit's AppHeader component required by PageHeadStyle
81 // mimic API of toolkit's AppHeader component required by PageHeadStyle
53 property Item pageStack
82 property Item pageStack
54 property Item contents
83 property Item contents
55− property string title: root.title
84+ property string title
56 property var tabsModel
85 property var tabsModel
57 property var config: QtObject {
86 property var config: QtObject {
58− property color foregroundColor: theme.palette.selected.backgroundText
87+ property color foregroundColor: styledItem.theme.palette.selected.backgroundText
59− property var sections
88+ property var sections: QtObject {}
60 }
89 }
61
90
62 // FIXME: should instead use future toolkit API:
91 // FIXME: should instead use future toolkit API:
63 // style: theme.createStyleComponent("PageHeadStyle.qml", header)
92 // style: theme.createStyleComponent("PageHeadStyle.qml", header)
64− style: Component { PageHeadStyle {theme: root.theme} }
93+ style: Component { PageHeadStyle {theme: styledItem.theme} }
65 }
94 }
66
95
67 Image {
96 Image {
68 id: overlaidImage
97 id: overlaidImage
69 anchors.centerIn: parent
98 anchors.centerIn: parent
70− anchors.verticalCenterOffset: root.showHeader ? header.height / 2 : 0
99+ anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0
71 sourceSize {
100 sourceSize {
72 width: root.width
101 width: root.width
73 height: root.height
102 height: root.height
74 }
103 }
75− source: root.image
76 asynchronous: true
104 asynchronous: true
77 cache: false
105 cache: false
78 }
106 }
79
107
80 ActivityIndicator {
108 ActivityIndicator {
81 anchors.centerIn: parent
109 anchors.centerIn: parent
82− anchors.verticalCenterOffset: root.showHeader ? header.height / 2 : 0
110+ anchors.verticalCenterOffset: header.visible ? header.height / 2 : 0
83 running: overlaidImage.status == Image.Error || overlaidImage.status == Image.Null
111 running: overlaidImage.status == Image.Error || overlaidImage.status == Image.Null
84 }
112 }
85
113
tests/mocks/Unity/Application/ApplicationInfo.h+7
@@ -68,6 +68,13 @@ public:
68 void setFocused(bool value);
68 void setFocused(bool value);
69 bool focused() const override { return m_focused; }
69 bool focused() const override { return m_focused; }
70
70
71+ QString splashTitle() const override { return QString(); }
72+ QUrl splashImage() const override { return QUrl(); }
73+ bool splashShowHeader() const override { return true; }
74+ QColor splashColor() 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); }
77+
71 QString screenshot() const { return m_screenshotFileName; }
78 QString screenshot() const { return m_screenshotFileName; }
72
79
73 void setFullscreen(bool value);
80 void setFullscreen(bool value);
tests/mocks/Unity/Application/CMakeLists.txt+1−1
@@ -1,4 +1,4 @@
1−pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=3)
1+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=4)
2
2
3set(FakeUnityApplicationQml_SOURCES
3set(FakeUnityApplicationQml_SOURCES
4 plugin.cpp
4 plugin.cpp
tests/plugins/Unity/Launcher/CMakeLists.txt+1−1
@@ -1,6 +1,6 @@
1pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
1pkg_check_modules(GSETTINGS_QT REQUIRED gsettings-qt)
2pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
2pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
3−pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=3)
3+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=4)
4
4
5include_directories(
5include_directories(
6 ${CMAKE_CURRENT_BINARY_DIR}
6 ${CMAKE_CURRENT_BINARY_DIR}
tests/plugins/Unity/Launcher/launchermodeltest.cpp+6−1
@@ -39,7 +39,12 @@ public:
39 ApplicationInfoInterface::Stage stage() const { return ApplicationInfoInterface::MainStage; }
39 ApplicationInfoInterface::Stage stage() const { return ApplicationInfoInterface::MainStage; }
40 ApplicationInfoInterface::State state() const { return ApplicationInfoInterface::Running; }
40 ApplicationInfoInterface::State state() const { return ApplicationInfoInterface::Running; }
41 bool focused() const { return m_focused; }
41 bool focused() const { return m_focused; }
42+ QString splashTitle() const override { return QString(); }
42− QUrl screenshot() const { return QUrl(); }
43+ QUrl splashImage() const override { return QUrl(); }
44+ bool splashShowHeader() const override { return true; }
45+ QColor splashColor() const override { return QColor(0,0,0,0); }
46+ QColor splashColorHeader() const override { return QColor(0,0,0,0); }
47+ QColor splashColorFooter() const override { return QColor(0,0,0,0); }
43
48
44 // Methods used for mocking (not in the interface)
49 // Methods used for mocking (not in the interface)
45 void setFocused(bool focused) { m_focused = focused; Q_EMIT focusedChanged(focused); }
50 void setFocused(bool focused) { m_focused = focused; Q_EMIT focusedChanged(focused); }
tests/qmltests/CMakeLists.txt+1
@@ -87,3 +87,4 @@ add_qml_test(Stages PhoneStage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/
87add_qml_test(Stages SpreadDelegate ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
87add_qml_test(Stages SpreadDelegate ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
88add_qml_test(Stages SurfaceContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
88add_qml_test(Stages SurfaceContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
89add_qml_test(Stages SessionContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
89add_qml_test(Stages SessionContainer ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
90+add_qml_test(Stages Splash)
tests/qmltests/Components/tst_DragHandle/HorizontalShowable.qml+1−1
@@ -49,7 +49,7 @@ Showable {
49 showAnimation: StandardAnimation { property: animatedProp; to: propValueWhenShown }
49 showAnimation: StandardAnimation { property: animatedProp; to: propValueWhenShown }
50 hideAnimation: StandardAnimation { property: animatedProp; to: propValueWhenHidden }
50 hideAnimation: StandardAnimation { property: animatedProp; to: propValueWhenHidden }
51
51
52− Image { source: "UnityLogo.png"; anchors.fill: parent }
52+ Image { source: "../../UnityLogo.png"; anchors.fill: parent }
53
53
54 DragHandle {
54 DragHandle {
55 objectName: "leftwardsDragHandle"
55 objectName: "leftwardsDragHandle"
tests/qmltests/Components/tst_DragHandle/VerticalShowable.qml+1−1
@@ -49,7 +49,7 @@ Showable {
49 showAnimation: StandardAnimation { property: animatedProp; to: propValueWhenShown }
49 showAnimation: StandardAnimation { property: animatedProp; to: propValueWhenShown }
50 hideAnimation: StandardAnimation { property: animatedProp; to: propValueWhenHidden }
50 hideAnimation: StandardAnimation { property: animatedProp; to: propValueWhenHidden }
51
51
52− Image { source: "UnityLogo.png"; anchors.fill: parent }
52+ Image { source: "../../UnityLogo.png"; anchors.fill: parent }
53
53
54 DragHandle {
54 DragHandle {
55 objectName: "upwardsDragHandle"
55 objectName: "upwardsDragHandle"
tests/qmltests/Stages/tst_Splash.qmlnew file+110
@@ -0,0 +1,110 @@
1+/*
2+ * Copyright 2014 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.0
18+import QtTest 1.0
19+import Unity.Test 0.1 as UT
20+import ".."
21+import "../../../qml/Stages"
22+import Ubuntu.Components 0.1
23+import Unity.Application 0.1
24+
25+Rectangle {
26+ color: "black"
27+ id: root
28+ width: units.gu(70)
29+ height: units.gu(70)
30+
31+ Component {
32+ id: splashComponent
33+ Splash {
34+ anchors.fill: parent
35+ title: "Splash Title"
36+ showHeader: showHeaderCheckbox.checked
37+ imageSource: imageSourceCheckbox.checked ? "../UnityLogo.png" : ""
38+ backgroundColor: backgroundColorCheckbox.checked ? "darkorange" : "#00000000"
39+ headerColor: headerColorCheckbox.checked ? "mediumseagreen" : "#00000000"
40+ footerColor: footerColorCheckbox.checked ? "teal" : "#00000000"
41+ }
42+ }
43+ Loader {
44+ id: splashLoader
45+ anchors {
46+ top: parent.top
47+ bottom: parent.bottom
48+ left: parent.left
49+ }
50+ width: units.gu(40)
51+ sourceComponent: splashComponent
52+ }
53+
54+ Rectangle {
55+ color: "white"
56+ anchors {
57+ top: parent.top
58+ bottom: parent.bottom
59+ left: splashLoader.right
60+ right: parent.right
61+ }
62+
63+ Column {
64+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
65+ spacing: units.gu(1)
66+
67+ Row {
68+ anchors { left: parent.left; right: parent.right }
69+ CheckBox {id: showHeaderCheckbox; checked: true; }
70+ Label { text: "showHeader"; anchors.verticalCenter: parent.verticalCenter }
71+ }
72+ Row {
73+ anchors { left: parent.left; right: parent.right }
74+ CheckBox {id: imageSourceCheckbox; checked: false; }
75+ Label { text: "imageSource"; anchors.verticalCenter: parent.verticalCenter }
76+ }
77+ Row {
78+ anchors { left: parent.left; right: parent.right }
79+ CheckBox {id: backgroundColorCheckbox; checked: false; }
80+ Label { text: "custom backgroundColor"; anchors.verticalCenter: parent.verticalCenter }
81+ }
82+ Row {
83+ anchors { left: parent.left; right: parent.right }
84+ CheckBox {id: headerColorCheckbox; checked: false; }
85+ Label { text: "custom headerColor"; anchors.verticalCenter: parent.verticalCenter }
86+ }
87+ Row {
88+ anchors { left: parent.left; right: parent.right }
89+ CheckBox {id: footerColorCheckbox; checked: false; }
90+ Label { text: "custom footerColor"; anchors.verticalCenter: parent.verticalCenter }
91+ }
92+ }
93+ }
94+
95+ UT.UnityTestCase {
96+ id: testCase
97+ name: "Splash"
98+ when: windowShown
99+
100+ function cleanup() {
101+ // reload our test subject to get it in a fresh state once again
102+ splashLoader.active = false;
103+ surfaceCheckbox.checked = false;
104+ splashLoader.active = true;
105+ }
106+
107+ // No automated tests so far. Used only for manual testing at the moment.
108+ }
109+}
110+
tests/qmltests/Components/tst_DragHandle/UnityLogo.png → tests/qmltests/UnityLogo.pngrenamed

Binary file not shown.