diff --git a/qml.qrc b/qml.qrc index 975919c..b6b41f1 100644 --- a/qml.qrc +++ b/qml.qrc @@ -15,5 +15,6 @@ qml/BottomLine.qml qml/StatsLabel.qml qml/qmldir + qml/settings.qml diff --git a/qml/Livedata.qml b/qml/Livedata.qml index ab48667..e6a96cb 100644 --- a/qml/Livedata.qml +++ b/qml/Livedata.qml @@ -37,6 +37,7 @@ GamePage { contentHeight: contentColumn.height flickableDirection: Flickable.VerticalFlick clip: true + anchors.margins: 5 Column { id: contentColumn @@ -68,7 +69,7 @@ GamePage { wrapMode: Text.WordWrap text: "Front: " + Number(deviceHandler.frontVoltage).toLocaleString(Qt.locale()) + "V / " + Number(deviceHandler.frontTemperature).toLocaleString(Qt.locale()) + "°C" color: GameSettings.textColor - minimumPixelSize: 10 + //minimumPixelSize: 10 font.pixelSize: GameSettings.mediumFontSize } @@ -120,7 +121,7 @@ GamePage { text: "Back: " + Number(deviceHandler.backVoltage).toLocaleString(Qt.locale()) + "V / " + Number(deviceHandler.backTemperature).toLocaleString(Qt.locale()) + "°C" //visible: deviceHandler.alive color: GameSettings.textColor - minimumPixelSize: 10 + //minimumPixelSize: 10 font.pixelSize: GameSettings.mediumFontSize } @@ -153,22 +154,45 @@ GamePage { } } - GameButton { - id: startButton - anchors.horizontalCenter: parent.horizontalCenter + Row { + id: buttonRow anchors.bottom: parent.bottom anchors.bottomMargin: GameSettings.fieldMargin - width: container.width - height: GameSettings.fieldHeight - radius: GameSettings.buttonRadius + spacing: 5 + anchors.horizontalCenter: parent.horizontalCenter - onClicked: app.showPage("RemoteControl.qml") + width: childrenRect.width - Text { - anchors.centerIn: parent - font.pixelSize: GameSettings.tinyFontSize - text: qsTr("REMOTE") - color: startButton.enabled ? GameSettings.textColor : GameSettings.disabledTextColor + GameButton { + id: startButton + width: container.width / 2 + height: GameSettings.fieldHeight + radius: GameSettings.buttonRadius + + onClicked: app.showPage("RemoteControl.qml") + + Text { + anchors.centerIn: parent + font.pixelSize: GameSettings.tinyFontSize + text: qsTr("REMOTE") + color: startButton.enabled ? GameSettings.textColor : GameSettings.disabledTextColor + } + } + + GameButton { + id: settingsButton + width: container.width / 2 + height: GameSettings.fieldHeight + radius: GameSettings.buttonRadius + + onClicked: app.showPage("settings.qml", 3) + + Text { + anchors.centerIn: parent + font.pixelSize: GameSettings.tinyFontSize + text: qsTr("SETTINGS") + color: settingsButton.enabled ? GameSettings.textColor : GameSettings.disabledTextColor + } } } } diff --git a/qml/TitleBar.qml b/qml/TitleBar.qml index 0e9df7f..00fc889 100644 --- a/qml/TitleBar.qml +++ b/qml/TitleBar.qml @@ -8,21 +8,23 @@ Rectangle { height: GameSettings.fieldHeight color: GameSettings.viewColor - property var __titles: ["CONNECT", "LIVEDATA", "REMOTECONTROL"] + property var __titles: ["CONNECT", "LIVEDATA", "REMOTECONTROL", "SETTINGS"] property int currentIndex: 0 signal titleClicked(int index) Repeater { - model: 3 + model: 4 Text { - width: titleBar.width / 3 + width: titleBar.width / 4 height: titleBar.height x: index * width horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter + //text: GameSettings.hugeFontSize * 0.4 + //text: currentIndex text: __titles[index] - font.pixelSize: GameSettings.tinyFontSize + font.pixelSize: GameSettings.hugeFontSize * 0.3 color: titleBar.currentIndex === index ? GameSettings.textColor : GameSettings.disabledTextColor MouseArea { @@ -35,7 +37,7 @@ Rectangle { Item { anchors.bottom: parent.bottom - width: parent.width / 3 + width: parent.width / 4 height: parent.height x: currentIndex * width diff --git a/qml/settings.qml b/qml/settings.qml new file mode 100644 index 0000000..60dc072 --- /dev/null +++ b/qml/settings.qml @@ -0,0 +1,31 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 + +GamePage { + id: livedatePage + + errorMessage: deviceHandler.error + infoMessage: deviceHandler.info + + function close() + { + deviceHandler.disconnectService(); + app.prevPage(); + } + + Rectangle { + id: container + anchors.centerIn: parent + anchors.horizontalCenter: parent.horizontalCenter + width: Math.min(livedatePage.width, livedatePage.height-GameSettings.fieldHeight*4) - 2*GameSettings.fieldMargin + height: livedatePage.height-GameSettings.fieldHeight*4 + radius: GameSettings.buttonRadius + color: GameSettings.viewColor + + Text { + id: test + text: qsTr("text") + color: "white" + } + } +}