change to horizontal mode
[apps/hvac.git] / app / HVAC.qml
index 41cf7fa..317ef70 100644 (file)
@@ -18,21 +18,42 @@ import QtQuick 2.6
 import QtQuick.Layouts 1.1
 import QtQuick.Controls 2.0
 import AGL.Demo.Controls 1.0
+import Translator 1.0
 import 'api' as API
 
 ApplicationWindow {
     id: root
 
-    API.Binding {
-        id: binding
-        url: bindingAddress
-        onFanSpeedChanged: fanSpeedSlider.value = fanSpeed
+    width: container.width * container.scale
+    height: container.height * container.scale
+
+    Translator {
+        id: translator
+        language: binding.language
     }
 
+       API.Binding {
+               id: binding
+               url: bindingAddress
+               onFanSpeedChanged: fanSpeedSlider.value = fanSpeed
+               onLanguageChanged: translator.language = language
+       }
+
+    Item {
+        id: container
+//        anchors.centerIn: parent
+        x: 555
+        y: -465
+        width: 720
+        height: 1920
+        rotation: -90
+        scale: screenInfo.scale_factor()
+
     ColumnLayout {
         anchors.fill: parent
         anchors.topMargin: width / 10
         anchors.bottomMargin: width / 10
+
         RowLayout {
             Layout.fillHeight: true
             Layout.alignment: Qt.AlignHCenter
@@ -40,7 +61,7 @@ ApplicationWindow {
                 source: './images/HMI_HVAC_Fan_Icon.svg'
             }
             Item {
-                width: root.width * 0.8
+                width: container.width * 0.8
                 Slider {
                     id: fanSpeedSlider
                     anchors.left: parent.left
@@ -57,14 +78,15 @@ ApplicationWindow {
                     anchors.left: fanSpeedSlider.left
                     anchors.top: fanSpeedSlider.bottom
                     font.pixelSize: 32
-                    text: 'FAN SPEED'
+                    text: translator.translate(qsTr('FAN SPEED'), translator.language)
                 }
             }
         }
         RowLayout {
             Layout.fillHeight: true
             Layout.fillWidth: true
-            Layout.alignment: Layout.Center
+            Layout.alignment: Qt.AlignHCenter
+            rotation: 90
             spacing: 20
             ColumnLayout {
                 Layout.fillWidth: true
@@ -74,10 +96,9 @@ ApplicationWindow {
                     side: 'Left'
                 }
                 HeatDegree {
-                    enabled: leftSeat.headLevel > 0
                     onCurrentItemChanged: {
-                        console.log("Left Temp changed",degree)
-                        binding.leftTemperature = degree
+                    console.log("Left Temp changed",degree)
+                    binding.leftTemperature = degree
                     }
                 }
             }
@@ -89,8 +110,8 @@ ApplicationWindow {
                     offImage: './images/HMI_HVAC_Inactive.svg'
                     Label {
                         anchors.centerIn: parent
-                        color: parent.checked ? '#66FF99' : '#848286'
-                        text: 'A/C'
+                        color: parent.checked ? '#00ADDC' : '#848286'
+                        text: translator.translate(qsTr('A/C'), translator.language)
                         font.pixelSize: parent.height / 3
                     }
                     onCheckedChanged: {
@@ -102,8 +123,8 @@ ApplicationWindow {
                     offImage: './images/HMI_HVAC_Inactive.svg'
                     Label {
                         anchors.centerIn: parent
-                        color: parent.checked ? '#66FF99' : '#848286'
-                        text: 'AUTO'
+                        color: parent.checked ? '#00ADDC' : '#848286'
+                        text: translator.translate(qsTr('AUTO'), translator.language)
                         font.pixelSize: parent.height / 3
                     }
                     onCheckedChanged: {
@@ -127,7 +148,6 @@ ApplicationWindow {
                     side: 'Right'
                 }
                 HeatDegree {
-                    enabled: rightSeat.headLevel > 0
                     onCurrentItemChanged: {
                         console.log("Right Temp changed",degree)
                         binding.rightTemperature = degree
@@ -135,16 +155,15 @@ ApplicationWindow {
                 }
             }
         }
-
         RowLayout {
             Layout.fillHeight: true
             Layout.alignment: Qt.AlignHCenter
-            spacing: root.width / 20
             Repeater {
                 model: ['AirDown', 'AirUp', 'AirRight', 'Rear', 'Front']
                 ToggleButton {
                     onImage: './images/HMI_HVAC_%1_Active.svg'.arg(model.modelData)
                     offImage: './images/HMI_HVAC_%1_Inactive.svg'.arg(model.modelData)
+                    rotation: 90
                     onCheckedChanged: {
                         console.debug(model.modelData, checked)
                     }
@@ -153,3 +172,4 @@ ApplicationWindow {
         }
     }
 }
+}