parent
46c62ba187
commit
a56eae71a7
7 changed files with 147 additions and 22 deletions
|
@ -29,7 +29,7 @@ class ScStwRemoteRace : public ScStwRace
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ScStwRemoteRace(ScStwClient *scStwClient, QObject *parent = nullptr);
|
ScStwRemoteRace(ScStwClient *scStwClient, ScStwSettings *settings = nullptr, QObject *parent = nullptr);
|
||||||
|
|
||||||
enum RaceMode {
|
enum RaceMode {
|
||||||
LOCAL,
|
LOCAL,
|
||||||
|
@ -60,13 +60,14 @@ public slots:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleBaseStationSignal(ScStw::SignalKey key, QVariant data);
|
void handleBaseStationSignal(ScStw::SignalKey key, QVariant data);
|
||||||
|
void handleSettingChange(int keyInt, int keyLevel, QVariant value);
|
||||||
|
|
||||||
bool refreshRemoteTimers(QVariantList remoteTimers);
|
bool refreshRemoteTimers(QVariantList remoteTimers);
|
||||||
void rebuildRemoteTimers(QVariantList remoteTimers);
|
void rebuildRemoteTimers(QVariantList remoteTimers);
|
||||||
void refreshDetails(QVariantMap details);
|
void refreshDetails(QVariantMap details);
|
||||||
void handleClientStateChange();
|
void handleClientStateChange();
|
||||||
RaceMode getMode();
|
RaceMode getMode();
|
||||||
bool local();
|
bool local();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SCSTWREMOTEMONITORRACE_H
|
#endif // SCSTWREMOTEMONITORRACE_H
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include "scstwtimer.h"
|
#include "scstwtimer.h"
|
||||||
#include "scstwsoundplayer.h"
|
#include "scstwsoundplayer.h"
|
||||||
|
#include "scstwsettings.h"
|
||||||
|
|
||||||
class ScStwRemoteRace;
|
class ScStwRemoteRace;
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ class ScStwRace : public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ScStwRace(QObject *parent = nullptr);
|
explicit ScStwRace(QObject *parent = nullptr);
|
||||||
|
explicit ScStwRace(ScStwSettings *settings, QObject *parent = nullptr);
|
||||||
|
|
||||||
friend class ScStwRemoteRace;
|
friend class ScStwRemoteRace;
|
||||||
|
|
||||||
|
@ -80,7 +82,8 @@ private:
|
||||||
// sounds
|
// sounds
|
||||||
ScStwSoundPlayer * soundPlayer;
|
ScStwSoundPlayer * soundPlayer;
|
||||||
|
|
||||||
// some settings
|
// settings
|
||||||
|
ScStwSettings *settings;
|
||||||
double soundVolume;
|
double soundVolume;
|
||||||
bool competitionMode;
|
bool competitionMode;
|
||||||
bool competitionModeChangedRecently;
|
bool competitionModeChangedRecently;
|
||||||
|
@ -128,7 +131,7 @@ public slots:
|
||||||
bool writeStartSoundSetting(ScStwSoundPlayer::StartSound sound, bool enabled, int delay);
|
bool writeStartSoundSetting(ScStwSoundPlayer::StartSound sound, bool enabled, int delay);
|
||||||
bool setSoundVolume(double volume);
|
bool setSoundVolume(double volume);
|
||||||
virtual bool addTimer(ScStwTimer *timer);
|
virtual bool addTimer(ScStwTimer *timer);
|
||||||
void setCompetitionMode(bool competitionMode);
|
bool setCompetitionMode(bool competitionMode);
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
RaceState getState();
|
RaceState getState();
|
||||||
|
@ -148,6 +151,7 @@ private slots:
|
||||||
bool playSoundsAndStartTimers();
|
bool playSoundsAndStartTimers();
|
||||||
bool doDelayAndSoundOfCurrentStartState(double *timeOfSoundPlaybackStart = nullptr);
|
bool doDelayAndSoundOfCurrentStartState(double *timeOfSoundPlaybackStart = nullptr);
|
||||||
void enableAllTimers();
|
void enableAllTimers();
|
||||||
|
void technicalIncident();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Function to declare the winner and looser timers after a timer has been stopped
|
* \brief Function to declare the winner and looser timers after a timer has been stopped
|
||||||
|
@ -158,6 +162,11 @@ private slots:
|
||||||
virtual bool getIsReadyForNextState();
|
virtual bool getIsReadyForNextState();
|
||||||
void handleTimerReadyStateChange(ScStwTimer::ReadyState readyState);
|
void handleTimerReadyStateChange(ScStwTimer::ReadyState readyState);
|
||||||
|
|
||||||
|
// settings
|
||||||
|
bool writeStartSoundSettingKey(ScStwSoundPlayer::StartSound sound, QString key, QVariant value);
|
||||||
|
virtual void handleSettingChange(int keyInt, int keyLevel, QVariant value);
|
||||||
|
void reloadAllSettings();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void startTimers();
|
void startTimers();
|
||||||
void stopTimers(int type);
|
void stopTimers(int type);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "scstwremoterace.h"
|
#include "scstwremoterace.h"
|
||||||
|
|
||||||
ScStwRemoteRace::ScStwRemoteRace(ScStwClient *scStwClient, QObject *parent) : ScStwRace(parent)
|
ScStwRemoteRace::ScStwRemoteRace(ScStwClient *scStwClient, ScStwSettings *settings, QObject *parent) : ScStwRace(settings, parent)
|
||||||
{
|
{
|
||||||
this->isReadyForNextState = true;
|
this->isReadyForNextState = true;
|
||||||
|
|
||||||
|
@ -90,7 +90,6 @@ ScStw::StatusCode ScStwRemoteRace::reset() {
|
||||||
return ScStw::StatusCode(reply["status"].toInt());
|
return ScStw::StatusCode(reply["status"].toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -------------------------
|
// -------------------------
|
||||||
// --- Base Station sync ---
|
// --- Base Station sync ---
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
@ -130,6 +129,12 @@ bool ScStwRemoteRace::local() {
|
||||||
return this->getMode() == LOCAL;
|
return this->getMode() == LOCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScStwRemoteRace::handleSettingChange(int keyInt, int keyLevel, QVariant value) {
|
||||||
|
if(this->local())
|
||||||
|
return ScStwRace::handleSettingChange(keyInt, keyLevel, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ScStwAppBackend::handleBaseStationUpdate
|
* @brief ScStwAppBackend::handleBaseStationUpdate
|
||||||
*
|
*
|
||||||
|
|
|
@ -37,6 +37,8 @@ QVariant ScStwRemoteSettings::readSetting(QString key, int keyInt, int keyLevel)
|
||||||
if(this->getMode() == LOCAL || keyLevel > ScStwSettings::KeyLevel)
|
if(this->getMode() == LOCAL || keyLevel > ScStwSettings::KeyLevel)
|
||||||
return ScStwSettings::readSetting(key, keyInt, keyLevel);
|
return ScStwSettings::readSetting(key, keyInt, keyLevel);
|
||||||
|
|
||||||
|
qDebug() << "Setting read: keyLevel: " << keyLevel << " key: " << key;
|
||||||
|
|
||||||
return this->scStwClient->readRemoteSetting(ScStwSettings::BaseStationSetting(keyInt));
|
return this->scStwClient->readRemoteSetting(ScStwSettings::BaseStationSetting(keyInt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +46,9 @@ bool ScStwRemoteSettings::writeSetting(QString key, QVariant value, int keyInt,
|
||||||
if(this->getMode() == LOCAL || keyLevel > ScStwSettings::KeyLevel)
|
if(this->getMode() == LOCAL || keyLevel > ScStwSettings::KeyLevel)
|
||||||
return ScStwSettings::writeSetting(key, value, keyInt, keyLevel);
|
return ScStwSettings::writeSetting(key, value, keyInt, keyLevel);
|
||||||
|
|
||||||
|
|
||||||
|
qDebug() << "Setting write: keyLevel: " << keyLevel << " key: " << key << " value: " << value;
|
||||||
|
|
||||||
ScStw::StatusCode res = this->scStwClient->writeRemoteSetting(ScStwSettings::BaseStationSetting(keyInt), value);
|
ScStw::StatusCode res = this->scStwClient->writeRemoteSetting(ScStwSettings::BaseStationSetting(keyInt), value);
|
||||||
|
|
||||||
return res == ScStw::Success;
|
return res == ScStw::Success;
|
||||||
|
|
|
@ -18,7 +18,11 @@
|
||||||
|
|
||||||
#include "../headers/scstwrace.h"
|
#include "../headers/scstwrace.h"
|
||||||
|
|
||||||
ScStwRace::ScStwRace(QObject *parent) : QObject(parent)
|
ScStwRace::ScStwRace(QObject * parent) : ScStwRace(nullptr, parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ScStwRace::ScStwRace(ScStwSettings *settings, QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
this->state = IDLE;
|
this->state = IDLE;
|
||||||
|
|
||||||
|
@ -36,12 +40,18 @@ ScStwRace::ScStwRace(QObject *parent) : QObject(parent)
|
||||||
connect(this, &ScStwRace::timersChanged, this, &ScStwRace::detailsChanged);
|
connect(this, &ScStwRace::timersChanged, this, &ScStwRace::detailsChanged);
|
||||||
connect(this, &ScStwRace::stateChanged, this, &ScStwRace::detailsChanged);
|
connect(this, &ScStwRace::stateChanged, this, &ScStwRace::detailsChanged);
|
||||||
|
|
||||||
// write default settings
|
// init settings
|
||||||
|
this->competitionMode = false;
|
||||||
|
this->soundVolume = 1;
|
||||||
this->startSoundSettings.insert(ScStwSoundPlayer::Start, {{"Enabled", true}, {"Delay", 1}});
|
this->startSoundSettings.insert(ScStwSoundPlayer::Start, {{"Enabled", true}, {"Delay", 1}});
|
||||||
this->writeStartSoundSetting(ScStwSoundPlayer::AtYourMarks, false, 0);
|
this->writeStartSoundSetting(ScStwSoundPlayer::AtYourMarks, false, 0);
|
||||||
this->writeStartSoundSetting(ScStwSoundPlayer::Ready, false, 0);
|
this->writeStartSoundSetting(ScStwSoundPlayer::Ready, false, 0);
|
||||||
this->setSoundVolume(1.0);
|
this->setSoundVolume(1.0);
|
||||||
this->competitionMode = false;
|
|
||||||
|
this->settings = settings;
|
||||||
|
if(this->settings != nullptr) {
|
||||||
|
connect(this->settings, &ScStwSettings::settingChanged, this, &ScStwRace::handleSettingChange);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
@ -81,6 +91,9 @@ ScStw::StatusCode ScStwRace::stop() {
|
||||||
return ScStw::CurrentStateNotVaildForOperationError;
|
return ScStw::CurrentStateNotVaildForOperationError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this->competitionMode)
|
||||||
|
return this->cancel();
|
||||||
|
|
||||||
qDebug() << "+ [INFO] stopping race";
|
qDebug() << "+ [INFO] stopping race";
|
||||||
|
|
||||||
double timeOfStop = QDateTime::currentMSecsSinceEpoch();
|
double timeOfStop = QDateTime::currentMSecsSinceEpoch();
|
||||||
|
@ -150,7 +163,7 @@ ScStw::StatusCode ScStwRace::reset() {
|
||||||
ScStw::StatusCode returnCode = ScStw::Success;
|
ScStw::StatusCode returnCode = ScStw::Success;
|
||||||
|
|
||||||
foreach(ScStwTimer *speedTimer, this->timers){
|
foreach(ScStwTimer *speedTimer, this->timers){
|
||||||
if(!speedTimer->reset() && speedTimer->getState() != ScStwTimer::DISABLED) {
|
if(!speedTimer->reset() && speedTimer->getState() != ScStwTimer::DISABLED && speedTimer->getState() != ScStwTimer::IDLE) {
|
||||||
returnCode = ScStw::InternalErrorTimerOperationFailed;
|
returnCode = ScStw::InternalErrorTimerOperationFailed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,6 +203,13 @@ ScStw::StatusCode ScStwRace::cancel() {
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScStwRace::technicalIncident() {
|
||||||
|
foreach(ScStwTimer *timer, this->timers){
|
||||||
|
timer->cancel();
|
||||||
|
}
|
||||||
|
this->setState(INCIDENT);
|
||||||
|
}
|
||||||
|
|
||||||
int ScStwRace::handleFalseStart() {
|
int ScStwRace::handleFalseStart() {
|
||||||
if(this->getState() != STARTING && this->getState() != RUNNING)
|
if(this->getState() != STARTING && this->getState() != RUNNING)
|
||||||
return ScStw::CurrentStateNotVaildForOperationError;
|
return ScStw::CurrentStateNotVaildForOperationError;
|
||||||
|
@ -284,7 +304,7 @@ bool ScStwRace::playSoundsAndStartTimers() {
|
||||||
// play ready tone
|
// play ready tone
|
||||||
if(!this->soundPlayer->play(ScStwSoundPlayer::Ready, this->soundVolume)) {
|
if(!this->soundPlayer->play(ScStwSoundPlayer::Ready, this->soundVolume)) {
|
||||||
qDebug() << "Ready sound redturned false!";
|
qDebug() << "Ready sound redturned false!";
|
||||||
this->setState(INCIDENT);
|
this->technicalIncident();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,7 +336,7 @@ bool ScStwRace::playSoundsAndStartTimers() {
|
||||||
qDebug() << "now playing start sound";
|
qDebug() << "now playing start sound";
|
||||||
double timeOfSoundPlaybackStart;
|
double timeOfSoundPlaybackStart;
|
||||||
if(!this->doDelayAndSoundOfCurrentStartState(&timeOfSoundPlaybackStart)) {
|
if(!this->doDelayAndSoundOfCurrentStartState(&timeOfSoundPlaybackStart)) {
|
||||||
this->setState(INCIDENT);
|
this->technicalIncident();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,13 +351,13 @@ bool ScStwRace::playSoundsAndStartTimers() {
|
||||||
}
|
}
|
||||||
if(!startOk) {
|
if(!startOk) {
|
||||||
qDebug() << "[ERROR][START] error staring all timers";
|
qDebug() << "[ERROR][START] error staring all timers";
|
||||||
this->setState(INCIDENT);
|
this->technicalIncident();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this->soundPlayer->waitForSoundFinish()) {
|
if(!this->soundPlayer->waitForSoundFinish()) {
|
||||||
qDebug() << "[ERROR][START] start sound wait error";
|
qDebug() << "[ERROR][START] start sound wait error";
|
||||||
this->setState(INCIDENT);
|
this->technicalIncident();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +494,7 @@ bool ScStwRace::getIsReadyForNextState() {
|
||||||
subTimer->setState(ScStwTimer::CANCELLED);
|
subTimer->setState(ScStwTimer::CANCELLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setState(INCIDENT);
|
this->technicalIncident();
|
||||||
|
|
||||||
qDebug() << "[ERROR][RACE] Could not start due to not-ready timers";
|
qDebug() << "[ERROR][RACE] Could not start due to not-ready timers";
|
||||||
|
|
||||||
|
@ -514,9 +534,12 @@ void ScStwRace::handleTimerWantsToBeDisabledChange(ScStwTimer* timer, bool wants
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScStwRace::setCompetitionMode(bool competitionMode) {
|
bool ScStwRace::setCompetitionMode(bool competitionMode) {
|
||||||
|
if(this->settings != nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
if(this->competitionMode == competitionMode)
|
if(this->competitionMode == competitionMode)
|
||||||
return;
|
return true;
|
||||||
|
|
||||||
qDebug() << "Setting competition mode to " << competitionMode;
|
qDebug() << "Setting competition mode to " << competitionMode;
|
||||||
|
|
||||||
|
@ -526,6 +549,8 @@ void ScStwRace::setCompetitionMode(bool competitionMode) {
|
||||||
this->competitionModeChangedRecently = true;
|
this->competitionModeChangedRecently = true;
|
||||||
else if(this->competitionMode)
|
else if(this->competitionMode)
|
||||||
this->enableAllTimers();
|
this->enableAllTimers();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScStwRace::enableAllTimers() {
|
void ScStwRace::enableAllTimers() {
|
||||||
|
@ -587,20 +612,38 @@ QVariantMap ScStwRace::getCurrentStartDelay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScStwRace::writeStartSoundSetting(ScStwSoundPlayer::StartSound sound, bool enabled, int delay) {
|
bool ScStwRace::writeStartSoundSetting(ScStwSoundPlayer::StartSound sound, bool enabled, int delay) {
|
||||||
|
if(this->settings != nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
if(sound != ScStwSoundPlayer::AtYourMarks && sound != ScStwSoundPlayer::Ready)
|
if(sound != ScStwSoundPlayer::AtYourMarks && sound != ScStwSoundPlayer::Ready)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QVariantMap setting = {{"Enabled", enabled}, {"Delay", delay}};
|
this->writeStartSoundSettingKey(sound, "Enabled", enabled);
|
||||||
|
this->writeStartSoundSettingKey(sound, "Delay", delay);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ScStwRace::writeStartSoundSettingKey(ScStwSoundPlayer::StartSound sound, QString key, QVariant value) {
|
||||||
|
|
||||||
|
if(key != "Delay" && key != "Enabled")
|
||||||
|
return false;
|
||||||
|
|
||||||
if(!this->startSoundSettings.contains(sound))
|
if(!this->startSoundSettings.contains(sound))
|
||||||
this->startSoundSettings.insert(sound, setting);
|
this->startSoundSettings.insert(sound, {});
|
||||||
|
|
||||||
|
if(!this->startSoundSettings[sound].contains(key))
|
||||||
|
this->startSoundSettings[sound].insert(key, value);
|
||||||
else
|
else
|
||||||
this->startSoundSettings[sound] = setting;
|
this->startSoundSettings[sound][key] = value;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScStwRace::setSoundVolume(double volume) {
|
bool ScStwRace::setSoundVolume(double volume) {
|
||||||
|
if(this->settings != nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
if(volume >= 0 && volume <= 1) {
|
if(volume >= 0 && volume <= 1) {
|
||||||
this->soundVolume = volume;
|
this->soundVolume = volume;
|
||||||
return true;
|
return true;
|
||||||
|
@ -637,6 +680,63 @@ bool ScStwRace::addTimer(ScStwTimer *timer) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScStwRace::reloadAllSettings() {
|
||||||
|
this->writeStartSoundSetting(
|
||||||
|
ScStwSoundPlayer::AtYourMarks,
|
||||||
|
this->settings->readSetting(ScStwSettings::BaseStationSetting::AtYourMarksSoundEnableSetting).toBool(),
|
||||||
|
this->settings->readSetting(ScStwSettings::BaseStationSetting::AtYourMarksSoundDelaySetting).toDouble()
|
||||||
|
);
|
||||||
|
|
||||||
|
this->writeStartSoundSetting(
|
||||||
|
ScStwSoundPlayer::Ready,
|
||||||
|
this->settings->readSetting(ScStwSettings::BaseStationSetting::ReadySoundEnableSetting).toBool(),
|
||||||
|
this->settings->readSetting(ScStwSettings::BaseStationSetting::ReadySoundDelaySetting).toDouble()
|
||||||
|
);
|
||||||
|
|
||||||
|
this->setSoundVolume(this->settings->readSetting(ScStwSettings::SoundVolumeSetting).toDouble());
|
||||||
|
|
||||||
|
this->setCompetitionMode(this->settings->readSetting(ScStwSettings::CompetitionModeSetting).toBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScStwRace::handleSettingChange(int keyInt, int keyLevel, QVariant value) {
|
||||||
|
if(keyInt == -1) {
|
||||||
|
this->reloadAllSettings();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "Setting changed";
|
||||||
|
|
||||||
|
switch (keyLevel) {
|
||||||
|
case 0: {
|
||||||
|
// BaseStationSetting!!
|
||||||
|
ScStwSettings::BaseStationSetting key = static_cast<ScStwSettings::BaseStationSetting>(keyInt);
|
||||||
|
switch (key) {
|
||||||
|
case ScStwSettings::AtYourMarksSoundEnableSetting:
|
||||||
|
this->writeStartSoundSettingKey(ScStwSoundPlayer::AtYourMarks, "Enabled", value);
|
||||||
|
break;
|
||||||
|
case ScStwSettings::AtYourMarksSoundDelaySetting:
|
||||||
|
this->writeStartSoundSettingKey(ScStwSoundPlayer::AtYourMarks, "Delay", value);
|
||||||
|
break;
|
||||||
|
case ScStwSettings::ReadySoundEnableSetting:
|
||||||
|
this->writeStartSoundSettingKey(ScStwSoundPlayer::Ready, "Enabled", value);
|
||||||
|
break;
|
||||||
|
case ScStwSettings::ReadySoundDelaySetting:
|
||||||
|
this->writeStartSoundSettingKey(ScStwSoundPlayer::Ready, "Delay", value);
|
||||||
|
break;
|
||||||
|
case ScStwSettings::SoundVolumeSetting:
|
||||||
|
this->setSoundVolume(value.toDouble());
|
||||||
|
break;
|
||||||
|
case ScStwSettings::CompetitionModeSetting:
|
||||||
|
this->setCompetitionMode(value.toBool());
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ScStwRace::RaceState ScStwRace::getState() {
|
ScStwRace::RaceState ScStwRace::getState() {
|
||||||
return this->state;
|
return this->state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,6 @@ QVariant ScStwSetting::getValue() {
|
||||||
this->hasToReload = false;
|
this->hasToReload = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Setting read: keyLevel: " << this->keyLevel << " key: " << this->key << " value: " << this->valueCache;
|
|
||||||
|
|
||||||
return this->valueCache;
|
return this->valueCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,13 @@ ScStwSettings::ScStwSettings(QObject *parent) : QObject(parent)
|
||||||
connect(this, &ScStwSettings::settingChanged, this, &ScStwSettings::writeSettingsToFile);
|
connect(this, &ScStwSettings::settingChanged, this, &ScStwSettings::writeSettingsToFile);
|
||||||
|
|
||||||
this->registerKeyLevelConverters(ScStwSettings::KeyLevel, &ScStwSettings::keyToString, &ScStwSettings::keyToType);
|
this->registerKeyLevelConverters(ScStwSettings::KeyLevel, &ScStwSettings::keyToString, &ScStwSettings::keyToType);
|
||||||
|
|
||||||
|
this->setDefaultSetting(ScStwSettings::BaseStationSetting::ReadySoundEnableSetting, false);
|
||||||
|
this->setDefaultSetting(ScStwSettings::BaseStationSetting::ReadySoundDelaySetting, 0);
|
||||||
|
this->setDefaultSetting(ScStwSettings::BaseStationSetting::AtYourMarksSoundEnableSetting, false);
|
||||||
|
this->setDefaultSetting(ScStwSettings::BaseStationSetting::AtYourMarksSoundDelaySetting, 0);
|
||||||
|
this->setDefaultSetting(ScStwSettings::SoundVolumeSetting, 1);
|
||||||
|
this->setDefaultSetting(ScStwSettings::CompetitionModeSetting, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ScStwSettings::readSetting(BaseStationSetting key) {
|
QVariant ScStwSettings::readSetting(BaseStationSetting key) {
|
||||||
|
|
Reference in a new issue