From 50ee7805883ec2e735ed4742833fec78848626f4 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sat, 13 Jun 2020 12:38:24 +0200 Subject: [PATCH] - added 'letter' property to timer --- ScStwLibraries/headers/scstwtimer.h | 14 +++++++++++++- ScStwLibraries/sources/scstwrace.cpp | 1 + ScStwLibraries/sources/scstwtimer.cpp | 7 ++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ScStwLibraries/headers/scstwtimer.h b/ScStwLibraries/headers/scstwtimer.h index bfe5469..f8f6d00 100644 --- a/ScStwLibraries/headers/scstwtimer.h +++ b/ScStwLibraries/headers/scstwtimer.h @@ -66,8 +66,9 @@ public: * \brief ScStwTimer constructor * \param parent the parent object * \param directControlEnabled Defines if protected properties (startTimer, stopTime, reactionTime and state) can be directly set from outside. + * \param letter the letter of the timer (only first char will be used!) */ - explicit ScStwTimer(QObject *parent = nullptr, bool directControlEnabled = false); + explicit ScStwTimer(QObject *parent = nullptr, bool directControlEnabled = false, QString letter = "" ); /*! * \brief The TimerState enum contains all state the timer can be in @@ -121,6 +122,11 @@ protected: */ bool directControlEnabled; + /*! + * \brief The letter (eg. "A" or "B") of the Timer (only one char) + */ + QString letter; + public slots: /*! @@ -218,6 +224,12 @@ public slots: */ QString getText(); + /*! + * \brief Function to get the letter of the timer + * \return The letter of the timer or "" + */ + QString getLetter(); + /*! * \brief Function to set if the timer is supposed to be disabled * diff --git a/ScStwLibraries/sources/scstwrace.cpp b/ScStwLibraries/sources/scstwrace.cpp index 0d86f1c..5998f13 100644 --- a/ScStwLibraries/sources/scstwrace.cpp +++ b/ScStwLibraries/sources/scstwrace.cpp @@ -397,6 +397,7 @@ QVariantList ScStwRace::getTimerDetailList() { tmpTimer.insert("currentTime", timer->getCurrentTime()); tmpTimer.insert("reactionTime", timer->getReactionTime()); tmpTimer.insert("text", timer->getText()); + tmpTimer.insert("letter", timer->getLetter()); tmpTimers.append(tmpTimer); } diff --git a/ScStwLibraries/sources/scstwtimer.cpp b/ScStwLibraries/sources/scstwtimer.cpp index 737c058..61cfbe8 100644 --- a/ScStwLibraries/sources/scstwtimer.cpp +++ b/ScStwLibraries/sources/scstwtimer.cpp @@ -18,9 +18,10 @@ #include "../headers/scstwtimer.h" -ScStwTimer::ScStwTimer(QObject *parent, bool directControlEnabled) : QObject(parent) +ScStwTimer::ScStwTimer(QObject *parent, bool directControlEnabled, QString letter) : QObject(parent) { this->directControlEnabled = directControlEnabled; + this->letter = letter; this->startTime = 0; this->stopTime = 0; this->reactionTime = 0; @@ -46,10 +47,6 @@ bool ScStwTimer::start(double timeOfStart) { if(this->state == STARTING) this->setState(RUNNING); }); - QTimer::singleShot(timeOfStart - QDateTime::currentMSecsSinceEpoch() - 1000, [=](){ - //this->handleClimberStart(QDateTime::currentMSecsSinceEpoch()); - }); - } else this->setState(RUNNING);