From 4078711cd4ace88e7a4e353031572cf44bc2be9b Mon Sep 17 00:00:00 2001 From: dorian Date: Thu, 7 Mar 2019 22:31:23 +0100 Subject: [PATCH] some cleanup --- qml/styles/StyleSettings.qml | 5 +++-- sources/climbingrace.cpp | 12 ++++++++---- sources/main.cpp | 2 -- sources/speedtimer.cpp | 11 +++++++++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/qml/styles/StyleSettings.qml b/qml/styles/StyleSettings.qml index 27a9806..fa8af42 100644 --- a/qml/styles/StyleSettings.qml +++ b/qml/styles/StyleSettings.qml @@ -57,8 +57,9 @@ import "./Default.js" as Default Item { property int wHeight property int wWidth - property var theme: Default - + property var theme: _cppAppSettings.loadSetting("theme") === "Default" ? Default: + _cppAppSettings.loadSetting("theme") === "Light" ? Light: + _cppAppSettings.loadSetting("theme") === "Dark" ? Dark:null // Colors readonly property color backgroundColor: theme.backgroundColor diff --git a/sources/climbingrace.cpp b/sources/climbingrace.cpp index db85a89..f97f1a7 100644 --- a/sources/climbingrace.cpp +++ b/sources/climbingrace.cpp @@ -18,13 +18,16 @@ ClimbingRace::ClimbingRace(QObject *parent) : QObject(parent) this->appSettings = new AppSettings; this->baseConn = new BaseConn; - this->baseConn->setIP("192.168.4.1"); + this->baseConn->setIP("localhost"); connect(this->baseConn, &BaseConn::stateChanged, this, &ClimbingRace::baseStationStateChanged); this->speedTimers.append( new SpeedTimer ); this->player = new QMediaPlayer; + this->nextStartActionTimer = new QTimer(this); + nextStartActionTimer->setSingleShot(true); + this->baseStationSyncTimer = new QTimer(); this->baseStationSyncTimer->setInterval(10); this->baseStationSyncTimer->setSingleShot(true); @@ -36,9 +39,6 @@ ClimbingRace::ClimbingRace(QObject *parent) : QObject(parent) this->timerTextRefreshTimer->setSingleShot(true); this->timerTextRefreshTimer->connect(this->timerTextRefreshTimer, &QTimer::timeout, this, &ClimbingRace::refreshTimerText); this->refreshTimerText(); - - this->nextStartActionTimer = new QTimer(this); - nextStartActionTimer->setSingleShot(true); } // -------------------------- @@ -483,6 +483,10 @@ void ClimbingRace::refreshTimerText() { emit this->nextStartActionDelayProgressChanged(); } } + else if (this->mode == REMOTE && this->state == IDLE) { + this->nextStartActionDelayProgress = 0; + emit this->nextStartActionDelayProgressChanged(); + } this->timerTextRefreshTimer->start(); } diff --git a/sources/main.cpp b/sources/main.cpp index f308d87..4b74b85 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -50,11 +50,9 @@ #endif #include "headers/sqlstoragemodel.h" #include "headers/sqlprofilemodel.h" -#include "headers/buzzerconn.h" #include "headers/appsettings.h" #include "headers/baseconn.h" #include "headers/speedtimer.h" -#include "headers/speedtimerqmladapter.h" #include "headers/climbingrace.h" #include diff --git a/sources/speedtimer.cpp b/sources/speedtimer.cpp index e9b237b..6dd043a 100644 --- a/sources/speedtimer.cpp +++ b/sources/speedtimer.cpp @@ -104,7 +104,12 @@ QString SpeedTimer::getState(){ return("RUNNING"); case STOPPED: return("STOPPED"); + case FAILED: + return("FAILED"); + case CANCELLED: + return("CANCELLED"); } + return("ERROR"); } double SpeedTimer::getCurrTime() { @@ -176,5 +181,11 @@ SpeedTimer::timerState SpeedTimer::stateFromString(QString state){ else if (state == "STOPPED") { return STOPPED; } + else if (state == "FAILED") { + return FAILED; + } + else { + return CANCELLED; + } }