added a very fancy indicator for timer rady state during waiting state of race

This commit is contained in:
Dorian Zedler 2020-10-05 20:41:43 +02:00
parent df33598049
commit 620e943bd2
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
4 changed files with 10 additions and 5 deletions

View file

@ -53,7 +53,7 @@ class ScStwRace : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(RaceState state READ getState NOTIFY stateChanged) Q_PROPERTY(RaceState state READ getState NOTIFY stateChanged)
Q_PROPERTY(QVariantList timers READ getTimerDetailList NOTIFY timersChanged) Q_PROPERTY(QVariantList timers READ getTimerDetailList NOTIFY timersChanged)
Q_PROPERTY(QVariantMap currentStartDelay READ getCurrentStartDelay NOTIFY currentStartDelayChanged) Q_PROPERTY(QVariantMap currentStartDelay READ getCurrentStartDelay NOTIFY currentStartDelayChanged)
Q_PROPERTY(bool isReadyForNextState READ getIsReadyForNextState NOTIFY isReadyForNextStateChanged) Q_PROPERTY(bool isReadyForNextState READ getIsReadyForNextState NOTIFY isReadyForNextStateChanged)
Q_PROPERTY(bool competitionMode READ getCompetitionMode NOTIFY competitionModeChanged) Q_PROPERTY(bool competitionMode READ getCompetitionMode NOTIFY competitionModeChanged)

View file

@ -105,6 +105,7 @@ public:
ExtensionBatteryNotFine, /*!< The battery level of one or more extension is critical or unknown */ ExtensionBatteryNotFine, /*!< The battery level of one or more extension is critical or unknown */
ClimberIsNotReady /*!< The startpad of the timer is not triggered */ ClimberIsNotReady /*!< The startpad of the timer is not triggered */
}; };
Q_ENUM(ReadyState)
protected: protected:
/*! /*!

View file

@ -157,9 +157,6 @@ void ScStwRemoteRace::refreshDetails(QVariantMap details) {
qDebug() << "RACE DETAILS: " << details; qDebug() << "RACE DETAILS: " << details;
// state
this->setState(ScStwRace::RaceState(details["state"].toInt()));
// competition mode // competition mode
if(this->competitionMode != details["competitionMode"].toBool()) { if(this->competitionMode != details["competitionMode"].toBool()) {
this->competitionMode = details["competitionMode"].toBool(); this->competitionMode = details["competitionMode"].toBool();
@ -182,6 +179,9 @@ void ScStwRemoteRace::refreshDetails(QVariantMap details) {
// timers // timers
this->refreshRemoteTimers(details["timers"].toList()); this->refreshRemoteTimers(details["timers"].toList());
// state
this->setState(ScStwRace::RaceState(details["state"].toInt()));
// isReady // isReady
if(this->state == WAITING) { if(this->state == WAITING) {
this->isReadyForNextState = details["isReadyForNextState"].toBool(); this->isReadyForNextState = details["isReadyForNextState"].toBool();
@ -212,6 +212,8 @@ void ScStwRemoteRace::rebuildRemoteTimers(QVariantList remoteTimers) {
bool ScStwRemoteRace::refreshRemoteTimers(QVariantList remoteTimers) { bool ScStwRemoteRace::refreshRemoteTimers(QVariantList remoteTimers) {
qDebug() << "REFRESHING TIMERS";
if(remoteTimers.length() != this->remoteTimers.length()){ if(remoteTimers.length() != this->remoteTimers.length()){
// local timers are out of sync // local timers are out of sync
this->rebuildRemoteTimers(remoteTimers); this->rebuildRemoteTimers(remoteTimers);
@ -242,6 +244,8 @@ bool ScStwRemoteRace::refreshRemoteTimers(QVariantList remoteTimers) {
this->remoteTimers[currId]->setState(newState); this->remoteTimers[currId]->setState(newState);
} }
emit this->timersChanged();
return true; return true;
} }

View file

@ -266,7 +266,7 @@ QString ScStwTimer::getText() {
newText = "cancelled"; newText = "cancelled";
break; break;
case ScStwTimer::INCIDENT: case ScStwTimer::INCIDENT:
newText = "Technical\nincident!"; newText = "Technical incident!";
break; break;
case ScStwTimer::DISABLED: case ScStwTimer::DISABLED:
newText = "---"; newText = "---";