From 3ee017104f547e96250ff2dc5774d5503de3ac69 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Fri, 2 Oct 2020 19:58:25 +0200 Subject: [PATCH] some fixes for start delay stuff --- headers/scstwappbackend.h | 4 ++-- resources/qml/MainPage/CenterContent.qml | 20 +++++++++++-------- resources/qml/components/MainActionButton.qml | 3 ++- resources/qml/main.qml | 15 +++++++------- shared-libraries | 2 +- sources/scstwappbackend.cpp | 2 +- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/headers/scstwappbackend.h b/headers/scstwappbackend.h index 084a29d..ce06143 100644 --- a/headers/scstwappbackend.h +++ b/headers/scstwappbackend.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include "headers/scstwappsettings.h" @@ -34,7 +34,7 @@ private: QTimer * timerTextRefreshTimer; ScStwRace * localRace; - ScStwRemoteMonitorRace * remoteRace; + ScStwRemoteRace * remoteRace; public slots: // functions for qml diff --git a/resources/qml/MainPage/CenterContent.qml b/resources/qml/MainPage/CenterContent.qml index 583b65f..f86dd32 100644 --- a/resources/qml/MainPage/CenterContent.qml +++ b/resources/qml/MainPage/CenterContent.qml @@ -13,9 +13,9 @@ import de.itsblue.ScStw.Styling.Components 1.0 Item { id: control - // ---------------------------------- - // -- Start / Stop / Reset button --- - // ---------------------------------- + property ScStwSetting competitionModeSetting: speedBackend.settings.getSetting(ScStwSettings.CompetitionModeSetting, ScStwSettings.KeyLevel) + property ScStwSetting readySoundEnableSetting: speedBackend.settings.getSetting(ScStwSettings.ReadySoundEnableSetting, ScStwSettings.KeyLevel) + GridLayout { id: centerLayout @@ -43,8 +43,6 @@ Item { MainActionButton { id: mainActionButton - - property ScStwSetting setting: speedBackend.settings.getSetting(ScStwSettings.CompetitionModeSetting, ScStwSettings.KeyLevel) property double size startProgress: speedBackend.race.currentStartDelay[ScStwRace.CurrentStartStateDelayProgress] @@ -73,8 +71,13 @@ Item { case ScStwRace.IDLE: ret = speedBackend.race.start() break; - case ScStwRace.PREPAIRING: case ScStwRace.WAITING: + if(!control.readySoundEnableSetting.value) + ret = speedBackend.race.start() + else + ret = speedBackend.race.cancel() + break; + case ScStwRace.PREPAIRING: case ScStwRace.STARTING: ret = speedBackend.race.cancel() break; @@ -133,7 +136,8 @@ Item { PropertyChanges { target: mainActionButton size: 0.9 - text: "cancel" + text: control.readySoundEnableSetting.value ? "cancel":"ready" + enabled: control.readySoundEnableSetting.value ? true:speedBackend.race.isReadyForNextState } }, @@ -152,7 +156,7 @@ Item { target: mainActionButton size: 0.9 text: "stop" - progressControlActivated: speedBackend.scStwClient.state === ScStwClient.CONNECTED // TODO && mainActionButton.setting.value === true + progressControlActivated: speedBackend.scStwClient.state === ScStwClient.CONNECTED && control.competitionModeSetting.value } }, diff --git a/resources/qml/components/MainActionButton.qml b/resources/qml/components/MainActionButton.qml index a31a997..4f8f87f 100644 --- a/resources/qml/components/MainActionButton.qml +++ b/resources/qml/components/MainActionButton.qml @@ -79,7 +79,8 @@ DelayButton { onPaint: { var progress - var showHoldProgress = (control.down && control.progressControlActivated) + var showHoldProgress = ((control.startProgress <= 0 || control.startProgress === 1) && control.progressControlActivated) + if(showHoldProgress) progress = control.progress else diff --git a/resources/qml/main.qml b/resources/qml/main.qml index 18d61db..29fdac0 100644 --- a/resources/qml/main.qml +++ b/resources/qml/main.qml @@ -75,7 +75,8 @@ ApplicationWindow { console.log("race state changed to: " + speedBackend.race.state) if(speedBackend.race.state != ScStwRace.IDLE) { - //settingsDialog.close() + settingsDialog.close() + profilesDialog.close() } app.state = speedBackend.race.state @@ -240,16 +241,16 @@ ApplicationWindow { height: width } - /*ProfilesDialog { + ProfilesDialog { id: profilesDialog property int margin: app.landscape() ? app.height * 0.05:app.width * 0.05 - x: app.landscape() ? topContainerItm.width + margin:topContainerItm.x + margin - y: !app.landscape() ? topContainerItm.height + margin:topContainerItm.x + margin - width: app.landscape() ? app.width - topContainerItm.width - menu_container.width - margin * 2 : app.width - margin * 2 - height: !app.landscape() ? app.height - topContainerItm.height - menu_container.height - margin * 2 : app.height - margin * 2 - }*/ + x: centerContent.x + margin + y: centerContent.y + margin + width: centerContent.width - margin * 2 + height: centerContent.height - margin * 2 + } /* states: [ diff --git a/shared-libraries b/shared-libraries index a247a6c..3c626b8 160000 --- a/shared-libraries +++ b/shared-libraries @@ -1 +1 @@ -Subproject commit a247a6c3054545ec69c4eff14b5134f4c084ec31 +Subproject commit 3c626b82da8373a2a69b6b7979ecf17d962076dd diff --git a/sources/scstwappbackend.cpp b/sources/scstwappbackend.cpp index ba5886b..4644fca 100644 --- a/sources/scstwappbackend.cpp +++ b/sources/scstwappbackend.cpp @@ -5,7 +5,7 @@ ScStwAppBackend::ScStwAppBackend(QObject *parent) : QObject(parent) this->scStwClient = new ScStwClient(this); this->appSettings = new ScStwAppSettings(this->scStwClient, this); this->localRace = new ScStwRace(this); - this->remoteRace = new ScStwRemoteMonitorRace(this->scStwClient, this); + this->remoteRace = new ScStwRemoteRace(this->scStwClient, this); this->mode = LOCAL; connect(this->appSettings, &ScStwAppSettings::settingChanged, this, &ScStwAppBackend::handleSettingChange);