mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 05:45:35 +08:00
refactor: Fix readability-static-accessed-through-instance warnings
This commit is contained in:
@@ -46,6 +46,7 @@ Checks: >
|
|||||||
readability-use-anyofallof,
|
readability-use-anyofallof,
|
||||||
readability-redundant-member-init,
|
readability-redundant-member-init,
|
||||||
cppcoreguidelines-init-variables,
|
cppcoreguidelines-init-variables,
|
||||||
|
readability-static-accessed-through-instance,
|
||||||
|
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: readability-identifier-naming.ClassCase
|
- key: readability-identifier-naming.ClassCase
|
||||||
|
|||||||
@@ -838,7 +838,7 @@ namespace swift::core
|
|||||||
{
|
{
|
||||||
const CStatusMessage m = this->supportsContexts() ? this->getIContextApplication()->saveSettings() :
|
const CStatusMessage m = this->supportsContexts() ? this->getIContextApplication()->saveSettings() :
|
||||||
CSettingsCache::instance()->saveToStore();
|
CSettingsCache::instance()->saveToStore();
|
||||||
CLogMessage(this).preformatted(m);
|
CLogMessage::preformatted(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
// from here on we really rip apart the application object
|
// from here on we really rip apart the application object
|
||||||
@@ -870,7 +870,7 @@ namespace swift::core
|
|||||||
|
|
||||||
// clean up all in "deferred delete state"
|
// clean up all in "deferred delete state"
|
||||||
qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete);
|
qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete);
|
||||||
sApp->processEventsFor(500);
|
processEventsFor(500);
|
||||||
|
|
||||||
// completed
|
// completed
|
||||||
m_shutdown = true;
|
m_shutdown = true;
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ namespace swift::core::context
|
|||||||
ownAircraft.setPilot(m_currentNetworkServer.get().getUser());
|
ownAircraft.setPilot(m_currentNetworkServer.get().getUser());
|
||||||
|
|
||||||
// If we already have a model from somehwere, keep it, otherwise init default
|
// If we already have a model from somehwere, keep it, otherwise init default
|
||||||
ownAircraft.setModel(this->reverseLookupModel(ownAircraft.getModel()));
|
ownAircraft.setModel(reverseLookupModel(ownAircraft.getModel()));
|
||||||
if (!ownAircraft.getAircraftIcaoCode().hasValidDesignator())
|
if (!ownAircraft.getAircraftIcaoCode().hasValidDesignator())
|
||||||
{
|
{
|
||||||
ownAircraft.setModel(getDefaultOwnAircraftModel());
|
ownAircraft.setModel(getDefaultOwnAircraftModel());
|
||||||
@@ -205,7 +205,7 @@ namespace swift::core::context
|
|||||||
|
|
||||||
bool CContextOwnAircraft::updateOwnModel(const CAircraftModel &model, const CIdentifier &identifier)
|
bool CContextOwnAircraft::updateOwnModel(const CAircraftModel &model, const CIdentifier &identifier)
|
||||||
{
|
{
|
||||||
CAircraftModel updateModel(this->reverseLookupModel(model));
|
CAircraftModel updateModel(reverseLookupModel(model));
|
||||||
{
|
{
|
||||||
QWriteLocker l(&m_lockAircraft);
|
QWriteLocker l(&m_lockAircraft);
|
||||||
const bool changed = (m_ownAircraft.getModel() != updateModel);
|
const bool changed = (m_ownAircraft.getModel() != updateModel);
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ namespace swift::core::db
|
|||||||
if (processEvents && c % 125 == 0)
|
if (processEvents && c % 125 == 0)
|
||||||
{
|
{
|
||||||
if (!sApp || sApp->isShuttingDown()) { return models; }
|
if (!sApp || sApp->isShuttingDown()) { return models; }
|
||||||
sApp->processEventsFor(25);
|
CApplication::processEventsFor(25);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString ms(model.getModelString());
|
const QString ms(model.getModelString());
|
||||||
@@ -222,7 +222,7 @@ namespace swift::core::db
|
|||||||
if (processEvents && c % 125 == 0)
|
if (processEvents && c % 125 == 0)
|
||||||
{
|
{
|
||||||
if (!sApp || sApp->isShuttingDown()) { return models; }
|
if (!sApp || sApp->isShuttingDown()) { return models; }
|
||||||
sApp->processEventsFor(25);
|
CApplication::processEventsFor(25);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString ms(model.getModelString());
|
const QString ms(model.getModelString());
|
||||||
@@ -268,7 +268,7 @@ namespace swift::core::db
|
|||||||
if (modified || model.hasValidDbKey())
|
if (modified || model.hasValidDbKey())
|
||||||
{
|
{
|
||||||
c++;
|
c++;
|
||||||
if (processEvents && c % 125 == 0) { sApp->processEventsFor(25); }
|
if (processEvents && c % 125 == 0) { CApplication::processEventsFor(25); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CLogMessage(static_cast<CDatabaseUtils *>(nullptr)).info(u"Consolidated %1 models in %2ms")
|
CLogMessage(static_cast<CDatabaseUtils *>(nullptr)).info(u"Consolidated %1 models in %2ms")
|
||||||
@@ -374,7 +374,7 @@ namespace swift::core::db
|
|||||||
const int percentage = c * 100 / maxModelsCount;
|
const int percentage = c * 100 / maxModelsCount;
|
||||||
progressIndicator->updateProgressIndicatorAndProcessEvents(percentage);
|
progressIndicator->updateProgressIndicatorAndProcessEvents(percentage);
|
||||||
}
|
}
|
||||||
else { sApp->processEventsFor(10); }
|
else { CApplication::processEventsFor(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// values to be skipped
|
// values to be skipped
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ namespace swift::gui::components
|
|||||||
ui->cb_SetupAudioNotificationLogoff->isChecked());
|
ui->cb_SetupAudioNotificationLogoff->isChecked());
|
||||||
|
|
||||||
const CStatusMessage msg = m_audioSettings.set(as);
|
const CStatusMessage msg = m_audioSettings.set(as);
|
||||||
CLogMessage(this).preformatted(msg);
|
CLogMessage::preformatted(msg);
|
||||||
|
|
||||||
const auto *sender = qobject_cast<const QCheckBox *>(QObject::sender());
|
const auto *sender = qobject_cast<const QCheckBox *>(QObject::sender());
|
||||||
if (checked && sGui && sGui->getCContextAudioBase() && sender)
|
if (checked && sGui && sGui->getCContextAudioBase() && sender)
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ namespace swift::gui::components
|
|||||||
if (ui->cb_Silent->isChecked())
|
if (ui->cb_Silent->isChecked())
|
||||||
{
|
{
|
||||||
// allow UI updates
|
// allow UI updates
|
||||||
sApp->processEventsFor(50);
|
CApplication::processEventsFor(50);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const QMessageBox::StandardButton reply = QMessageBox::question(
|
const QMessageBox::StandardButton reply = QMessageBox::question(
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace swift::gui::components
|
|||||||
//! \fixme KB 201709 It is hard to judge if it is a good idea to trigger cache admit in a UI component
|
//! \fixme KB 201709 It is hard to judge if it is a good idea to trigger cache admit in a UI component
|
||||||
// althought admit happens in background, this component might trigger cache reads not needed (though it is not
|
// althought admit happens in background, this component might trigger cache reads not needed (though it is not
|
||||||
// very likely)
|
// very likely)
|
||||||
this->admitCaches();
|
admitCaches();
|
||||||
|
|
||||||
ui->lbl_DatabaseUrl->setTextFormat(Qt::RichText);
|
ui->lbl_DatabaseUrl->setTextFormat(Qt::RichText);
|
||||||
ui->lbl_DatabaseUrl->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
ui->lbl_DatabaseUrl->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ namespace swift::gui::components
|
|||||||
|
|
||||||
QWidget *CFirstModelSetComponent::mainWindow()
|
QWidget *CFirstModelSetComponent::mainWindow()
|
||||||
{
|
{
|
||||||
QWidget *pw = sGui->mainApplicationWidget();
|
QWidget *pw = CGuiApplication::mainApplicationWidget();
|
||||||
return pw ? pw : this;
|
return pw ? pw : this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -250,8 +250,8 @@ namespace swift::gui::components
|
|||||||
|
|
||||||
void CInfoBarStatusComponent::updateSpacing()
|
void CInfoBarStatusComponent::updateSpacing()
|
||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown() || !sGui->mainApplicationWidget()) { return; }
|
if (!sGui || sGui->isShuttingDown() || !CGuiApplication::mainApplicationWidget()) { return; }
|
||||||
const int w = sGui->mainApplicationWidget()->width();
|
const int w = CGuiApplication::mainApplicationWidget()->width();
|
||||||
const int s = (w >= 400) ? 6 : 2;
|
const int s = (w >= 400) ? 6 : 2;
|
||||||
this->setSpacing(s);
|
this->setSpacing(s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace swift::gui::components
|
|||||||
void CSettingsHotkeyComponent::saveSettings()
|
void CSettingsHotkeyComponent::saveSettings()
|
||||||
{
|
{
|
||||||
const CStatusMessage msg = m_actionHotkeys.save();
|
const CStatusMessage msg = m_actionHotkeys.save();
|
||||||
CLogMessage(this).preformatted(msg);
|
CLogMessage::preformatted(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsHotkeyComponent::registerDummyPttEntry()
|
void CSettingsHotkeyComponent::registerDummyPttEntry()
|
||||||
|
|||||||
@@ -166,8 +166,8 @@ namespace swift::gui::components
|
|||||||
|
|
||||||
// override if values are not empty
|
// override if values are not empty
|
||||||
const CSpecializedSimulatorSettings ss = m_settings.getSpecializedSettings(simulator);
|
const CSpecializedSimulatorSettings ss = m_settings.getSpecializedSettings(simulator);
|
||||||
const QString sd = CFileUtils::fixWindowsUncPath(
|
const QString sd = CFileUtils::fixWindowsUncPath(CFileUtils::normalizeFilePathToQtStandard(
|
||||||
CFileUtils::normalizeFilePathToQtStandard(ss.defaultSimulatorDirectory(simulator)));
|
CSpecializedSimulatorSettings::defaultSimulatorDirectory(simulator)));
|
||||||
if (!sd.isEmpty())
|
if (!sd.isEmpty())
|
||||||
{
|
{
|
||||||
ui->le_SimulatorDirectory->setText(sd);
|
ui->le_SimulatorDirectory->setText(sd);
|
||||||
@@ -181,7 +181,7 @@ namespace swift::gui::components
|
|||||||
m_unsavedChanges = true;
|
m_unsavedChanges = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QStringList excludes(ss.defaultModelExcludeDirectoryPatterns(simulator));
|
const QStringList excludes(CSpecializedSimulatorSettings::defaultModelExcludeDirectoryPatterns(simulator));
|
||||||
if (!excludes.isEmpty())
|
if (!excludes.isEmpty())
|
||||||
{
|
{
|
||||||
this->displayExcludeDirectoryPatterns(excludes);
|
this->displayExcludeDirectoryPatterns(excludes);
|
||||||
|
|||||||
@@ -222,8 +222,9 @@ namespace swift::gui::components
|
|||||||
// get initial aircraft to render
|
// get initial aircraft to render
|
||||||
CInterpolationAndRenderingSetupGlobal setup =
|
CInterpolationAndRenderingSetupGlobal setup =
|
||||||
sGui->getIContextSimulator()->getInterpolationAndRenderingSetupGlobal();
|
sGui->getIContextSimulator()->getInterpolationAndRenderingSetupGlobal();
|
||||||
const int noRequested =
|
const int noRequested = ui->le_MaxAircraft->text().isEmpty() ?
|
||||||
ui->le_MaxAircraft->text().isEmpty() ? setup.InfiniteAircraft() : ui->le_MaxAircraft->text().toInt();
|
CInterpolationAndRenderingSetupGlobal::InfiniteAircraft() :
|
||||||
|
ui->le_MaxAircraft->text().toInt();
|
||||||
const int oldValue = setup.getMaxRenderedAircraft();
|
const int oldValue = setup.getMaxRenderedAircraft();
|
||||||
if (oldValue == noRequested) { return; }
|
if (oldValue == noRequested) { return; }
|
||||||
|
|
||||||
@@ -301,7 +302,7 @@ namespace swift::gui::components
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
CSimulatorSettings settings = CSettingsSimulatorComponent::getSimulatorSettings(ok);
|
CSimulatorSettings settings = CSettingsSimulatorComponent::getSimulatorSettings(ok);
|
||||||
if (!ok || !settings.setComIntegrated(ui->cb_ComSync->isChecked())) { return; }
|
if (!ok || !settings.setComIntegrated(ui->cb_ComSync->isChecked())) { return; }
|
||||||
this->setSimulatorSettings(settings);
|
setSimulatorSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsSimulatorComponent::onApplyCGSource()
|
void CSettingsSimulatorComponent::onApplyCGSource()
|
||||||
@@ -310,7 +311,7 @@ namespace swift::gui::components
|
|||||||
const CSimulatorSettings::CGSource source = ui->comp_CGSourceSelector->getValue();
|
const CSimulatorSettings::CGSource source = ui->comp_CGSourceSelector->getValue();
|
||||||
CSimulatorSettings settings = CSettingsSimulatorComponent::getSimulatorSettings(ok);
|
CSimulatorSettings settings = CSettingsSimulatorComponent::getSimulatorSettings(ok);
|
||||||
if (!ok || !settings.setCGSource(source)) { return; }
|
if (!ok || !settings.setCGSource(source)) { return; }
|
||||||
this->setSimulatorSettings(settings);
|
setSimulatorSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsSimulatorComponent::onApplyRecordGnd()
|
void CSettingsSimulatorComponent::onApplyRecordGnd()
|
||||||
@@ -332,7 +333,7 @@ namespace swift::gui::components
|
|||||||
const bool c1 = settings.setRecordOwnAircraftGnd(ui->cb_RecordOwnGndPositions->isChecked());
|
const bool c1 = settings.setRecordOwnAircraftGnd(ui->cb_RecordOwnGndPositions->isChecked());
|
||||||
const bool c2 = settings.setRecordedGndRadius(radius);
|
const bool c2 = settings.setRecordedGndRadius(radius);
|
||||||
if (!c1 && !c2) { return; }
|
if (!c1 && !c2) { return; }
|
||||||
this->setSimulatorSettings(settings);
|
setSimulatorSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsSimulatorComponent::onReload() { this->setGuiValues(); }
|
void CSettingsSimulatorComponent::onReload() { this->setGuiValues(); }
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ namespace swift::gui::components
|
|||||||
const QString platform = this->getSelectedOrDefaultPlatform().getPlatformName();
|
const QString platform = this->getSelectedOrDefaultPlatform().getPlatformName();
|
||||||
const QStringList settings({ channel, platform });
|
const QStringList settings({ channel, platform });
|
||||||
const CStatusMessage m = m_updateSettings.setAndSave(settings);
|
const CStatusMessage m = m_updateSettings.setAndSave(settings);
|
||||||
if (m.isFailure()) { CLogMessage(this).preformatted(m); }
|
if (m.isFailure()) { CLogMessage::preformatted(m); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CUpdateInfoComponent::channelChanged() { this->uiSelectionChanged(); }
|
void CUpdateInfoComponent::channelChanged() { this->uiSelectionChanged(); }
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace swift::gui::editors
|
|||||||
}
|
}
|
||||||
catch (const CJsonException &ex)
|
catch (const CJsonException &ex)
|
||||||
{
|
{
|
||||||
CLogMessage(this).preformatted(CStatusMessage::fromJsonException(ex, this, "Parse error"));
|
CLogMessage::preformatted(CStatusMessage::fromJsonException(ex, this, "Parse error"));
|
||||||
return parts;
|
return parts;
|
||||||
}
|
}
|
||||||
return parts;
|
return parts;
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ namespace swift::gui
|
|||||||
CLogSubscriber logSub(this, [&](const CStatusMessage &message) {
|
CLogSubscriber logSub(this, [&](const CStatusMessage &message) {
|
||||||
// handles an error in restoreGeometry/State
|
// handles an error in restoreGeometry/State
|
||||||
const int ret =
|
const int ret =
|
||||||
QMessageBox::critical(sGui->mainApplicationWidget(), sGui->getApplicationNameAndVersion(),
|
QMessageBox::critical(mainApplicationWidget(), sGui->getApplicationNameAndVersion(),
|
||||||
QStringLiteral("Restoring the window state/geometry failed!\n"
|
QStringLiteral("Restoring the window state/geometry failed!\n"
|
||||||
"You need to reset the window size (command -%1).\n\n"
|
"You need to reset the window size (command -%1).\n\n"
|
||||||
"Original msg: %2\n\n"
|
"Original msg: %2\n\n"
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ namespace swift::gui
|
|||||||
if (resetTimeMs > 0)
|
if (resetTimeMs > 0)
|
||||||
{
|
{
|
||||||
QPointer<CLedWidget> myself(this);
|
QPointer<CLedWidget> myself(this);
|
||||||
m_resetTimer.singleShot(resetTimeMs, this, [=] {
|
QTimer::singleShot(resetTimeMs, this, [=] {
|
||||||
if (!myself) { return; }
|
if (!myself) { return; }
|
||||||
this->resetState();
|
this->resetState();
|
||||||
});
|
});
|
||||||
@@ -252,7 +252,7 @@ namespace swift::gui
|
|||||||
|
|
||||||
void CLedWidget::setTriState(int resetTimeMs)
|
void CLedWidget::setTriState(int resetTimeMs)
|
||||||
{
|
{
|
||||||
if (resetTimeMs > 0) { m_resetTimer.singleShot(resetTimeMs, this, &CLedWidget::resetState); }
|
if (resetTimeMs > 0) { QTimer::singleShot(resetTimeMs, this, &CLedWidget::resetState); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_resetTimer.stop();
|
m_resetTimer.stop();
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ namespace swift::gui
|
|||||||
|
|
||||||
void CTextMessageTextEdit::redrawHtml()
|
void CTextMessageTextEdit::redrawHtml()
|
||||||
{
|
{
|
||||||
const QString html(
|
const QString html(toHtml(m_latestFirst ? m_messages.reversed() : m_messages, m_withSender, m_withRecipient));
|
||||||
this->toHtml(m_latestFirst ? m_messages.reversed() : m_messages, m_withSender, m_withRecipient));
|
|
||||||
m_textDocument.setHtml(html);
|
m_textDocument.setHtml(html);
|
||||||
this->moveCursor(m_latestFirst ? QTextCursor::Start : QTextCursor::End);
|
this->moveCursor(m_latestFirst ? QTextCursor::Start : QTextCursor::End);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ namespace swift::misc
|
|||||||
|
|
||||||
CApplicationInfo::Application CApplicationInfo::guessApplication()
|
CApplicationInfo::Application CApplicationInfo::guessApplication()
|
||||||
{
|
{
|
||||||
const QString a(QCoreApplication::instance()->applicationName().toLower());
|
const QString a(QCoreApplication::applicationName().toLower());
|
||||||
if (a.contains("test")) { return CApplicationInfo::UnitTest; } // names like testcore
|
if (a.contains("test")) { return CApplicationInfo::UnitTest; } // names like testcore
|
||||||
if (a.contains("sample")) { return CApplicationInfo::Sample; }
|
if (a.contains("sample")) { return CApplicationInfo::Sample; }
|
||||||
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }
|
if (a.contains("core")) { return CApplicationInfo::PilotClientCore; }
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace swift::misc::aviation
|
|||||||
{
|
{
|
||||||
// actually we would expect all DB data to be valid, however right now
|
// actually we would expect all DB data to be valid, however right now
|
||||||
// we only check special cases
|
// we only check special cases
|
||||||
if (this->getDesignator() == this->getUnassignedDesignator()) { return msg; } // DB ZZZZ
|
if (this->getDesignator() == getUnassignedDesignator()) { return msg; } // DB ZZZZ
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasKnownDesignator())
|
if (!hasKnownDesignator())
|
||||||
|
|||||||
@@ -128,13 +128,12 @@ namespace swift::misc::aviation
|
|||||||
m_isParsed = true;
|
m_isParsed = true;
|
||||||
if (m_remarks.isEmpty()) { return; }
|
if (m_remarks.isEmpty()) { return; }
|
||||||
const QString remarks = m_remarks.toUpper();
|
const QString remarks = m_remarks.toUpper();
|
||||||
const QString callsign =
|
const QString callsign = CCallsign::unifyCallsign(getRemark(remarks, "REG/")); // registration is a callsign
|
||||||
CCallsign::unifyCallsign(this->getRemark(remarks, "REG/")); // registration is a callsign
|
|
||||||
if (CCallsign::isValidAircraftCallsign(callsign)) { m_registration = CCallsign(callsign, CCallsign::Aircraft); }
|
if (CCallsign::isValidAircraftCallsign(callsign)) { m_registration = CCallsign(callsign, CCallsign::Aircraft); }
|
||||||
m_voiceCapabilities = m_voiceCapabilities.isUnknown() ? CVoiceCapabilities(m_remarks) : m_voiceCapabilities;
|
m_voiceCapabilities = m_voiceCapabilities.isUnknown() ? CVoiceCapabilities(m_remarks) : m_voiceCapabilities;
|
||||||
m_flightOperator =
|
m_flightOperator =
|
||||||
this->getRemark(remarks, "OPR/"); // operator, e.g. British airways, sometimes people use ICAO code here
|
getRemark(remarks, "OPR/"); // operator, e.g. British airways, sometimes people use ICAO code here
|
||||||
m_selcalCode = CSelcal(this->getRemark(remarks, "SEL/"));
|
m_selcalCode = CSelcal(getRemark(remarks, "SEL/"));
|
||||||
m_radioTelephony = getRemark(remarks, "CALLSIGN/"); // used similar to radio telephony
|
m_radioTelephony = getRemark(remarks, "CALLSIGN/"); // used similar to radio telephony
|
||||||
if (m_radioTelephony.isEmpty()) { m_radioTelephony = getRemark(remarks, "RT/"); }
|
if (m_radioTelephony.isEmpty()) { m_radioTelephony = getRemark(remarks, "RT/"); }
|
||||||
if (!m_flightOperator.isEmpty() && CAirlineIcaoCode::isValidAirlineDesignator(m_flightOperator))
|
if (!m_flightOperator.isEmpty() && CAirlineIcaoCode::isValidAirlineDesignator(m_flightOperator))
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ namespace swift::misc
|
|||||||
m_revisionFileName(revisionFileName)
|
m_revisionFileName(revisionFileName)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const QString &CDataCacheSerializer::persistentStore() const { return m_cache->persistentStore(); }
|
const QString &CDataCacheSerializer::persistentStore() const { return CDataCache::persistentStore(); }
|
||||||
|
|
||||||
void CDataCacheSerializer::saveToStore(const swift::misc::CVariantMap &values,
|
void CDataCacheSerializer::saveToStore(const swift::misc::CVariantMap &values,
|
||||||
const swift::misc::CValueCachePacket &baseline)
|
const swift::misc::CValueCachePacket &baseline)
|
||||||
|
|||||||
@@ -211,12 +211,12 @@ namespace swift::misc
|
|||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
CLogMessage(this).info(u"Adding '%1' to the new connection '%2'")
|
CLogMessage(this).info(u"Adding '%1' to the new connection '%2'")
|
||||||
<< key << this->getDBusInterfaceFromClassInfo(i.value());
|
<< key << getDBusInterfaceFromClassInfo(i.value());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLogMessage(this).info(u"Adding '%1' failed, connection '%2', error '%3'")
|
CLogMessage(this).info(u"Adding '%1' failed, connection '%2', error '%3'")
|
||||||
<< key << this->getDBusInterfaceFromClassInfo(i.value()) << connection.lastError().message();
|
<< key << getDBusInterfaceFromClassInfo(i.value()) << connection.lastError().message();
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ namespace swift::misc::simulation
|
|||||||
QJsonObject CAircraftModel::toMemoizedJson(MemoHelper::CMemoizer &helper) const
|
QJsonObject CAircraftModel::toMemoizedJson(MemoHelper::CMemoizer &helper) const
|
||||||
{
|
{
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
|
// NOLINTBEGIN(readability-static-accessed-through-instance)
|
||||||
introspect<CAircraftModel>().forEachMember([&, this](auto member) {
|
introspect<CAircraftModel>().forEachMember([&, this](auto member) {
|
||||||
if constexpr (!decltype(member)::has(MetaFlags<DisabledForJson>()))
|
if constexpr (!decltype(member)::has(MetaFlags<DisabledForJson>()))
|
||||||
{
|
{
|
||||||
@@ -139,11 +140,13 @@ namespace swift::misc::simulation
|
|||||||
json << std::make_pair(CExplicitLatin1String(member.latin1Name()), std::cref(maybeMemo));
|
json << std::make_pair(CExplicitLatin1String(member.latin1Name()), std::cref(maybeMemo));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// NOLINTEND(readability-static-accessed-through-instance)
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAircraftModel::convertFromMemoizedJson(const QJsonObject &json, const MemoHelper::CUnmemoizer &helper)
|
void CAircraftModel::convertFromMemoizedJson(const QJsonObject &json, const MemoHelper::CUnmemoizer &helper)
|
||||||
{
|
{
|
||||||
|
// NOLINTBEGIN(readability-static-accessed-through-instance)
|
||||||
introspect<CAircraftModel>().forEachMember([&, this](auto member) {
|
introspect<CAircraftModel>().forEachMember([&, this](auto member) {
|
||||||
if constexpr (!decltype(member)::has(MetaFlags<DisabledForJson>()))
|
if constexpr (!decltype(member)::has(MetaFlags<DisabledForJson>()))
|
||||||
{
|
{
|
||||||
@@ -151,6 +154,7 @@ namespace swift::misc::simulation
|
|||||||
if (it != json.end()) { it.value() >> helper.maybeUnmemoize(member.in(*this)).get(); }
|
if (it != json.end()) { it.value() >> helper.maybeUnmemoize(member.in(*this)).get(); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// NOLINTEND(readability-static-accessed-through-instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAircraftModel::asHtmlSummary(const QString &separator) const
|
QString CAircraftModel::asHtmlSummary(const QString &separator) const
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace swift::simplugin::emulated
|
|||||||
this->onSettingsChanged(); // init from settings
|
this->onSettingsChanged(); // init from settings
|
||||||
|
|
||||||
m_myAircraft = this->getOwnAircraft(); // sync with provider
|
m_myAircraft = this->getOwnAircraft(); // sync with provider
|
||||||
m_monitorWidget = new CSimulatorEmulatedMonitorDialog(this, sGui->mainApplicationWidget());
|
m_monitorWidget = new CSimulatorEmulatedMonitorDialog(this, CGuiApplication::mainApplicationWidget());
|
||||||
|
|
||||||
connect(qApp, &QApplication::aboutToQuit, this, &CSimulatorEmulated::closeMonitor);
|
connect(qApp, &QApplication::aboutToQuit, this, &CSimulatorEmulated::closeMonitor);
|
||||||
connect(sGui, &CGuiApplication::aboutToShutdown, this, &CSimulatorEmulated::closeMonitor, Qt::QueuedConnection);
|
connect(sGui, &CGuiApplication::aboutToShutdown, this, &CSimulatorEmulated::closeMonitor, Qt::QueuedConnection);
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ namespace swift::simplugin::flightgear
|
|||||||
if (!m_serviceProxy) { return; }
|
if (!m_serviceProxy) { return; }
|
||||||
CLogMessage(this).info(u"FG DBus service unregistered");
|
CLogMessage(this).info(u"FG DBus service unregistered");
|
||||||
|
|
||||||
if (m_dbusMode == P2P) { m_dBusConnection.disconnectFromPeer(m_dBusConnection.name()); }
|
if (m_dbusMode == P2P) { QDBusConnection::disconnectFromPeer(m_dBusConnection.name()); }
|
||||||
m_dBusConnection = QDBusConnection { "default" };
|
m_dBusConnection = QDBusConnection { "default" };
|
||||||
if (m_watcher) { m_watcher->setConnection(m_dBusConnection); }
|
if (m_watcher) { m_watcher->setConnection(m_dBusConnection); }
|
||||||
delete m_serviceProxy;
|
delete m_serviceProxy;
|
||||||
@@ -1043,11 +1043,11 @@ namespace swift::simplugin::flightgear
|
|||||||
m_conn = QDBusConnection::sessionBus();
|
m_conn = QDBusConnection::sessionBus();
|
||||||
if (!m_conn.isConnected())
|
if (!m_conn.isConnected())
|
||||||
{
|
{
|
||||||
m_conn.disconnectFromBus(m_conn.name());
|
QDBusConnection::disconnectFromBus(m_conn.name());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checkConnectionCommon();
|
checkConnectionCommon();
|
||||||
m_conn.disconnectFromBus(m_conn.name());
|
QDBusConnection::disconnectFromBus(m_conn.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFlightgearListener::checkConnectionViaPeer(const QString &address)
|
void CSimulatorFlightgearListener::checkConnectionViaPeer(const QString &address)
|
||||||
@@ -1056,11 +1056,11 @@ namespace swift::simplugin::flightgear
|
|||||||
if (!m_conn.isConnected())
|
if (!m_conn.isConnected())
|
||||||
{
|
{
|
||||||
// This is required to cleanup the connection in QtDBus
|
// This is required to cleanup the connection in QtDBus
|
||||||
m_conn.disconnectFromPeer(m_conn.name());
|
QDBusConnection::disconnectFromPeer(m_conn.name());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checkConnectionCommon();
|
checkConnectionCommon();
|
||||||
m_conn.disconnectFromPeer(m_conn.name());
|
QDBusConnection::disconnectFromPeer(m_conn.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFlightgearListener::checkConnectionCommon()
|
void CSimulatorFlightgearListener::checkConnectionCommon()
|
||||||
@@ -1103,7 +1103,7 @@ namespace swift::simplugin::flightgear
|
|||||||
void CSimulatorFlightgearListener::serviceRegistered(const QString &serviceName)
|
void CSimulatorFlightgearListener::serviceRegistered(const QString &serviceName)
|
||||||
{
|
{
|
||||||
if (serviceName == fgswiftbusServiceName()) { emit simulatorStarted(getPluginInfo()); }
|
if (serviceName == fgswiftbusServiceName()) { emit simulatorStarted(getPluginInfo()); }
|
||||||
m_conn.disconnectFromBus(m_conn.name());
|
QDBusConnection::disconnectFromBus(m_conn.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFlightgearListener::fgSwiftBusServerSettingChanged()
|
void CSimulatorFlightgearListener::fgSwiftBusServerSettingChanged()
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace swift::simplugin::common
|
|||||||
{
|
{
|
||||||
if (!m_interpolationDisplayDialog)
|
if (!m_interpolationDisplayDialog)
|
||||||
{
|
{
|
||||||
QWidget *parentWidget = sGui ? sGui->mainApplicationWidget() : nullptr;
|
QWidget *parentWidget = sGui ? CGuiApplication::mainApplicationWidget() : nullptr;
|
||||||
auto *dialog = new CInterpolationLogDisplayDialog(this, nullptr, parentWidget);
|
auto *dialog = new CInterpolationLogDisplayDialog(this, nullptr, parentWidget);
|
||||||
m_interpolationDisplayDialog = dialog;
|
m_interpolationDisplayDialog = dialog;
|
||||||
m_interpolationDisplayDialog->setModal(false);
|
m_interpolationDisplayDialog->setModal(false);
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ namespace swift::simplugin::xplane
|
|||||||
if (!m_serviceProxy) { return; }
|
if (!m_serviceProxy) { return; }
|
||||||
CLogMessage(this).info(u"XPlane xSwiftBus service unregistered");
|
CLogMessage(this).info(u"XPlane xSwiftBus service unregistered");
|
||||||
|
|
||||||
if (m_dbusMode == P2P) { m_dBusConnection.disconnectFromPeer(m_dBusConnection.name()); }
|
if (m_dbusMode == P2P) { QDBusConnection::disconnectFromPeer(m_dBusConnection.name()); }
|
||||||
m_dBusConnection = QDBusConnection { "default" };
|
m_dBusConnection = QDBusConnection { "default" };
|
||||||
if (m_watcher) { m_watcher->setConnection(m_dBusConnection); }
|
if (m_watcher) { m_watcher->setConnection(m_dBusConnection); }
|
||||||
delete m_serviceProxy;
|
delete m_serviceProxy;
|
||||||
@@ -1373,11 +1373,11 @@ namespace swift::simplugin::xplane
|
|||||||
m_DBusConnection = QDBusConnection::sessionBus();
|
m_DBusConnection = QDBusConnection::sessionBus();
|
||||||
if (!m_DBusConnection.isConnected())
|
if (!m_DBusConnection.isConnected())
|
||||||
{
|
{
|
||||||
m_DBusConnection.disconnectFromBus(m_DBusConnection.name());
|
QDBusConnection::disconnectFromBus(m_DBusConnection.name());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checkConnectionCommon(); // bus
|
checkConnectionCommon(); // bus
|
||||||
m_DBusConnection.disconnectFromBus(m_DBusConnection.name());
|
QDBusConnection::disconnectFromBus(m_DBusConnection.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorXPlaneListener::checkConnectionViaPeer(const QString &address)
|
void CSimulatorXPlaneListener::checkConnectionViaPeer(const QString &address)
|
||||||
@@ -1386,11 +1386,11 @@ namespace swift::simplugin::xplane
|
|||||||
if (!m_DBusConnection.isConnected())
|
if (!m_DBusConnection.isConnected())
|
||||||
{
|
{
|
||||||
// This is required to cleanup the connection in QtDBus
|
// This is required to cleanup the connection in QtDBus
|
||||||
m_DBusConnection.disconnectFromPeer(m_DBusConnection.name());
|
QDBusConnection::disconnectFromPeer(m_DBusConnection.name());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checkConnectionCommon(); // peer
|
checkConnectionCommon(); // peer
|
||||||
m_DBusConnection.disconnectFromPeer(m_DBusConnection.name());
|
QDBusConnection::disconnectFromPeer(m_DBusConnection.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorXPlaneListener::checkConnectionCommon()
|
void CSimulatorXPlaneListener::checkConnectionCommon()
|
||||||
@@ -1441,7 +1441,7 @@ namespace swift::simplugin::xplane
|
|||||||
void CSimulatorXPlaneListener::serviceRegistered(const QString &serviceName)
|
void CSimulatorXPlaneListener::serviceRegistered(const QString &serviceName)
|
||||||
{
|
{
|
||||||
if (serviceName == xswiftbusServiceName()) { emit simulatorStarted(getPluginInfo()); }
|
if (serviceName == xswiftbusServiceName()) { emit simulatorStarted(getPluginInfo()); }
|
||||||
m_DBusConnection.disconnectFromBus(m_DBusConnection.name());
|
QDBusConnection::disconnectFromBus(m_DBusConnection.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorXPlaneListener::onXSwiftBusServerSettingChanged()
|
void CSimulatorXPlaneListener::onXSwiftBusServerSettingChanged()
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void CSwiftLauncher::clearWindowsRegistry()
|
|||||||
|
|
||||||
CSwiftLauncher::~CSwiftLauncher() = default;
|
CSwiftLauncher::~CSwiftLauncher() = default;
|
||||||
|
|
||||||
QString CSwiftLauncher::getCmdLine() const { return this->toCmdLine(m_executable, m_executableArgs); }
|
QString CSwiftLauncher::getCmdLine() const { return toCmdLine(m_executable, m_executableArgs); }
|
||||||
|
|
||||||
bool CSwiftLauncher::startDetached()
|
bool CSwiftLauncher::startDetached()
|
||||||
{
|
{
|
||||||
@@ -500,7 +500,7 @@ void CSwiftLauncher::checkRunningApplicationsAndCore()
|
|||||||
if (m_startMappingToolWaitCycles > 0) { m_startMappingToolWaitCycles--; }
|
if (m_startMappingToolWaitCycles > 0) { m_startMappingToolWaitCycles--; }
|
||||||
if (m_startGuiWaitCycles > 0) { m_startGuiWaitCycles--; }
|
if (m_startGuiWaitCycles > 0) { m_startGuiWaitCycles--; }
|
||||||
|
|
||||||
const CApplicationInfoList runningApps = sGui->getRunningApplications();
|
const CApplicationInfoList runningApps = CGuiApplication::getRunningApplications();
|
||||||
const bool foundLocalCore = runningApps.containsApplication(CApplicationInfo::PilotClientCore);
|
const bool foundLocalCore = runningApps.containsApplication(CApplicationInfo::PilotClientCore);
|
||||||
const bool foundLocalMappingTool = runningApps.containsApplication(CApplicationInfo::MappingTool);
|
const bool foundLocalMappingTool = runningApps.containsApplication(CApplicationInfo::MappingTool);
|
||||||
const bool foundLocalPilotClientGui = runningApps.containsApplication(CApplicationInfo::PilotClientGui);
|
const bool foundLocalPilotClientGui = runningApps.containsApplication(CApplicationInfo::PilotClientGui);
|
||||||
|
|||||||
Reference in New Issue
Block a user