some fixes and improvements
This commit is contained in:
parent
e01c00ded8
commit
e5080e7118
3 changed files with 13 additions and 20 deletions
|
@ -55,14 +55,6 @@ private:
|
||||||
// helper vars
|
// helper vars
|
||||||
QVariantList qmlTimers;
|
QVariantList qmlTimers;
|
||||||
|
|
||||||
const QMap<QString, ScStw::BaseStationSetting> remoteSettings = {
|
|
||||||
{"ready_en", ScStw::ReadySoundEnableSetting},
|
|
||||||
{"ready_delay", ScStw::ReadySoundDelaySetting},
|
|
||||||
{"at_marks_en", ScStw::AtYourMarksSoundEnableSetting},
|
|
||||||
{"at_marks_delay", ScStw::AtYourMarksSoundDelaySetting},
|
|
||||||
{"soundVolume", ScStw::SoundVolumeSetting}
|
|
||||||
};
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// helper functions
|
// helper functions
|
||||||
void playSoundsAndStartRace();
|
void playSoundsAndStartRace();
|
||||||
|
|
|
@ -193,26 +193,26 @@ int ClimbingRace::resetRace() {
|
||||||
* @param data
|
* @param data
|
||||||
*/
|
*/
|
||||||
void ClimbingRace::handleBaseStationSignal(ScStw::SignalKey key, QVariant data) {
|
void ClimbingRace::handleBaseStationSignal(ScStw::SignalKey key, QVariant data) {
|
||||||
//qDebug() << "got update: " << data;
|
qDebug() << "got signal: " << data;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case ScStw::RaceStateChanged:
|
case ScStw::RaceStateChanged:
|
||||||
{
|
{
|
||||||
// the remote race state has changed
|
// the remote race state has changed
|
||||||
this->setState( ScStw::RaceState( data.toMap()["data"].toInt() ) );
|
this->setState( ScStw::RaceState( data.toInt() ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ScStw::TimersChanged:
|
case ScStw::TimersChanged:
|
||||||
{
|
{
|
||||||
// the remote timers have changed
|
// the remote timers have changed
|
||||||
this->refreshRemoteTimers(data.toMap()["data"].toList());
|
this->refreshRemoteTimers(data.toList());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ScStw::NextStartActionChanged:
|
case ScStw::NextStartActionChanged:
|
||||||
{
|
{
|
||||||
// the next start action has changed
|
// the next start action has changed
|
||||||
this->nextStartActionTotalDelay = data.toMap()["data"].toMap()["nextActionDelay"].toDouble();
|
this->nextStartActionTotalDelay = data.toMap()["nextActionDelay"].toDouble();
|
||||||
this->nextStartActionDelayStartedAt = this->date->currentMSecsSinceEpoch() - (this->nextStartActionTotalDelay * data.toMap()["data"].toMap()["nextActionDelayProg"].toDouble());
|
this->nextStartActionDelayStartedAt = this->date->currentMSecsSinceEpoch() - (this->nextStartActionTotalDelay * data.toMap()["nextActionDelayProg"].toDouble());
|
||||||
this->nextStartAction = ScStw::NextStartAction( data.toMap()["data"].toMap()["nextAction"].toInt() );
|
this->nextStartAction = ScStw::NextStartAction( data.toMap()["nextAction"].toInt() );
|
||||||
|
|
||||||
emit this->nextStartActionChanged();
|
emit this->nextStartActionChanged();
|
||||||
break;
|
break;
|
||||||
|
@ -222,6 +222,8 @@ void ClimbingRace::handleBaseStationSignal(ScStw::SignalKey key, QVariant data)
|
||||||
emit this->baseStationConnectionsChanged();
|
emit this->baseStationConnectionsChanged();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ScStw::InvalidSignal:
|
||||||
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,7 +363,6 @@ bool ClimbingRace::playSound(QString path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClimbingRace::setState(ScStw::RaceState newState) {
|
void ClimbingRace::setState(ScStw::RaceState newState) {
|
||||||
|
|
||||||
if(newState != this->state) {
|
if(newState != this->state) {
|
||||||
this->state = newState;
|
this->state = newState;
|
||||||
this->stateChanged(newState);
|
this->stateChanged(newState);
|
||||||
|
@ -576,8 +577,8 @@ int ClimbingRace::getNextStartAction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClimbingRace::writeSetting(QString key, QVariant value) {
|
void ClimbingRace::writeSetting(QString key, QVariant value) {
|
||||||
if(this->mode == REMOTE && this->remoteSettings.contains(key) ){
|
if(this->mode == REMOTE && ScStw::baseStationSettingFromString(key) != ScStw::InvalidSetting ){
|
||||||
this->scStwClient->writeRemoteSetting(remoteSettings[key], value.toString());
|
this->scStwClient->writeRemoteSetting(ScStw::baseStationSettingFromString(key), value.toString());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->appSettings->writeSetting(key, value);
|
this->appSettings->writeSetting(key, value);
|
||||||
|
@ -585,8 +586,8 @@ void ClimbingRace::writeSetting(QString key, QVariant value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ClimbingRace::readSetting(QString key) {
|
QString ClimbingRace::readSetting(QString key) {
|
||||||
if(this->mode == REMOTE && this->remoteSettings.contains(key)){
|
if(this->mode == REMOTE && ScStw::baseStationSettingFromString(key) != ScStw::InvalidSetting){
|
||||||
return this->scStwClient->readRemoteSetting(this->remoteSettings[key]);
|
return this->scStwClient->readRemoteSetting(ScStw::baseStationSettingFromString(key));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return this->appSettings->loadSetting(key);
|
return this->appSettings->loadSetting(key);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b752bdeed25f17b4840b2b215e8695eca4bfa711
|
Subproject commit e7ecd6730fa988f078f8fc052e94086f5acbcdac
|
Reference in a new issue