- began to redo layout
- fixed some issues in ScStwRace
This commit is contained in:
parent
6460714b62
commit
78b0b883d5
4 changed files with 35 additions and 26 deletions
|
@ -150,6 +150,8 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void handleTimerStop();
|
void handleTimerStop();
|
||||||
|
|
||||||
|
bool isStarting();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void startTimers();
|
void startTimers();
|
||||||
void stopTimers(int type);
|
void stopTimers(int type);
|
||||||
|
|
|
@ -71,11 +71,6 @@ int ScStwRemoteMonitorRace::stop() {
|
||||||
return 904;
|
return 904;
|
||||||
}
|
}
|
||||||
|
|
||||||
// type can be:
|
|
||||||
// 0: stopp
|
|
||||||
// 1: cancel
|
|
||||||
// 2: fail (fase start)
|
|
||||||
|
|
||||||
qDebug() << "+ --- stopping race";
|
qDebug() << "+ --- stopping race";
|
||||||
|
|
||||||
int returnCode = 900;
|
int returnCode = 900;
|
||||||
|
@ -95,7 +90,7 @@ int ScStwRemoteMonitorRace::stop() {
|
||||||
|
|
||||||
int ScStwRemoteMonitorRace::reset() {
|
int ScStwRemoteMonitorRace::reset() {
|
||||||
|
|
||||||
if(this->getState() != ScStwRace::STOPPED) {
|
if(this->getState() != ScStwRace::STOPPED && this->getState() != ScStwRace::INCIDENT) {
|
||||||
return 904;
|
return 904;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,9 +175,8 @@ int ScStwRace::reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(returnCode == ScStw::Success){
|
if(returnCode == ScStw::Success)
|
||||||
this->setState(IDLE);
|
this->setState(IDLE);
|
||||||
}
|
|
||||||
|
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
@ -188,12 +187,6 @@ int ScStwRace::cancel() {
|
||||||
|
|
||||||
qDebug() << "[INFO][RACE] cancelling race";
|
qDebug() << "[INFO][RACE] cancelling race";
|
||||||
|
|
||||||
this->soundPlayer->cancel(this->soundVolume);
|
|
||||||
this->nextActionTimer->stop();
|
|
||||||
this->nextActionLoop->quit();
|
|
||||||
this->climberReadyWaitLoop->quit();
|
|
||||||
this->nextStartAction = None;
|
|
||||||
|
|
||||||
int returnCode = ScStw::Success;
|
int returnCode = ScStw::Success;
|
||||||
|
|
||||||
foreach(ScStwTimer *timer, this->timers){
|
foreach(ScStwTimer *timer, this->timers){
|
||||||
|
@ -201,6 +194,17 @@ int ScStwRace::cancel() {
|
||||||
returnCode = ScStw::InternalErrorTimerOperationFailed;
|
returnCode = ScStw::InternalErrorTimerOperationFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(returnCode != ScStw::Success)
|
||||||
|
return returnCode;
|
||||||
|
|
||||||
|
this->setState(STOPPED);
|
||||||
|
|
||||||
|
this->soundPlayer->cancel(this->soundVolume);
|
||||||
|
this->nextActionTimer->stop();
|
||||||
|
this->nextActionLoop->quit();
|
||||||
|
this->climberReadyWaitLoop->quit();
|
||||||
|
this->nextStartAction = None;
|
||||||
|
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,15 +231,13 @@ bool ScStwRace::playSoundsAndStartTimers() {
|
||||||
|
|
||||||
// The check if all timers are ready has already happened at this point
|
// The check if all timers are ready has already happened at this point
|
||||||
if(!this->doDelayAndSoundOfStartAction(AtYourMarks)) {
|
if(!this->doDelayAndSoundOfStartAction(AtYourMarks)) {
|
||||||
qDebug() << "At marks sound returned false!";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the start was cancelled
|
// check if the start was cancelled
|
||||||
if(this->state != PREPAIRING)
|
if(!this->isStarting())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
qDebug() << "NOW IN WAITING";
|
|
||||||
this->setState(WAITING);
|
this->setState(WAITING);
|
||||||
|
|
||||||
// do climber readiness tests
|
// do climber readiness tests
|
||||||
|
@ -265,7 +267,7 @@ bool ScStwRace::playSoundsAndStartTimers() {
|
||||||
this->climberReadyWaitLoop->exec();
|
this->climberReadyWaitLoop->exec();
|
||||||
|
|
||||||
// check if the start was cancelled
|
// check if the start was cancelled
|
||||||
if(this->state != WAITING)
|
if(!this->isStarting())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +282,7 @@ bool ScStwRace::playSoundsAndStartTimers() {
|
||||||
this->climberReadyWaitLoop->exec();
|
this->climberReadyWaitLoop->exec();
|
||||||
|
|
||||||
// check if the start was cancelled
|
// check if the start was cancelled
|
||||||
if(this->state != WAITING)
|
if(!this->isStarting())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
} while(this->nextActionTimer->remainingTime() > 0);
|
} while(this->nextActionTimer->remainingTime() > 0);
|
||||||
|
@ -319,7 +321,7 @@ bool ScStwRace::playSoundsAndStartTimers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if a false start occured
|
// check if a false start occured
|
||||||
if(this->state != STARTING)
|
if(!this->isStarting())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
nextStartAction = None;
|
nextStartAction = None;
|
||||||
|
@ -333,6 +335,9 @@ bool ScStwRace::playSoundsAndStartTimers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScStwRace::doDelayAndSoundOfStartAction(ScStwRace::StartAction action, double *timeOfSoundPlaybackStart) {
|
bool ScStwRace::doDelayAndSoundOfStartAction(ScStwRace::StartAction action, double *timeOfSoundPlaybackStart) {
|
||||||
|
if(!this->isStarting())
|
||||||
|
return false;
|
||||||
|
|
||||||
if(this->startActionSettings.contains(action) && this->startActionSettings[action]["Enabled"].toBool()) {
|
if(this->startActionSettings.contains(action) && this->startActionSettings[action]["Enabled"].toBool()) {
|
||||||
|
|
||||||
this->nextStartAction = action;
|
this->nextStartAction = action;
|
||||||
|
@ -351,6 +356,9 @@ bool ScStwRace::doDelayAndSoundOfStartAction(ScStwRace::StartAction action, doub
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this->isStarting())
|
||||||
|
return false;
|
||||||
|
|
||||||
if(!this->soundPlayer->play(action, this->soundVolume, timeOfSoundPlaybackStart))
|
if(!this->soundPlayer->play(action, this->soundVolume, timeOfSoundPlaybackStart))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -547,3 +555,7 @@ QVariantList ScStwRace::getTimerDetailList() {
|
||||||
|
|
||||||
return tmpTimers;
|
return tmpTimers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScStwRace::isStarting() {
|
||||||
|
return this->state == PREPAIRING || this->state == WAITING || this->state == STARTING;
|
||||||
|
}
|
||||||
|
|
|
@ -86,7 +86,9 @@ bool ScStwTimer::cancel() {
|
||||||
if(!(this->state == IDLE || this->state == STARTING || this->state == RUNNING))
|
if(!(this->state == IDLE || this->state == STARTING || this->state == RUNNING))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this->stop(CancelStop, -1);
|
qDebug() << "[INFO][TIMER] Timer was cancelled";
|
||||||
|
|
||||||
|
this->setState(CANCELLED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,11 +127,6 @@ bool ScStwTimer::stop(StopReason reason, double timeOfStop) {
|
||||||
this->setState(FAILED);
|
this->setState(FAILED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CancelStop: {
|
|
||||||
qDebug() << "[INFO][TIMER] Timer was cancelled";
|
|
||||||
this->setState(CANCELLED);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
default: {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -284,6 +281,9 @@ QString ScStwTimer::getText() {
|
||||||
case ScStwTimer::CANCELLED:
|
case ScStwTimer::CANCELLED:
|
||||||
newText = "cancelled";
|
newText = "cancelled";
|
||||||
break;
|
break;
|
||||||
|
case ScStwTimer::INCIDENT:
|
||||||
|
newText = "Technical incident!";
|
||||||
|
break;
|
||||||
case ScStwTimer::DISABLED:
|
case ScStwTimer::DISABLED:
|
||||||
newText = "---";
|
newText = "---";
|
||||||
break;
|
break;
|
||||||
|
|
Reference in a new issue