some fixes for start delay stuff

This commit is contained in:
Dorian Zedler 2020-10-02 19:58:25 +02:00
parent 6609245356
commit 3ee017104f
Signed by: dorian
GPG Key ID: D3B255CB8BC7CD37
6 changed files with 26 additions and 20 deletions

View File

@ -6,7 +6,7 @@
#include <scstwclient.h>
#include <scstwrace.h>
#include <ScStw.hpp>
#include <scstwremotemonitorrace.h>
#include <scstwremoterace.h>
#include "headers/scstwappsettings.h"
@ -34,7 +34,7 @@ private:
QTimer * timerTextRefreshTimer;
ScStwRace * localRace;
ScStwRemoteMonitorRace * remoteRace;
ScStwRemoteRace * remoteRace;
public slots:
// functions for qml

View File

@ -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
}
},

View File

@ -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

View File

@ -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: [

@ -1 +1 @@
Subproject commit a247a6c3054545ec69c4eff14b5134f4c084ec31
Subproject commit 3c626b82da8373a2a69b6b7979ecf17d962076dd

View File

@ -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);