on xenial help sign in
Remove stage property from Application

It's not used anymore Approved by: Michał Sawicz

commitded105d1af0df8cc539783875f2ee8a5dee740de authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateThu 11 Aug 2016, 06:26 (10 years ago) parent23c80b9ccb1888
10 files changed+35−42
CMakeLists.txt+1−1 debian/control+3−3 qml/Stages/TabletStage.qml+1−1 tests/mocks/Unity/Application/ApplicationInfo.cpp−8 tests/mocks/Unity/Application/ApplicationInfo.h−4 tests/mocks/Unity/Application/ApplicationManager.cpp−10 tests/plugins/Unity/Launcher/launchermodeltest.cpp−2 tests/qmltests/Stages/tst_TabletStage.qml+6−3 tests/qmltests/tst_OrientedShell.qml+10−6 tests/qmltests/tst_Shell.qml+14−4
CMakeLists.txt+1−1
@@ -57,7 +57,7 @@ find_package(Qt5DBus 5.4 REQUIRED)
5757find_package(Qt5Concurrent 5.4 REQUIRED)
5858find_package(Qt5Sql 5.4 REQUIRED)
5959
60−pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=19)
60+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=20)
6161pkg_check_modules(GEONAMES REQUIRED geonames>=0.2)
6262pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
6363pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)
debian/control+3−3
@@ -35,7 +35,7 @@ Build-Depends: cmake,
3535 libubuntugestures5-dev (>= 1.3.2030),
3636 libubuntugestures5-private-dev (>= 1.3.2030),
3737 libudev-dev,
38− libunity-api-dev (>= 7.116),
38+ libunity-api-dev (>= 7.117),
3939 libusermetricsoutput1-dev,
4040# Need those X11 libs touch emulation from mouse events in manual QML tests on a X11 desktop
4141 libx11-dev[!arm64 !armhf],
@@ -153,7 +153,7 @@ Depends: qml-module-qtquick-layouts,
153153 qtdeclarative5-ubuntu-settings-components (>= 0.7),
154154 qtdeclarative5-unity-notifications-plugin (>= 0.1.2) | unity-notifications-impl,
155155 ubuntu-thumbnailer-impl-0,
156− unity-application-impl-19,
156+ unity-application-impl-20,
157157 unity-notifications-impl-3,
158158 unity-plugin-scopes | unity-scopes-impl,
159159 unity-scopes-impl-12,
@@ -199,7 +199,7 @@ Pre-Depends: ${misc:Pre-Depends},
199199Depends: ${misc:Depends},
200200 ${shlibs:Depends},
201201Provides: unity-application-impl,
202− unity-application-impl-19,
202+ unity-application-impl-20,
203203Replaces: unity8-autopilot (<< 8.02+15.04.20150422-0ubuntu1)
204204Description: Fake environment for running Unity 8 shell
205205 Provides fake implementations of some QML modules used by Unity 8 shell
qml/Stages/TabletStage.qml+1−1
@@ -542,7 +542,7 @@ AbstractStage {
542542 if (!app) {
543543 return index;
544544 }
545− var stage = spreadRepeater.itemAt(index) ? spreadRepeater.itemAt(index).stage : app.stage;
545+ var stage = spreadRepeater.itemAt(index) ? spreadRepeater.itemAt(index).stage : ApplicationInfoInterface.MainStage;
546546
547547 // don't shuffle indexes greater than "actives or next"
548548 if (index > 2) return index;
tests/mocks/Unity/Application/ApplicationInfo.cpp−8
@@ -175,14 +175,6 @@ void ApplicationInfo::setIcon(const QUrl &value)
175175 }
176176}
177177
178−void ApplicationInfo::setStage(Stage value)
179−{
180− if (value != m_stage) {
181− m_stage = value;
182− Q_EMIT stageChanged(value);
183− }
184−}
185−
186178void ApplicationInfo::setState(State value)
187179{
188180 if (value != m_state) {
tests/mocks/Unity/Application/ApplicationInfo.h−4
@@ -67,9 +67,6 @@ public:
6767
6868 QUrl icon() const override { return m_icon; }
6969
70− Q_INVOKABLE void setStage(Stage value) override; // invokable only for mock
71− Stage stage() const override { return m_stage; }
72−
7370 Q_INVOKABLE void setState(State value);
7471 State state() const override { return m_state; }
7572
@@ -137,7 +134,6 @@ private:
137134 QString m_appId;
138135 QString m_name;
139136 QUrl m_icon;
140− Stage m_stage{MainStage};
141137 State m_state{Stopped};
142138 bool m_fullscreen{false};
143139 Qt::ScreenOrientations m_supportedOrientations{Qt::PortraitOrientation |
tests/mocks/Unity/Application/ApplicationManager.cpp−10
@@ -102,8 +102,6 @@ QVariant ApplicationManager::data(const QModelIndex& index, int role) const {
102102 return app->comment();
103103 case RoleIcon:
104104 return app->icon();
105− case RoleStage:
106− return app->stage();
107105 case RoleState:
108106 return app->state();
109107 case RoleFocused:
@@ -166,11 +164,6 @@ bool ApplicationManager::add(ApplicationInfo *application) {
166164 if (!appIndex.isValid()) return;
167165 Q_EMIT dataChanged(appIndex, appIndex, QVector<int>() << ApplicationManager::RoleState);
168166 });
169− connect(application, &ApplicationInfo::stageChanged, this, [application, this]() {
170− QModelIndex appIndex = findIndex(application);
171− if (!appIndex.isValid()) return;
172− Q_EMIT dataChanged(appIndex, appIndex, QVector<int>() << ApplicationManager::RoleStage);
173− });
174167
175168 connect(application, &ApplicationInfo::closed, this, [application, this]() {
176169 this->remove(application);
@@ -344,7 +337,6 @@ void ApplicationManager::buildListOfAvailableApplications()
344337 application->setScreenshotId("gallery");
345338 application->setIconId("gallery");
346339 application->setShellChrome(Mir::LowChrome);
347− application->setStage(ApplicationInfo::MainStage);
348340 m_availableApplications.append(application);
349341
350342 application = new ApplicationInfo(this);
@@ -381,7 +373,6 @@ void ApplicationManager::buildListOfAvailableApplications()
381373 application->setName("GMail");
382374 application->setIconId("gmail");
383375 application->setScreenshotId("gmail-webapp.svg");
384− application->setStage(ApplicationInfo::MainStage);
385376 application->setSupportedOrientations(Qt::PortraitOrientation
386377 | Qt::LandscapeOrientation
387378 | Qt::InvertedPortraitOrientation
@@ -393,7 +384,6 @@ void ApplicationManager::buildListOfAvailableApplications()
393384 application->setName("Music");
394385 application->setIconId("soundcloud");
395386 application->setScreenshotId("music");
396− application->setStage(ApplicationInfo::MainStage);
397387 application->setSupportedOrientations(Qt::PortraitOrientation
398388 | Qt::LandscapeOrientation
399389 | Qt::InvertedPortraitOrientation
tests/plugins/Unity/Launcher/launchermodeltest.cpp−2
@@ -49,8 +49,6 @@ public:
4949 QString name() const override { return "mock"; }
5050 QString comment() const override { return "this is a mock"; }
5151 QUrl icon() const override { return QUrl(); }
52− ApplicationInfoInterface::Stage stage() const override { return ApplicationInfoInterface::MainStage; }
53− void setStage(ApplicationInfoInterface::Stage) override {}
5452 ApplicationInfoInterface::State state() const override { return ApplicationInfoInterface::Running; }
5553 bool focused() const override { return m_focused; }
5654 QString splashTitle() const override { return QString(); }
tests/qmltests/Stages/tst_TabletStage.qml+6−3
@@ -290,8 +290,9 @@ Rectangle {
290290 var webbrowserSurfaceId = topSurfaceList.nextId;
291291 webbrowserCheckBox.checked = true;
292292 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
293− var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
294− compare(webbrowserApp.stage, ApplicationInfoInterface.MainStage);
293+ var webbrowserDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
294+ verify(webbrowserDelegate);
295+ compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
295296 var webbrowserWindow = findAppWindowForSurfaceId(webbrowserSurfaceId);
296297 verify(webbrowserWindow);
297298
@@ -397,8 +398,10 @@ Rectangle {
397398 var webbrowserSurfaceId = topSurfaceList.nextId;
398399 webbrowserCheckBox.checked = true;
399400 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
401+ var webbrowserDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
402+ verify(webbrowserDelegate);
403+ compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
400404 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
401− compare(webbrowserApp.stage, ApplicationInfoInterface.MainStage);
402405
403406 var gallerySurfaceId = topSurfaceList.nextId;
404407 galleryCheckBox.checked = true;
tests/qmltests/tst_OrientedShell.qml+10−6
@@ -515,7 +515,6 @@ Rectangle {
515515 compare(primaryDelegate.focus, true);
516516 compare(primaryApp.rotatesWindowContents, false);
517517 compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
518− compare(primaryApp.stage, ApplicationInfoInterface.MainStage);
519518
520519 tryCompareFunction(function(){return primaryDelegate.surface != null;}, true);
521520 verify(checkAppSurfaceOrientation(primaryAppWindow, primaryApp, root.primaryOrientationAngle));
@@ -559,7 +558,8 @@ Rectangle {
559558 compare(ApplicationManager.focusedApplicationId, "primary-oriented-app");
560559 compare(primaryApp.rotatesWindowContents, false);
561560 compare(primaryApp.supportedOrientations, Qt.PrimaryOrientation);
562− compare(primaryApp.stage, ApplicationInfoInterface.MainStage);
561+ var primaryDelegate = findChild(shell, "spreadDelegate_" + primarySurfaceId);
562+ compare(primaryDelegate.stage, ApplicationInfoInterface.MainStage);
563563
564564 tryCompareFunction(function(){return primaryApp.surfaceList.count > 0;}, true);
565565
@@ -599,7 +599,6 @@ Rectangle {
599599 compare(gmailApp.rotatesWindowContents, false);
600600 compare(gmailApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
601601 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
602− compare(gmailApp.stage, ApplicationInfoInterface.MainStage);
603602
604603 // wait until it's able to rotate
605604 tryCompare(shell, "orientationChangesEnabled", true);
@@ -724,7 +723,6 @@ Rectangle {
724723 compare(gmailApp.rotatesWindowContents, false);
725724 compare(gmailApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
726725 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
727− compare(gmailApp.stage, ApplicationInfoInterface.MainStage);
728726
729727 waitUntilAppWindowIsFullyLoaded(gmailSurfaceId);
730728
@@ -736,7 +734,10 @@ Rectangle {
736734 compare(musicApp.rotatesWindowContents, false);
737735 compare(musicApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
738736 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
739− compare(musicApp.stage, ApplicationInfoInterface.MainStage);
737+ if (data.deviceName === "manta" || data.deviceName === "flo") {
738+ var musicDelegate = findChild(shell, "spreadDelegate_" + musicSurfaceId);
739+ compare(musicDelegate.stage, ApplicationInfoInterface.MainStage);
740+ }
740741
741742 waitUntilAppWindowIsFullyLoaded(musicSurfaceId);
742743 tryCompare(shell, "orientationChangesEnabled", true);
@@ -889,6 +890,7 @@ Rectangle {
889890 ];
890891 }
891892 function test_appInSideStageDoesntRotateOnStartUp(data) {
893+ WindowStateStorage.saveStage("twitter-webapp", ApplicationInfoInterface.SideStage)
892894 loadShell(data.deviceName);
893895
894896 var twitterDelegate = null;
@@ -905,9 +907,11 @@ Rectangle {
905907 signalSpy.target = null;
906908 signalSpy.signalName = "runningChanged";
907909
910+ var twitterSurfaceId = topLevelSurfaceList.nextId;
908911 var twitterApp = ApplicationManager.startApplication("twitter-webapp");
909912 verify(twitterApp);
910− twitterApp.stage = ApplicationInfoInterface.SideStage;
913+ var twitterDelegate = findChild(shell, "spreadDelegate_" + twitterSurfaceId);
914+ compare(twitterDelegate.stage, ApplicationInfoInterface.SideStage);
911915
912916 // ensure the mock twitter-webapp is as we expect
913917 compare(twitterApp.rotatesWindowContents, false);
tests/qmltests/tst_Shell.qml+14−4
@@ -2103,8 +2103,13 @@ Rectangle {
21032103 waitUntilAppWindowIsFullyLoaded(app2SurfaceId);
21042104
21052105 // Sanity checking
2106− compare(app1.stage, ApplicationInfoInterface.MainStage);
2107− compare(app2.stage, ApplicationInfoInterface.MainStage);
2106+ if (data.usageScenario === "tablet") {
2107+ var app1Delegate = findChild(shell, "spreadDelegate_" + app1SurfaceId);
2108+ compare(app1Delegate.stage, ApplicationInfoInterface.MainStage);
2109+
2110+ var app2Delegate = findChild(shell, "spreadDelegate_" + app2SurfaceId);
2111+ compare(app2Delegate.stage, ApplicationInfoInterface.MainStage);
2112+ }
21082113 verify(!app1.isTouchApp);
21092114
21102115 var app1Surface = app1.surfaceList.get(0);
@@ -2139,8 +2144,13 @@ Rectangle {
21392144 waitUntilAppWindowIsFullyLoaded(app2SurfaceId);
21402145
21412146 // Sanity checking
2142− compare(app1.stage, ApplicationInfoInterface.MainStage);
2143− compare(app2.stage, ApplicationInfoInterface.MainStage);
2147+ if (data.usageScenario === "tablet") {
2148+ var app1Delegate = findChild(shell, "spreadDelegate_" + app1SurfaceId);
2149+ compare(app1Delegate.stage, ApplicationInfoInterface.MainStage);
2150+
2151+ var app2Delegate = findChild(shell, "spreadDelegate_" + app2SurfaceId);
2152+ compare(app2Delegate.stage, ApplicationInfoInterface.MainStage);
2153+ }
21442154
21452155 var app1Surface = app1.surfaceList.get(0);
21462156 verify(app1Surface);