From 886abb2a02f54029fe0ae8f0d34083e679b9fd3d Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Tue, 6 Oct 2020 14:00:22 +0200 Subject: [PATCH] some fixes, added timer disable function --- ScStwLibraries/headers/ScStw.hpp | 2 +- .../headers/client/scstwremoterace.h | 1 + .../sources/client/scstwremoterace.cpp | 21 +++++++++++++++++++ .../sources/styling/scstwappthememanager.cpp | 2 +- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ScStwLibraries/headers/ScStw.hpp b/ScStwLibraries/headers/ScStw.hpp index 46aba53..c38f72f 100644 --- a/ScStwLibraries/headers/ScStw.hpp +++ b/ScStwLibraries/headers/ScStw.hpp @@ -81,7 +81,7 @@ public: StopRaceCommand = 1001, ResetRaceCommand = 1002, CancelRaceCommand = 1003, - SetTimerDisabled = 1004, + SetTimerDisabledCommand = 1004, GetRaceStateCommand = 2000, GetRaceDetailsCommand = 2001, diff --git a/ScStwLibraries/headers/client/scstwremoterace.h b/ScStwLibraries/headers/client/scstwremoterace.h index ccf780f..75488c7 100644 --- a/ScStwLibraries/headers/client/scstwremoterace.h +++ b/ScStwLibraries/headers/client/scstwremoterace.h @@ -53,6 +53,7 @@ public slots: ScStw::StatusCode cancel(); ScStw::StatusCode stop(); ScStw::StatusCode reset(); + ScStw::StatusCode setTimerDisabled(int id, bool disabled); bool addTimer(ScStwTimer *timer); QVariantMap getCurrentStartDelay(); bool getIsReadyForNextState(); diff --git a/ScStwLibraries/sources/client/scstwremoterace.cpp b/ScStwLibraries/sources/client/scstwremoterace.cpp index 272fa5e..6d26201 100644 --- a/ScStwLibraries/sources/client/scstwremoterace.cpp +++ b/ScStwLibraries/sources/client/scstwremoterace.cpp @@ -90,6 +90,27 @@ ScStw::StatusCode ScStwRemoteRace::reset() { return ScStw::StatusCode(reply["status"].toInt()); } +ScStw::StatusCode ScStwRemoteRace::setTimerDisabled(int timerId, bool disabled) { + if(this->state != IDLE && this->state != WAITING) + return ScStw::CurrentStateNotVaildForOperationError; + + if(timerId < 0 || timerId - 1 > this->timers.length()) + return ScStw::ItemNotFoundError; + + qDebug() << "+ --- setting timer " << timerId << " to disabled: " << disabled; + + QVariantMap requestData = { + {"timerId", timerId}, + {"disabled", disabled} + }; + + QVariantMap reply = this->scStwClient->sendCommand(ScStw::SetTimerDisabledCommand, QJsonValue::fromVariant(requestData)); + + qDebug() << "+ --- timer disabled command returned: " << reply; + + return ScStw::StatusCode(reply["status"].toInt()); +} + // ------------------------- // --- Base Station sync --- // ------------------------- diff --git a/ScStwLibraries/sources/styling/scstwappthememanager.cpp b/ScStwLibraries/sources/styling/scstwappthememanager.cpp index afa31c2..e2eca13 100644 --- a/ScStwLibraries/sources/styling/scstwappthememanager.cpp +++ b/ScStwLibraries/sources/styling/scstwappthememanager.cpp @@ -116,7 +116,7 @@ ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent) {"success", "#6bd43b"}, {"error", "#e03b2f"}, - {"warning", "#e0b928"}, + {"warning", "#d6ae1e"}, {"line", "grey"},