- added 'letter' property to timer

This commit is contained in:
Dorian Zedler 2020-06-13 12:38:24 +02:00
parent 3fe4fcca42
commit 50ee780588
Signed by: dorian
GPG key ID: 989DE36109AFA354
3 changed files with 16 additions and 6 deletions

View file

@ -66,8 +66,9 @@ public:
* \brief ScStwTimer constructor * \brief ScStwTimer constructor
* \param parent the parent object * \param parent the parent object
* \param directControlEnabled Defines if protected properties (startTimer, stopTime, reactionTime and state) can be directly set from outside. * \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 * \brief The TimerState enum contains all state the timer can be in
@ -121,6 +122,11 @@ protected:
*/ */
bool directControlEnabled; bool directControlEnabled;
/*!
* \brief The letter (eg. "A" or "B") of the Timer (only one char)
*/
QString letter;
public slots: public slots:
/*! /*!
@ -218,6 +224,12 @@ public slots:
*/ */
QString getText(); 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 * \brief Function to set if the timer is supposed to be disabled
* *

View file

@ -397,6 +397,7 @@ QVariantList ScStwRace::getTimerDetailList() {
tmpTimer.insert("currentTime", timer->getCurrentTime()); tmpTimer.insert("currentTime", timer->getCurrentTime());
tmpTimer.insert("reactionTime", timer->getReactionTime()); tmpTimer.insert("reactionTime", timer->getReactionTime());
tmpTimer.insert("text", timer->getText()); tmpTimer.insert("text", timer->getText());
tmpTimer.insert("letter", timer->getLetter());
tmpTimers.append(tmpTimer); tmpTimers.append(tmpTimer);
} }

View file

@ -18,9 +18,10 @@
#include "../headers/scstwtimer.h" #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->directControlEnabled = directControlEnabled;
this->letter = letter;
this->startTime = 0; this->startTime = 0;
this->stopTime = 0; this->stopTime = 0;
this->reactionTime = 0; this->reactionTime = 0;
@ -46,10 +47,6 @@ bool ScStwTimer::start(double timeOfStart) {
if(this->state == STARTING) if(this->state == STARTING)
this->setState(RUNNING); this->setState(RUNNING);
}); });
QTimer::singleShot(timeOfStart - QDateTime::currentMSecsSinceEpoch() - 1000, [=](){
//this->handleClimberStart(QDateTime::currentMSecsSinceEpoch());
});
} }
else else
this->setState(RUNNING); this->setState(RUNNING);