summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2016-08-30 17:41:37 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2016-09-01 08:47:38 +0000
commitdae966c9ed509bab775a30e85364a64b77290081 (patch)
tree162dcf907ee7153401a2b37c93f6230009d9c0d1
parentdc7f8ff7c14e25f109990dd0cd42776e40d389b0 (diff)
downloadneptune-ui-dae966c9ed509bab775a30e85364a64b77290081.tar.gz
Moved the cluster detection into the AutoConfig.qml
This is needed as also the multi-process applications need to know whether to display the cluster widget and how big it can be rendered Change-Id: I589439f50fa3aa60630dd7b1fb6e4008a3d1b8c2 Reviewed-by: Nedim Hadzic <nedim.hadzic@pelagicore.com>
-rw-r--r--Main.qml9
-rw-r--r--apps/com.pelagicore.music/ClusterWidget.qml5
-rw-r--r--imports/shared/utils/AutoConfig.qml14
-rw-r--r--imports/shared/utils/Style.qml3
-rw-r--r--plugins/screenManager/screenmanager.cpp8
-rw-r--r--plugins/screenManager/screenmanager.h4
6 files changed, 28 insertions, 15 deletions
diff --git a/Main.qml b/Main.qml
index 69ecbef..8ef993e 100644
--- a/Main.qml
+++ b/Main.qml
@@ -98,20 +98,11 @@ Rectangle {
id: clusterItem
}
- function calculateSize() {
- print (Screen.width, Screen.height)
- Style.clusterWidth = Screen.width
- Style.clusterHeight = Screen.width * 0.375
- }
-
Component.onCompleted: {
WindowManager.registerCompositorView(cluster)
- Style.withCluster = true
ScreenManager.setScreen(cluster, 1)
cluster.show()
- calculateSize()
}
-
}
}
diff --git a/apps/com.pelagicore.music/ClusterWidget.qml b/apps/com.pelagicore.music/ClusterWidget.qml
index 3f5c806..654f87a 100644
--- a/apps/com.pelagicore.music/ClusterWidget.qml
+++ b/apps/com.pelagicore.music/ClusterWidget.qml
@@ -36,12 +36,13 @@ import controls 1.0
import "."
Item {
- width: 1300
+ width: Style.clusterWidth * 0.677
height: parent.height
+ anchors.horizontalCenter: parent.horizontalCenter
ListView {
id: playListView
- width: 400
+ width: parent.width * 0.3
height: parent.height
anchors.centerIn: parent
clip: true
diff --git a/imports/shared/utils/AutoConfig.qml b/imports/shared/utils/AutoConfig.qml
index b4136d3..5c567f7 100644
--- a/imports/shared/utils/AutoConfig.qml
+++ b/imports/shared/utils/AutoConfig.qml
@@ -31,8 +31,10 @@
import QtQuick 2.0
import QtQuick.Window 2.2
+import com.pelagicore.ScreenManager 1.0
QtObject {
+ property bool withCluster: false
property int cellWidth: 53 // 1280/24
property int cellHeight: 33 // 800/24
property var fontWeight: Font.Light
@@ -52,12 +54,15 @@ QtObject {
property int symbolSizeL: 96
property int symbolSizeXL: 114
property int symbolSizeXXL: 192
+ property bool showClusterIfPossible: false
property string displayBackground: "background_1920x1080"
property int screenWidth: Screen.width
property int screenHeight: Math.min(screenWidth * 0.62, Screen.height)
+ property int clusterWidth: 1920
+ property int clusterHeight: 720
onScreenWidthChanged: cellWidth = Math.floor(screenWidth/24)
onScreenHeightChanged: cellHeight = Math.floor(screenHeight/24)
@@ -103,5 +108,14 @@ QtObject {
fontSizeXXL = scalFactor * 48
fontWeight = Font.Light
+
+ var canDisplayCluster = Screen.desktopAvailableWidth > Screen.width || ScreenManager.screenCount() > 1
+ if (canDisplayCluster) {
+ print("Instrument Cluster enabled")
+ withCluster = true
+ clusterWidth = ScreenManager.availableScreens[1].size.width
+ clusterHeight = Math.min(ScreenManager.availableScreens[1].size.width * 0.375, ScreenManager.availableScreens[1].size.height)
+ print("cluster resolution: " + clusterWidth + "x" + clusterHeight)
+ }
}
}
diff --git a/imports/shared/utils/Style.qml b/imports/shared/utils/Style.qml
index 59cdafe..dfb3e2d 100644
--- a/imports/shared/utils/Style.qml
+++ b/imports/shared/utils/Style.qml
@@ -87,12 +87,15 @@ QtObject {
property bool isClient: typeof ApplicationInterface !== 'undefined'
property string styleConfig: isClient ? ApplicationInterface.additionalConfiguration.styleConfig : ApplicationManager.additionalConfiguration.styleConfig
+ property bool showClusterIfPossible: isClient ? ApplicationInterface.additionalConfiguration.showCluster :ApplicationManager.additionalConfiguration.showCluster
property Loader styleLoader: Loader {
source: styleConfig === "auto" ? Qt.resolvedUrl("AutoConfig.qml") : styleConfig
onLoaded: {
print("StyleConfig loaded: ", source)
+ if (item.showClusterIfPossible)
+ item.showClusterIfPossible = root.showClusterIfPossible
}
}
diff --git a/plugins/screenManager/screenmanager.cpp b/plugins/screenManager/screenmanager.cpp
index 72a6bba..660c770 100644
--- a/plugins/screenManager/screenmanager.cpp
+++ b/plugins/screenManager/screenmanager.cpp
@@ -55,7 +55,11 @@ void ScreenManager::setScreen(QWindow *window, int screen)
}
}
-QList<QScreen *> ScreenManager::availableScreens() const
+QList<QObject *> ScreenManager::availableScreens() const
{
- return QGuiApplication::screens();
+ QList<QObject *> list;
+ for (QScreen *screen : QGuiApplication::screens())
+ list.append(screen);
+
+ return list;
}
diff --git a/plugins/screenManager/screenmanager.h b/plugins/screenManager/screenmanager.h
index e9f6af8..3b92b01 100644
--- a/plugins/screenManager/screenmanager.h
+++ b/plugins/screenManager/screenmanager.h
@@ -39,14 +39,14 @@ class ScreenManager : public QObject
{
Q_OBJECT
- Q_PROPERTY(QList<QScreen*> availableScreens READ availableScreens NOTIFY availableScreensChanged)
+ Q_PROPERTY(QList<QObject*> availableScreens READ availableScreens NOTIFY availableScreensChanged)
public:
explicit ScreenManager(QObject *parent = 0);
Q_INVOKABLE int screenCount() const;
Q_INVOKABLE void setScreen(QWindow * window, int screen);
- QList<QScreen*> availableScreens() const;
+ QList<QObject*> availableScreens() const;
signals:
void availableScreensChanged();