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

@@ -445,6 +445,7 @@ void SwiftGuiStd::verifyPrerequisites()
void SwiftGuiStd::onValidatedModelSet(const CSimulatorInfo &simulator, const CAircraftModelList &valid,
const CAircraftModelList &invalid, bool stopped, const CStatusMessageList &msgs)
{
using namespace std::chrono_literals;
// will NOT be called if no errors and setting is "only on errors"
if (!sGui || sGui->isShuttingDown()) { return; }
if (QApplication::activeModalWidget())
@@ -455,7 +456,7 @@ void SwiftGuiStd::onValidatedModelSet(const CSimulatorInfo &simulator, const CAi
CLogMessage(this).validationWarning(
u"Model set validation has found %1 invalid models for '%2', check the model validation")
<< invalid.size() << simulator.toQString(true);
this->displayInOverlayWindow(m, 5000);
this->displayInOverlayWindow(m, 5s);
return;
}
@@ -545,10 +546,10 @@ void SwiftGuiStd::displayDBusReconnectDialog()
CLogMessage::preformatted(msg);
}
void SwiftGuiStd::onShowOverlayVariant(const CVariant &variant, int durationMs)
void SwiftGuiStd::onShowOverlayVariant(const CVariant &variant, std::chrono::milliseconds duration)
{
if (!sGui || sGui->isShuttingDown()) { return; }
ui->fr_CentralFrameInside->showOverlayVariant(variant, durationMs);
ui->fr_CentralFrameInside->showOverlayVariant(variant, duration);
}
void SwiftGuiStd::onShowOverlayInlineTextMessageTab(components::TextMessageTab tab)

View File

@@ -331,7 +331,7 @@ private:
//! @{
//! Request overlay inline text message
void onShowOverlayVariant(const swift::misc::CVariant &variant, int durationMs);
void onShowOverlayVariant(const swift::misc::CVariant &variant, std::chrono::milliseconds duration);
void onShowOverlayInlineTextMessageTab(swift::gui::components::TextMessageTab tab);
void onShowOverlayInlineTextMessageCallsign(const swift::misc::aviation::CCallsign &callsign);
//! @}

View File

@@ -37,6 +37,7 @@ using namespace swift::misc::simulation;
void SwiftGuiStd::onMenuClicked()
{
using namespace std::chrono_literals;
QObject *sender = QObject::sender();
if (sender == ui->menu_TestLocationsEDRY)
{
@@ -80,7 +81,7 @@ void SwiftGuiStd::onMenuClicked()
{
sGui->toggleIncognito();
this->displayInOverlayWindow(QStringLiteral("Incognito mode is %1").arg(boolToOnOff(sGui->isIncognito())),
5000);
5s);
}
}
}