aboutsummaryrefslogtreecommitdiffstats
path: root/sysui
diff options
context:
space:
mode:
authorEgor Nemtsev <enemtsev@luxoft.com>2020-01-27 15:37:42 +0300
committerEgor Nemtsev <enemtsev@luxoft.com>2020-01-29 12:58:06 +0000
commitf7bdd6ab38770121f0cae13066ee7588f1737710 (patch)
tree3ca48cd1b0a211ac6bff2f11e809ce97bb8d0a2a /sysui
parent665e6d07cd4ce7a31fba8cf4f09cfe0f0442573f (diff)
[qsr] implement scaling for qsr window on Desktop
-scale qsr window according to cluster panel size Task-number: AUTOSUITE-1415 Change-Id: I52c36890531d6d5c27b0d8ec06be82e7553de7f5 Reviewed-by: Grigorii Zimin <gzimin@luxoft.com>
Diffstat (limited to 'sysui')
-rw-r--r--sysui/instrumentcluster/InstrumentClusterWindow.qml55
-rw-r--r--sysui/stores/ClusterStore.qml17
2 files changed, 50 insertions, 22 deletions
diff --git a/sysui/instrumentcluster/InstrumentClusterWindow.qml b/sysui/instrumentcluster/InstrumentClusterWindow.qml
index 6dd30255..8a9c0688 100644
--- a/sysui/instrumentcluster/InstrumentClusterWindow.qml
+++ b/sysui/instrumentcluster/InstrumentClusterWindow.qml
@@ -53,29 +53,30 @@ Window {
applicationICWindows.next();
}
- //Demo case to stick QtSafeRendererWindow to Cluster on Desktop
- //should be also enabled on "Safe" part
- function sendWindowCoordsToSafeUI(x, y) {
- var sendMessageObject = Qt.createQmlObject("import QtQuick 2.0; import Qt.SafeRenderer 1.1;
- QtObject {
- function sendClusterWindowPos(x,y) {
- SafeMessage.moveItem(\"mainWindow\", Qt.point(x, y))
- }
- }
- ", root, "sendMessageObject")
- sendMessageObject.sendClusterWindowPos(x, y);
+ // Demo case to stick QtSafeRendererWindow to Cluster on Desktop
+ // should be also enabled on "Safe" part
+ // send x,y of window, x,y of uiSlot (contains cluster view item) inside window,
+ // width and height of uiSlot item
+ function sendWindowStateToSafeUI() {
+ if (root.clusterStore.runningOnDesktop) {
+ var sendMessageObject = Qt.createQmlObject(
+ "import QtQuick 2.0; import Qt.SafeRenderer 1.1;
+ QtObject {
+ function sendClusterWindowState(x,y, dx, dy, width, height) {
+ SafeMessage.moveItem(\"mainWindowPos\", Qt.point(x, y))
+ SafeMessage.moveItem(\"mainWindowPanelOrigin\", Qt.point(dx, dy))
+ SafeMessage.moveItem(\"mainWindowPanelSize\", Qt.point(width, height))
+ }
+ }", root, "sendMessageObject");
+ sendMessageObject.sendClusterWindowState(root.x, root.y, uiSlot.x, uiSlot.y,
+ uiSlot.width, uiSlot.height);
+ }
}
color: "black"
title: root.clusterStore.clusterTitle
screen: root.clusterStore.clusterScreen
- //send (if enabled) cluster window positions to QSR Safe UI, 180 is cluster item top margin
- //QSR Safe UI window then moves to cluster item 0,0 position
- onXChanged: if (root.clusterStore.qsrEnabled) sendWindowCoordsToSafeUI(root.x, root.y + 180);
- onYChanged: if (root.clusterStore.qsrEnabled) sendWindowCoordsToSafeUI(root.x, root.y + 180);
-
-
Component.onCompleted: {
// Would like to use a regular property binding instead. But it doesn't work and I don't know why
visible = true;
@@ -93,6 +94,26 @@ Window {
}
}
+ // Use these two Connections to send (if qsr enabled) cluster window positions to QSR Safe UI
+ // QSR Safe UI window then moves to cluster item 0,0 position
+ // panel properties for scale are sent from SafeTelltalesPanel
+ // Desktop-specific demo case
+ Connections {
+ target: root
+ enabled: root.clusterStore.qsrEnabled
+ onXChanged: sendWindowStateToSafeUI();
+ onYChanged: sendWindowStateToSafeUI();
+ onActiveChanged: sendWindowStateToSafeUI();
+ }
+ Connections {
+ target: uiSlot
+ enabled: root.clusterStore.qsrEnabled
+ onWidthChanged: sendWindowStateToSafeUI();
+ onHeightChanged: sendWindowStateToSafeUI();
+ onYChanged: sendWindowStateToSafeUI();
+ onXChanged: sendWindowStateToSafeUI();
+ }
+
Item {
id: uiSlot
diff --git a/sysui/stores/ClusterStore.qml b/sysui/stores/ClusterStore.qml
index 679eba64..c5266cf3 100644
--- a/sysui/stores/ClusterStore.qml
+++ b/sysui/stores/ClusterStore.qml
@@ -65,15 +65,22 @@ QtObject {
property int clusterPosition: 1 // 0: top 1: center 2: bottom
onClusterScreenChanged: {
- if (qsrEnabled || !adjustSizesForScreen) {
- desktopWidth = Config.instrumentClusterWidth;
- desktopHeight = Config.instrumentClusterHeight;
- } else {
+ if (adjustSizesForScreen) {
var tempWidth = Math.ceil(clusterScreen.width * 0.9);
desktopWidth = tempWidth > Config.instrumentClusterWidth
? Config.instrumentClusterWidth
: tempWidth;
- desktopHeight = Math.ceil(desktopWidth / Config.instrumentClusterUIAspectRatio);
+ if (qsrEnabled) {
+ // Desktop demo case: make window 20% higher than cluster panel, so qsr
+ // window will not overlap cluster window title bar
+ desktopHeight = Math.ceil(desktopWidth / Config.instrumentClusterUIAspectRatio
+ * 1.2);
+ } else {
+ desktopHeight = Math.ceil(desktopWidth / Config.instrumentClusterUIAspectRatio);
+ }
+ } else {
+ desktopWidth = Config.instrumentClusterWidth;
+ desktopHeight = Config.instrumentClusterHeight;
}
}
}