on xenial help sign in
Use ApplicationManager as the model instead of SurfaceManager in the stage
commit6586a0bfe4c507177a9fe0bf83a011547277953f authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateFri 30 May 2014, 09:01 (12 years ago) parent6e972467038057
3 files changed+9−15
qml/Shell.qml+4−4 qml/Stages/PhoneStage.qml+3−10 qml/Stages/SpreadDelegate.qml+2−1
qml/Shell.qml+4−4
@@ -39,8 +39,8 @@ FocusScope {
3939 property int orientationAngle
4040
4141 property int supportedScreenOrientations: {
42− if (stages.shown && SurfaceManager.topmostSurface) {
43− return SurfaceManager.topmostSurface.application.supportedOrientations;
42+ if (stages.shown && ApplicationManager.topmostApplication) {
43+ return ApplicationManager.topmostApplication.supportedOrientations;
4444 } else {
4545 return Qt.PortraitOrientation
4646 | Qt.InvertedPortraitOrientation
@@ -232,8 +232,8 @@ FocusScope {
232232
233233 Binding {
234234 target: applicationsDisplayLoader.item
235− property: "surfaces"
236− value: SurfaceManager
235+ property: "applications"
236+ value: ApplicationManager
237237 }
238238 Binding {
239239 target: applicationsDisplayLoader.item
qml/Stages/PhoneStage.qml+3−10
@@ -28,9 +28,7 @@ Rectangle {
2828 // Controls to be set from outside
2929 property int dragAreaWidth
3030 property real maximizedAppTopMargin
31−
32− // FIXME: Should be registerd singleton type QAbstractItemModel.
33− property var surfaces
31+ property var applications
3432
3533 // State information propagated to the outside
3634 property bool fullscreen: priv.focusedApplication ? priv.focusedApplication.fullscreen : false
@@ -95,8 +93,6 @@ Rectangle {
9593 applicationSwitchingAnimation.start();
9694 } else {
9795 ApplicationManager.focusApplication(appId);
98− // TODO: Should happen behind the schenes
99− surfaces.move(surfaces.getIndexOfSurfaceWithAppId(appId), 0);
10096 }
10197 }
10298
@@ -213,9 +209,6 @@ Rectangle {
213209 if (spreadView.selectedIndex >= 0) {
214210 ApplicationManager.focusApplication(ApplicationManager.get(spreadView.selectedIndex).appId);
215211
216− // TODO: Should happen behind the schenes
217− surfaces.move(spreadView.selectedIndex, 0);
218−
219212 spreadView.selectedIndex = -1
220213 spreadView.phase = 0;
221214 spreadView.contentX = -spreadView.shift;
@@ -235,7 +228,7 @@ Rectangle {
235228
236229 Repeater {
237230 id: spreadRepeater
238− model: root.surfaces
231+ model: root.applications
239232 delegate: TransformedSpreadDelegate {
240233 id: appDelegate
241234 objectName: "appDelegate" + index
@@ -249,7 +242,7 @@ Rectangle {
249242 height: spreadView.height
250243 selected: spreadView.selectedIndex == index
251244 otherSelected: spreadView.selectedIndex >= 0 && !selected
252− surface: model.surface
245+ application: root.applications.get(index)
253246 interactive: !spreadView.interactive
254247 maximizedAppTopMargin: root.maximizedAppTopMargin
255248
qml/Stages/SpreadDelegate.qml+2−1
@@ -26,10 +26,11 @@ Item {
2626 property real topMarginProgress
2727 property bool interactive: true
2828 property real maximizedAppTopMargin
29+ property var application
2930
3031 // FIXME: This really should be invisible to QML code.
3132 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
32− property var surface
33+ property var surface: application ? application.surface : null
3334 onSurfaceChanged: {
3435 if (surface) {
3536 surface.parent = root;