Stop timer based model validation after some runs

This commit is contained in:
Klaus Basan
2019-05-09 03:26:40 +02:00
parent 669402c7e0
commit 7b5b15b0e8
2 changed files with 14 additions and 1 deletions

View File

@@ -110,6 +110,7 @@ namespace BlackMisc
m_inWork = true;
emit this->validating(true);
const bool isTimerBased = (QObject::sender() == &m_updateTimer);
CAircraftModelList valid;
CAircraftModelList invalid;
CStatusMessageList msgs;
@@ -154,11 +155,22 @@ namespace BlackMisc
while (false);
m_inWork = false;
if (isTimerBased)
{
m_timerBasedRuns++;
// stop timer after some runs
if (m_timerBasedRuns > 3)
{
m_updateTimer.stop();
}
}
emit this->validating(false);
if (validated)
{
const bool e = !onlyErrorsAndWarnings || (!invalid.isEmpty() || msgs.hasWarningOrErrorMessages());
if (e) { emit this->validated(simulator, valid, invalid, wasStopped, msgs); }
if (e || !isTimerBased) { emit this->validated(simulator, valid, invalid, wasStopped, msgs); }
}
}
} // ns