refactor: Use chrono instead of plain ints

This commit is contained in:
Lars Toenning
2024-11-30 12:18:32 +01:00
parent b8ce7a96f3
commit 74415e756a
84 changed files with 450 additions and 350 deletions

View File

@@ -324,12 +324,14 @@ namespace swift::gui::components
void CMappingComponent::doMatchingsAgain()
{
using namespace std::chrono_literals;
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return; }
if (!sGui->getIContextSimulator()->isSimulatorAvailable()) { return; }
const int rematchedNumber = sGui->getIContextSimulator()->doMatchingsAgain();
const QString info = QStringLiteral("Triggered re-matching of %1 aircraft").arg(rematchedNumber);
this->showOverlayHTMLMessage(info, 5000);
this->showOverlayHTMLMessage(info, 5s);
CLogMessage(this).info(info);
}
@@ -417,6 +419,8 @@ namespace swift::gui::components
void CMappingComponent::onResetAircraft()
{
using namespace std::chrono_literals;
if (!sGui || !sGui->getIContextSimulator() || !sGui->getIContextSimulator()->isSimulatorSimulating())
{
return;
@@ -426,7 +430,7 @@ namespace swift::gui::components
const bool reset = sGui->getIContextSimulator()->resetToModelMatchingAircraft(callsign);
const CStatusMessage msg = reset ? CStatusMessage(this).info(u"Model reset for '%1'") << callsign.toQString() :
CStatusMessage(this).info(u"Reset failed for '%1'") << callsign.toQString();
this->showOverlayHTMLMessage(msg, 3000);
this->showOverlayHTMLMessage(msg, 3s);
}
void CMappingComponent::onModelPreviewChanged(int state)