on xenial help sign in
Revert revision 161 that causes issues with invalid background.

Approved by PS Jenkins bot, Gerry Boland, Albert Astals Cid.

commit2a526c6b9604f9ce1f13fab8d1d0f89efe14e695 authorMichał Sawicz <michal.sawicz@canonical.com> dateTue 6 Aug 2013, 17:31 (13 years ago) parent78e46290498238
15 files changed+12−327
Components/CrossFadeImage.qml+1−3 Greeter/GreeterContent.qml+1 Shell.qml+8−16 debian/control+1−3 tests/data/unity/backgrounds/blue.png tests/data/unity/backgrounds/red.png tests/mocks/CMakeLists.txt−1 tests/mocks/GSettings/CMakeLists.txt−31 tests/mocks/GSettings/fake_gsettings.cpp−102 tests/mocks/GSettings/fake_gsettings.h−90 tests/mocks/GSettings/plugin.cpp−33 tests/mocks/GSettings/plugin.h−31 tests/mocks/GSettings/qmldir−2 tests/qmltests/CMakeLists.txt+1−1 tests/qmltests/tst_Shell.qml−14
Components/CrossFadeImage.qml+1−3
@@ -85,7 +85,7 @@ Item {
8585 Connections {
8686 target: __nextImage
8787 onStatusChanged: {
88− if (__nextImage.status == Image.Ready || __nextImage.status == Image.Error) {
88+ if (__nextImage.status == Image.Ready) {
8989 swapImages();
9090 }
9191 }
@@ -96,7 +96,6 @@ Item {
9696 anchors.fill: parent
9797 cache: false
9898 asynchronous: true
99− fillMode: Image.PreserveAspectCrop
10099 z: 1
101100 }
102101
@@ -105,7 +104,6 @@ Item {
105104 anchors.fill: parent
106105 cache: false
107106 asynchronous: true
108− fillMode: Image.PreserveAspectCrop
109107 z: 0
110108 }
111109
Greeter/GreeterContent.qml+1
@@ -37,6 +37,7 @@ MouseArea {
3737
3838 source: shell.background
3939 anchors.fill: parent
40+ crossFade: false
4041 fadeInFirst: false
4142 }
4243
Shell.qml+8−16
@@ -15,7 +15,6 @@
1515 */
1616
1717import QtQuick 2.0
18−import GSettings 1.0
1918import Ubuntu.Application 0.1
2019import Ubuntu.Components 0.1
2120import Ubuntu.Gestures 0.1
@@ -42,8 +41,8 @@ FocusScope {
4241 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
4342
4443 property real edgeSize: units.gu(2)
45− property url defaultBackground: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
46− property url background: backgroundSettings.pictureUri
44+ property url default_background: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
45+ property url background: default_background
4746 readonly property real panelHeight: panel.panelHeight
4847
4948 property bool dashShown: dash.shown
@@ -116,11 +115,6 @@ FocusScope {
116115 }
117116 }
118117
119− GSettings {
120− id: backgroundSettings
121− schema.id: "org.gnome.desktop.background"
122− }
123−
124118 VolumeControl {
125119 id: volumeControl
126120 }
@@ -145,16 +139,12 @@ FocusScope {
145139 // through the translucent parts of the shell surface.
146140 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
147141
148− CrossFadeImage {
142+ Image {
149143 id: backgroundImage
150− objectName: "backgroundImage"
151144 source: shell.background
145+ sourceSize.width: parent.width
146+ sourceSize.height: parent.height
152147 anchors.fill: parent
153− onStatusChanged: {
154− if (status == Image.Error) {
155− backgroundSettings.pictureUri = shell.defaultBackground
156− }
157− }
158148 }
159149
160150 Rectangle {
@@ -199,6 +189,7 @@ FocusScope {
199189 }
200190 }
201191
192+
202193 Item {
203194 id: stagesOuterContainer
204195
@@ -263,6 +254,7 @@ FocusScope {
263254 ignoreUnknownSignals: true
264255 }
265256
257+
266258 Stage {
267259 id: mainStage
268260
@@ -438,7 +430,7 @@ FocusScope {
438430 onUnlocked: greeter.hide()
439431 onSelected: {
440432 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
441− shell.background = bgPath ? bgPath : defaultBackground
433+ shell.background = bgPath ? bgPath : default_background
442434 }
443435
444436 onLeftTeaserPressedChanged: {
debian/control+1−3
@@ -56,10 +56,8 @@ Description: Indicators client test application
5656
5757Package: unity8
5858Architecture: any
59−Depends: gsettings-desktop-schemas,
60− qmenumodel-qml,
59+Depends: qmenumodel-qml,
6160 qtdeclarative5-dee-plugin,
62− qtdeclarative5-gsettings1.0,
6361 qtdeclarative5-ubuntu-ui-toolkit-plugin,
6462 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
6563 qtdeclarative5-xmllistmodel-plugin,
tests/data/unity/backgrounds/blue.pngdeleted

Binary file not shown.

tests/data/unity/backgrounds/red.pngdeleted

Binary file not shown.

tests/mocks/CMakeLists.txt−1
@@ -1,4 +1,3 @@
1−add_subdirectory(GSettings)
21add_subdirectory(libusermetrics)
32add_subdirectory(LightDM)
43add_subdirectory(QMenuModel)
tests/mocks/GSettings/CMakeLists.txtdeleted−31
@@ -1,31 +0,0 @@
1−set(CMAKE_AUTOMOC ON)
2−
3−include(FindPkgConfig)
4−find_package(Qt5Core REQUIRED)
5−find_package(Qt5Quick REQUIRED)
6−
7−include_directories(
8− ${CMAKE_CURRENT_BINARY_DIR}
9− ${Qt5Core_INCLUDE_DIRS}
10− ${Qt5Quick_INCLUDE_DIRS}
11−)
12−
13−add_definitions(-DQT_NO_KEYWORDS)
14−
15−set(GSettingsQML_SOURCES
16− fake_gsettings.cpp
17− plugin.cpp
18−)
19−
20−add_library(FakeGSettingsQml MODULE ${GSettingsQML_SOURCES})
21−target_link_libraries(FakeGSettingsQml
22− ${Qt5Core_LIBRARIES}
23− ${Qt5Quick_LIBRARIES}
24−)
25−
26−qt5_use_modules(FakeGSettingsQml Qml)
27−
28−# copy qmldir file into build directory for shadow builds
29−file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
30− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
31− )
tests/mocks/GSettings/fake_gsettings.cppdeleted−102
@@ -1,102 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#include "fake_gsettings.h"
18−
19−#include <QList>
20−
21−GSettingsControllerQml* GSettingsControllerQml::s_controllerInstance = 0;
22−
23−GSettingsControllerQml::GSettingsControllerQml() {
24−}
25−
26−GSettingsControllerQml::~GSettingsControllerQml() {
27− s_controllerInstance = 0;
28−}
29−
30−GSettingsControllerQml* GSettingsControllerQml::instance() {
31− if(!s_controllerInstance) {
32− s_controllerInstance = new GSettingsControllerQml();
33− }
34− return s_controllerInstance;
35−}
36−
37−void GSettingsControllerQml::registerSettingsObject(GSettingsQml *obj) {
38− m_registeredGSettings.append(obj);
39−}
40−
41−void GSettingsControllerQml::unRegisterSettingsObject(GSettingsQml *obj) {
42− m_registeredGSettings.removeOne(obj);
43−}
44−
45−void GSettingsControllerQml::setPictureUri(const QString &str) {
46− Q_FOREACH (GSettingsQml *obj, m_registeredGSettings) {
47− obj->setPictureUri(str);
48− }
49−}
50−
51−GSettingsSchemaQml::GSettingsSchemaQml(QObject *parent): QObject(parent) {
52−}
53−
54−QByteArray GSettingsSchemaQml::id() const {
55− return m_id;
56−}
57−
58−void GSettingsSchemaQml::setId(const QByteArray &id) {
59− if (m_id.isEmpty()) {
60− qWarning("GSettings.schema.id may only be set on construction");
61− return;
62− }
63−
64− m_id = id;
65−}
66−
67−QByteArray GSettingsSchemaQml::path() const {
68− return m_path;
69−}
70−
71−void GSettingsSchemaQml::setPath(const QByteArray &path) {
72− if (m_path.isEmpty()) {
73− qWarning("GSettings.schema.path may only be set on construction");
74− return;
75− }
76−
77− m_path = path;
78−}
79−
80−GSettingsQml::GSettingsQml(QObject *parent): QObject(parent) {
81− m_schema = new GSettingsSchemaQml(this);
82− GSettingsControllerQml::instance()->registerSettingsObject(this);
83−}
84−
85−GSettingsQml::~GSettingsQml() {
86− GSettingsControllerQml::instance()->unRegisterSettingsObject(this);
87−}
88−
89−GSettingsSchemaQml * GSettingsQml::schema() const {
90− return m_schema;
91−}
92−
93−QString GSettingsQml::pictureUri() const {
94− return m_pictureUri;
95−}
96−
97−void GSettingsQml::setPictureUri(const QString &str) {
98− if (str != m_pictureUri) {
99− m_pictureUri = str;
100− Q_EMIT pictureUriChanged(m_pictureUri);
101− }
102−}
tests/mocks/GSettings/fake_gsettings.hdeleted−90
@@ -1,90 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−#ifndef FAKE_GSETTINGS_H
18−#define FAKE_GSETTINGS_H
19−
20−#include <QList>
21−#include <QtQml>
22−
23−class GSettingsSchemaQml: public QObject
24−{
25− Q_OBJECT
26−
27− Q_PROPERTY(QByteArray id READ id WRITE setId)
28−
29−public:
30− GSettingsSchemaQml(QObject *parent = NULL);
31−
32− QByteArray id() const;
33− void setId(const QByteArray &id);
34−
35− QByteArray path() const;
36− void setPath(const QByteArray &path);
37−
38−private:
39− QByteArray m_id;
40− QByteArray m_path;
41−};
42−
43−class GSettingsQml: public QObject
44−{
45− Q_OBJECT
46−
47− Q_PROPERTY(GSettingsSchemaQml* schema READ schema NOTIFY schemaChanged)
48− Q_PROPERTY(QString pictureUri READ pictureUri WRITE setPictureUri NOTIFY pictureUriChanged)
49−
50−public:
51− GSettingsQml(QObject *parent = NULL);
52− ~GSettingsQml();
53−
54− GSettingsSchemaQml * schema() const;
55− QString pictureUri() const;
56−
57− void setPictureUri(const QString &str);
58−
59−Q_SIGNALS:
60− void schemaChanged();
61− void pictureUriChanged(const QString&);
62−
63−private:
64− GSettingsSchemaQml* m_schema;
65−
66− QString m_pictureUri;
67−
68− friend class GSettingsSchemaQml;
69−};
70−
71−class GSettingsControllerQml: public QObject
72−{
73− Q_OBJECT
74−
75−public:
76− static GSettingsControllerQml* instance();
77− ~GSettingsControllerQml();
78−
79− void registerSettingsObject(GSettingsQml *obj);
80− void unRegisterSettingsObject(GSettingsQml *obj);
81− Q_INVOKABLE void setPictureUri(const QString &str);
82−
83−private:
84− GSettingsControllerQml();
85−
86− static GSettingsControllerQml* s_controllerInstance;
87− QList<GSettingsQml *> m_registeredGSettings;
88−};
89−
90−#endif // FAKE_GSETTINGS_H
tests/mocks/GSettings/plugin.cppdeleted−33
@@ -1,33 +0,0 @@
1−/*
2− * Copyright (C) 2013 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−#include "plugin.h"
18−#include "fake_gsettings.h"
19−
20−#include <QtQml>
21−
22−static QObject* controllerProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
23−{
24− return GSettingsControllerQml::instance();
25−}
26−
27−void FakeGSettingsQmlPlugin::registerTypes(const char *uri)
28−{
29− qmlRegisterSingletonType<GSettingsControllerQml>(uri, 1, 0, "GSettingsController", controllerProvider);
30− qmlRegisterType<GSettingsQml>(uri, 1, 0, "GSettings");
31− qmlRegisterUncreatableType<GSettingsSchemaQml>(uri, 1, 0, "GSettingsSchema",
32− "GSettingsSchema can only be used inside of a GSettings component");
33−}
tests/mocks/GSettings/plugin.hdeleted−31
@@ -1,31 +0,0 @@
1−/*
2− * Copyright (C) 2013 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−#ifndef PLUGIN_H
18−#define PLUGIN_H
19−
20−#include <QtQml/QQmlExtensionPlugin>
21−
22−class FakeGSettingsQmlPlugin : public QQmlExtensionPlugin
23−{
24− Q_OBJECT
25− Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
26−
27−public:
28− void registerTypes(const char *uri);
29−};
30−
31−#endif // PLUGIN_H
tests/mocks/GSettings/qmldirdeleted−2
@@ -1,2 +0,0 @@
1−module GSettings
2−plugin FakeGSettingsQml
tests/qmltests/CMakeLists.txt+1−1
@@ -26,7 +26,7 @@ set(qmltest_DEFAULT_TARGETS qmluitests)
2626set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
2727set(qmltest_DEFAULT_PROPERTIES "")
2828
29−add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks
29+add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS}
3030 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
3131add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
3232add_qml_test(Components DraggingArea)
tests/qmltests/tst_Shell.qml−14
@@ -19,7 +19,6 @@
1919
2020import QtQuick 2.0
2121import QtTest 1.0
22−import GSettings 1.0
2322import Ubuntu.Application 0.1
2423import Unity.Test 0.1 as UT
2524
@@ -278,18 +277,5 @@ Item {
278277 }
279278 } while (!isStill);
280279 }
281−
282− function test_wallpaper_data() {
283− return [
284− {tag: "red", url: "tests/data/unity/backgrounds/red.png"},
285− {tag: "blue", url: "tests/data/unity/backgrounds/blue.png"}
286− ]
287− }
288−
289− function test_wallpaper(data) {
290− var backgroundImage = findChild(shell, "backgroundImage")
291− GSettingsController.setPictureUri(data.url)
292− tryCompareFunction(function() { return backgroundImage.source.toString().indexOf(data.url) !== -1; }, true)
293− }
294280 }
295281}