From dad84983ce6dcee078d370e25b8c4cef9e5b2c6b Mon Sep 17 00:00:00 2001 From: Nedim Hadzic Date: Wed, 27 Jul 2016 15:02:37 +0200 Subject: [PATCH] Server-client refactoring and cleanup Communication between wayland surfaces and the system UI is more simple, without unnecessary messages. Change-Id: I360fb2ce61ba82d05fde4a9c0758882200df2508 Reviewed-by: Dominik Holland --- imports/shared/utils/AppUIScreen.qml | 16 ++------ imports/shared/utils/NavigationUIScreen.qml | 41 ++----------------- imports/shared/utils/qmldir | 1 + .../models/ApplicationManagerInterface.qml | 31 ++++++-------- sysui/LaunchController.qml | 2 - 5 files changed, 20 insertions(+), 71 deletions(-) diff --git a/imports/shared/utils/AppUIScreen.qml b/imports/shared/utils/AppUIScreen.qml index c78ee40..6a70f38 100644 --- a/imports/shared/utils/AppUIScreen.qml +++ b/imports/shared/utils/AppUIScreen.qml @@ -62,10 +62,10 @@ ApplicationManagerWindow { } ApplicationManagerWindow { - id: cluster + id: clusterSurface width: typeof parent !== 'undefined' ? parent.width : Style.cellWidth * 24 height: typeof parent !== 'undefined' ? parent.height : Style.cellHeight * 24 - visible: false + visible: clusterContainer.children.length > 0 && Style.withCluster color: "transparent" Item { @@ -74,9 +74,7 @@ ApplicationManagerWindow { } Component.onCompleted: { - cluster.setWindowProperty("windowType", "clusterWidget") - // Send this wayland surface after the base wayland surface - timer.start() + clusterSurface.setWindowProperty("windowType", "clusterWidget") } onWindowPropertyChanged: { @@ -89,12 +87,4 @@ ApplicationManagerWindow { id: content anchors.fill: parent } - - Timer { - id: timer - interval: 1000 - onTriggered: { - cluster.visible = Qt.binding(function() { return clusterContainer.children.length > 0}) - } - } } diff --git a/imports/shared/utils/NavigationUIScreen.qml b/imports/shared/utils/NavigationUIScreen.qml index f2ac7aa..04c490d 100644 --- a/imports/shared/utils/NavigationUIScreen.qml +++ b/imports/shared/utils/NavigationUIScreen.qml @@ -40,51 +40,18 @@ AppUIScreen { property alias widget: widgetContainer.children - property bool _widgetSet: false - - property bool isInWidgetState: false - - onWidgetChanged: _widgetSet = true - - function sendWidget() { - widget.setWindowProperty("windowType", "widgetMap") - widget.visible = true - } - - - function startFullScreen() { - root.setWindowProperty("goTo", "fullScreen") - } - - ApplicationManagerWindow { - id: widget + property var widgetSurface: ApplicationManagerWindow { width: Style.cellWidth * 12 height: Style.cellHeight * 19 - visible: false - parent: root + visible: widgetContainer.children.length > 0 Item { id: widgetContainer anchors.fill: parent - - Component.onCompleted: { - if (root._widgetSet) { - root.sendWidget() - } - else { - widget.setWindowProperty("windowType", "widgetMap") - } - } } - } - onWindowPropertyChanged: { - //print(":::AppUIScreen::: Window property changed", name, value) - if (name === "windowType" && value === "widget") { - root.isInWidgetState = true - } - else if (name === "windowType" && value === "fullScreen") { - root.isInWidgetState = false + Component.onCompleted: { + widgetSurface.setWindowProperty("windowType", "widgetMap") } } } diff --git a/imports/shared/utils/qmldir b/imports/shared/utils/qmldir index 7fa5775..8ad5872 100644 --- a/imports/shared/utils/qmldir +++ b/imports/shared/utils/qmldir @@ -9,4 +9,5 @@ UIPanel 1.0 UIPanel.qml UIScreen 1.0 UIScreen.qml UIPage 1.0 UIPage.qml AppUIScreen 1.0 AppUIScreen.qml +NavigationUIScreen 1.0 NavigationUIScreen.qml Layouter 1.0 Layouter.qml diff --git a/imports/system/models/ApplicationManagerInterface.qml b/imports/system/models/ApplicationManagerInterface.qml index d83b24e..9d906cc 100644 --- a/imports/system/models/ApplicationManagerInterface.qml +++ b/imports/system/models/ApplicationManagerInterface.qml @@ -43,10 +43,19 @@ QtObject { property string activeAppId property variant blackListItems: [] - property var minimizedItems: [] // Apps which will be started but not shown in full screen + property var minimizedItems: [NavigationService.defaultNavApp] // Apps which will be started but not shown in full screen property Item windowItem property Item mapWidget + property Timer timer: Timer { + interval: 1000 + onTriggered: { + for (var i in root.minimizedItems) { + ApplicationManager.startApplication(root.minimizedItems[i]) + } + } + } + signal applicationSurfaceReady(Item item) signal releaseApplicationSurface() @@ -59,6 +68,7 @@ QtObject { ApplicationManager.applicationWasActivated.connect(applicationActivated) WindowManager.windowLost.connect(windowLostHandler) WindowManager.windowPropertyChanged.connect(windowPropertyChanged) + timer.start() } function windowReadyHandler(index, item) { @@ -100,8 +110,6 @@ QtObject { for (i = 0; i < root.minimizedItems.length; ++i) { if (appID === root.minimizedItems[i]) { acceptWindow = false; - // For now we assume that only navigation has a widget - WindowManager.setWindowProperty(item, "windowType", "widget") root.minimizedItems.pop(appID) break } @@ -109,8 +117,7 @@ QtObject { } if (acceptWindow) { - //root.windowItem = item - WindowManager.setWindowProperty(item, "windowType", "fullScreen") + root.windowItem = item WindowManager.setWindowProperty(item, "visibility", true) root.applicationSurfaceReady(item) @@ -132,19 +139,6 @@ QtObject { //print(":::LaunchController::: WindowManager:windowPropertyChanged", window, name, value) if (name === "visibility" && value === false) { root.releaseApplicationSurface() - var index = WindowManager.indexOfWindow(root.windowItem) - - if (ApplicationManager.get(WindowManager.get(index).applicationId).categories[0] === "navigation") { - // Sending after pop transition is done - WindowManager.setWindowProperty(root.windowItem, "windowType", "widget") - - } - } - else if (name === "goTo" && value === "fullScreen") { - index = WindowManager.indexOfWindow(window) - //print(":::LaunchController::: App found. Going to full screen the app ", index, WindowManager.get(index).applicationId) - ApplicationManager.startApplication(WindowManager.get(index).applicationId) - WindowManager.setWindowProperty(window, "goTo", "") } } @@ -173,7 +167,6 @@ QtObject { if (!isMapWidget && !isClusterWidget) { WindowManager.setWindowProperty(item, "visibility", true) - WindowManager.setWindowProperty(item, "windowType", "fullScreen") root.windowItem = item root.applicationSurfaceReady(item) break diff --git a/sysui/LaunchController.qml b/sysui/LaunchController.qml index ff56f81..87cafe6 100644 --- a/sysui/LaunchController.qml +++ b/sysui/LaunchController.qml @@ -133,9 +133,7 @@ StackView { target: ApplicationManagerInterface onApplicationSurfaceReady: { - print("itemmm", item, item.visible, item.width, item.height) root.push(item) - print("itemmm", item, item.visible, item.width, item.height) } onReleaseApplicationSurface: {