aboutsummaryrefslogtreecommitdiffstats
path: root/Main.qml
diff options
context:
space:
mode:
Diffstat (limited to 'Main.qml')
-rw-r--r--Main.qml49
1 files changed, 49 insertions, 0 deletions
diff --git a/Main.qml b/Main.qml
index 713856e..1428b7d 100644
--- a/Main.qml
+++ b/Main.qml
@@ -31,6 +31,9 @@
import QtQuick 2.5
import QtQuick.Window 2.2
+import QtApplicationManager 1.0
+import com.pelagicore.ScreenManager 1.0
+import "sysui/Cluster"
import "sysui"
import controls 1.0
import utils 1.0
@@ -38,6 +41,9 @@ import utils 1.0
Rectangle {
id: root
+ property bool showClusterIfPossible: ApplicationManager.additionalConfiguration.showCluster
+ property var cluster
+
color: "black"
width: Style.screenWidth
height: Style.screenHeight
@@ -71,4 +77,47 @@ Rectangle {
anchors.fill: display
}
}
+
+ Component {
+ id: clusterComponent
+ Window {
+ id: cluster
+ title: "Neptune Cluster Display"
+ height: 720
+ width: 1920
+ visible: false
+
+ color: "black"
+
+ Cluster {}
+
+ Component.onCompleted: {
+ WindowManager.registerCompositorView(cluster)
+ Style.withCluster = true
+ ScreenManager.setScreen(cluster, 1)
+ cluster.show()
+ }
+ }
+ }
+
+ Window.onActiveChanged: {
+ if (Window.active && !WindowManager.runningOnDesktop)
+ cluster.requestActivate()
+ }
+
+ Component.onCompleted: {
+ var canDisplayCluster = Screen.desktopAvailableWidth > Screen.width || WindowManager.runningOnDesktop || ScreenManager.screenCount() > 1
+
+ if (!showClusterIfPossible) {
+ console.log("Showing Instrument Cluster was disabled");
+ return
+ }
+
+ if (canDisplayCluster) {
+ console.log("Showing Instrument Cluster");
+ cluster = clusterComponent.createObject(root);
+ } else {
+ console.log("Showing the Instrument Cluster is not possible on this platform");
+ }
+ }
}