From 33834884e804b50b18d22bb70c88fb5943afd34e Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 9 Jan 2021 23:13:45 +0100 Subject: [PATCH] - fix issues when reading settings while connecting --- resources/qml/MainPage/TopToolBar.qml | 1 - .../qml/ProfilesDialog/ProfilesDialog.qml | 2 +- .../SettingsBaseStationPage.qml | 36 ++--------- .../SettingsBaseStationSettingsPage.qml | 62 +++++++++++++++++++ .../qml/SettingsDialog/SettingsStack.qml | 8 +++ resources/qml/components/MainActionButton.qml | 9 ++- .../qml/components/SmoothItemDelegate.qml | 2 +- resources/qml/qml.qrc | 1 + shared-libraries | 2 +- 9 files changed, 86 insertions(+), 37 deletions(-) create mode 100644 resources/qml/SettingsDialog/SettingsBaseStationSettingsPage.qml diff --git a/resources/qml/MainPage/TopToolBar.qml b/resources/qml/MainPage/TopToolBar.qml index e90be3b..8b13d38 100644 --- a/resources/qml/MainPage/TopToolBar.qml +++ b/resources/qml/MainPage/TopToolBar.qml @@ -166,7 +166,6 @@ ToolBar { function getLaneState(extensions) { var batteryWarning = false; for(var i = 0; i < extensions.length; i++) { - console.log(JSON.stringify(extensions[i])) if(extensions[i]["state"] !== ScStw.ExtensionConnected || extensions[i]["batteryState"] === ScStw.BatteryCritical) return 2 if(extensions[i]["batteryState"] === ScStw.BatteryWarning) diff --git a/resources/qml/ProfilesDialog/ProfilesDialog.qml b/resources/qml/ProfilesDialog/ProfilesDialog.qml index 645a405..772c934 100644 --- a/resources/qml/ProfilesDialog/ProfilesDialog.qml +++ b/resources/qml/ProfilesDialog/ProfilesDialog.qml @@ -92,7 +92,7 @@ Popup { Connections { target: root - onOpened: { + function onOpened() { profilesStack.init() } } diff --git a/resources/qml/SettingsDialog/SettingsBaseStationPage.qml b/resources/qml/SettingsDialog/SettingsBaseStationPage.qml index b095d4d..85912d1 100644 --- a/resources/qml/SettingsDialog/SettingsBaseStationPage.qml +++ b/resources/qml/SettingsDialog/SettingsBaseStationPage.qml @@ -190,8 +190,7 @@ Column { width: parent.width height: parentObj.delegateHeight - scale: 0 - visible: false + visible: true verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter @@ -226,44 +225,19 @@ Column { text: "Firmware: " + speedBackend.scStwClient.getFirmwareVersion() + " API: " + speedBackend.scStwClient.getApiVersion() } - SmoothSliderDelegate { - id: baseStationVolumeDel - - property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.SoundVolumeSetting, ScStwSettings.KeyLevel) - - text: qsTr("volume") + NextPageDelegate { + text: qsTr("settings") width: parent.width height: parentObj.delegateHeight * 0.8 font.pixelSize: height * 0.5 - sliderValue: setting.value - - onSliderFinished: { - enabled = false - setting.value = sliderValue - enabled = true + onClicked: { + parentObj.push(baseStationSettings) } } - SmoothSwitchDelegate { - property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.CompetitionModeSetting, ScStwSettings.KeyLevel) - - width: parent.width - height: parentObj.delegateHeight - - checked: setting.value - - onCheckedChanged: { - enabled = false - setting.value = checked - enabled = true - } - - text: qsTr("competition mode") - } - NextPageDelegate { text: qsTr("extensions") diff --git a/resources/qml/SettingsDialog/SettingsBaseStationSettingsPage.qml b/resources/qml/SettingsDialog/SettingsBaseStationSettingsPage.qml new file mode 100644 index 0000000..6d72167 --- /dev/null +++ b/resources/qml/SettingsDialog/SettingsBaseStationSettingsPage.qml @@ -0,0 +1,62 @@ +import QtQuick 2.12 +import QtMultimedia 5.8 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.12 +import QtQuick.Layouts 1.3 +import QtGraphicalEffects 1.0 +import QtQuick.Controls.Styles 1.4 + +import de.itsblue.ScStw 2.0 +import de.itsblue.ScStw.Styling 2.0 +import de.itsblue.ScStw.Styling.Components 1.0 +import de.itsblue.ScStwApp 2.0 + +import "../components" + + +Column { + id: baseStationSettings + + property var parentObj + property string title: "Bs settings" + + width: parentObj.width + + SmoothSliderDelegate { + id: baseStationVolumeDel + + property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.SoundVolumeSetting, ScStwSettings.KeyLevel) + + text: qsTr("volume") + + width: parent.width + height: parentObj.delegateHeight + + font.pixelSize: height * 0.5 + + sliderValue: setting.readonlyValue + + onSliderFinished: { + enabled = false + setting.value = sliderValue + enabled = true + } + } + + SmoothSwitchDelegate { + property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.CompetitionModeSetting, ScStwSettings.KeyLevel) + + width: parent.width + height: parentObj.delegateHeight + + checked: setting.readonlyValue + + onClicked: { + enabled = false + setting.value = checked + enabled = true + } + + text: qsTr("competition mode") + } +} diff --git a/resources/qml/SettingsDialog/SettingsStack.qml b/resources/qml/SettingsDialog/SettingsStack.qml index d2c2567..b68aebd 100644 --- a/resources/qml/SettingsDialog/SettingsStack.qml +++ b/resources/qml/SettingsDialog/SettingsStack.qml @@ -57,6 +57,14 @@ StackView { } } + Component { + id: baseStationSettings + + SettingsBaseStationSettingsPage { + parentObj: control + } + } + /*-----Custom animations-----*/ pushEnter: Transition { NumberAnimation { diff --git a/resources/qml/components/MainActionButton.qml b/resources/qml/components/MainActionButton.qml index 7ed13f0..b82a21a 100644 --- a/resources/qml/components/MainActionButton.qml +++ b/resources/qml/components/MainActionButton.qml @@ -94,8 +94,13 @@ DelayButton { Connections { target: control - onProgressChanged: canvas.requestPaint() - onOldStartProgressChanged: canvas.requestPaint() + function onProgressChanged() { + canvas.requestPaint() + } + + function onOldStartProgressChanged() { + canvas.requestPaint() + } } onPaint: { diff --git a/resources/qml/components/SmoothItemDelegate.qml b/resources/qml/components/SmoothItemDelegate.qml index e79c30b..18ca7f5 100644 --- a/resources/qml/components/SmoothItemDelegate.qml +++ b/resources/qml/components/SmoothItemDelegate.qml @@ -43,7 +43,7 @@ ItemDelegate { background: Rectangle { id: backgroundRect - color: control.down ? Qt.darker(control.color, 1.3) : control.color + color: control.down ? appTheme.theme.colors.delegatePressed : appTheme.theme.colors.delegateBackground radius: height * 0.3 diff --git a/resources/qml/qml.qrc b/resources/qml/qml.qrc index 26fa609..18988d9 100644 --- a/resources/qml/qml.qrc +++ b/resources/qml/qml.qrc @@ -29,5 +29,6 @@ components/StateIndicator.qml components/BatteryIndicator.qml components/ExtensionOverview.qml + SettingsDialog/SettingsBaseStationSettingsPage.qml diff --git a/shared-libraries b/shared-libraries index 92fae09..d37c564 160000 --- a/shared-libraries +++ b/shared-libraries @@ -1 +1 @@ -Subproject commit 92fae096726f559cf36a87816ab97093db555d8b +Subproject commit d37c5646f02712b8c88e98fc540c78158fca0cc0