some cleanup

This commit is contained in:
Dorian Zedler 2019-03-07 22:31:23 +01:00
parent 9260358e11
commit 4078711cd4
4 changed files with 22 additions and 8 deletions

View file

@ -57,8 +57,9 @@ import "./Default.js" as Default
Item { Item {
property int wHeight property int wHeight
property int wWidth 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 // Colors
readonly property color backgroundColor: theme.backgroundColor readonly property color backgroundColor: theme.backgroundColor

View file

@ -18,13 +18,16 @@ ClimbingRace::ClimbingRace(QObject *parent) : QObject(parent)
this->appSettings = new AppSettings; this->appSettings = new AppSettings;
this->baseConn = new BaseConn; this->baseConn = new BaseConn;
this->baseConn->setIP("192.168.4.1"); this->baseConn->setIP("localhost");
connect(this->baseConn, &BaseConn::stateChanged, this, &ClimbingRace::baseStationStateChanged); connect(this->baseConn, &BaseConn::stateChanged, this, &ClimbingRace::baseStationStateChanged);
this->speedTimers.append( new SpeedTimer ); this->speedTimers.append( new SpeedTimer );
this->player = new QMediaPlayer; this->player = new QMediaPlayer;
this->nextStartActionTimer = new QTimer(this);
nextStartActionTimer->setSingleShot(true);
this->baseStationSyncTimer = new QTimer(); this->baseStationSyncTimer = new QTimer();
this->baseStationSyncTimer->setInterval(10); this->baseStationSyncTimer->setInterval(10);
this->baseStationSyncTimer->setSingleShot(true); this->baseStationSyncTimer->setSingleShot(true);
@ -36,9 +39,6 @@ ClimbingRace::ClimbingRace(QObject *parent) : QObject(parent)
this->timerTextRefreshTimer->setSingleShot(true); this->timerTextRefreshTimer->setSingleShot(true);
this->timerTextRefreshTimer->connect(this->timerTextRefreshTimer, &QTimer::timeout, this, &ClimbingRace::refreshTimerText); this->timerTextRefreshTimer->connect(this->timerTextRefreshTimer, &QTimer::timeout, this, &ClimbingRace::refreshTimerText);
this->refreshTimerText(); this->refreshTimerText();
this->nextStartActionTimer = new QTimer(this);
nextStartActionTimer->setSingleShot(true);
} }
// -------------------------- // --------------------------
@ -483,6 +483,10 @@ void ClimbingRace::refreshTimerText() {
emit this->nextStartActionDelayProgressChanged(); emit this->nextStartActionDelayProgressChanged();
} }
} }
else if (this->mode == REMOTE && this->state == IDLE) {
this->nextStartActionDelayProgress = 0;
emit this->nextStartActionDelayProgressChanged();
}
this->timerTextRefreshTimer->start(); this->timerTextRefreshTimer->start();
} }

View file

@ -50,11 +50,9 @@
#endif #endif
#include "headers/sqlstoragemodel.h" #include "headers/sqlstoragemodel.h"
#include "headers/sqlprofilemodel.h" #include "headers/sqlprofilemodel.h"
#include "headers/buzzerconn.h"
#include "headers/appsettings.h" #include "headers/appsettings.h"
#include "headers/baseconn.h" #include "headers/baseconn.h"
#include "headers/speedtimer.h" #include "headers/speedtimer.h"
#include "headers/speedtimerqmladapter.h"
#include "headers/climbingrace.h" #include "headers/climbingrace.h"
#include <QTranslator> #include <QTranslator>

View file

@ -104,7 +104,12 @@ QString SpeedTimer::getState(){
return("RUNNING"); return("RUNNING");
case STOPPED: case STOPPED:
return("STOPPED"); return("STOPPED");
case FAILED:
return("FAILED");
case CANCELLED:
return("CANCELLED");
} }
return("ERROR");
} }
double SpeedTimer::getCurrTime() { double SpeedTimer::getCurrTime() {
@ -176,5 +181,11 @@ SpeedTimer::timerState SpeedTimer::stateFromString(QString state){
else if (state == "STOPPED") { else if (state == "STOPPED") {
return STOPPED; return STOPPED;
} }
else if (state == "FAILED") {
return FAILED;
}
else {
return CANCELLED;
}
} }