Skip to content

Commit

Permalink
Server-client refactoring and cleanup
Browse files Browse the repository at this point in the history
Communication between wayland surfaces and
the system UI is more simple, without
unnecessary messages.

Change-Id: I360fb2ce61ba82d05fde4a9c0758882200df2508
Reviewed-by: Dominik Holland <[email protected]>
  • Loading branch information
Nedim Hadzic committed Jul 29, 2016
1 parent cb54780 commit dad8498
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 71 deletions.
16 changes: 3 additions & 13 deletions imports/shared/utils/AppUIScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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: {
Expand All @@ -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})
}
}
}
41 changes: 4 additions & 37 deletions imports/shared/utils/NavigationUIScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
1 change: 1 addition & 0 deletions imports/shared/utils/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 12 additions & 19 deletions imports/system/models/ApplicationManagerInterface.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -59,6 +68,7 @@ QtObject {
ApplicationManager.applicationWasActivated.connect(applicationActivated)
WindowManager.windowLost.connect(windowLostHandler)
WindowManager.windowPropertyChanged.connect(windowPropertyChanged)
timer.start()
}

function windowReadyHandler(index, item) {
Expand Down Expand Up @@ -100,17 +110,14 @@ 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
}
}
}

if (acceptWindow) {
//root.windowItem = item
WindowManager.setWindowProperty(item, "windowType", "fullScreen")
root.windowItem = item
WindowManager.setWindowProperty(item, "visibility", true)

root.applicationSurfaceReady(item)
Expand All @@ -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", "")
}
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions sysui/LaunchController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit dad8498

Please sign in to comment.