From 620e943bd2581062aea327a1610ad0a99bd9c07f Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Mon, 5 Oct 2020 20:41:43 +0200 Subject: [PATCH] added a very fancy indicator for timer rady state during waiting state of race --- ScStwLibraries/headers/scstwrace.h | 2 +- ScStwLibraries/headers/scstwtimer.h | 1 + ScStwLibraries/sources/client/scstwremoterace.cpp | 10 +++++++--- ScStwLibraries/sources/scstwtimer.cpp | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ScStwLibraries/headers/scstwrace.h b/ScStwLibraries/headers/scstwrace.h index 9b513dc..ec6ab52 100644 --- a/ScStwLibraries/headers/scstwrace.h +++ b/ScStwLibraries/headers/scstwrace.h @@ -53,7 +53,7 @@ class ScStwRace : public QObject { Q_OBJECT 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(bool isReadyForNextState READ getIsReadyForNextState NOTIFY isReadyForNextStateChanged) Q_PROPERTY(bool competitionMode READ getCompetitionMode NOTIFY competitionModeChanged) diff --git a/ScStwLibraries/headers/scstwtimer.h b/ScStwLibraries/headers/scstwtimer.h index 5b52247..bdbe780 100644 --- a/ScStwLibraries/headers/scstwtimer.h +++ b/ScStwLibraries/headers/scstwtimer.h @@ -105,6 +105,7 @@ public: ExtensionBatteryNotFine, /*!< The battery level of one or more extension is critical or unknown */ ClimberIsNotReady /*!< The startpad of the timer is not triggered */ }; + Q_ENUM(ReadyState) protected: /*! diff --git a/ScStwLibraries/sources/client/scstwremoterace.cpp b/ScStwLibraries/sources/client/scstwremoterace.cpp index e7ddc8a..272fa5e 100644 --- a/ScStwLibraries/sources/client/scstwremoterace.cpp +++ b/ScStwLibraries/sources/client/scstwremoterace.cpp @@ -157,9 +157,6 @@ void ScStwRemoteRace::refreshDetails(QVariantMap details) { qDebug() << "RACE DETAILS: " << details; - // state - this->setState(ScStwRace::RaceState(details["state"].toInt())); - // competition mode if(this->competitionMode != details["competitionMode"].toBool()) { this->competitionMode = details["competitionMode"].toBool(); @@ -182,6 +179,9 @@ void ScStwRemoteRace::refreshDetails(QVariantMap details) { // timers this->refreshRemoteTimers(details["timers"].toList()); + // state + this->setState(ScStwRace::RaceState(details["state"].toInt())); + // isReady if(this->state == WAITING) { this->isReadyForNextState = details["isReadyForNextState"].toBool(); @@ -212,6 +212,8 @@ void ScStwRemoteRace::rebuildRemoteTimers(QVariantList remoteTimers) { bool ScStwRemoteRace::refreshRemoteTimers(QVariantList remoteTimers) { + qDebug() << "REFRESHING TIMERS"; + if(remoteTimers.length() != this->remoteTimers.length()){ // local timers are out of sync this->rebuildRemoteTimers(remoteTimers); @@ -242,6 +244,8 @@ bool ScStwRemoteRace::refreshRemoteTimers(QVariantList remoteTimers) { this->remoteTimers[currId]->setState(newState); } + emit this->timersChanged(); + return true; } diff --git a/ScStwLibraries/sources/scstwtimer.cpp b/ScStwLibraries/sources/scstwtimer.cpp index 718d186..8ffb30f 100644 --- a/ScStwLibraries/sources/scstwtimer.cpp +++ b/ScStwLibraries/sources/scstwtimer.cpp @@ -266,7 +266,7 @@ QString ScStwTimer::getText() { newText = "cancelled"; break; case ScStwTimer::INCIDENT: - newText = "Technical\nincident!"; + newText = "Technical incident!"; break; case ScStwTimer::DISABLED: newText = "---";