diff --git a/.clang-tidy b/.clang-tidy index 73f03d9b2..c924a8f3e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -5,6 +5,7 @@ Checks: > -*, modernize-use-auto, modernize-use-override, + modernize-return-braced-init-list, CheckOptions: diff --git a/src/core/afv/crypto/cryptodtoserializer.cpp b/src/core/afv/crypto/cryptodtoserializer.cpp index b29f5a7b1..027ac3c31 100644 --- a/src/core/afv/crypto/cryptodtoserializer.cpp +++ b/src/core/afv/crypto/cryptodtoserializer.cpp @@ -8,7 +8,7 @@ namespace swift::core::afv::crypto CryptoDtoSerializer::Deserializer CryptoDtoSerializer::deserialize(CCryptoDtoChannel &channel, const QByteArray &bytes, bool loopback) { - return Deserializer(channel, bytes, loopback); + return { channel, bytes, loopback }; } CryptoDtoSerializer::Deserializer::Deserializer(CCryptoDtoChannel &channel, const QByteArray &bytes, bool loopback) diff --git a/src/core/afv/model/atcstationmodel.cpp b/src/core/afv/model/atcstationmodel.cpp index bb77a703f..db07b11e7 100644 --- a/src/core/afv/model/atcstationmodel.cpp +++ b/src/core/afv/model/atcstationmodel.cpp @@ -71,7 +71,7 @@ namespace swift::core::afv::model QVariant CSampleAtcStationModel::data(const QModelIndex &index, int role) const { - if (index.row() < 0 || index.row() >= m_atcStations.count()) return QVariant(); + if (index.row() < 0 || index.row() >= m_atcStations.count()) return {}; const CSampleAtcStation &atcStation = m_atcStations[index.row()]; if (role == CallsignRole) return atcStation.callsign(); @@ -80,7 +80,7 @@ namespace swift::core::afv::model if (role == RadioDistanceRole) return atcStation.radioDistanceM(); if (role == FrequencyRole) return atcStation.formattedFrequency(); if (role == FrequencyKhzRole) return atcStation.frequency() / 1000; - return QVariant(); + return {}; } QHash CSampleAtcStationModel::roleNames() const diff --git a/src/core/aircraftmatcher.cpp b/src/core/aircraftmatcher.cpp index b83fd71a6..8d1163a91 100644 --- a/src/core/aircraftmatcher.cpp +++ b/src/core/aircraftmatcher.cpp @@ -164,7 +164,7 @@ namespace swift::core if (models.isEmpty()) { CCallsign::addLogDetailsToList(log, callsign, QStringLiteral("No models to find airline from")); - return CAirlineIcaoCode(); + return {}; } static const QString info("Multiple models (%1) with airline ICAOs for '%2'"); @@ -641,7 +641,7 @@ namespace swift::core const CAircraftModelList &modelSet, CStatusMessageList *log) { - if (!setup.doRunMsReverseLookupScript()) { return MatchingScriptReturnValues(inModel); } + if (!setup.doRunMsReverseLookupScript()) { return { inModel }; } if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return inModel; } const QString js = CFileUtils::readFileToString(setup.getMsReverseLookupFile()); const MatchingScriptReturnValues rv = @@ -655,7 +655,7 @@ namespace swift::core const CAircraftModelList &modelSet, CStatusMessageList *log) { - if (!setup.doRunMsMatchingStageScript()) { return MatchingScriptReturnValues(inModel); } + if (!setup.doRunMsMatchingStageScript()) { return { inModel }; } if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return inModel; } const QString js = CFileUtils::readFileToString(setup.getMsMatchingStageFile()); const MatchingScriptReturnValues rv = @@ -874,7 +874,7 @@ namespace swift::core const CAircraftMatcherSetup &setup, const CAircraftModelList &modelSet, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAircraftModel(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } // already DB model? CAircraftModel model(modelToLookup); // copy @@ -1147,7 +1147,7 @@ namespace swift::core CAircraftModel CAircraftMatcher::reverseLookupModelStringInDB(const QString &modelString, const CCallsign &callsign, bool doLookupString, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAircraftModel(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } if (!doLookupString) { if (log) @@ -1156,7 +1156,7 @@ namespace swift::core log, callsign, QStringLiteral("Ignore model string in reverse lookup (disabled), ignoring '%1'").arg(modelString)); } - return CAircraftModel(); + return {}; } CAircraftModel model = sApp->getWebDataServices()->getModelForModelString(modelString); const bool isDBModel = model.hasValidDbKey(); @@ -1177,7 +1177,7 @@ namespace swift::core } } - if (!isDBModel) { return CAircraftModel(); } // not found + if (!isDBModel) { return {}; } // not found // found model.setCallsign(callsign); @@ -1190,7 +1190,7 @@ namespace swift::core const CAircraftModelList &modelSet, bool useNonDbEntries, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAircraftModel(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } if (modelString.isEmpty()) { if (log) @@ -1198,7 +1198,7 @@ namespace swift::core CCallsign::addLogDetailsToList( log, callsign, QStringLiteral("Empty model string for lookup in %1 models").arg(modelSet.size())); } - return CAircraftModel(); + return {}; } if (modelSet.isEmpty()) { @@ -1207,7 +1207,7 @@ namespace swift::core CCallsign::addLogDetailsToList(log, callsign, QStringLiteral("Empty models, ignoring '%1'").arg(modelString)); } - return CAircraftModel(); + return {}; } CAircraftModel model = modelSet.findFirstByModelStringOrDefault(modelString, Qt::CaseInsensitive); @@ -1219,7 +1219,7 @@ namespace swift::core log, callsign, QStringLiteral("Model '%1' not found in %2 models").arg(modelString).arg(modelSet.size())); } - return CAircraftModel(); + return {}; } const bool isDBModel = model.hasValidDbKey(); @@ -1241,7 +1241,7 @@ namespace swift::core } } - if (!isDBModel && !useNonDbEntries) { return CAircraftModel(); } // ignore DB entries + if (!isDBModel && !useNonDbEntries) { return {}; } // ignore DB entries // found model.setCallsign(callsign); @@ -1251,7 +1251,7 @@ namespace swift::core CAircraftModel CAircraftMatcher::reverseLookupModelId(int id, const CCallsign &callsign, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAircraftModel(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } CAircraftModel model = sApp->getWebDataServices()->getModelForDbKey(id); if (log) { @@ -1273,7 +1273,7 @@ namespace swift::core CAircraftIcaoCode CAircraftMatcher::reverseLookupAircraftIcao(const CAircraftIcaoCode &icaoCandidate, const CCallsign &logCallsign, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAircraftIcaoCode(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } const QString designator(icaoCandidate.getDesignator()); CAircraftIcaoCodeList foundIcaos = sApp->getWebDataServices()->getAircraftIcaoCodesForDesignator(designator); @@ -1321,7 +1321,7 @@ namespace swift::core CCallsign::addLogDetailsToList(log, logCallsign, QStringLiteral("No DB data for ICAO '%1', valid ICAO?").arg(designator), CAircraftMatcher::getLogCategories()); - return CAircraftIcaoCode(icaoCandidate); + return { icaoCandidate }; } } @@ -1330,7 +1330,7 @@ namespace swift::core CCallsign::addLogDetailsToList( log, logCallsign, QStringLiteral("Reverse lookup of aircraft ICAO '%1', nothing found").arg(designator), CAircraftMatcher::getLogCategories()); - return CAircraftIcaoCode(icaoCandidate); + return { icaoCandidate }; } else if (foundIcaos.size() == 1) { @@ -1377,7 +1377,7 @@ namespace swift::core CAircraftIcaoCode CAircraftMatcher::reverseLookupAircraftIcaoId(int id, const CCallsign &logCallsign, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAircraftIcaoCode(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } const CAircraftIcaoCode icao = sApp->getWebDataServices()->getAircraftIcaoCodeForDbKey(id); if (log) { @@ -1398,7 +1398,7 @@ namespace swift::core CAirlineIcaoCode CAircraftMatcher::reverseLookupAirlineIcao(const CAirlineIcaoCode &icaoPattern, const CCallsign &callsign, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAirlineIcaoCode(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } const CAirlineIcaoCode icao = sApp->getWebDataServices()->smartAirlineIcaoSelector(icaoPattern, callsign); if (log) { @@ -1426,7 +1426,7 @@ namespace swift::core CLivery CAircraftMatcher::reverseLookupStandardLivery(const CAirlineIcaoCode &airline, const CCallsign &callsign, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CLivery(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } if (!airline.hasValidDesignator()) { if (log) @@ -1435,7 +1435,7 @@ namespace swift::core log, callsign, QStringLiteral("Reverse lookup of standard livery skipped, no airline designator"), CAircraftMatcher::getLogCategories(), CStatusMessage::SeverityWarning); } - return CLivery(); + return {}; } const CLivery livery = sApp->getWebDataServices()->getStdLiveryForAirlineCode(airline); @@ -1461,7 +1461,7 @@ namespace swift::core CLivery CAircraftMatcher::reverseLookupLiveryId(int id, const CCallsign &logCallsign, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CLivery(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } const CLivery livery = sApp->getWebDataServices()->getLiveryForDbKey(id); if (log) { @@ -1564,12 +1564,12 @@ namespace swift::core const CAirlineIcaoCode &airline, const CCallsign &callsign, CStatusMessageList *log) { - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAircraftIcaoCode(); } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; } if (!airline.isLoadedFromDb()) { CCallsign::addLogDetailsToList( log, callsign, QStringLiteral("No valid airline from DB '%1'").arg(airline.getDesignator())); - return CAircraftIcaoCode(); + return {}; } Q_ASSERT_X(sApp->getWebDataServices(), Q_FUNC_INFO, "No web services"); @@ -1579,7 +1579,7 @@ namespace swift::core { CCallsign::addLogDetailsToList( log, callsign, QStringLiteral("No aircraft known for airline '%1'").arg(airline.getDesignator())); - return CAircraftIcaoCode(); + return {}; } const QSet allIcaos = aircraft.allDesignators(); @@ -1602,7 +1602,7 @@ namespace swift::core CAirlineIcaoCode CAircraftMatcher::callsignToAirline(const CCallsign &callsign, CStatusMessageList *log) { - if (callsign.isEmpty() || !sApp || !sApp->getWebDataServices()) { return CAirlineIcaoCode(); } + if (callsign.isEmpty() || !sApp || !sApp->getWebDataServices()) { return {}; } const CAirlineIcaoCode icao = sApp->getWebDataServices()->findBestMatchByCallsign(callsign); if (icao.hasValidDesignator()) @@ -1893,7 +1893,7 @@ namespace swift::core map = modelSet.scoreFull(remoteAircraft.getModel(), preferColorLiveries, noZeroScores, scoreLog); CAircraftModel matchedModel; - if (map.isEmpty()) { return CAircraftModelList(); } + if (map.isEmpty()) { return {}; } maxScore = map.lastKey(); const CAircraftModelList maxScoreAircraft(map.values(maxScore)); @@ -1972,7 +1972,7 @@ namespace swift::core CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QStringLiteral("No model string, no exact match possible")); } - return CAircraftModel(); + return {}; } CAircraftModel model = models.findFirstByModelStringAliasOrDefault(remoteAircraft.getModelString()); @@ -2694,10 +2694,10 @@ namespace swift::core const QString &airlineTelephony, bool useSwiftDbData, CStatusMessageList *log) { - if (!useSwiftDbData) { return CAirlineIcaoCode(designator); } - if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return CAirlineIcaoCode(designator); } + if (!useSwiftDbData) { return { designator }; } + if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return { designator }; } const CAirlineIcaoCodeList codes = sApp->getWebDataServices()->getAirlineIcaoCodesForDesignator(designator); - if (codes.isEmpty()) { return CAirlineIcaoCode(designator); } + if (codes.isEmpty()) { return { designator }; } if (codes.size() == 1) { return codes.front(); } // more than 1 diff --git a/src/core/application.cpp b/src/core/application.cpp index 04f396cdf..bbd0ab7b4 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -259,16 +259,16 @@ namespace swift::core CGlobalSetup CApplication::getGlobalSetup() const { - if (m_shutdown) { return CGlobalSetup(); } + if (m_shutdown) { return {}; } const CSetupReader *r = m_setupReader.data(); - if (!r) { return CGlobalSetup(); } + if (!r) { return {}; } return r->getSetup(); } CUpdateInfo CApplication::getUpdateInfo() const { - if (m_shutdown) { return CUpdateInfo(); } - if (!m_gitHubPackagesReader) { return CUpdateInfo(); } + if (m_shutdown) { return {}; } + if (!m_gitHubPackagesReader) { return {}; } return m_gitHubPackagesReader->getUpdateInfo(); } @@ -412,7 +412,7 @@ namespace swift::core CStatusMessage CApplication::initLocalSettings() { - if (m_localSettingsLoaded) { return CStatusMessage(); } + if (m_localSettingsLoaded) { return {}; } m_localSettingsLoaded = true; // trigger loading and saving of settings in appropriate scenarios @@ -427,7 +427,7 @@ namespace swift::core // sent to swiftcore and saved by swiftcore. CSettingsCache::instance()->enableLocalSave(); } - return CStatusMessage(); + return {}; } bool CApplication::hasUnsavedSettings() const { return !this->getUnsavedSettingsKeys().isEmpty(); } @@ -442,7 +442,7 @@ namespace swift::core CStatusMessage CApplication::saveSettingsByKey(const QStringList &keys) { - if (keys.isEmpty()) { return CStatusMessage(); } + if (keys.isEmpty()) { return {}; } return this->supportsContexts() ? this->getIContextApplication()->saveSettingsByKey(keys) : CSettingsCache::instance()->saveToStore(keys); } diff --git a/src/core/application.h b/src/core/application.h index ac31faf9d..b5f22cee1 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -543,7 +543,7 @@ namespace swift::core virtual void onCoreFacadeStarted(); //! Can be used to start special services - virtual swift::misc::CStatusMessageList startHookIn() { return swift::misc::CStatusMessageList(); } + virtual swift::misc::CStatusMessageList startHookIn() { return {}; } //! Flag set or explicitly set to true bool isSet(const QCommandLineOption &option) const; diff --git a/src/core/context/contextapplicationempty.h b/src/core/context/contextapplicationempty.h index 03d4cca7b..f5d09c2b4 100644 --- a/src/core/context/contextapplicationempty.h +++ b/src/core/context/contextapplicationempty.h @@ -41,21 +41,21 @@ namespace swift::core swift::misc::CValueCachePacket getAllSettings() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CValueCachePacket(); + return {}; } //! \copydoc IContextApplication::getUnsavedSettingsKeys QStringList getUnsavedSettingsKeys() const override { logEmptyContextWarning(Q_FUNC_INFO); - return QStringList(); + return {}; } //! \copydoc IContextApplication::getUnsavedSettingsKeys swift::core::context::CSettingsDictionary getUnsavedSettingsKeysDescribed() const override { logEmptyContextWarning(Q_FUNC_INFO); - return CSettingsDictionary(); + return {}; } //! \copydoc IContextApplication::synchronizeLocalSettings @@ -66,7 +66,7 @@ namespace swift::core { Q_UNUSED(keyPrefix); logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CStatusMessage(); + return {}; } //! \copydoc IContextApplication::saveSettingsByKey @@ -74,14 +74,14 @@ namespace swift::core { Q_UNUSED(keys); logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CStatusMessage(); + return {}; } //! \copydoc IContextApplication::loadSettings swift::misc::CStatusMessage loadSettings() override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CStatusMessage(); + return {}; } //! \copydoc IContextApplication::registerHotkeyActions @@ -107,7 +107,7 @@ namespace swift::core { Q_UNUSED(application); logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CIdentifier(); + return {}; } //! \copydoc IContextApplication::unregisterApplication @@ -121,14 +121,14 @@ namespace swift::core swift::misc::CIdentifierList getRegisteredApplications() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CIdentifierList(); + return {}; } //! \copydoc IContextApplication::getApplicationIdentifier swift::misc::CIdentifier getApplicationIdentifier() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CIdentifier(); + return {}; } }; } // namespace context diff --git a/src/core/context/contextnetworkempty.h b/src/core/context/contextnetworkempty.h index a41a9d872..6ff259ef1 100644 --- a/src/core/context/contextnetworkempty.h +++ b/src/core/context/contextnetworkempty.h @@ -29,7 +29,7 @@ namespace swift::core::context { Q_UNUSED(recalculateDistance) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CAtcStationList(); + return {}; } //! \copydoc IContextNetwork::getClosestAtcStationsOnline() @@ -37,14 +37,14 @@ namespace swift::core::context { Q_UNUSED(number) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CAtcStationList(); + return {}; } //! \copydoc IContextNetwork::getAircraftInRange() swift::misc::simulation::CSimulatedAircraftList getAircraftInRange() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CSimulatedAircraftList(); + return {}; } //! \copydoc IContextNetwork::getAircraftInRangeForCallsign @@ -53,7 +53,7 @@ namespace swift::core::context { Q_UNUSED(callsign) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CSimulatedAircraft(); + return {}; } //! \copydoc IContextNetwork::getOnlineStationsForFrequency @@ -62,14 +62,14 @@ namespace swift::core::context { Q_UNUSED(frequency) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CAtcStationList(); + return {}; } //! \copydoc IContextNetwork::getAircraftInRangeCallsigns() swift::misc::aviation::CCallsignSet getAircraftInRangeCallsigns() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CCallsignSet(); + return {}; } //! \copydoc IContextNetwork::getAircraftInRangeCount @@ -93,7 +93,7 @@ namespace swift::core::context { Q_UNUSED(callsign) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CAtcStation(); + return {}; } //! \copydoc IContextNetwork::isOnlineStation @@ -154,7 +154,7 @@ namespace swift::core::context swift::misc::network::CServer getConnectedServer() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::network::CServer(); + return {}; } //! \copydoc IContextNetwork::getLoginMode @@ -184,7 +184,7 @@ namespace swift::core::context { Q_UNUSED(callsign) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CFlightPlan(); + return {}; } //! \copydoc IContextNetwork::getMetarForAirport @@ -200,7 +200,7 @@ namespace swift::core::context swift::misc::network::CUserList getUsers() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::network::CUserList(); + return {}; } //! \copydoc IContextNetwork::getUsersForCallsigns @@ -209,7 +209,7 @@ namespace swift::core::context { Q_UNUSED(callsigns) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::network::CUserList(); + return {}; } //! \copydoc IContextNetwork::getUserForCallsign @@ -217,14 +217,14 @@ namespace swift::core::context { Q_UNUSED(callsign) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::network::CUser(); + return {}; } //! \copydoc IContextNetwork::getClients swift::misc::network::CClientList getClients() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::network::CClientList(); + return {}; } //! \copydoc IContextNetwork::getClientsForCallsigns @@ -233,7 +233,7 @@ namespace swift::core::context { Q_UNUSED(callsigns) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::network::CClientList(); + return {}; } //! \copydoc IContextNetwork::setOtherClient @@ -314,7 +314,7 @@ namespace swift::core::context swift::misc::network::CServerList getVatsimFsdServers() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::network::CServerList(); + return {}; } //! \copydoc IContextNetwork::updateAircraftEnabled @@ -393,7 +393,7 @@ namespace swift::core::context swift::misc::aviation::CCallsignSet getFastPositionEnabledCallsigns() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CCallsignSet(); + return {}; } //! \copydoc IContextNetwork::getReverseLookupMessages @@ -402,7 +402,7 @@ namespace swift::core::context { logEmptyContextWarning(Q_FUNC_INFO); Q_UNUSED(callsign) - return swift::misc::CStatusMessageList(); + return {}; } //! \copydoc IContextNetwork::isReverseLookupMessagesEnabled @@ -425,7 +425,7 @@ namespace swift::core::context { logEmptyContextWarning(Q_FUNC_INFO); Q_UNUSED(callsign) - return swift::misc::CStatusMessageList(); + return {}; } //! \copydoc IContextNetwork::getRemoteAircraftParts @@ -434,7 +434,7 @@ namespace swift::core::context { logEmptyContextWarning(Q_FUNC_INFO); Q_UNUSED(callsign) - return swift::misc::aviation::CAircraftPartsList(); + return {}; } //! \copydoc IContextNetwork::isAircraftPartsHistoryEnabled diff --git a/src/core/context/contextnetworkimpl.cpp b/src/core/context/contextnetworkimpl.cpp index f8c0e237a..4fdd059c4 100644 --- a/src/core/context/contextnetworkimpl.cpp +++ b/src/core/context/contextnetworkimpl.cpp @@ -255,10 +255,7 @@ namespace swift::core::context return CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityError, u"Invalid ICAO data for own aircraft"); } - if (!CNetworkUtils::canConnect(server, msg, 5000)) - { - return CStatusMessage(CStatusMessage::SeverityError, msg); - } + if (!CNetworkUtils::canConnect(server, msg, 5000)) { return { CStatusMessage::SeverityError, msg }; } if (m_fsdClient->isConnected()) { return CStatusMessage({ CLogCategories::validation() }, CStatusMessage::SeverityError, @@ -620,7 +617,7 @@ namespace swift::core::context CCallsignSet callsigns; callsigns.push_back(callsign); const CUserList users = this->getUsersForCallsigns(callsigns); - if (users.isEmpty()) { return CUser(); } + if (users.isEmpty()) { return {}; } return users[0]; } @@ -894,7 +891,7 @@ namespace swift::core::context CAtcStationList CContextNetwork::getClosestAtcStationsOnline(int number) const { - if (!this->getIContextOwnAircraft()) { return CAtcStationList(); } + if (!this->getIContextOwnAircraft()) { return {}; } const CAircraftSituation ownSituation = this->getIContextOwnAircraft()->getOwnAircraftSituation(); const CAtcStationList stations = m_airspace->getAtcStationsOnline().findClosest(number, ownSituation); return stations; @@ -1036,7 +1033,7 @@ namespace swift::core::context QString CContextNetwork::getNetworkStatistics(bool reset, const QString &separator) { if (this->isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } - if (!m_fsdClient) { return QString(); } + if (!m_fsdClient) { return {}; } return m_fsdClient->getNetworkStatisticsAsText(reset, separator); } diff --git a/src/core/context/contextownaircraftempty.h b/src/core/context/contextownaircraftempty.h index 8b0bc4311..4b0f6c219 100644 --- a/src/core/context/contextownaircraftempty.h +++ b/src/core/context/contextownaircraftempty.h @@ -27,7 +27,7 @@ namespace swift::core::context swift::misc::simulation::CSimulatedAircraft getOwnAircraft() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CSimulatedAircraft(); + return {}; } //! \copydoc IContextOwnAircraft::getOwnComSystem @@ -36,21 +36,21 @@ namespace swift::core::context { Q_UNUSED((unit);) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CComSystem(); + return {}; } //! \copydoc IContextOwnAircraft::getOwnTransponder() swift::misc::aviation::CTransponder getOwnTransponder() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CTransponder(); + return {}; } //! \copydoc IContextOwnAircraft::getOwnAircraftSituation() swift::misc::aviation::CAircraftSituation getOwnAircraftSituation() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::aviation::CAircraftSituation(); + return {}; } //! \copydoc IContextOwnAircraft::updateOwnPosition diff --git a/src/core/context/contextsimulatorempty.h b/src/core/context/contextsimulatorempty.h index fc374a50c..11213dd3d 100644 --- a/src/core/context/contextsimulatorempty.h +++ b/src/core/context/contextsimulatorempty.h @@ -28,21 +28,21 @@ namespace swift::core::context swift::misc::simulation::CSimulatorPluginInfo getSimulatorPluginInfo() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CSimulatorPluginInfo(); + return {}; } //! \copydoc IContextSimulator::getAvailableSimulatorPlugins swift::misc::simulation::CSimulatorPluginInfoList getAvailableSimulatorPlugins() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CSimulatorPluginInfoList(); + return {}; } //! \copydoc IContextSimulator::getSimulatorSettings swift::misc::simulation::settings::CSimulatorSettings getSimulatorSettings() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::settings::CSimulatorSettings(); + return {}; } //! \copydoc IContextSimulator::setSimulatorSettings @@ -84,28 +84,28 @@ namespace swift::core::context swift::misc::simulation::CAircraftModelList getModelSet() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CAircraftModelList(); + return {}; } //! \copydoc IContextSimulator::simulatorsWithInitializedModelSet swift::misc::simulation::CSimulatorInfo simulatorsWithInitializedModelSet() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CSimulatorInfo(); + return {}; } //! \copydoc IContextSimulator::verifyPrerequisites swift::misc::CStatusMessageList verifyPrerequisites() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CStatusMessageList(); + return {}; } //! \copydoc IContextSimulator::getModelSetLoaderSimulator swift::misc::simulation::CSimulatorInfo getModelSetLoaderSimulator() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CSimulatorInfo(); + return {}; } //! \copydoc IContextSimulator::setModelSetLoaderSimulator @@ -119,7 +119,7 @@ namespace swift::core::context QStringList getModelSetStrings() const override { logEmptyContextWarning(Q_FUNC_INFO); - return QStringList(); + return {}; } //! \copydoc IContextSimulator::getModelSetCompleterStrings @@ -127,7 +127,7 @@ namespace swift::core::context { Q_UNUSED(sorted); logEmptyContextWarning(Q_FUNC_INFO); - return QStringList(); + return {}; } //! \copydoc IContextSimulator::removeModelsFromSet @@ -151,7 +151,7 @@ namespace swift::core::context swift::misc::simulation::CAircraftModelList getDisabledModelsForMatching() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CAircraftModelList(); + return {}; } //! \copydoc CAircraftMatcher::restoreDisabledModels @@ -186,7 +186,7 @@ namespace swift::core::context { Q_UNUSED(modelString); logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CAircraftModelList(); + return {}; } //! \copydoc IContextSimulator::getModelSetCount @@ -200,7 +200,7 @@ namespace swift::core::context swift::misc::simulation::CSimulatorInternals getSimulatorInternals() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CSimulatorInternals(); + return {}; } //! \copydoc ISimulator::getInterpolationSetupGlobal @@ -208,14 +208,14 @@ namespace swift::core::context getInterpolationAndRenderingSetupGlobal() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CInterpolationAndRenderingSetupGlobal(); + return {}; } //! \copydoc ISimulator::getInterpolationSetupsPerCallsign swift::misc::simulation::CInterpolationSetupList getInterpolationAndRenderingSetupsPerCallsign() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CInterpolationSetupList(); + return {}; } //! \copydoc ISimulator::getInterpolationSetupPerCallsignOrDefault @@ -225,7 +225,7 @@ namespace swift::core::context { Q_UNUSED(callsign) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CInterpolationAndRenderingSetupPerCallsign(); + return {}; } //! \copydoc swift::misc::simulation::IInterpolationSetupProvider::setInterpolationSetupGlobal @@ -253,7 +253,7 @@ namespace swift::core::context { Q_UNUSED(callsign) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CStatusMessageList(); + return {}; } //! \copydoc IContextSimulator::followAircraft @@ -309,7 +309,7 @@ namespace swift::core::context { Q_UNUSED(callsign); logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::CStatusMessageList(); + return {}; } //! \copydoc IContextSimulator::enableMatchingMessages @@ -340,7 +340,7 @@ namespace swift::core::context { Q_UNUSED(missingOnly) logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CMatchingStatistics(); + return {}; } //! \copydoc IContextSimulator::setMatchingSetup @@ -375,7 +375,7 @@ namespace swift::core::context swift::misc::simulation::CAircraftMatcherSetup getMatchingSetup() const override { logEmptyContextWarning(Q_FUNC_INFO); - return swift::misc::simulation::CAircraftMatcherSetup(); + return {}; } }; } // namespace swift::core::context diff --git a/src/core/context/contextsimulatorimpl.cpp b/src/core/context/contextsimulatorimpl.cpp index 6cb1f6455..4b5506656 100644 --- a/src/core/context/contextsimulatorimpl.cpp +++ b/src/core/context/contextsimulatorimpl.cpp @@ -205,7 +205,7 @@ namespace swift::core::context CSimulatorInternals CContextSimulator::getSimulatorInternals() const { if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } - if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CSimulatorInternals(); } + if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return {}; } return m_simulatorPlugin.second->getSimulatorInternals(); } @@ -213,7 +213,7 @@ namespace swift::core::context { if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } const CSimulatorInfo simulator = this->getModelSetLoaderSimulator(); - if (!simulator.isSingleSimulator()) { return CAircraftModelList(); } + if (!simulator.isSingleSimulator()) { return {}; } CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator); return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCachedModels(simulator); @@ -321,7 +321,7 @@ namespace swift::core::context CAircraftModelList CContextSimulator::getDisabledModelsForMatching() const { if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } - if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CAircraftModelList(); } + if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return {}; } return m_aircraftMatcher.getDisabledModelsForMatching(); } @@ -354,7 +354,7 @@ namespace swift::core::context { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << modelString; } - if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CAircraftModelList(); } + if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return {}; } return this->getModelSet().findModelsStartingWith(modelString); } @@ -369,7 +369,7 @@ namespace swift::core::context CInterpolationSetupList CContextSimulator::getInterpolationAndRenderingSetupsPerCallsign() const { if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } - if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CInterpolationSetupList(); } + if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return {}; } return m_simulatorPlugin.second->getInterpolationSetupsPerCallsign(); } @@ -377,10 +377,7 @@ namespace swift::core::context CContextSimulator::getInterpolationAndRenderingSetupPerCallsignOrDefault(const CCallsign &callsign) const { if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } - if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) - { - return CInterpolationAndRenderingSetupPerCallsign(); - } + if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return {}; } return m_simulatorPlugin.second->getInterpolationSetupPerCallsignOrDefault(callsign); } @@ -408,8 +405,8 @@ namespace swift::core::context CStatusMessageList CContextSimulator::getInterpolationMessages(const CCallsign &callsign) const { if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; } - if (callsign.isEmpty()) { return CStatusMessageList(); } - if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CStatusMessageList(); } + if (callsign.isEmpty()) { return {}; } + if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return {}; } return m_simulatorPlugin.second->getInterpolationMessages(callsign); } diff --git a/src/core/corefacade.cpp b/src/core/corefacade.cpp index 793e2fd1b..ac3322c4f 100644 --- a/src/core/corefacade.cpp +++ b/src/core/corefacade.cpp @@ -51,21 +51,15 @@ namespace swift::core CStatusMessage CCoreFacade::tryToReconnectWithDBus() { - if (m_shuttingDown) { return CStatusMessage(this, CStatusMessage::SeverityInfo, u"Shutdown"); } - if (!m_config.requiresDBusConnection()) - { - return CStatusMessage(this, CStatusMessage::SeverityInfo, u"Not DBus based"); - } + if (m_shuttingDown) { return { this, CStatusMessage::SeverityInfo, u"Shutdown" }; } + if (!m_config.requiresDBusConnection()) { return { this, CStatusMessage::SeverityInfo, u"Not DBus based" }; } const QString dBusAddress = this->getDBusAddress(); - if (dBusAddress.isEmpty()) - { - return CStatusMessage(this, CStatusMessage::SeverityInfo, u"Not DBus based, no address"); - } + if (dBusAddress.isEmpty()) { return { this, CStatusMessage::SeverityInfo, u"Not DBus based, no address" }; } QString connectMsg; if (!CContextApplicationProxy::isContextResponsive(dBusAddress, connectMsg)) { - return CStatusMessage(this, CStatusMessage::SeverityError, - u"Cannot connect DBus at '" % dBusAddress % u"', reason: " % connectMsg); + return { this, CStatusMessage::SeverityError, + u"Cannot connect DBus at '" % dBusAddress % u"', reason: " % connectMsg }; } // re-init diff --git a/src/core/db/databasereader.cpp b/src/core/db/databasereader.cpp index 40cf66cbd..bad212982 100644 --- a/src/core/db/databasereader.cpp +++ b/src/core/db/databasereader.cpp @@ -493,7 +493,7 @@ namespace swift::core::db CUrl CDatabaseReader::getBaseUrl(CDbFlags::DataRetrievalModeFlag mode) const { - if (!sApp || sApp->isShuttingDown()) { return CUrl(); } + if (!sApp || sApp->isShuttingDown()) { return {}; } switch (mode) { case CDbFlags::DbReading: return this->getDbServiceBaseUrl().withAppendedPath("/service"); @@ -501,7 +501,7 @@ namespace swift::core::db case CDbFlags::Shared: return sApp->getGlobalSetup().getSharedDbDataDirectoryUrl(); default: qFatal("Wrong mode"); break; } - return CUrl(); + return {}; } bool CDatabaseReader::isChangedUrl(const CUrl &oldUrl, const CUrl ¤tUrl) diff --git a/src/core/db/databasereaderconfig.cpp b/src/core/db/databasereaderconfig.cpp index 79060625d..9a1a1df51 100644 --- a/src/core/db/databasereaderconfig.cpp +++ b/src/core/db/databasereaderconfig.cpp @@ -110,7 +110,7 @@ namespace swift::core::db if (config.getEntities() == entities) { return config; } } } - return CDatabaseReaderConfig(); // not found + return {}; // not found } void CDatabaseReaderConfigList::markAsDbDown() diff --git a/src/core/db/databaseutils.cpp b/src/core/db/databaseutils.cpp index fca32ae61..505b152e5 100644 --- a/src/core/db/databaseutils.cpp +++ b/src/core/db/databaseutils.cpp @@ -353,7 +353,7 @@ namespace swift::core::db IProgressIndicator *progressIndicator, bool processEvents) { - if (!sApp || !sApp->getWebDataServices() || sApp->isShuttingDown()) { return CAircraftModelList(); } + if (!sApp || !sApp->getWebDataServices() || sApp->isShuttingDown()) { return {}; } const CAircraftModelList dbFsFamilyModels(sApp->getWebDataServices()->getModels().findFsFamilyModels()); CAircraftModelList stashModels; if (dbFsFamilyModels.isEmpty() || ownModels.isEmpty()) { return stashModels; } @@ -410,7 +410,7 @@ namespace swift::core::db QJsonDocument CDatabaseUtils::databaseJsonToQJsonDocument(const QString &content) { static const QString compressed("swift:"); - if (content.isEmpty()) { return QJsonDocument(); } + if (content.isEmpty()) { return {}; } QByteArray byteData; if (json::looksLikeJson(content)) { @@ -439,21 +439,21 @@ namespace swift::core::db while (false); } - if (byteData.isEmpty()) { return QJsonDocument(); } + if (byteData.isEmpty()) { return {}; } return QJsonDocument::fromJson(byteData); } QJsonDocument CDatabaseUtils::readQJsonDocumentFromDatabaseFile(const QString &filename) { const QString raw = CFileUtils::readFileToString(filename); - if (raw.isEmpty()) { return QJsonDocument(); } + if (raw.isEmpty()) { return {}; } return CDatabaseUtils::databaseJsonToQJsonDocument(raw); } QJsonObject CDatabaseUtils::readQJsonObjectFromDatabaseFile(const QString &filename) { const QString raw = CFileUtils::readFileToString(filename); - if (raw.isEmpty()) { return QJsonObject(); } + if (raw.isEmpty()) { return {}; } // allow also compressed format const QJsonDocument jsonDoc = CDatabaseUtils::databaseJsonToQJsonDocument(raw); diff --git a/src/core/db/icaodatareader.cpp b/src/core/db/icaodatareader.cpp index 44551abb8..d9faa78f6 100644 --- a/src/core/db/icaodatareader.cpp +++ b/src/core/db/icaodatareader.cpp @@ -741,7 +741,7 @@ namespace swift::core::db case CEntityFlags::AirlineIcaoEntity: return m_airlineIcaoCache.getAvailableTimestamp(); case CEntityFlags::CountryEntity: return m_countryCache.getAvailableTimestamp(); case CEntityFlags::AircraftCategoryEntity: return m_categoryCache.getAvailableTimestamp(); - default: return QDateTime(); + default: return {}; } } diff --git a/src/core/db/infodatareader.cpp b/src/core/db/infodatareader.cpp index c7881608a..82d317732 100644 --- a/src/core/db/infodatareader.cpp +++ b/src/core/db/infodatareader.cpp @@ -73,7 +73,7 @@ namespace swift::core::db if (entity == CEntityFlags::DbInfoObjectEntity || entity == CEntityFlags::SharedInfoObjectEntity) { SWIFT_VERIFY_X(false, Q_FUNC_INFO, "Using this for CInfoDataReader makes no sense"); - return QDateTime(); + return {}; } // Forward to web data services so I get cache data from other readers @@ -214,7 +214,7 @@ namespace swift::core::db case CDbFlags::Shared: return getSharedInfoObjectsUrl(); default: qFatal("Wrong mode"); } - return CUrl(); + return {}; } CStatusMessageList CInfoDataReader::readFromJsonFiles(const QString &dir, CEntityFlags::Entity whatToRead, diff --git a/src/core/db/modeldatareader.cpp b/src/core/db/modeldatareader.cpp index bc48ef1e7..ec0af260e 100644 --- a/src/core/db/modeldatareader.cpp +++ b/src/core/db/modeldatareader.cpp @@ -49,21 +49,21 @@ namespace swift::core::db CLivery CModelDataReader::getLiveryForCombinedCode(const QString &combinedCode) const { - if (!CLivery::isValidCombinedCode(combinedCode)) { return CLivery(); } + if (!CLivery::isValidCombinedCode(combinedCode)) { return {}; } const CLiveryList liveries(getLiveries()); return liveries.findByCombinedCode(combinedCode); } CLivery CModelDataReader::getStdLiveryForAirlineVDesignator(const CAirlineIcaoCode &icao) const { - if (!icao.hasValidDesignator()) { return CLivery(); } + if (!icao.hasValidDesignator()) { return {}; } const CLiveryList liveries(getLiveries()); return liveries.findStdLiveryByAirlineIcaoVDesignator(icao); } CLivery CModelDataReader::getLiveryForDbKey(int id) const { - if (id < 0) { return CLivery(); } + if (id < 0) { return {}; } const CLiveryList liveries(getLiveries()); return liveries.findByKey(id); } @@ -78,7 +78,7 @@ namespace swift::core::db CDistributor CModelDataReader::getDistributorForDbKey(const QString &dbKey) const { - if (dbKey.isEmpty()) { return CDistributor(); } + if (dbKey.isEmpty()) { return {}; } const CDistributorList distributors(getDistributors()); return distributors.findByKeyOrAlias(dbKey); } @@ -87,7 +87,7 @@ namespace swift::core::db CAircraftModel CModelDataReader::getModelForModelString(const QString &modelString) const { - if (modelString.isEmpty()) { return CAircraftModel(); } + if (modelString.isEmpty()) { return {}; } const CAircraftModelList models(this->getModels()); return models.findFirstByModelStringOrDefault(modelString); } @@ -100,21 +100,21 @@ namespace swift::core::db CAircraftModel CModelDataReader::getModelForDbKey(int dbKey) const { - if (dbKey < 0) { return CAircraftModel(); } + if (dbKey < 0) { return {}; } const CAircraftModelList models(this->getModels()); return models.findByKey(dbKey); } QSet CModelDataReader::getAircraftDesignatorsForAirline(const CAirlineIcaoCode &code) const { - if (!code.hasValidDesignator()) { return QSet(); } + if (!code.hasValidDesignator()) { return {}; } const CAircraftModelList models(this->getModels()); return models.getAircraftDesignatorsForAirline(code); } CAircraftIcaoCodeList CModelDataReader::getAicraftIcaoCodesForAirline(const CAirlineIcaoCode &code) const { - if (!code.hasValidDesignator()) { return CAircraftIcaoCodeList(); } + if (!code.hasValidDesignator()) { return {}; } const CAircraftModelList models(this->getModels()); return models.getAicraftIcaoCodesForAirline(code); } @@ -123,7 +123,7 @@ namespace swift::core::db CModelDataReader::getModelsForAircraftDesignatorAndLiveryCombinedCode(const QString &aircraftDesignator, const QString &combinedCode) { - if (aircraftDesignator.isEmpty()) { return CAircraftModelList(); } + if (aircraftDesignator.isEmpty()) { return {}; } const CAircraftModelList models(this->getModels()); return models.findByAircraftDesignatorAndLiveryCombinedCode(aircraftDesignator, combinedCode); } @@ -230,13 +230,13 @@ namespace swift::core::db CAircraftIcaoCodeList CModelDataReader::getAircraftAircraftIcaos() const { - if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return CAircraftIcaoCodeList(); } + if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return {}; } return sApp->getWebDataServices()->getAircraftIcaoCodes(); } CAircraftCategoryList CModelDataReader::getAircraftCategories() const { - if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return CAircraftCategoryList(); } + if (!sApp || sApp->isShuttingDown() || !sApp->getWebDataServices()) { return {}; } return sApp->getWebDataServices()->getAircraftCategories(); } @@ -628,7 +628,7 @@ namespace swift::core::db case CEntityFlags::LiveryEntity: return m_liveryCache.getAvailableTimestamp(); case CEntityFlags::ModelEntity: return m_modelCache.getAvailableTimestamp(); case CEntityFlags::DistributorEntity: return m_distributorCache.getAvailableTimestamp(); - default: return QDateTime(); + default: return {}; } } diff --git a/src/core/fsd/addatc.cpp b/src/core/fsd/addatc.cpp index 0f102b331..b4bf6552a 100644 --- a/src/core/fsd/addatc.cpp +++ b/src/core/fsd/addatc.cpp @@ -39,6 +39,6 @@ namespace swift::core::fsd const AtcRating rating = fromQString(tokens[5]); const int protocolRevision = tokens[6].toInt(); - return AddAtc(tokens[0], tokens[2], tokens[3], tokens[4], rating, protocolRevision); + return { tokens[0], tokens[2], tokens[3], tokens[4], rating, protocolRevision }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/authchallenge.cpp b/src/core/fsd/authchallenge.cpp index 32d743002..a4d05d966 100644 --- a/src/core/fsd/authchallenge.cpp +++ b/src/core/fsd/authchallenge.cpp @@ -29,6 +29,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).warning(u"Wrong number of arguments."); return {}; } - return AuthChallenge(tokens[0], tokens[1], tokens[2]); + return { tokens[0], tokens[1], tokens[2] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/authresponse.cpp b/src/core/fsd/authresponse.cpp index 7e7ab3f81..e1859c961 100644 --- a/src/core/fsd/authresponse.cpp +++ b/src/core/fsd/authresponse.cpp @@ -29,6 +29,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).warning(u"Wrong number of arguments."); return {}; } - return AuthResponse(tokens[0], tokens[1], tokens[2]); + return { tokens[0], tokens[1], tokens[2] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/clientquery.cpp b/src/core/fsd/clientquery.cpp index 6522cfef4..c8b412d5e 100644 --- a/src/core/fsd/clientquery.cpp +++ b/src/core/fsd/clientquery.cpp @@ -35,6 +35,6 @@ namespace swift::core::fsd QStringList payload; if (tokens.size() > 3) { payload = tokens.mid(3); } - return ClientQuery(tokens[0], tokens[1], fromQString(tokens[2]), payload); + return { tokens[0], tokens[1], fromQString(tokens[2]), payload }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/clientresponse.cpp b/src/core/fsd/clientresponse.cpp index fc6efecb1..6eed66ff1 100644 --- a/src/core/fsd/clientresponse.cpp +++ b/src/core/fsd/clientresponse.cpp @@ -33,6 +33,6 @@ namespace swift::core::fsd QStringList responseData; if (tokens.size() > 3) { responseData = tokens.mid(3); } - return ClientResponse(tokens[0], tokens[1], fromQString(tokens[2]), responseData); + return { tokens[0], tokens[1], fromQString(tokens[2]), responseData }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/deleteatc.cpp b/src/core/fsd/deleteatc.cpp index 385ab2d52..2577b03da 100644 --- a/src/core/fsd/deleteatc.cpp +++ b/src/core/fsd/deleteatc.cpp @@ -26,6 +26,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; }; - return DeleteAtc(tokens[0], (tokens.size() >= 2) ? tokens[1] : QString()); + return { tokens[0], (tokens.size() >= 2) ? tokens[1] : QString() }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/euroscopesimdata.cpp b/src/core/fsd/euroscopesimdata.cpp index 18a5fde1d..8e3801c0f 100644 --- a/src/core/fsd/euroscopesimdata.cpp +++ b/src/core/fsd/euroscopesimdata.cpp @@ -73,9 +73,20 @@ namespace swift::core::fsd }; // token[0,15,16] are not used - return EuroscopeSimData(tokens[1], tokens[2], tokens[3], tokens[4].toULongLong(), tokens[5].toDouble(), - tokens[6].toDouble(), tokens[7].toDouble(), tokens[8].toDouble(), tokens[9].toInt(), - tokens[10].toInt(), tokens[11].toInt(), tokens[12].toInt(), tokens[13].toDouble(), - tokens[14].toDouble(), fromFlags(tokens[17].toInt())); + return { tokens[1], + tokens[2], + tokens[3], + tokens[4].toULongLong(), + tokens[5].toDouble(), + tokens[6].toDouble(), + tokens[7].toDouble(), + tokens[8].toDouble(), + tokens[9].toInt(), + tokens[10].toInt(), + tokens[11].toInt(), + static_cast(tokens[12].toInt()), + tokens[13].toDouble(), + tokens[14].toDouble(), + fromFlags(tokens[17].toInt()) }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/flightplan.cpp b/src/core/fsd/flightplan.cpp index 9dd1b4d82..4815948c9 100644 --- a/src/core/fsd/flightplan.cpp +++ b/src/core/fsd/flightplan.cpp @@ -53,9 +53,11 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; }; - return FlightPlan(tokens[0], tokens[1], fromQString(tokens[2]), tokens[3], tokens[4].toInt(), - tokens[5], tokens[6].toInt(), tokens[7].toInt(), tokens[8], tokens[9], tokens[10].toInt(), - tokens[11].toInt(), tokens[12].toInt(), tokens[13].toInt(), tokens[14], tokens[15], - tokens[16]); + return { tokens[0], tokens[1], fromQString(tokens[2]), + tokens[3], tokens[4].toInt(), tokens[5], + tokens[6].toInt(), tokens[7].toInt(), tokens[8], + tokens[9], tokens[10].toInt(), tokens[11].toInt(), + tokens[12].toInt(), tokens[13].toInt(), tokens[14], + tokens[15], tokens[16] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/fsdidentification.cpp b/src/core/fsd/fsdidentification.cpp index 0a684c962..2b58b38a4 100644 --- a/src/core/fsd/fsdidentification.cpp +++ b/src/core/fsd/fsdidentification.cpp @@ -31,6 +31,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; }; - return FSDIdentification(tokens[0], tokens[1], tokens[2], tokens[3]); + return { tokens[0], tokens[1], tokens[2], tokens[3] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/interimpilotdataupdate.cpp b/src/core/fsd/interimpilotdataupdate.cpp index fd1e7467c..a9ace13cc 100644 --- a/src/core/fsd/interimpilotdataupdate.cpp +++ b/src/core/fsd/interimpilotdataupdate.cpp @@ -53,7 +53,15 @@ namespace swift::core::fsd bool onGround = false; unpackPBH(tokens[7].toUInt(), pitch, bank, heading, onGround); - return InterimPilotDataUpdate(tokens[0], tokens[1], tokens[3].toDouble(), tokens[4].toDouble(), - tokens[5].toInt(), tokens[6].toInt(), pitch, bank, heading, onGround); + return { tokens[0], + tokens[1], + tokens[3].toDouble(), + tokens[4].toDouble(), + tokens[5].toInt(), + tokens[6].toInt(), + pitch, + bank, + heading, + onGround }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/killrequest.cpp b/src/core/fsd/killrequest.cpp index be15aa9b2..ad05a9ff1 100644 --- a/src/core/fsd/killrequest.cpp +++ b/src/core/fsd/killrequest.cpp @@ -29,6 +29,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; }; - return KillRequest(tokens[0], tokens[1], tokens.size() > 2 ? tokens[2] : QString()); + return { tokens[0], tokens[1], tokens.size() > 2 ? tokens[2] : QString() }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/mute.cpp b/src/core/fsd/mute.cpp index bd9f92128..c977f23ea 100644 --- a/src/core/fsd/mute.cpp +++ b/src/core/fsd/mute.cpp @@ -26,6 +26,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; }; - return Mute(tokens[0], tokens[1], tokens[2] == QStringLiteral("1")); + return { tokens[0], tokens[1], tokens[2] == QStringLiteral("1") }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/pilotdataupdate.cpp b/src/core/fsd/pilotdataupdate.cpp index b055ec6dd..51dd63c61 100644 --- a/src/core/fsd/pilotdataupdate.cpp +++ b/src/core/fsd/pilotdataupdate.cpp @@ -57,9 +57,18 @@ namespace swift::core::fsd bool onGround = false; unpackPBH(tokens[8].toUInt(), pitch, bank, heading, onGround); - return PilotDataUpdate(fromQString(tokens[0]), tokens[1], tokens[2].toInt(), - fromQString(tokens[3]), tokens[4].toDouble(), tokens[5].toDouble(), - tokens[6].toInt(), tokens[6].toInt() + tokens[9].toInt(), tokens[7].toInt(), pitch, bank, - heading, onGround); + return { fromQString(tokens[0]), + tokens[1], + tokens[2].toInt(), + fromQString(tokens[3]), + tokens[4].toDouble(), + tokens[5].toDouble(), + tokens[6].toInt(), + tokens[6].toInt() + tokens[9].toInt(), + tokens[7].toInt(), + pitch, + bank, + heading, + onGround }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/ping.cpp b/src/core/fsd/ping.cpp index 3ed45f3dc..c3c2f776f 100644 --- a/src/core/fsd/ping.cpp +++ b/src/core/fsd/ping.cpp @@ -29,6 +29,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; }; - return Ping(tokens[0], tokens[1], tokens[2]); + return { tokens[0], tokens[1], tokens[2] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/planeinforequest.cpp b/src/core/fsd/planeinforequest.cpp index f3fc19711..ea2adbb1c 100644 --- a/src/core/fsd/planeinforequest.cpp +++ b/src/core/fsd/planeinforequest.cpp @@ -28,6 +28,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; }; - return PlaneInfoRequest(tokens[0], tokens[1]); + return { tokens[0], tokens[1] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/planeinforequestfsinn.cpp b/src/core/fsd/planeinforequestfsinn.cpp index e29a1a889..8d07f982e 100644 --- a/src/core/fsd/planeinforequestfsinn.cpp +++ b/src/core/fsd/planeinforequestfsinn.cpp @@ -43,6 +43,6 @@ namespace swift::core::fsd .debug(u"Wrong number of arguments."); return {}; }; - return PlaneInfoRequestFsinn(tokens[0], tokens[1], tokens[4], tokens[5], tokens[10], tokens[11]); + return { tokens[0], tokens[1], tokens[4], tokens[5], tokens[10], tokens[11] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/planeinformation.cpp b/src/core/fsd/planeinformation.cpp index 57eddbd98..0856324ec 100644 --- a/src/core/fsd/planeinformation.cpp +++ b/src/core/fsd/planeinformation.cpp @@ -52,6 +52,6 @@ namespace swift::core::fsd else if (pair[0] == QLatin1String("LIVERY")) { livery = pair[1]; } } } - return PlaneInformation(tokens[0], tokens[1], aircraft, airline, livery); + return { tokens[0], tokens[1], aircraft, airline, livery }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/planeinformationfsinn.cpp b/src/core/fsd/planeinformationfsinn.cpp index d16130e90..a618cc007 100644 --- a/src/core/fsd/planeinformationfsinn.cpp +++ b/src/core/fsd/planeinformationfsinn.cpp @@ -44,6 +44,6 @@ namespace swift::core::fsd return {}; }; - return PlaneInformationFsinn(tokens[0], tokens[1], tokens[4], tokens[5], tokens[10], tokens[11]); + return { tokens[0], tokens[1], tokens[4], tokens[5], tokens[10], tokens[11] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/pong.cpp b/src/core/fsd/pong.cpp index e510fa9e7..1e1ef6a9c 100644 --- a/src/core/fsd/pong.cpp +++ b/src/core/fsd/pong.cpp @@ -29,6 +29,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; }; - return Pong(tokens[0], tokens[1], tokens[2]); + return { tokens[0], tokens[1], tokens[2] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/rehost.cpp b/src/core/fsd/rehost.cpp index a0150a8e0..e5bd207fb 100644 --- a/src/core/fsd/rehost.cpp +++ b/src/core/fsd/rehost.cpp @@ -26,6 +26,6 @@ namespace swift::core::fsd return {}; } - return Rehost(tokens[0], tokens[1]); + return { tokens[0], tokens[1] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/revbclientparts.cpp b/src/core/fsd/revbclientparts.cpp index 06163cdff..36bd8b3bf 100644 --- a/src/core/fsd/revbclientparts.cpp +++ b/src/core/fsd/revbclientparts.cpp @@ -31,7 +31,7 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; } - return RevBClientParts(tokens[0], tokens[1], tokens[2], tokens[3]); + return { tokens[0], tokens[1], tokens[2], tokens[3] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/servererror.cpp b/src/core/fsd/servererror.cpp index 9ad94dd7f..20ea3d9da 100644 --- a/src/core/fsd/servererror.cpp +++ b/src/core/fsd/servererror.cpp @@ -48,6 +48,6 @@ namespace swift::core::fsd swift::misc::CLogMessage(static_cast(nullptr)).debug(u"Wrong number of arguments."); return {}; } - return ServerError(tokens[0], tokens[1], static_cast(tokens[2].toInt()), tokens[3], tokens[4]); + return { tokens[0], tokens[1], static_cast(tokens[2].toInt()), tokens[3], tokens[4] }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/textmessage.cpp b/src/core/fsd/textmessage.cpp index ec9cab92a..c5da36a5a 100644 --- a/src/core/fsd/textmessage.cpp +++ b/src/core/fsd/textmessage.cpp @@ -46,6 +46,6 @@ namespace swift::core::fsd }; QStringList messageTokens = tokens.mid(2); - return TextMessage(tokens[0], tokens[1], messageTokens.join(":")); + return { tokens[0], tokens[1], messageTokens.join(":") }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/visualpilotdataperiodic.cpp b/src/core/fsd/visualpilotdataperiodic.cpp index b593d9404..cb1c8b4f3 100644 --- a/src/core/fsd/visualpilotdataperiodic.cpp +++ b/src/core/fsd/visualpilotdataperiodic.cpp @@ -63,16 +63,27 @@ namespace swift::core::fsd bool unused = false; //! \todo check if needed? unpackPBH(tokens[5].toUInt(), pitch, bank, heading, unused); - return VisualPilotDataPeriodic( - tokens[0], tokens[1].toDouble(), tokens[2].toDouble(), tokens[3].toDouble(), tokens[4].toDouble(), pitch, - bank, heading, tokens[6].toDouble(), tokens[7].toDouble(), tokens[8].toDouble(), tokens[9].toDouble(), - tokens[11].toDouble(), tokens[10].toDouble(), tokens.value(12, QStringLiteral("0")).toDouble()); + return { tokens[0], + tokens[1].toDouble(), + tokens[2].toDouble(), + tokens[3].toDouble(), + tokens[4].toDouble(), + pitch, + bank, + heading, + tokens[6].toDouble(), + tokens[7].toDouble(), + tokens[8].toDouble(), + tokens[9].toDouble(), + tokens[11].toDouble(), + tokens[10].toDouble(), + tokens.value(12, QStringLiteral("0")).toDouble() }; } VisualPilotDataUpdate VisualPilotDataPeriodic::toUpdate() const { - return VisualPilotDataUpdate(m_sender, m_latitude, m_longitude, m_altitudeTrue, m_heightAgl, m_pitch, m_bank, - m_heading, m_xVelocity, m_yVelocity, m_zVelocity, m_pitchRadPerSec, - m_bankRadPerSec, m_headingRadPerSec, m_noseGearAngle); + return { m_sender, m_latitude, m_longitude, m_altitudeTrue, m_heightAgl, + m_pitch, m_bank, m_heading, m_xVelocity, m_yVelocity, + m_zVelocity, m_pitchRadPerSec, m_bankRadPerSec, m_headingRadPerSec, m_noseGearAngle }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/visualpilotdatastopped.cpp b/src/core/fsd/visualpilotdatastopped.cpp index dad0b3200..9fb0a7d94 100644 --- a/src/core/fsd/visualpilotdatastopped.cpp +++ b/src/core/fsd/visualpilotdatastopped.cpp @@ -53,14 +53,20 @@ namespace swift::core::fsd bool unused = false; //! \todo check if needed? unpackPBH(tokens[5].toUInt(), pitch, bank, heading, unused); - return VisualPilotDataStopped(tokens[0], tokens[1].toDouble(), tokens[2].toDouble(), tokens[3].toDouble(), - tokens[4].toDouble(), pitch, bank, heading, - tokens.value(12, QStringLiteral("0")).toDouble()); + return { tokens[0], + tokens[1].toDouble(), + tokens[2].toDouble(), + tokens[3].toDouble(), + tokens[4].toDouble(), + pitch, + bank, + heading, + tokens.value(12, QStringLiteral("0")).toDouble() }; } VisualPilotDataUpdate VisualPilotDataStopped::toUpdate() const { - return VisualPilotDataUpdate(m_sender, m_latitude, m_longitude, m_altitudeTrue, m_heightAgl, m_pitch, m_bank, - m_heading, 0, 0, 0, 0, 0, 0, m_noseGearAngle); + return { m_sender, m_latitude, m_longitude, m_altitudeTrue, m_heightAgl, m_pitch, m_bank, m_heading, 0, 0, 0, + 0, 0, 0, m_noseGearAngle }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/visualpilotdatatoggle.cpp b/src/core/fsd/visualpilotdatatoggle.cpp index a13accf8c..88ee70ba4 100644 --- a/src/core/fsd/visualpilotdatatoggle.cpp +++ b/src/core/fsd/visualpilotdatatoggle.cpp @@ -36,6 +36,6 @@ namespace swift::core::fsd return {}; } - return VisualPilotDataToggle(tokens[0], tokens[1], tokens[2] == QStringLiteral("1")); + return { tokens[0], tokens[1], tokens[2] == QStringLiteral("1") }; } } // namespace swift::core::fsd diff --git a/src/core/fsd/visualpilotdataupdate.cpp b/src/core/fsd/visualpilotdataupdate.cpp index 85f57d72f..1755f4210 100644 --- a/src/core/fsd/visualpilotdataupdate.cpp +++ b/src/core/fsd/visualpilotdataupdate.cpp @@ -64,22 +64,33 @@ namespace swift::core::fsd bool unused = false; //! \todo check if needed? unpackPBH(tokens[5].toUInt(), pitch, bank, heading, unused); - return VisualPilotDataUpdate( - tokens[0], tokens[1].toDouble(), tokens[2].toDouble(), tokens[3].toDouble(), tokens[4].toDouble(), pitch, - bank, heading, tokens[6].toDouble(), tokens[7].toDouble(), tokens[8].toDouble(), tokens[9].toDouble(), - tokens[11].toDouble(), tokens[10].toDouble(), tokens.value(12, QStringLiteral("0")).toDouble()); + return { tokens[0], + tokens[1].toDouble(), + tokens[2].toDouble(), + tokens[3].toDouble(), + tokens[4].toDouble(), + pitch, + bank, + heading, + tokens[6].toDouble(), + tokens[7].toDouble(), + tokens[8].toDouble(), + tokens[9].toDouble(), + tokens[11].toDouble(), + tokens[10].toDouble(), + tokens.value(12, QStringLiteral("0")).toDouble() }; } VisualPilotDataPeriodic VisualPilotDataUpdate::toPeriodic() const { - return VisualPilotDataPeriodic(m_sender, m_latitude, m_longitude, m_altitudeTrue, m_heightAgl, m_pitch, m_bank, - m_heading, m_xVelocity, m_yVelocity, m_zVelocity, m_pitchRadPerSec, - m_bankRadPerSec, m_headingRadPerSec, m_noseGearAngle); + return { m_sender, m_latitude, m_longitude, m_altitudeTrue, m_heightAgl, + m_pitch, m_bank, m_heading, m_xVelocity, m_yVelocity, + m_zVelocity, m_pitchRadPerSec, m_bankRadPerSec, m_headingRadPerSec, m_noseGearAngle }; } VisualPilotDataStopped VisualPilotDataUpdate::toStopped() const { - return VisualPilotDataStopped(m_sender, m_latitude, m_longitude, m_altitudeTrue, m_heightAgl, m_pitch, m_bank, - m_heading, m_noseGearAngle); + return { m_sender, m_latitude, m_longitude, m_altitudeTrue, m_heightAgl, + m_pitch, m_bank, m_heading, m_noseGearAngle }; } } // namespace swift::core::fsd diff --git a/src/core/modelsetbuilder.cpp b/src/core/modelsetbuilder.cpp index 56c457b0c..2cbe84325 100644 --- a/src/core/modelsetbuilder.cpp +++ b/src/core/modelsetbuilder.cpp @@ -28,7 +28,7 @@ namespace swift::core const CAircraftModelList ¤tSet, Builder options, const CDistributorList &distributors) const { - if (models.isEmpty()) { return CAircraftModelList(); } + if (models.isEmpty()) { return {}; } CAircraftModelList modelSet; // Select by distributor: diff --git a/src/core/threadedreader.cpp b/src/core/threadedreader.cpp index 0ee29c5a3..ef02bb6a2 100644 --- a/src/core/threadedreader.cpp +++ b/src/core/threadedreader.cpp @@ -119,7 +119,7 @@ namespace swift::core QPair CThreadedReader::getNetworkReplyBytes() const { - return QPair(m_networkReplyCurrent, m_networkReplyMax); + return { m_networkReplyCurrent, m_networkReplyMax }; } void CThreadedReader::networkReplyProgress(int logId, qint64 current, qint64 max, const QUrl &url) diff --git a/src/core/vatsim/vatsimdatafilereader.cpp b/src/core/vatsim/vatsimdatafilereader.cpp index a65ee3381..62e68463a 100644 --- a/src/core/vatsim/vatsimdatafilereader.cpp +++ b/src/core/vatsim/vatsimdatafilereader.cpp @@ -105,7 +105,7 @@ namespace swift::core::vatsim CVoiceCapabilities CVatsimDataFileReader::getVoiceCapabilityForCallsign(const CCallsign &callsign) const { - if (callsign.isEmpty()) { return CVoiceCapabilities(); } + if (callsign.isEmpty()) { return {}; } QReadLocker rl(&m_lock); return m_flightPlanRemarks.value(callsign).getVoiceCapabilities(); } @@ -299,7 +299,7 @@ namespace swift::core::vatsim CFlightPlanRemarks CVatsimDataFileReader::parseFlightPlanRemarks(const QJsonObject &pilot) const { - return CFlightPlanRemarks(pilot["flight_plan"]["remarks"].toString().trimmed()); + return { pilot["flight_plan"]["remarks"].toString().trimmed() }; } CAtcStation CVatsimDataFileReader::parseController(const QJsonObject &controller) const @@ -311,7 +311,7 @@ namespace swift::core::vatsim const QJsonArray atisLines = controller["text_atis"].toArray(); const auto atisText = makeRange(atisLines).transform([](auto line) { return line.toString(); }); const CInformationMessage atis(CInformationMessage::ATIS, atisText.to().join('\n')); - return CAtcStation(callsign, user, freq, {}, range, true, {}, {}, atis); + return { callsign, user, freq, {}, range, true, {}, {}, atis }; } void CVatsimDataFileReader::reloadSettings() diff --git a/src/core/vatsim/vatsimserverfilereader.cpp b/src/core/vatsim/vatsimserverfilereader.cpp index a187d9bf5..119ea93c6 100644 --- a/src/core/vatsim/vatsimserverfilereader.cpp +++ b/src/core/vatsim/vatsimserverfilereader.cpp @@ -131,9 +131,15 @@ namespace swift::core::vatsim CServer CVatsimServerFileReader::parseServer(const QJsonObject &server) const { - return CServer(server["name"].toString(), server["location"].toString(), server["hostname_or_ip"].toString(), - 6809, CUser("id", "real name", "email", "password"), CFsdSetup::vatsimStandard(), - CEcosystem::VATSIM, CServer::FSDServerVatsim, server["clients_connection_allowed"].toInt()); + return { server["name"].toString(), + server["location"].toString(), + server["hostname_or_ip"].toString(), + 6809, + CUser("id", "real name", "email", "password"), + CFsdSetup::vatsimStandard(), + CEcosystem::VATSIM, + CServer::FSDServerVatsim, + static_cast(server["clients_connection_allowed"].toInt()) }; } } // namespace swift::core::vatsim diff --git a/src/gui/components/airportsmallcompleter.cpp b/src/gui/components/airportsmallcompleter.cpp index 2fdd8c753..024bdf070 100644 --- a/src/gui/components/airportsmallcompleter.cpp +++ b/src/gui/components/airportsmallcompleter.cpp @@ -60,7 +60,7 @@ namespace swift::gui::components CAirportIcaoCode CAirportSmallCompleter::getAirportIcaoCode() const { if (m_current.hasValidIcaoCode()) { return m_current.getIcao(); } - return CAirportIcaoCode(this->getIcaoText()); + return { this->getIcaoText() }; } QString CAirportSmallCompleter::getIcaoText() const { return ui->le_Icao->text().trimmed().toUpper(); } diff --git a/src/gui/components/audiodevicevolumesetupcomponent.cpp b/src/gui/components/audiodevicevolumesetupcomponent.cpp index 9cc59f572..5f17c3658 100644 --- a/src/gui/components/audiodevicevolumesetupcomponent.cpp +++ b/src/gui/components/audiodevicevolumesetupcomponent.cpp @@ -524,14 +524,14 @@ namespace swift::gui::components CAudioDeviceInfo CAudioDeviceVolumeSetupComponent::getSelectedInputDevice() const { - if (!hasAudio()) { return CAudioDeviceInfo(); } + if (!hasAudio()) { return {}; } const CAudioDeviceInfoList devices = sGui->getCContextAudioBase()->getAudioInputDevices(); return devices.findByName(ui->cb_SetupAudioInputDevice->currentText()); } CAudioDeviceInfo CAudioDeviceVolumeSetupComponent::getSelectedOutputDevice() const { - if (!hasAudio()) { return CAudioDeviceInfo(); } + if (!hasAudio()) { return {}; } const CAudioDeviceInfoList devices = sGui->getCContextAudioBase()->getAudioOutputDevices(); return devices.findByName(ui->cb_SetupAudioOutputDevice->currentText()); } diff --git a/src/gui/components/callsigncompleter.cpp b/src/gui/components/callsigncompleter.cpp index cd531e358..6e974d9e8 100644 --- a/src/gui/components/callsigncompleter.cpp +++ b/src/gui/components/callsigncompleter.cpp @@ -50,8 +50,8 @@ namespace swift::gui::components const QString csString = ui->le_Callsign->text().trimmed().toUpper(); const bool valid = onlyKnownCallsign ? this->isValidKnownCallsign(csString) : CCallsign::isValidAircraftCallsign(csString); - if (!valid) { return CCallsign(); } - return CCallsign(csString, CCallsign::Aircraft); + if (!valid) { return {}; } + return { csString, CCallsign::Aircraft }; } void CCallsignCompleter::setCallsign(const CCallsign &cs) { ui->le_Callsign->setText(cs.asString()); } diff --git a/src/gui/components/cockpitcomcomponent.cpp b/src/gui/components/cockpitcomcomponent.cpp index e75b0c507..64d359308 100644 --- a/src/gui/components/cockpitcomcomponent.cpp +++ b/src/gui/components/cockpitcomcomponent.cpp @@ -140,7 +140,7 @@ namespace swift::gui::components { // unavailable context during shutdown possible // mostly when client runs with DBus, but DBus is down - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return CSimulatedAircraft(); } + if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return {}; } return sGui->getIContextOwnAircraft()->getOwnAircraft(); } diff --git a/src/gui/components/cockpitinfoareacomponent.cpp b/src/gui/components/cockpitinfoareacomponent.cpp index 4c9c137a9..1916d495f 100644 --- a/src/gui/components/cockpitinfoareacomponent.cpp +++ b/src/gui/components/cockpitinfoareacomponent.cpp @@ -30,7 +30,7 @@ namespace swift::gui::components { // see also CMainInfoAreaComponent::getPreferredSizeWhenFloating Q_UNUSED(areaIndex) - return QSize(600, 400); + return { 600, 400 }; } const QPixmap &CCockpitInfoAreaComponent::indexToPixmap(int areaIndex) const diff --git a/src/gui/components/cockpittranspondermodeledscomponent.cpp b/src/gui/components/cockpittranspondermodeledscomponent.cpp index e0f591783..45a4d9e7a 100644 --- a/src/gui/components/cockpittranspondermodeledscomponent.cpp +++ b/src/gui/components/cockpittranspondermodeledscomponent.cpp @@ -114,13 +114,13 @@ namespace swift::gui::components CTransponder CCockpitTransponderModeLedsComponent::getOwnTransponder() const { - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return CTransponder(); } + if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return {}; } return sGui->getIContextOwnAircraft()->getOwnAircraft().getTransponder(); } CSimulatedAircraft CCockpitTransponderModeLedsComponent::getOwnAircraft() const { - if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return CSimulatedAircraft(); } + if (!sGui || sGui->isShuttingDown() || !sGui->getIContextOwnAircraft()) { return {}; } return sGui->getIContextOwnAircraft()->getOwnAircraft(); } } // namespace swift::gui::components diff --git a/src/gui/components/coreinfoareacomponent.cpp b/src/gui/components/coreinfoareacomponent.cpp index d401599e2..d50789833 100644 --- a/src/gui/components/coreinfoareacomponent.cpp +++ b/src/gui/components/coreinfoareacomponent.cpp @@ -32,8 +32,8 @@ namespace swift::gui::components auto area = static_cast(areaIndex); switch (area) { - case InfoAreaLog: return QSize(400, 300); - default: return QSize(400, 300); + case InfoAreaLog: return { 400, 300 }; + default: return { 400, 300 }; } } diff --git a/src/gui/components/datainfoareacomponent.cpp b/src/gui/components/datainfoareacomponent.cpp index 55c4919df..62c14fb0b 100644 --- a/src/gui/components/datainfoareacomponent.cpp +++ b/src/gui/components/datainfoareacomponent.cpp @@ -110,7 +110,7 @@ namespace swift::gui::components case InfoAreaModels: case InfoAreaCountries: case InfoAreaAircraftCategories: - default: return QSize(800, 600); + default: return { 800, 600 }; } } diff --git a/src/gui/components/datamaininfoareacomponent.cpp b/src/gui/components/datamaininfoareacomponent.cpp index 9d3867272..9638366c6 100644 --- a/src/gui/components/datamaininfoareacomponent.cpp +++ b/src/gui/components/datamaininfoareacomponent.cpp @@ -75,7 +75,7 @@ namespace swift::gui::components case InfoAreaMapping: case InfoAreaSettings: case InfoAreaLog: - default: return QSize(800, 600); + default: return { 800, 600 }; } } diff --git a/src/gui/components/dbaircrafticaoselectorcomponent.cpp b/src/gui/components/dbaircrafticaoselectorcomponent.cpp index bb47986ac..07519c523 100644 --- a/src/gui/components/dbaircrafticaoselectorcomponent.cpp +++ b/src/gui/components/dbaircrafticaoselectorcomponent.cpp @@ -91,7 +91,7 @@ namespace swift::gui::components { const QString icaoOnly = CDatastoreUtility::stripKeyInParentheses(text); if (m_currentIcao.getDesignator() == icaoOnly) { return m_currentIcao; } - return CAircraftIcaoCode(icaoOnly); + return { icaoOnly }; } CAircraftIcaoCode icao(sGui->getWebDataServices()->getAircraftIcaoCodeForDbKey(key)); if (icao.isNull()) @@ -99,7 +99,7 @@ namespace swift::gui::components // did not find by key const QString icaoOnly = CDatastoreUtility::stripKeyInParentheses(text); if (m_currentIcao.getDesignator() == icaoOnly) { return m_currentIcao; } - return CAircraftIcaoCode(icaoOnly); + return { icaoOnly }; } return icao; } diff --git a/src/gui/components/dbautostashingcomponent.cpp b/src/gui/components/dbautostashingcomponent.cpp index fe449f5ca..1330e838b 100644 --- a/src/gui/components/dbautostashingcomponent.cpp +++ b/src/gui/components/dbautostashingcomponent.cpp @@ -350,7 +350,7 @@ namespace swift::gui::components swift::misc::aviation::CLivery CDbAutoStashingComponent::getTempLivery() { - if (!sGui || !sGui->hasWebDataServices()) { return CLivery(); } + if (!sGui || !sGui->hasWebDataServices()) { return {}; } return sGui->getWebDataServices()->getTempLiveryOrDefault(); } } // namespace swift::gui::components diff --git a/src/gui/components/dbcountryselectorcomponent.cpp b/src/gui/components/dbcountryselectorcomponent.cpp index 71bd9dbd6..f2a908b90 100644 --- a/src/gui/components/dbcountryselectorcomponent.cpp +++ b/src/gui/components/dbcountryselectorcomponent.cpp @@ -73,13 +73,13 @@ namespace swift::gui::components swift::misc::CCountry CDbCountrySelectorComponent::getCountry() const { - if (!sGui) { return CCountry(); } + if (!sGui) { return {}; } const QString iso(ui->le_CountryIso->text().trimmed().toUpper()); const QString name(ui->le_CountryName->text().trimmed()); if (CCountry::isValidIsoCode(iso)) { return sGui->getWebDataServices()->getCountryForIsoCode(iso); } else { - if (name.isEmpty()) { return CCountry(); } + if (name.isEmpty()) { return {}; } return sGui->getWebDataServices()->getCountryForName(name); } } diff --git a/src/gui/components/dbdistributorselectorcomponent.cpp b/src/gui/components/dbdistributorselectorcomponent.cpp index f91c62c1b..f495c46bb 100644 --- a/src/gui/components/dbdistributorselectorcomponent.cpp +++ b/src/gui/components/dbdistributorselectorcomponent.cpp @@ -88,9 +88,9 @@ namespace swift::gui::components CDistributor CDbDistributorSelectorComponent::getDistributor() const { - if (!sGui) { return CDistributor(); } + if (!sGui) { return {}; } const QString distributorKeyOrAlias(ui->le_Distributor->text().trimmed().toUpper()); - if (distributorKeyOrAlias.isEmpty()) { return CDistributor(); } + if (distributorKeyOrAlias.isEmpty()) { return {}; } if (m_currentDistributor.matchesKeyOrAlias(distributorKeyOrAlias)) { return m_currentDistributor; } const CDistributor d(sGui->getWebDataServices()->getDistributors().findByKey(distributorKeyOrAlias)); diff --git a/src/gui/components/dbliveryselectorcomponent.cpp b/src/gui/components/dbliveryselectorcomponent.cpp index c988d2b5a..b1b065619 100644 --- a/src/gui/components/dbliveryselectorcomponent.cpp +++ b/src/gui/components/dbliveryselectorcomponent.cpp @@ -98,7 +98,7 @@ namespace swift::gui::components CLivery CDbLiverySelectorComponent::getLivery() const { - if (!sGui || sGui->isShuttingDown()) { return CLivery(); } + if (!sGui || sGui->isShuttingDown()) { return {}; } const QString raw = ui->le_Livery->text(); const int dbKey = CDatastoreUtility::extractIntegerKey(raw); diff --git a/src/gui/components/dbmappingcomponent.cpp b/src/gui/components/dbmappingcomponent.cpp index beaa8de50..8f8732bda 100644 --- a/src/gui/components/dbmappingcomponent.cpp +++ b/src/gui/components/dbmappingcomponent.cpp @@ -233,7 +233,7 @@ namespace swift::gui::components CAircraftModel CDbMappingComponent::getModelFromView(const QModelIndex &index) const { - if (!index.isValid()) { return CAircraftModel(); } + if (!index.isValid()) { return {}; } const QObject *sender = QObject::sender(); // check if we have an explicit sender @@ -247,7 +247,7 @@ namespace swift::gui::components // no sender, use current tab const CAircraftModelView *mv = this->currentModelView(); - if (!mv) { return CAircraftModel(); } + if (!mv) { return {}; } return mv->at(index); } @@ -325,7 +325,7 @@ namespace swift::gui::components CAircraftModelList CDbMappingComponent::getSelectedModelsToStash() const { const CAircraftModelView *mv = this->currentModelView(); - if (!mv || !mv->hasSelectedModelsToStash()) { return CAircraftModelList(); } + if (!mv || !mv->hasSelectedModelsToStash()) { return {}; } return mv->selectedObjects(); } diff --git a/src/gui/components/dbownmodelsetcomponent.cpp b/src/gui/components/dbownmodelsetcomponent.cpp index d158ecf95..1ed96968d 100644 --- a/src/gui/components/dbownmodelsetcomponent.cpp +++ b/src/gui/components/dbownmodelsetcomponent.cpp @@ -177,7 +177,7 @@ namespace swift::gui::components const CSimulatorInfo &simulator) { Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator"); - if (models.isEmpty()) { return CStatusMessage(this, CStatusMessage::SeverityInfo, u"No data", true); } + if (models.isEmpty()) { return { this, CStatusMessage::SeverityInfo, u"No data", true }; } if (!this->getModelSetSimulator().isSingleSimulator()) { // no sim yet, we set it @@ -186,10 +186,10 @@ namespace swift::gui::components if (simulator != this->getModelSetSimulator()) { // only currently selected sim allowed - return CStatusMessage(this, CStatusMessage::SeverityError, - u"Cannot add data for " % simulator.toQString(true) % u" to " % - this->getModelSetSimulator().toQString(true), - true); + return { this, CStatusMessage::SeverityError, + u"Cannot add data for " % simulator.toQString(true) % u" to " % + this->getModelSetSimulator().toQString(true), + true }; } const bool allowExcludedModels = m_modelSettings.get().getAllowExcludedModels(); @@ -200,12 +200,12 @@ namespace swift::gui::components if (!allowExcludedModels) { updateModels.removeIfExcluded(); } updateModels.resetOrder(); ui->tvp_OwnModelSet->updateContainerMaybeAsync(updateModels); - return CStatusMessage(this, CStatusMessage::SeverityInfo, - u"Modified " % QString::number(d) % u" entries in model set " % - this->getModelSetSimulator().toQString(true), - true); + return { this, CStatusMessage::SeverityInfo, + u"Modified " % QString::number(d) % u" entries in model set " % + this->getModelSetSimulator().toQString(true), + true }; } - else { return CStatusMessage(this, CStatusMessage::SeverityInfo, u"No data modified in model set", true); } + else { return { this, CStatusMessage::SeverityInfo, u"No data modified in model set", true }; } } void CDbOwnModelSetComponent::setMappingComponent(CDbMappingComponent *component) diff --git a/src/gui/components/dbstashcomponent.cpp b/src/gui/components/dbstashcomponent.cpp index 4876f48de..b7fe57677 100644 --- a/src/gui/components/dbstashcomponent.cpp +++ b/src/gui/components/dbstashcomponent.cpp @@ -87,10 +87,9 @@ namespace swift::gui::components if (!allowReplace && ui->tvp_StashAircraftModels->container().containsModelStringOrDbKey(model)) { const QString msg("Model '%1' already stashed"); - return CStatusMessage(validationCategories(), CStatusMessage::SeverityError, - msg.arg(model.getModelString())); + return { validationCategories(), CStatusMessage::SeverityError, msg.arg(model.getModelString()) }; } - return CStatusMessage(); + return {}; } CStatusMessage CDbStashComponent::stashModel(const CAircraftModel &model, bool replace, bool consolidateWithDbData, @@ -114,7 +113,7 @@ namespace swift::gui::components CStatusMessageList CDbStashComponent::stashModels(const CAircraftModelList &models, bool replace, bool consolidateWithDbData, bool clearHighlighting) { - if (models.isEmpty()) { return CStatusMessageList(); } + if (models.isEmpty()) { return {}; } CStatusMessageList msgs; int successfullyAdded = 0; for (const CAircraftModel &model : models) @@ -168,7 +167,7 @@ namespace swift::gui::components CAircraftModel CDbStashComponent::getStashedModel(const QString &modelString) const { - if (modelString.isEmpty() || ui->tvp_StashAircraftModels->isEmpty()) { return CAircraftModel(); } + if (modelString.isEmpty() || ui->tvp_StashAircraftModels->isEmpty()) { return {}; } return ui->tvp_StashAircraftModels->container().findFirstByModelStringOrDefault(modelString); } @@ -304,10 +303,10 @@ namespace swift::gui::components CStatusMessageList CDbStashComponent::validate(CAircraftModelList &validModels, CAircraftModelList &invalidModels) const { - if (ui->tvp_StashAircraftModels->isEmpty()) { return CStatusMessageList(); } + if (ui->tvp_StashAircraftModels->isEmpty()) { return {}; } Q_ASSERT_X(sGui->getWebDataServices(), Q_FUNC_INFO, "No web services"); const CAircraftModelList models(getSelectedOrAllModels()); - if (models.isEmpty()) { return CStatusMessageList(); } + if (models.isEmpty()) { return {}; } const bool ignoreEqual = ui->cb_ChangedOnly->isChecked(); const CStatusMessageList msgs( sGui->getWebDataServices()->validateForPublishing(models, ignoreEqual, validModels, invalidModels)); diff --git a/src/gui/components/flightplancomponent.cpp b/src/gui/components/flightplancomponent.cpp index bd5e7ca97..ada5fb9ec 100644 --- a/src/gui/components/flightplancomponent.cpp +++ b/src/gui/components/flightplancomponent.cpp @@ -775,7 +775,7 @@ namespace swift::gui::components CAircraftIcaoCode CFlightPlanComponent::getAircraftIcaoCode() const { const QString designator(ui->le_AircraftType->text()); - if (!CAircraftIcaoCode::isValidDesignator(designator)) { return CAircraftIcaoCode(); } + if (!CAircraftIcaoCode::isValidDesignator(designator)) { return {}; } if (sApp && sApp->hasWebDataServices()) { const CAircraftIcaoCode designatorFromDb = diff --git a/src/gui/components/maininfoareacomponent.cpp b/src/gui/components/maininfoareacomponent.cpp index 84ac64b92..ccbe2f0e3 100644 --- a/src/gui/components/maininfoareacomponent.cpp +++ b/src/gui/components/maininfoareacomponent.cpp @@ -91,9 +91,9 @@ namespace swift::gui::components case InfoAreaInterpolation: case InfoAreaSettings: case InfoAreaTextMessages: - case InfoAreaRadar: return QSize(600, 400); - case InfoAreaFlightPlan: return QSize(800, 600); - default: return QSize(600, 400); + case InfoAreaRadar: return { 600, 400 }; + case InfoAreaFlightPlan: return { 800, 600 }; + default: return { 600, 400 }; } } diff --git a/src/gui/components/mappingcomponent.cpp b/src/gui/components/mappingcomponent.cpp index ab20b2108..fcc5114f3 100644 --- a/src/gui/components/mappingcomponent.cpp +++ b/src/gui/components/mappingcomponent.cpp @@ -265,7 +265,7 @@ namespace swift::gui::components { this->showOverlayMessage(CStatusMessage(this).validationError(u"Invalid callsign for mapping"), OverlayMessageMs); - return CCallsign(); + return {}; } const CCallsign callsign(cs); @@ -275,7 +275,7 @@ namespace swift::gui::components const CStatusMessage msg = CStatusMessage(this).validationError(u"Unmapped callsign '%1' for mapping") << callsign.asString(); this->showOverlayMessage(msg); - return CCallsign(); + return {}; } return callsign; } diff --git a/src/gui/components/networkdetailscomponent.cpp b/src/gui/components/networkdetailscomponent.cpp index c94d687ef..084813255 100644 --- a/src/gui/components/networkdetailscomponent.cpp +++ b/src/gui/components/networkdetailscomponent.cpp @@ -150,7 +150,7 @@ namespace swift::gui::components CCallsign CNetworkDetailsComponent::getPartnerCallsign() const { if (ui->le_PartnerCallsign->text().isEmpty()) { return {}; } - return CCallsign(ui->le_PartnerCallsign->text(), CCallsign::Aircraft); + return { ui->le_PartnerCallsign->text(), CCallsign::Aircraft }; } void CNetworkDetailsComponent::reloadOtherServersSetup() diff --git a/src/gui/components/serverlistselector.cpp b/src/gui/components/serverlistselector.cpp index 6653156b2..be2e06c8e 100644 --- a/src/gui/components/serverlistselector.cpp +++ b/src/gui/components/serverlistselector.cpp @@ -39,7 +39,7 @@ namespace swift::gui::components CServer CServerListSelector::currentServer() const { const int i = currentIndex(); - if (i < 0 || i >= m_servers.size()) { return CServer(); } + if (i < 0 || i >= m_servers.size()) { return {}; } return m_servers[i]; } diff --git a/src/gui/components/settingssimulatorbasicscomponent.cpp b/src/gui/components/settingssimulatorbasicscomponent.cpp index d3f012a31..da0967f0a 100644 --- a/src/gui/components/settingssimulatorbasicscomponent.cpp +++ b/src/gui/components/settingssimulatorbasicscomponent.cpp @@ -249,7 +249,7 @@ namespace swift::gui::components QStringList CSettingsSimulatorBasicsComponent::parseDirectories(const QString &rawString) const { const QString raw = rawString.trimmed(); - if (raw.isEmpty()) { return QStringList(); } + if (raw.isEmpty()) { return {}; } QStringList dirs; thread_local const QRegularExpression regExp("\n|\r\n|\r"); const QStringList rawLines = raw.split(regExp); diff --git a/src/gui/components/simbriefdownloaddialog.cpp b/src/gui/components/simbriefdownloaddialog.cpp index e4f0de699..1b017560f 100644 --- a/src/gui/components/simbriefdownloaddialog.cpp +++ b/src/gui/components/simbriefdownloaddialog.cpp @@ -20,7 +20,7 @@ namespace swift::gui::components CSimBriefData CSimBriefDownloadDialog::getSimBriefData() const { - return CSimBriefData(ui->le_SimBriefURL->text().trimmed(), ui->le_SimBriefUsername->text().trimmed()); + return { ui->le_SimBriefURL->text().trimmed(), ui->le_SimBriefUsername->text().trimmed() }; } void CSimBriefDownloadDialog::setSimBriefData(const CSimBriefData &data) diff --git a/src/gui/components/simulatorselector.cpp b/src/gui/components/simulatorselector.cpp index a96a5ecfa..5c22e0bda 100644 --- a/src/gui/components/simulatorselector.cpp +++ b/src/gui/components/simulatorselector.cpp @@ -80,14 +80,14 @@ namespace swift::gui::components { default: case CheckBoxes: - return CSimulatorInfo(ui->cb_FSX->isChecked(), ui->cb_FS9->isChecked(), ui->cb_XPlane->isChecked(), - ui->cb_P3D->isChecked(), ui->cb_FG->isChecked(), ui->cb_MSFS->isChecked(), - ui->cb_MSFS2024->isChecked()); + return { ui->cb_FSX->isChecked(), ui->cb_FS9->isChecked(), ui->cb_XPlane->isChecked(), + ui->cb_P3D->isChecked(), ui->cb_FG->isChecked(), ui->cb_MSFS->isChecked(), + ui->cb_MSFS2024->isChecked() }; case RadioButtons: - return CSimulatorInfo(ui->rb_FSX->isChecked(), ui->rb_FS9->isChecked(), ui->rb_XPlane->isChecked(), - ui->rb_P3D->isChecked(), ui->rb_FG->isChecked(), ui->rb_MSFS->isChecked(), - ui->rb_MSFS2024->isChecked()); - case ComboBox: return CSimulatorInfo(ui->cb_Simulators->currentText()); + return { ui->rb_FSX->isChecked(), ui->rb_FS9->isChecked(), ui->rb_XPlane->isChecked(), + ui->rb_P3D->isChecked(), ui->rb_FG->isChecked(), ui->rb_MSFS->isChecked(), + ui->rb_MSFS2024->isChecked() }; + case ComboBox: return { ui->cb_Simulators->currentText() }; } } diff --git a/src/gui/components/textmessagecomponent.cpp b/src/gui/components/textmessagecomponent.cpp index 5e2cc00c3..a30f5f7af 100644 --- a/src/gui/components/textmessagecomponent.cpp +++ b/src/gui/components/textmessagecomponent.cpp @@ -599,7 +599,7 @@ namespace swift::gui::components CSimulatedAircraft CTextMessageComponent::getOwnAircraft() const { - if (!sGui || !sGui->getIContextOwnAircraft()) { return CSimulatedAircraft(); } + if (!sGui || !sGui->getIContextOwnAircraft()) { return {}; } return sGui->getIContextOwnAircraft()->getOwnAircraft(); } diff --git a/src/gui/dockwidget.cpp b/src/gui/dockwidget.cpp index 1bd3568e2..c7202c09f 100644 --- a/src/gui/dockwidget.cpp +++ b/src/gui/dockwidget.cpp @@ -635,7 +635,7 @@ namespace swift::gui CDockWidgetSettings CDockWidget::getSettings() const { - if (this->objectName().isEmpty()) { return CDockWidgetSettings(); } + if (this->objectName().isEmpty()) { return {}; } // we need object name for settings %OwnerName%" const CDockWidgetSettings s = m_settings.get(); diff --git a/src/gui/ecosystemcombobox.cpp b/src/gui/ecosystemcombobox.cpp index 7ca6fac1e..f3013a045 100644 --- a/src/gui/ecosystemcombobox.cpp +++ b/src/gui/ecosystemcombobox.cpp @@ -19,7 +19,7 @@ namespace swift::gui CEcosystem CEcosystemComboBox::getSelectedEcosystem() const { - if (this->currentIndex() < 0 || this->currentIndex() >= m_systems.size()) { return CEcosystem(); } + if (this->currentIndex() < 0 || this->currentIndex() >= m_systems.size()) { return {}; } return m_systems[this->currentIndex()]; } diff --git a/src/gui/editors/form.cpp b/src/gui/editors/form.cpp index a7f661742..6b30437ef 100644 --- a/src/gui/editors/form.cpp +++ b/src/gui/editors/form.cpp @@ -23,7 +23,7 @@ namespace swift::gui::editors CStatusMessageList CForm::validate(bool withNestedObjects) const { Q_UNUSED(withNestedObjects); - return CStatusMessageList(); + return {}; } CStatusMessageList CForm::validateAsOverlayMessage(bool withNestedObjects, bool appendOldMessages, diff --git a/src/gui/editors/interpolationsetupform.cpp b/src/gui/editors/interpolationsetupform.cpp index 8bd7fb8fd..57687f30e 100644 --- a/src/gui/editors/interpolationsetupform.cpp +++ b/src/gui/editors/interpolationsetupform.cpp @@ -76,7 +76,7 @@ namespace swift::gui::editors CStatusMessageList CInterpolationSetupForm::validate(bool nested) const { Q_UNUSED(nested) - return CStatusMessageList(); + return {}; } void CInterpolationSetupForm::onCheckboxChanged(Qt::CheckState state) diff --git a/src/gui/editors/matchingform.cpp b/src/gui/editors/matchingform.cpp index 7468e7a06..f04b5cb50 100644 --- a/src/gui/editors/matchingform.cpp +++ b/src/gui/editors/matchingform.cpp @@ -86,7 +86,7 @@ namespace swift::gui::editors CStatusMessageList CMatchingForm::validate(bool withNestedForms) const { Q_UNUSED(withNestedForms) - return CStatusMessageList(); + return {}; } void CMatchingForm::setValue(const CAircraftMatcherSetup &setup) diff --git a/src/gui/editors/modelmappingform.cpp b/src/gui/editors/modelmappingform.cpp index ae78c0763..e519c25c3 100644 --- a/src/gui/editors/modelmappingform.cpp +++ b/src/gui/editors/modelmappingform.cpp @@ -115,7 +115,7 @@ namespace swift::gui::editors bool ok; const double cgv = v.toDouble(&ok); if (!ok) { return CLength::null(); } - return CLength(cgv, CLengthUnit::ft()); + return { cgv, CLengthUnit::ft() }; } CLength cg; diff --git a/src/gui/editors/ownmodelsetform.cpp b/src/gui/editors/ownmodelsetform.cpp index 052b5a7a3..9a93fe6b6 100644 --- a/src/gui/editors/ownmodelsetform.cpp +++ b/src/gui/editors/ownmodelsetform.cpp @@ -143,7 +143,7 @@ namespace swift::gui::editors if (ui->rb_DistributorsSelected->isChecked()) { return this->getSelectedDistributors(); } if (ui->rb_DistributorsFromBelow->isChecked()) { return this->getShownDistributors(); } Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong option"); - return CDistributorList(); + return {}; } bool COwnModelSetForm::optionDbIcaoCodesOnly() const { return ui->rb_DbIcaoCodesOnly->isChecked(); } diff --git a/src/gui/editors/pbhsform.cpp b/src/gui/editors/pbhsform.cpp index 54ffccc93..1631ae7a8 100644 --- a/src/gui/editors/pbhsform.cpp +++ b/src/gui/editors/pbhsform.cpp @@ -37,7 +37,7 @@ namespace swift::gui::editors CPbhsForm::~CPbhsForm() = default; - CAngle CPbhsForm::getBankAngle() const { return CAngle(getBankAngleDegrees(), CAngleUnit::deg()); } + CAngle CPbhsForm::getBankAngle() const { return { getBankAngleDegrees(), CAngleUnit::deg() }; } void CPbhsForm::setBankAngle(const CAngle &angle) { @@ -55,7 +55,7 @@ namespace swift::gui::editors return CAngle::normalizeDegrees180(vd, RoundDigits); } - CAngle CPbhsForm::getPitchAngle() const { return CAngle(getPitchAngleDegrees(), CAngleUnit::deg()); } + CAngle CPbhsForm::getPitchAngle() const { return { getPitchAngleDegrees(), CAngleUnit::deg() }; } void CPbhsForm::setPitchAngle(const CAngle &angle) { @@ -73,9 +73,9 @@ namespace swift::gui::editors return CAngle::normalizeDegrees180(vd, RoundDigits); } - CAngle CPbhsForm::getHeadingAngle() const { return CAngle(getHeadingAngleDegrees(), CAngleUnit::deg()); } + CAngle CPbhsForm::getHeadingAngle() const { return { getHeadingAngleDegrees(), CAngleUnit::deg() }; } - CHeading CPbhsForm::getHeading() const { return CHeading(this->getHeadingAngle(), CHeading::True); } + CHeading CPbhsForm::getHeading() const { return { this->getHeadingAngle(), CHeading::True }; } void CPbhsForm::setHeadingAngle(const CAngle &angle) { @@ -96,7 +96,7 @@ namespace swift::gui::editors CSpeed CPbhsForm::getGroundSpeed() const { const int gsKts = ui->sb_GsKts->value(); - return CSpeed(gsKts, CSpeedUnit::kts()); + return { static_cast(gsKts), CSpeedUnit::kts() }; } void CPbhsForm::setSituation(const CAircraftSituation &situation) diff --git a/src/gui/editors/situationform.cpp b/src/gui/editors/situationform.cpp index 0d2d19dca..faf27c8ac 100644 --- a/src/gui/editors/situationform.cpp +++ b/src/gui/editors/situationform.cpp @@ -78,7 +78,7 @@ namespace swift::gui::editors return s; } - CAngle CSituationForm::getBankAngle() const { return CAngle(getBankAngleDegrees(), CAngleUnit::deg()); } + CAngle CSituationForm::getBankAngle() const { return { getBankAngleDegrees(), CAngleUnit::deg() }; } double CSituationForm::getBankAngleDegrees() const { @@ -89,7 +89,7 @@ namespace swift::gui::editors return CAngle::normalizeDegrees180(vd, RoundDigits); } - CAngle CSituationForm::getPitchAngle() const { return CAngle(getPitchAngleDegrees(), CAngleUnit::deg()); } + CAngle CSituationForm::getPitchAngle() const { return { getPitchAngleDegrees(), CAngleUnit::deg() }; } double CSituationForm::getPitchAngleDegrees() const { @@ -100,7 +100,7 @@ namespace swift::gui::editors return CAngle::normalizeDegrees180(vd, RoundDigits); } - CAngle CSituationForm::getHeadingAngle() const { return CAngle(getHeadingAngleDegrees(), CAngleUnit::deg()); } + CAngle CSituationForm::getHeadingAngle() const { return { getHeadingAngleDegrees(), CAngleUnit::deg() }; } double CSituationForm::getHeadingAngleDegrees() const { @@ -122,13 +122,13 @@ namespace swift::gui::editors CPressure CSituationForm::getBarometricPressureMsl() const { - return CPressure(this->getBarometricPressureMslMillibar(), CPressureUnit::mbar()); + return { this->getBarometricPressureMslMillibar(), CPressureUnit::mbar() }; } CSpeed CSituationForm::getGroundSpeed() const { const int gsKts = ui->sb_GsKts->value(); - return CSpeed(gsKts, CSpeedUnit::kts()); + return { static_cast(gsKts), CSpeedUnit::kts() }; } void CSituationForm::setReadOnly(bool readonly) diff --git a/src/gui/guiutility.cpp b/src/gui/guiutility.cpp index 2072c2bfe..2a7dfdc7b 100644 --- a/src/gui/guiutility.cpp +++ b/src/gui/guiutility.cpp @@ -167,11 +167,11 @@ namespace swift::gui #ifdef Q_OS_WINDOWS return Private::windowsGetDesktopResolution(); #elif defined(Q_OS_MAC) - return QSize(); + return {}; #elif defined(Q_OS_LINUX) - return QSize(); + return {}; #else - return QSize(); + return {}; #endif } @@ -367,24 +367,24 @@ namespace swift::gui CVariant CGuiUtility::fromSwiftDragAndDropData(const QMimeData *mime) { - if (!hasSwiftVariantMimeType(mime)) { return CVariant(); } + if (!hasSwiftVariantMimeType(mime)) { return {}; } return CGuiUtility::fromSwiftDragAndDropData(mime->data(swiftJsonDragAndDropMimeType())); } CVariant CGuiUtility::fromSwiftDragAndDropData(const QByteArray &utf8Data) { - if (utf8Data.isEmpty()) { return CVariant(); } + if (utf8Data.isEmpty()) { return {}; } const QJsonDocument jsonDoc(QJsonDocument::fromJson(utf8Data)); const QJsonObject jsonObj(jsonDoc.object()); const QString typeName(jsonObj.value("type").toString()); const int typeId = QMetaType::fromName(qPrintable(typeName)).id(); // check if a potential valid value object - if (typeName.isEmpty() || typeId == QMetaType::UnknownType) { return CVariant(); } + if (typeName.isEmpty() || typeId == QMetaType::UnknownType) { return {}; } CVariant valueVariant; const CStatusMessage status = valueVariant.convertFromJsonNoThrow(jsonObj, {}, {}); - if (status.isFailure()) { return CVariant(); } + if (status.isFailure()) { return {}; } return valueVariant; } @@ -409,9 +409,9 @@ namespace swift::gui QFileInfo CGuiUtility::representedMimeFile(const QMimeData *mime) { - if (!mime->hasText()) { return QFileInfo(); } + if (!mime->hasText()) { return {}; } const QString candidate = mime->text(); - if (candidate.isEmpty()) { return QFileInfo(); } + if (candidate.isEmpty()) { return {}; } if (!candidate.contains("://")) { return QFileInfo(candidate); } QUrl url(candidate); const QString localFile = url.toLocalFile(); @@ -515,7 +515,7 @@ namespace swift::gui // fallback, can be mfw it is not found CEnableForFramelessWindow *mfw = CGuiUtility::mainFramelessEnabledWindow(); - if (!mfw || !mfw->getWidget()) { return QPoint(); } + if (!mfw || !mfw->getWidget()) { return {}; } return mfw->getWidget()->pos(); // is main window, so not mapToGlobal } @@ -631,7 +631,7 @@ namespace swift::gui const int b = parts.at(3).toInt(&ok); Q_ASSERT_X(ok, Q_FUNC_INFO, "malformed number"); Q_UNUSED(ok) - return QMargins(l, t, r, b); + return { l, t, r, b }; } QList CGuiUtility::indexToUniqueRows(const QModelIndexList &indexes) @@ -763,7 +763,7 @@ namespace swift::gui const QSizeF s = s1 + s2; const qreal w = s.width() * xCharacters / 123; // 123 chars const qreal h = s.height() * yCharacters / 2; // 2 lines - return QSizeF(w, h); + return { w, h }; } void CGuiUtility::centerWidget(QWidget *widget) diff --git a/src/gui/loadindicator.cpp b/src/gui/loadindicator.cpp index 88c544bc0..4b34b5f50 100644 --- a/src/gui/loadindicator.cpp +++ b/src/gui/loadindicator.cpp @@ -109,7 +109,7 @@ namespace swift::gui update(); } - QSize CLoadIndicator::sizeHint() const { return QSize(64, 64); } + QSize CLoadIndicator::sizeHint() const { return { 64, 64 }; } int CLoadIndicator::heightForWidth(int w) const { return w; } diff --git a/src/gui/menus/menuaction.cpp b/src/gui/menus/menuaction.cpp index f650a6bef..a9ec4a73d 100644 --- a/src/gui/menus/menuaction.cpp +++ b/src/gui/menus/menuaction.cpp @@ -59,7 +59,7 @@ namespace swift::gui::menus QPixmap CMenuAction::getPixmap() const { - if (m_icon.isNull()) { return QPixmap(); } + if (m_icon.isNull()) { return {}; } return m_icon.pixmap(m_icon.actualSize(QSize(16, 16))); } @@ -233,7 +233,7 @@ namespace swift::gui::menus CMenuActions CMenuActions::addActions(const QList &actions, const QString &path) { - if (actions.isEmpty()) { return CMenuActions(); } + if (actions.isEmpty()) { return {}; } CMenuAction menuAction; CMenuActions menuActions; for (QAction *a : actions) @@ -421,19 +421,19 @@ namespace swift::gui::menus CMenuAction CMenuActions::addMenuViewOrder() { - if (this->containsMenu(CMenuAction::pathViewOrder())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::pathViewOrder())) { return {}; } return this->addMenu(CIcons::arrowMediumEast16(), "Order", CMenuAction::pathViewOrder()); } CMenuAction CMenuActions::addMenuSimulator() { - if (this->containsMenu(CMenuAction::pathSimulator())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::pathSimulator())) { return {}; } return this->addMenu(CIcons::appSimulator16(), "Simulator", CMenuAction::pathSimulator()); } CMenuAction CMenuActions::addMenuStash() { - if (this->containsMenu(CMenuAction::pathModelStash())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::pathModelStash())) { return {}; } const bool canConnectDb = sGui && sGui->getWebDataServices() && sGui->getWebDataServices()->hasSuccesfullyConnectedSwiftDb(); const QString text(canConnectDb ? "Stash tools" : "Stash tools (Warning: no DB!)"); @@ -442,49 +442,49 @@ namespace swift::gui::menus CMenuAction CMenuActions::addMenuStashEditor() { - if (this->containsMenu(CMenuAction::pathModelStashEditor())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::pathModelStashEditor())) { return {}; } return this->addMenu(CIcons::appDbStash16(), "Edit models", CMenuAction::pathModelStashEditor()); } CMenuAction CMenuActions::addMenuDatabase() { - if (this->containsMenu(CMenuAction::pathViewDatabase())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::pathViewDatabase())) { return {}; } return this->addMenu(CMenuAction::subMenuDatabase()); } CMenuAction CMenuActions::addMenuConsolidateModels() { - if (this->containsMenu(CMenuAction::pathModelConsolidate())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::pathModelConsolidate())) { return {}; } return this->addMenu(CMenuAction::subMenuConsolidateModels()); } CMenuAction CMenuActions::addMenuModelSet() { - if (this->containsMenu(CMenuAction::pathModelSet())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::pathModelSet())) { return {}; } return this->addMenu(CIcons::appModels16(), "Model set", CMenuAction::pathModelSet()); } CMenuAction CMenuActions::addMenuCom() { - if (this->containsMenu(CMenuAction::subMenuCom().getPath())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::subMenuCom().getPath())) { return {}; } return this->addAction(CMenuAction::subMenuCom()); } CMenuAction CMenuActions::addMenuDisplayModels() { - if (this->containsMenu(CMenuAction::subMenuDisplayModels().getPath())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::subMenuDisplayModels().getPath())) { return {}; } return this->addAction(CMenuAction::subMenuDisplayModels()); } CMenuAction CMenuActions::addMenuRenderModels() { - if (this->containsMenu(CMenuAction::subMenuRenderModels().getPath())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::subMenuRenderModels().getPath())) { return {}; } return this->addAction(CMenuAction::subMenuRenderModels()); } CMenuAction CMenuActions::addMenuDataTransfer() { - if (this->containsMenu(CMenuAction::subMenuDataTransfer().getPath())) { return CMenuAction(); } + if (this->containsMenu(CMenuAction::subMenuDataTransfer().getPath())) { return {}; } return this->addAction(CMenuAction::subMenuDataTransfer()); } diff --git a/src/gui/models/actionhotkeylistmodel.cpp b/src/gui/models/actionhotkeylistmodel.cpp index 739be42f1..446a04c80 100644 --- a/src/gui/models/actionhotkeylistmodel.cpp +++ b/src/gui/models/actionhotkeylistmodel.cpp @@ -24,8 +24,8 @@ namespace swift::gui::models QVariant CActionHotkeyListModel::data(const QModelIndex &index, int role) const { - if (!index.isValid()) { return QVariant(); } - if (index.row() >= m_actionHotkeys.size() || index.row() < 0) { return QVariant(); } + if (!index.isValid()) { return {}; } + if (index.row() >= m_actionHotkeys.size() || index.row() < 0) { return {}; } if (role == Qt::DisplayRole) { diff --git a/src/gui/models/actionmodel.cpp b/src/gui/models/actionmodel.cpp index b2d434d9d..69c3a380c 100644 --- a/src/gui/models/actionmodel.cpp +++ b/src/gui/models/actionmodel.cpp @@ -33,7 +33,7 @@ namespace swift::gui::models QVariant CActionModel::data(const QModelIndex &index, int role) const { - if (!index.isValid()) { return QVariant(); } + if (!index.isValid()) { return {}; } const CActionItem *item = static_cast(index.internalPointer()); Q_ASSERT_X(item, Q_FUNC_INFO, "Missing item"); @@ -56,7 +56,7 @@ namespace swift::gui::models QModelIndex CActionModel::index(int row, int column, const QModelIndex &parent) const { - if (!hasIndex(row, column, parent)) { return QModelIndex(); } + if (!hasIndex(row, column, parent)) { return {}; } const CActionItem *parentItem = parent.isValid() ? static_cast(parent.internalPointer()) : m_rootItem.data(); diff --git a/src/gui/models/aircraftmodellistmodel.cpp b/src/gui/models/aircraftmodellistmodel.cpp index 92cd78989..1031b9ff5 100644 --- a/src/gui/models/aircraftmodellistmodel.cpp +++ b/src/gui/models/aircraftmodellistmodel.cpp @@ -237,7 +237,7 @@ namespace swift::gui::models QStringList CAircraftModelListModel::getModelStrings(bool sort) const { - if (this->isEmpty()) { return QStringList(); } + if (this->isEmpty()) { return {}; } return this->container().getModelStringList(sort); } @@ -263,7 +263,7 @@ namespace swift::gui::models // highlight stashed first if (m_highlightStrings.contains(model.getModelString(), Qt::CaseInsensitive)) { return m_highlightColor; } - return QVariant(); + return {}; } else if (role == Qt::ToolTipRole) { diff --git a/src/gui/models/clientlistmodel.cpp b/src/gui/models/clientlistmodel.cpp index 925672a7f..a83951fba 100644 --- a/src/gui/models/clientlistmodel.cpp +++ b/src/gui/models/clientlistmodel.cpp @@ -53,14 +53,14 @@ namespace swift::gui::models // no model string for ATC const CClient client = this->at(index); const bool atc = client.isAtc(); - if (atc) { return QVariant("ATC"); } + if (atc) { return { "ATC" }; } } else if (pi == qf && role == Qt::DecorationRole) { // no symbol for ATC const CClient client = this->at(index); const bool atc = client.isAtc(); - if (atc) { return QVariant(); } + if (atc) { return {}; } } return CListModelBase::data(index, role); } diff --git a/src/gui/models/columnformatters.cpp b/src/gui/models/columnformatters.cpp index 77f5f367e..c0b282a45 100644 --- a/src/gui/models/columnformatters.cpp +++ b/src/gui/models/columnformatters.cpp @@ -95,7 +95,7 @@ namespace swift::gui::models CVariant CDefaultFormatter::data(int role, const CVariant &inputData) const { - if (!this->supportsRole(role)) { return CVariant(); } + if (!this->supportsRole(role)) { return {}; } const auto roleEnum = static_cast(role); // always supported @@ -112,7 +112,7 @@ namespace swift::gui::models case Qt::CheckStateRole: return checkStateRole(inputData); // as Qt check state default: break; } - return CVariant(); + return {}; } int CDefaultFormatter::alignDefault() { return alignLeftVCenter(); } @@ -180,12 +180,12 @@ namespace swift::gui::models CVariant CValueObjectFormatter::displayRole(const CVariant &valueObject) const { - return CVariant(valueObject.toQString(m_useI18n)); + return { valueObject.toQString(m_useI18n) }; } CVariant CValueObjectFormatter::decorationRole(const CVariant &valueObject) const { - return CVariant(valueObject.toPixmap()); + return { valueObject.toPixmap() }; } CDateTimeFormatter::CDateTimeFormatter(const QString &formatString, int alignment, bool i18n) @@ -292,7 +292,7 @@ namespace swift::gui::models return v ? CVariant(m_trueNameVariant) : CVariant(m_falseNameVariant); } Q_ASSERT_X(false, "CBoolTextFormatter", "no boolean value"); - return CVariant(); + return {}; } Qt::ItemFlags CBoolTextFormatter::flags(Qt::ItemFlags flags, bool editable) const @@ -317,7 +317,7 @@ namespace swift::gui::models { Q_UNUSED(dataCVariant); Q_ASSERT_X(false, Q_FUNC_INFO, "this role should be disabled with led boolean"); - return CVariant(); + return {}; } CVariant CBoolLedFormatter::decorationRole(const CVariant &dataCVariant) const @@ -328,7 +328,7 @@ namespace swift::gui::models return v ? m_pixmapOnLedVariant : m_pixmapOffLedVariant; } Q_ASSERT_X(false, "CBoolLedFormatter", "no boolean value"); - return CVariant(); + return {}; } CBoolIconFormatter::CBoolIconFormatter(int alignment) @@ -355,7 +355,7 @@ namespace swift::gui::models { Q_UNUSED(dataCVariant) Q_ASSERT_X(false, "CBoolIconFormatter", "this role should be disabled with icon boolean"); - return CVariant(); + return {}; } CVariant CBoolIconFormatter::decorationRole(const CVariant &dataCVariant) const @@ -366,7 +366,7 @@ namespace swift::gui::models return v ? m_iconOnVariant : m_iconOffVariant; } Q_ASSERT_X(false, "CBoolIconFormatter", "no boolean value"); - return CVariant(); + return {}; } CVariant CBoolIconFormatter::tooltipRole(const CVariant &dataCVariant) const @@ -390,7 +390,7 @@ namespace swift::gui::models { Q_UNUSED(dataCVariant) Q_ASSERT_X(false, Q_FUNC_INFO, "this role should be disabled with RGB color"); - return CVariant(); + return {}; } CVariant CColorFormatter::decorationRole(const CVariant &dataCVariant) const @@ -430,7 +430,7 @@ namespace swift::gui::models const int i = expectedInteger.toInt(&ok); if (ok) { return QString::number(i); } - return CVariant(); + return {}; } CVariant CEmptyFormatter::displayRole(const CVariant &dataCVariant) const diff --git a/src/gui/models/columns.cpp b/src/gui/models/columns.cpp index 8f1f35888..3fa92466d 100644 --- a/src/gui/models/columns.cpp +++ b/src/gui/models/columns.cpp @@ -45,35 +45,35 @@ namespace swift::gui::models CColumn CColumn::standardValueObject(const QString &headerName, const CPropertyIndex &propertyIndex, int alignment) { - return CColumn(headerName, propertyIndex, new CValueObjectFormatter(alignment)); + return { headerName, propertyIndex, new CValueObjectFormatter(alignment) }; } CColumn CColumn::standardValueObject(const QString &headerName, const QString &toolTip, const CPropertyIndex &propertyIndex, int alignment) { - return CColumn(headerName, toolTip, propertyIndex, new CValueObjectFormatter(alignment)); + return { headerName, toolTip, propertyIndex, new CValueObjectFormatter(alignment) }; } CColumn CColumn::standardString(const QString &headerName, const CPropertyIndex &propertyIndex, int alignment) { - return CColumn(headerName, propertyIndex, new CStringFormatter(alignment)); + return { headerName, propertyIndex, new CStringFormatter(alignment) }; } CColumn CColumn::standardString(const QString &headerName, const QString &toolTip, const CPropertyIndex &propertyIndex, int alignment) { - return CColumn(headerName, toolTip, propertyIndex, new CStringFormatter(alignment)); + return { headerName, toolTip, propertyIndex, new CStringFormatter(alignment) }; } CColumn CColumn::orderColumn(const CPropertyIndex &propertyIndex, int alignment) { - return CColumn("#", "order", propertyIndex, new CStringFormatter(alignment)); + return { "#", "order", propertyIndex, new CStringFormatter(alignment) }; } CColumn CColumn::standardInteger(const QString &headerName, const QString &toolTip, const CPropertyIndex &propertyIndex, int alignment) { - return CColumn(headerName, toolTip, propertyIndex, new CIntegerFormatter(alignment)); + return { headerName, toolTip, propertyIndex, new CIntegerFormatter(alignment) }; } CColumn CColumn::emptyColumn() @@ -137,7 +137,7 @@ namespace swift::gui::models Q_ASSERT(isValidColumn(column)); const CColumn col = m_columns[column]; Q_ASSERT(col.isSortable()); - if (!col.isSortable()) { return CPropertyIndex(); } + if (!col.isSortable()) { return {}; } if (col.hasSortPropertyIndex()) { return col.getSortPropertyIndex(); } return col.getPropertyIndex(); } diff --git a/src/gui/models/listmodelbase.cpp b/src/gui/models/listmodelbase.cpp index 13fe19411..84e047d6b 100644 --- a/src/gui/models/listmodelbase.cpp +++ b/src/gui/models/listmodelbase.cpp @@ -79,7 +79,7 @@ namespace swift::gui::models QVariant CListModelBase::data(const QModelIndex &index, int role) const { // check / init - if (!this->isValidIndex(index)) { return QVariant(); } + if (!this->isValidIndex(index)) { return {}; } if (role == Qt::BackgroundRole) { return CListModelBaseNonTemplate::data(index, role); } diff --git a/src/gui/models/listmodelbasenontemplate.cpp b/src/gui/models/listmodelbasenontemplate.cpp index d572771ed..6298bb252 100644 --- a/src/gui/models/listmodelbasenontemplate.cpp +++ b/src/gui/models/listmodelbasenontemplate.cpp @@ -21,14 +21,14 @@ namespace swift::gui::models QVariant CListModelBaseNonTemplate::headerData(int section, Qt::Orientation orientation, int role) const { - if (orientation != Qt::Horizontal) { return QVariant(); } + if (orientation != Qt::Horizontal) { return {}; } const bool handled = (role == Qt::DisplayRole || role == Qt::ToolTipRole || role == Qt::InitialSortOrderRole); - if (!handled) { return QVariant(); } - if (section < 0 || section >= m_columns.size()) { return QVariant(); } + if (!handled) { return {}; } + if (section < 0 || section >= m_columns.size()) { return {}; } - if (role == Qt::DisplayRole) { return QVariant(m_columns.at(section).getColumnName()); } - if (role == Qt::ToolTipRole) { return QVariant(m_columns.at(section).getColumnToolTip()); } - return QVariant(); + if (role == Qt::DisplayRole) { return { m_columns.at(section).getColumnName() }; } + if (role == Qt::ToolTipRole) { return { m_columns.at(section).getColumnToolTip() }; } + return {}; } QModelIndex CListModelBaseNonTemplate::index(int row, int column, const QModelIndex &parent) const @@ -40,7 +40,7 @@ namespace swift::gui::models QModelIndex CListModelBaseNonTemplate::parent(const QModelIndex &child) const { Q_UNUSED(child) - return QModelIndex(); + return {}; } CPropertyIndex CListModelBaseNonTemplate::columnToPropertyIndex(int column) const diff --git a/src/gui/models/listmodelcallsignobjects.cpp b/src/gui/models/listmodelcallsignobjects.cpp index 3fb6b9e5d..198c41126 100644 --- a/src/gui/models/listmodelcallsignobjects.cpp +++ b/src/gui/models/listmodelcallsignobjects.cpp @@ -34,7 +34,7 @@ namespace swift::gui::models swift::misc::aviation::CCallsign CListModelCallsignObjects::callsignForIndex(const QModelIndex &index) const { - if (!index.isValid()) { return CCallsign(); } + if (!index.isValid()) { return {}; } return this->at(index).getCallsign(); } diff --git a/src/gui/overlaymessagesframe.h b/src/gui/overlaymessagesframe.h index bef61bbb7..971384efe 100644 --- a/src/gui/overlaymessagesframe.h +++ b/src/gui/overlaymessagesframe.h @@ -364,7 +364,7 @@ namespace swift::gui int hInner = qRound(heightFactor * h); if (wInner > WIDGET::maximumWidth()) { wInner = WIDGET::maximumWidth(); } if (hInner > WIDGET::maximumHeight()) { hInner = WIDGET::maximumHeight(); } - return QSize(wInner, hInner); + return { wInner, hInner }; } bool m_forceSmallMsgs = false; //!< force small messages diff --git a/src/gui/sharedstringlistcompleter.cpp b/src/gui/sharedstringlistcompleter.cpp index 76b0841de..6e11f48d6 100644 --- a/src/gui/sharedstringlistcompleter.cpp +++ b/src/gui/sharedstringlistcompleter.cpp @@ -39,7 +39,7 @@ namespace swift::gui QStringList CSharedStringListCompleter::stringList() const { const QStringListModel *model = this->getCompleterModel(); - if (!model) { return QStringList(); } + if (!model) { return {}; } return model->stringList(); } diff --git a/src/gui/stylesheetutility.cpp b/src/gui/stylesheetutility.cpp index 5da6b0b6e..ef0bcce4b 100644 --- a/src/gui/stylesheetutility.cpp +++ b/src/gui/stylesheetutility.cpp @@ -186,7 +186,7 @@ namespace swift::gui QString CStyleSheetUtility::style(const QString &fileName) const { - if (!this->containsStyle(fileName)) { return QString(); } + if (!this->containsStyle(fileName)) { return {}; } return m_styleSheets[fileName.toLower()].trimmed(); } diff --git a/src/gui/views/aircraftcategorytreeview.cpp b/src/gui/views/aircraftcategorytreeview.cpp index 94dcff112..797fd454b 100644 --- a/src/gui/views/aircraftcategorytreeview.cpp +++ b/src/gui/views/aircraftcategorytreeview.cpp @@ -74,7 +74,7 @@ namespace swift::gui::views CAircraftCategory CAircraftCategoryTreeView::selectedObject() const { const CAircraftCategoryTreeModel *model = this->categoryModel(); - if (!model) { return CAircraftCategory(); } + if (!model) { return {}; } return model->container().frontOrDefault(); } diff --git a/src/gui/views/aircraftmodelview.cpp b/src/gui/views/aircraftmodelview.cpp index 69a3506ae..d6d77c859 100644 --- a/src/gui/views/aircraftmodelview.cpp +++ b/src/gui/views/aircraftmodelview.cpp @@ -390,7 +390,7 @@ namespace swift::gui::views CStatusMessage CAircraftModelView::modifyLoadedJsonData(CAircraftModelList &models) const { if (m_correspondingSimulator.isNoSimulator()) { return {}; } - if (models.isEmpty()) { return CStatusMessage(this, CStatusMessage::SeverityDebug, u"Empty models", true); } + if (models.isEmpty()) { return { this, CStatusMessage::SeverityDebug, u"Empty models", true }; } // multiple sims with same count const int removed = models.removeIfNotMatchingSimulator(m_correspondingSimulator); diff --git a/src/gui/views/atcstationtreeview.cpp b/src/gui/views/atcstationtreeview.cpp index 680051fc0..0954491d2 100644 --- a/src/gui/views/atcstationtreeview.cpp +++ b/src/gui/views/atcstationtreeview.cpp @@ -86,7 +86,7 @@ namespace swift::gui::views const QVariant data = this->model()->data(index.siblingAtColumn(0)); // supposed to be the callsign const QString callsign = data.toString(); const CAtcStationTreeModel *model = this->stationModel(); - if (!model) { return CAtcStation(); } + if (!model) { return {}; } return model->container().findFirstByCallsign(CCallsign(callsign, CCallsign::Atc)); } diff --git a/src/gui/views/viewcallsignobjects.cpp b/src/gui/views/viewcallsignobjects.cpp index 0d5abc5ba..e5c0c41e8 100644 --- a/src/gui/views/viewcallsignobjects.cpp +++ b/src/gui/views/viewcallsignobjects.cpp @@ -53,7 +53,7 @@ namespace swift::gui::views template CCallsignSet CViewWithCallsignObjects::selectedCallsigns() const { - if (!this->hasSelection()) { return CCallsignSet(); } + if (!this->hasSelection()) { return {}; } const ContainerType selected(this->selectedObjects()); return selected.getCallsigns(); } diff --git a/src/misc/audio/audiodeviceinfolist.cpp b/src/misc/audio/audiodeviceinfolist.cpp index 7c332f0a4..ddd33ad2d 100644 --- a/src/misc/audio/audiodeviceinfolist.cpp +++ b/src/misc/audio/audiodeviceinfolist.cpp @@ -175,12 +175,12 @@ namespace swift::misc::audio CAudioDeviceInfo CAudioDeviceInfoList::defaultInputDevice() { - return CAudioDeviceInfo(CAudioDeviceInfo::InputDevice, defaultQtInputDevice().description()); + return { CAudioDeviceInfo::InputDevice, defaultQtInputDevice().description() }; } CAudioDeviceInfo CAudioDeviceInfoList::defaultOutputDevice() { - return CAudioDeviceInfo(CAudioDeviceInfo::OutputDevice, defaultQtOutputDevice().description()); + return { CAudioDeviceInfo::OutputDevice, defaultQtOutputDevice().description() }; } } // namespace swift::misc::audio diff --git a/src/misc/aviation/aircraftcategorylist.cpp b/src/misc/aviation/aircraftcategorylist.cpp index 59e75f89b..22df56bf4 100644 --- a/src/misc/aviation/aircraftcategorylist.cpp +++ b/src/misc/aviation/aircraftcategorylist.cpp @@ -66,7 +66,7 @@ namespace swift::misc::aviation CAircraftCategoryList CAircraftCategoryList::findHighestLevels(const CAircraftCategoryList &categories) { - if (categories.isEmpty()) { return CAircraftCategoryList(); } + if (categories.isEmpty()) { return {}; } QMap highestLevels; for (const CAircraftCategory &category : *this) { diff --git a/src/misc/aviation/aircrafticaocode.cpp b/src/misc/aviation/aircrafticaocode.cpp index 0ba3621b4..9a7abbaa6 100644 --- a/src/misc/aviation/aircrafticaocode.cpp +++ b/src/misc/aviation/aircrafticaocode.cpp @@ -368,7 +368,7 @@ namespace swift::misc::aviation { const QString et = this->getEngineType(); if (et.length() == 1) { return et[0]; } - return QChar(); + return {}; } int CAircraftIcaoCode::getEnginesCount() const @@ -819,7 +819,7 @@ namespace swift::misc::aviation { "L1P", "L2P" }, { "L1P", "S1P" }, { "L2J", "L3J" }, { "L2J", "L4J" }, { "L3J", "L4J" } }; - if (isValidCombinedType(combinedCode)) { return QStringList(); } + if (isValidCombinedType(combinedCode)) { return {}; } if (knownCodes.contains(combinedCode)) { return knownCodes.values(combinedCode); } // turn E to P engine @@ -873,7 +873,7 @@ namespace swift::misc::aviation if (!existsKey(json, prefix)) { // when using relationship, this can be null - return CAircraftIcaoCode(); + return {}; } const int engineCount(json.value(prefix % u"enginecount").toInt(-1)); diff --git a/src/misc/aviation/aircrafticaocodelist.cpp b/src/misc/aviation/aircrafticaocodelist.cpp index 6a999931e..8e8dd7cb1 100644 --- a/src/misc/aviation/aircrafticaocodelist.cpp +++ b/src/misc/aviation/aircrafticaocodelist.cpp @@ -23,18 +23,15 @@ namespace swift::misc::aviation CAircraftIcaoCodeList CAircraftIcaoCodeList::findByDesignator(const QString &designator, int fuzzySearch) const { - if (!fuzzySearch && !CAircraftIcaoCode::isValidDesignator(designator)) { return CAircraftIcaoCodeList(); } - if (fuzzySearch && designator.length() < CAircraftIcaoCode::DesignatorMinLength) - { - return CAircraftIcaoCodeList(); - } + if (!fuzzySearch && !CAircraftIcaoCode::isValidDesignator(designator)) { return {}; } + if (fuzzySearch && designator.length() < CAircraftIcaoCode::DesignatorMinLength) { return {}; } return this->findBy( [&](const CAircraftIcaoCode &code) { return code.matchesDesignator(designator, fuzzySearch); }); } CAircraftIcaoCode CAircraftIcaoCodeList::findBestFuzzyMatchOrDefault(const QString &designator, int cutoff) const { - if (designator.length() < CAircraftIcaoCode::DesignatorMinLength) { return CAircraftIcaoCode(); } + if (designator.length() < CAircraftIcaoCode::DesignatorMinLength) { return {}; } int best = 0; int current = 0; CAircraftIcaoCode found; @@ -60,13 +57,13 @@ namespace swift::misc::aviation CAircraftIcaoCodeList CAircraftIcaoCodeList::findByDesignatorOrIataCode(const QString &icaoOrIata) const { - if (icaoOrIata.isEmpty()) { return CAircraftIcaoCodeList(); } + if (icaoOrIata.isEmpty()) { return {}; } return this->findBy([&](const CAircraftIcaoCode &code) { return code.matchesDesignatorOrIata(icaoOrIata); }); } CAircraftIcaoCodeList CAircraftIcaoCodeList::findByDesignatorIataOrFamily(const QString &icaoIataOrFamily) const { - if (icaoIataOrFamily.isEmpty()) { return CAircraftIcaoCodeList(); } + if (icaoIataOrFamily.isEmpty()) { return {}; } return this->findBy( [&](const CAircraftIcaoCode &code) { return code.matchesDesignatorIataOrFamily(icaoIataOrFamily); }); } @@ -74,7 +71,7 @@ namespace swift::misc::aviation CAircraftIcaoCodeList CAircraftIcaoCodeList::findEndingWith(const QString &icaoEnding) const { const QString ends = icaoEnding.trimmed().toUpper(); - if (ends.isEmpty()) { return CAircraftIcaoCodeList(); } + if (ends.isEmpty()) { return {}; } CAircraftIcaoCodeList icaosDesignator; CAircraftIcaoCodeList icaosFamily; for (const CAircraftIcaoCode &icao : *this) @@ -87,19 +84,19 @@ namespace swift::misc::aviation CAircraftIcaoCodeList CAircraftIcaoCodeList::findByIataCode(const QString &iata, int fuzzySearch) const { - if (iata.isEmpty()) { return CAircraftIcaoCodeList(); } + if (iata.isEmpty()) { return {}; } return this->findBy([&](const CAircraftIcaoCode &code) { return code.matchesIataCode(iata, fuzzySearch); }); } CAircraftIcaoCodeList CAircraftIcaoCodeList::findByFamily(const QString &family, int fuzzySearch) const { - if (family.isEmpty()) { return CAircraftIcaoCodeList(); } + if (family.isEmpty()) { return {}; } return this->findBy([&](const CAircraftIcaoCode &code) { return code.matchesFamily(family, fuzzySearch); }); } CAircraftIcaoCodeList CAircraftIcaoCodeList::findByManufacturer(const QString &manufacturer) const { - if (manufacturer.isEmpty()) { return CAircraftIcaoCodeList(); } + if (manufacturer.isEmpty()) { return {}; } return this->findBy([&](const CAircraftIcaoCode &code) { return code.getManufacturer().startsWith(manufacturer, Qt::CaseInsensitive); }); @@ -107,7 +104,7 @@ namespace swift::misc::aviation CAircraftIcaoCodeList CAircraftIcaoCodeList::findByDescription(const QString &description) const { - if (description.isEmpty()) { return CAircraftIcaoCodeList(); } + if (description.isEmpty()) { return {}; } return this->findBy([&](const CAircraftIcaoCode &code) { return code.getModelDescription().startsWith(description, Qt::CaseInsensitive); }); @@ -141,9 +138,9 @@ namespace swift::misc::aviation CAircraftIcaoCode CAircraftIcaoCodeList::findFirstByDesignatorAndRank(const QString &designator) const { - if (!CAircraftIcaoCode::isValidDesignator(designator)) { return CAircraftIcaoCode(); } + if (!CAircraftIcaoCode::isValidDesignator(designator)) { return {}; } CAircraftIcaoCodeList codes(this->findByDesignator(designator)); - if (codes.isEmpty()) { return CAircraftIcaoCode(); } + if (codes.isEmpty()) { return {}; } if (codes.size() < 2) { return codes.front(); } codes.sortBy(&CAircraftIcaoCode::getRank, &CAircraftIcaoCode::getDbKey); return codes.front(); @@ -326,7 +323,7 @@ namespace swift::misc::aviation // get an initial set of data we can choose from const QString designator(icaoPattern.getDesignator()); - if (designator.isEmpty()) { return CAircraftIcaoCode(); } + if (designator.isEmpty()) { return {}; } CAircraftIcaoCodeList codes; do { codes = this->findByDesignator(designator); diff --git a/src/misc/aviation/aircraftsituation.cpp b/src/misc/aviation/aircraftsituation.cpp index 012a8659a..39d895450 100644 --- a/src/misc/aviation/aircraftsituation.cpp +++ b/src/misc/aviation/aircraftsituation.cpp @@ -252,13 +252,13 @@ namespace swift::misc::aviation if (distRatio > 0.95) { return oldSituation.getGroundElevationPlane(); } const double situationElvFt = newElvFt - distRatio * deltaElvFt; - return CElevationPlane(situation, situationElvFt, CElevationPlane::singlePointRadius()); + return { situation, situationElvFt, CElevationPlane::singlePointRadius() }; } else { const double elvSumFt = oldElvFt + newElvFt; const double elvFt = 0.5 * elvSumFt; - return CElevationPlane(newSituation, elvFt, CElevationPlane::singlePointRadius()); + return { newSituation, elvFt, CElevationPlane::singlePointRadius() }; } } @@ -834,7 +834,7 @@ namespace swift::misc::aviation if (this->getGroundSpeed().isNull()) { if (!min.isNull()) { return min; } - return CLength(0, CLengthUnit::nullUnit()); + return { 0, CLengthUnit::nullUnit() }; } const double seconds = ms.count() / 1000.0; const double gsMeterSecond = this->getGroundSpeed().value(CSpeedUnit::m_s()); diff --git a/src/misc/aviation/aircraftsituationchange.h b/src/misc/aviation/aircraftsituationchange.h index 0676e5d6c..24773adf5 100644 --- a/src/misc/aviation/aircraftsituationchange.h +++ b/src/misc/aviation/aircraftsituationchange.h @@ -119,7 +119,7 @@ namespace swift::misc bool containsPushBack() const { return m_containsPushBack; } //! Elevation standard deviation and mean - CAltitudePair getElevationStdDevAndMean() const { return CAltitudePair(m_elvStdDev, m_elvMean); } + CAltitudePair getElevationStdDevAndMean() const { return { m_elvStdDev, m_elvMean }; } //! Guess on ground flag bool guessOnGround(CAircraftSituation &situation, const simulation::CAircraftModel &model) const; diff --git a/src/misc/aviation/aircraftsituationlist.cpp b/src/misc/aviation/aircraftsituationlist.cpp index 3602395de..05e5b0daf 100644 --- a/src/misc/aviation/aircraftsituationlist.cpp +++ b/src/misc/aviation/aircraftsituationlist.cpp @@ -183,10 +183,7 @@ namespace swift::misc::aviation QPair CAircraftSituationList::isGndFlagStableChanging(bool alreadySortedLatestFirst) const { - if (this->size() < 2) - { - return QPair(false, COnGroundInfo::OnGroundSituationUnknown); - } + if (this->size() < 2) { return { false, COnGroundInfo::OnGroundSituationUnknown }; } const CAircraftSituationList sorted(alreadySortedLatestFirst ? (*this) : this->getSortedAdjustedLatestFirst()); const COnGroundInfo::IsOnGround f = sorted.front().getOnGroundInfo().getOnGround(); @@ -316,7 +313,7 @@ namespace swift::misc::aviation CAircraftSituationList CAircraftSituationList::withoutFrontSituation() const { - if (this->empty()) { return CAircraftSituationList(); } + if (this->empty()) { return {}; } CAircraftSituationList copy(*this); copy.pop_front(); return copy; @@ -366,17 +363,17 @@ namespace swift::misc::aviation CSpeedPair CAircraftSituationList::groundSpeedStandardDeviationAndMean() const { const QList gsValues = this->groundSpeedValues(CSpeedUnit::kts()); - if (gsValues.size() != this->size()) { return QPair(CSpeed::null(), CSpeed::null()); } + if (gsValues.size() != this->size()) { return { CSpeed::null(), CSpeed::null() }; } const QPair gsKts = CMathUtils::standardDeviationAndMean(gsValues); - return CSpeedPair(CSpeed(gsKts.first, CSpeedUnit::kts()), CSpeed(gsKts.second, CSpeedUnit::kts())); + return { CSpeed(gsKts.first, CSpeedUnit::kts()), CSpeed(gsKts.second, CSpeedUnit::kts()) }; } CAnglePair CAircraftSituationList::pitchStandardDeviationAndMean() const { const QList pitchValues = this->pitchValues(CAngleUnit::deg()); - if (pitchValues.size() != this->size()) { return QPair(CAngle::null(), CAngle::null()); } + if (pitchValues.size() != this->size()) { return { CAngle::null(), CAngle::null() }; } const QPair pitchDeg = CMathUtils::standardDeviationAndMean(pitchValues); - return CAnglePair(CAngle(pitchDeg.first, CAngleUnit::deg()), CAngle(pitchDeg.second, CAngleUnit::deg())); + return { CAngle(pitchDeg.first, CAngleUnit::deg()), CAngle(pitchDeg.second, CAngleUnit::deg()) }; } int CAircraftSituationList::transferElevationForward(const CLength &radius) @@ -421,6 +418,6 @@ namespace swift::misc::aviation static const double MaxDevFt = CAircraftSituation::allowedAltitudeDeviation().value(CLengthUnit::ft()); const QPair elvStdDevMean = CMathUtils::standardDeviationAndMean(valuesInFt); if (elvStdDevMean.first > MaxDevFt) { return CElevationPlane::null(); } - return CElevationPlane(reference, elvStdDevMean.second, CElevationPlane::singlePointRadius()); + return { reference, elvStdDevMean.second, CElevationPlane::singlePointRadius() }; } } // namespace swift::misc::aviation diff --git a/src/misc/aviation/airlineicaocode.cpp b/src/misc/aviation/airlineicaocode.cpp index 6baa9dc50..4262df24d 100644 --- a/src/misc/aviation/airlineicaocode.cpp +++ b/src/misc/aviation/airlineicaocode.cpp @@ -444,7 +444,7 @@ namespace swift::misc::aviation if (!existsKey(json, prefix)) { // when using relationship, this can be null (e.g. for color liveries) - return CAirlineIcaoCode(); + return {}; } QString designator(json.value(prefix % u"designator").toString()); diff --git a/src/misc/aviation/airlineicaocodelist.cpp b/src/misc/aviation/airlineicaocodelist.cpp index fdc0f59cb..add96e8d5 100644 --- a/src/misc/aviation/airlineicaocodelist.cpp +++ b/src/misc/aviation/airlineicaocodelist.cpp @@ -30,13 +30,13 @@ namespace swift::misc::aviation CAirlineIcaoCodeList CAirlineIcaoCodeList::findByDesignator(const QString &designator) const { - if (!CAirlineIcaoCode::isValidAirlineDesignator(designator)) { return CAirlineIcaoCodeList(); } + if (!CAirlineIcaoCode::isValidAirlineDesignator(designator)) { return {}; } return this->findBy([&](const CAirlineIcaoCode &code) { return code.matchesDesignator(designator); }); } CAirlineIcaoCodeList CAirlineIcaoCodeList::findByIataCode(const QString &iata) const { - if (!CAirlineIcaoCode::isValidIataCode(iata)) { return CAirlineIcaoCodeList(); } + if (!CAirlineIcaoCode::isValidIataCode(iata)) { return {}; } return this->findBy([&](const CAirlineIcaoCode &code) { return code.matchesIataCode(iata); }); } @@ -48,14 +48,14 @@ namespace swift::misc::aviation CAirlineIcaoCodeList CAirlineIcaoCodeList::findByDesignatorOrIataCode(const QString &designatorOrIata) const { - if (designatorOrIata.isEmpty()) { return CAirlineIcaoCodeList(); } + if (designatorOrIata.isEmpty()) { return {}; } return this->findBy( [&](const CAirlineIcaoCode &code) { return code.matchesDesignatorOrIataCode(designatorOrIata); }); } CAirlineIcaoCodeList CAirlineIcaoCodeList::findByVDesignator(const QString &designator) const { - if (!CAirlineIcaoCode::isValidAirlineDesignator(designator)) { return CAirlineIcaoCodeList(); } + if (!CAirlineIcaoCode::isValidAirlineDesignator(designator)) { return {}; } return this->findBy([&](const CAirlineIcaoCode &code) { return code.matchesVDesignator(designator); }); } @@ -69,34 +69,34 @@ namespace swift::misc::aviation CAirlineIcaoCodeList CAirlineIcaoCodeList::findByVDesignatorOrIataCode(const QString &designatorOrIata) const { - if (designatorOrIata.isEmpty()) { return CAirlineIcaoCodeList(); } + if (designatorOrIata.isEmpty()) { return {}; } return this->findBy( [&](const CAirlineIcaoCode &code) { return code.matchesVDesignatorOrIataCode(designatorOrIata); }); } CAirlineIcaoCodeList CAirlineIcaoCodeList::findByCountryIsoCode(const QString &isoCode) const { - if (isoCode.length() != 2) { return CAirlineIcaoCodeList(); } + if (isoCode.length() != 2) { return {}; } const QString iso(isoCode.toUpper()); return this->findBy([&](const CAirlineIcaoCode &code) { return code.getCountry().getIsoCode() == iso; }); } CAirlineIcaoCodeList CAirlineIcaoCodeList::findBySimplifiedNameContaining(const QString &containedString) const { - if (containedString.isEmpty()) { return CAirlineIcaoCodeList(); } + if (containedString.isEmpty()) { return {}; } return this->findBy( [&](const CAirlineIcaoCode &code) { return code.isContainedInSimplifiedName(containedString); }); } CAirlineIcaoCodeList CAirlineIcaoCodeList::findByTelephonyDesignator(const QString &candidate) const { - if (candidate.isEmpty()) { return CAirlineIcaoCodeList(); } + if (candidate.isEmpty()) { return {}; } return this->findBy([&](const CAirlineIcaoCode &code) { return code.matchesTelephonyDesignator(candidate); }); } CAirlineIcaoCodeList CAirlineIcaoCodeList::findByNamesOrTelephonyDesignator(const QString &candidate) const { - if (candidate.isEmpty()) { return CAirlineIcaoCodeList(); } + if (candidate.isEmpty()) { return {}; } return this->findBy( [&](const CAirlineIcaoCode &code) { return code.matchesNamesOrTelephonyDesignator(candidate); }); } @@ -275,9 +275,9 @@ namespace swift::misc::aviation CAirlineIcaoCode CAirlineIcaoCodeList::findBestMatchByCallsign(const CCallsign &callsign) const { - if (this->isEmpty() || callsign.isEmpty()) { return CAirlineIcaoCode(); } + if (this->isEmpty() || callsign.isEmpty()) { return {}; } const QString airline = callsign.getAirlinePrefix().toUpper(); - if (airline.isEmpty()) { return CAirlineIcaoCode(); } + if (airline.isEmpty()) { return {}; } const CAirlineIcaoCode airlineCode = (airline.length() == 3) ? this->findFirstByOrDefault(&CAirlineIcaoCode::getDesignator, airline) : this->findFirstByOrDefault(&CAirlineIcaoCode::getVDesignator, airline); diff --git a/src/misc/aviation/airport.cpp b/src/misc/aviation/airport.cpp index 64354960d..0386acf80 100644 --- a/src/misc/aviation/airport.cpp +++ b/src/misc/aviation/airport.cpp @@ -97,8 +97,8 @@ namespace swift::misc::aviation switch (i) { case IndexIcao: return m_icao.propertyByIndex(index.copyFrontRemoved()); - case IndexLocation: return QVariant(m_location); - case IndexDescriptiveName: return QVariant(m_descriptiveName); + case IndexLocation: return { m_location }; + case IndexDescriptiveName: return { m_descriptiveName }; case IndexPosition: return m_position.propertyByIndex(index.copyFrontRemoved()); case IndexElevation: return this->getElevation().propertyByIndex(index.copyFrontRemoved()); case IndexOperating: return QVariant::fromValue(this->isOperating()); diff --git a/src/misc/aviation/airportlist.cpp b/src/misc/aviation/airportlist.cpp index 61b92f3c1..7a0efc958 100644 --- a/src/misc/aviation/airportlist.cpp +++ b/src/misc/aviation/airportlist.cpp @@ -50,14 +50,14 @@ namespace swift::misc::aviation CAirport CAirportList::findFirstByNameOrLocation(const QString &nameOrLocation) const { - if (this->isEmpty() || nameOrLocation.isEmpty()) { return CAirport(); } + if (this->isEmpty() || nameOrLocation.isEmpty()) { return {}; } CAirportList airports = this->findBy([&](const CAirport &airport) { return airport.matchesDescriptiveName(nameOrLocation); }); if (!airports.isEmpty()) { return airports.frontOrDefault(); } airports = this->findBy([&](const CAirport &airport) { return airport.matchesLocation(nameOrLocation); }); if (!airports.isEmpty()) { return airports.frontOrDefault(); } - return CAirport(); + return {}; } QStringList CAirportList::allIcaoCodes(bool sorted) const diff --git a/src/misc/aviation/atcstationlist.cpp b/src/misc/aviation/atcstationlist.cpp index 85eb9b05b..5e580410b 100644 --- a/src/misc/aviation/atcstationlist.cpp +++ b/src/misc/aviation/atcstationlist.cpp @@ -35,7 +35,7 @@ namespace swift::misc::aviation CAtcStationList CAtcStationList::findIfFrequencyIsWithinSpacing(const CFrequency &frequency) { - if (frequency.isNull()) { return CAtcStationList(); } + if (frequency.isNull()) { return {}; } return this->findBy([&](const CAtcStation &atcStation) { return atcStation.isAtcStationFrequency(frequency); }); } @@ -111,7 +111,7 @@ namespace swift::misc::aviation QHash CAtcStationList::splitPerSuffix(bool sort) const { - if (this->isEmpty()) { return QHash(); } + if (this->isEmpty()) { return {}; } const CAtcStationList stations = sort ? this->sortedByAtcSuffixSortOrderAndDistance() : *this; QString suffix; diff --git a/src/misc/aviation/callsign.cpp b/src/misc/aviation/callsign.cpp index d882a6608..3240eef93 100644 --- a/src/misc/aviation/callsign.cpp +++ b/src/misc/aviation/callsign.cpp @@ -313,10 +313,10 @@ namespace swift::misc::aviation const auto i = index.frontCasted(); switch (i) { - case IndexCallsignString: return QVariant(this->asString()); - case IndexCallsignStringAsSet: return QVariant(this->getStringAsSet()); - case IndexTelephonyDesignator: return QVariant(this->getTelephonyDesignator()); - case IndexSuffix: return QVariant(this->getSuffix()); + case IndexCallsignString: return { this->asString() }; + case IndexCallsignStringAsSet: return { this->getStringAsSet() }; + case IndexTelephonyDesignator: return { this->getTelephonyDesignator() }; + case IndexSuffix: return { this->getSuffix() }; default: return CValueObject::propertyByIndex(index); } } diff --git a/src/misc/aviation/callsignobjectlist.h b/src/misc/aviation/callsignobjectlist.h index d7568cba6..4504e80f1 100644 --- a/src/misc/aviation/callsignobjectlist.h +++ b/src/misc/aviation/callsignobjectlist.h @@ -51,7 +51,7 @@ namespace swift::misc::aviation //! Get callsigns as strings QString getCallsignsAsString(const QString &separator, bool sorted = false) const { - if (this->container().isEmpty()) { return QString(); } + if (this->container().isEmpty()) { return {}; } const QStringList callsigns = this->getCallsignStrings(sorted); return callsigns.join(separator); } diff --git a/src/misc/aviation/comsystem.cpp b/src/misc/aviation/comsystem.cpp index 977a912b9..70a92ec68 100644 --- a/src/misc/aviation/comsystem.cpp +++ b/src/misc/aviation/comsystem.cpp @@ -63,32 +63,30 @@ namespace swift::misc::aviation CComSystem CComSystem::getCom1System(double activeFrequencyMHz, double standbyFrequencyMHz) { - return CComSystem( - CModulator::NameCom1(), - physical_quantities::CFrequency(activeFrequencyMHz, physical_quantities::CFrequencyUnit::MHz()), - physical_quantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, - physical_quantities::CFrequencyUnit::MHz())); + return { CModulator::NameCom1(), + physical_quantities::CFrequency(activeFrequencyMHz, physical_quantities::CFrequencyUnit::MHz()), + physical_quantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, + physical_quantities::CFrequencyUnit::MHz()) }; } CComSystem CComSystem::getCom1System(const CFrequency &activeFrequency, const CFrequency &standbyFrequency) { - return CComSystem(CModulator::NameCom1(), activeFrequency, - standbyFrequency.isNull() ? activeFrequency : standbyFrequency); + return { CModulator::NameCom1(), activeFrequency, + standbyFrequency.isNull() ? activeFrequency : standbyFrequency }; } CComSystem CComSystem::getCom2System(double activeFrequencyMHz, double standbyFrequencyMHz) { - return CComSystem( - CModulator::NameCom2(), - physical_quantities::CFrequency(activeFrequencyMHz, physical_quantities::CFrequencyUnit::MHz()), - physical_quantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, - physical_quantities::CFrequencyUnit::MHz())); + return { CModulator::NameCom2(), + physical_quantities::CFrequency(activeFrequencyMHz, physical_quantities::CFrequencyUnit::MHz()), + physical_quantities::CFrequency(standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, + physical_quantities::CFrequencyUnit::MHz()) }; } CComSystem CComSystem::getCom2System(const CFrequency &activeFrequency, const CFrequency &standbyFrequency) { - return CComSystem(CModulator::NameCom2(), activeFrequency, - standbyFrequency.isNull() ? activeFrequency : standbyFrequency); + return { CModulator::NameCom2(), activeFrequency, + standbyFrequency.isNull() ? activeFrequency : standbyFrequency }; } bool CComSystem::isValidCivilAviationFrequency(const CFrequency &f) diff --git a/src/misc/aviation/flightplan.cpp b/src/misc/aviation/flightplan.cpp index 796ee40dc..95673dd37 100644 --- a/src/misc/aviation/flightplan.cpp +++ b/src/misc/aviation/flightplan.cpp @@ -322,7 +322,7 @@ namespace swift::misc::aviation CFlightPlan CFlightPlan::fromVPilotFormat(const QString &vPilotData) { - if (vPilotData.isEmpty()) { return CFlightPlan(); } + if (vPilotData.isEmpty()) { return {}; } QDomDocument doc; doc.setContent(vPilotData); const QDomElement fpDom = doc.firstChildElement(); @@ -378,7 +378,7 @@ namespace swift::misc::aviation CFlightPlan CFlightPlan::fromSB4Format(const QString &sbData) { - if (sbData.isEmpty()) { return CFlightPlan(); } + if (sbData.isEmpty()) { return {}; } CFlightPlan fp; const QMap values = parseIniValues(sbData); const QString altStr = values.value("Altitude"); @@ -416,7 +416,7 @@ namespace swift::misc::aviation CFlightPlan CFlightPlan::fromSimBriefFormat(const QString &simBrief) { - if (simBrief.isEmpty()) { return CFlightPlan(); } + if (simBrief.isEmpty()) { return {}; } CFlightPlan fp; QDomDocument doc; doc.setContent(simBrief); @@ -532,7 +532,7 @@ namespace swift::misc::aviation CFlightPlan CFlightPlan::fromMultipleFormats(const QString &data, const QString &fileSuffix) { - if (data.isEmpty()) { return CFlightPlan(); } + if (data.isEmpty()) { return {}; } if (fileSuffix.contains("xml", Qt::CaseInsensitive)) { if (data.contains("", Qt::CaseInsensitive) && data.contains("", Qt::CaseInsensitive)) @@ -561,7 +561,7 @@ namespace swift::misc::aviation msgs->push_back( CStatusMessage(static_cast(nullptr)).validationError(u"No file name")); } - return CFlightPlan(); + return {}; } else { @@ -573,7 +573,7 @@ namespace swift::misc::aviation .validationError(u"File '%1' does not exist") << fileName); } - return CFlightPlan(); + return {}; } } @@ -586,7 +586,7 @@ namespace swift::misc::aviation .validationError(u"File '%1' does not contain data") << fileName); } - return CFlightPlan(); + return {}; } if (fileName.endsWith(".sfp", Qt::CaseInsensitive)) { return CFlightPlan::fromSB4Format(data); } @@ -653,7 +653,7 @@ namespace swift::misc::aviation QStringLiteral("Parsing flight plan from '%1' failed.").arg(fileName))); } } - return CFlightPlan(); + return {}; } const QString &CFlightPlan::flightRulesToString(CFlightPlan::FlightRules rules) diff --git a/src/misc/aviation/livery.cpp b/src/misc/aviation/livery.cpp index 4d50f3fe4..33c2f49f6 100644 --- a/src/misc/aviation/livery.cpp +++ b/src/misc/aviation/livery.cpp @@ -201,7 +201,7 @@ namespace swift::misc::aviation if (!existsKey(json, prefix)) { // when using relationship, this can be null - return CLivery(); + return {}; } const QString combinedCode(json.value(prefix % u"combinedcode").toString()); @@ -236,7 +236,7 @@ namespace swift::misc::aviation if (!existsKey(json, prefix)) { // when using relationship, this can be null - return CLivery(); + return {}; } const QString combinedCode(json.value(prefix % u"combinedcode").toString()); diff --git a/src/misc/aviation/liverylist.cpp b/src/misc/aviation/liverylist.cpp index 20ac2ddfa..4ca0068a2 100644 --- a/src/misc/aviation/liverylist.cpp +++ b/src/misc/aviation/liverylist.cpp @@ -17,13 +17,13 @@ namespace swift::misc::aviation CLiveryList CLiveryList::findByAirlineIcaoDesignator(const QString &icao) const { QString icaoCode(icao.trimmed().toUpper()); - if (icaoCode.isEmpty()) { return CLiveryList(); } + if (icaoCode.isEmpty()) { return {}; } return this->findBy(&CLivery::getAirlineIcaoCodeDesignator, icaoCode); } CLivery CLiveryList::findStdLiveryByAirlineIcaoVDesignator(const CAirlineIcaoCode &icao) const { - if (this->isEmpty() || !icao.hasValidDesignator()) { return CLivery(); } + if (this->isEmpty() || !icao.hasValidDesignator()) { return {}; } CLiveryList candidates; for (const CLivery &livery : *this) { @@ -47,7 +47,7 @@ namespace swift::misc::aviation CLivery CLiveryList::findStdLiveryByAirlineIcaoVDesignator(const QString &icao) const { const QString icaoDesignator(icao.trimmed().toUpper()); - if (icaoDesignator.isEmpty()) { return CLivery(); } + if (icaoDesignator.isEmpty()) { return {}; } return this->findFirstByOrDefault([&](const CLivery &livery) { if (!livery.isAirlineStandardLivery()) { return false; } return livery.getAirlineIcaoCode().matchesVDesignator(icaoDesignator); @@ -56,7 +56,7 @@ namespace swift::misc::aviation CLiveryList CLiveryList::findStdLiveriesBySimplifiedAirlineName(const QString &containedString) const { - if (containedString.isEmpty()) { return CLiveryList(); } + if (containedString.isEmpty()) { return {}; } return this->findBy([&](const CLivery &livery) { // keep isAirlineStandardLivery first (faster) return livery.isAirlineStandardLivery() && livery.isContainedInSimplifiedAirlineName(containedString); @@ -65,7 +65,7 @@ namespace swift::misc::aviation CLiveryList CLiveryList::findStdLiveriesByNamesOrTelephonyDesignator(const QString &candidate) const { - if (candidate.isEmpty()) { return CLiveryList(); } + if (candidate.isEmpty()) { return {}; } return this->findBy([&](const CLivery &livery) { // keep isAirlineStandardLivery first (faster) return livery.isAirlineStandardLivery() && @@ -75,7 +75,7 @@ namespace swift::misc::aviation CLivery CLiveryList::findColorLiveryOrDefault(const CRgbColor &fuselage, const CRgbColor &tail) const { - if (!fuselage.isValid() || !tail.isValid()) { return CLivery(); } + if (!fuselage.isValid() || !tail.isValid()) { return {}; } return this->findFirstByOrDefault([&](const CLivery &livery) { if (!livery.isColorLivery()) { return false; } return livery.matchesColors(fuselage, tail); @@ -84,7 +84,7 @@ namespace swift::misc::aviation CLivery CLiveryList::findClosestColorLiveryOrDefault(const CRgbColor &fuselage, const CRgbColor &tail) const { - if (!fuselage.isValid() || !tail.isValid()) { return CLivery(); } + if (!fuselage.isValid() || !tail.isValid()) { return {}; } CLivery bestMatch; double bestDistance = 1.0; for (const CLivery &livery : *this) @@ -103,14 +103,14 @@ namespace swift::misc::aviation CLivery CLiveryList::findByCombinedCode(const QString &combinedCode) const { - if (!CLivery::isValidCombinedCode(combinedCode)) { return CLivery(); } + if (!CLivery::isValidCombinedCode(combinedCode)) { return {}; } return this->findFirstByOrDefault( [&](const CLivery &livery) { return livery.matchesCombinedCode(combinedCode); }); } QStringList CLiveryList::getCombinedCodes(bool sort) const { - if (this->isEmpty()) { return QStringList(); } + if (this->isEmpty()) { return {}; } QStringList codes = this->transform(predicates::MemberTransform(&CLivery::getCombinedCode)); if (sort) { codes.sort(); } return codes; @@ -118,7 +118,7 @@ namespace swift::misc::aviation QStringList CLiveryList::getCombinedCodesPlusInfo(bool sort) const { - if (this->isEmpty()) { return QStringList(); } + if (this->isEmpty()) { return {}; } QStringList codes = this->transform(predicates::MemberTransform(&CLivery::getCombinedCodePlusInfo)); if (sort) { codes.sort(); } return codes; @@ -126,7 +126,7 @@ namespace swift::misc::aviation QStringList CLiveryList::getCombinedCodesPlusInfoAndId(bool sort) const { - if (this->isEmpty()) { return QStringList(); } + if (this->isEmpty()) { return {}; } QStringList codes = this->transform(predicates::MemberTransform(&CLivery::getCombinedCodePlusInfoAndId)); if (sort) { codes.sort(); } return codes; @@ -186,7 +186,7 @@ namespace swift::misc::aviation const CLiveryList liveries(this->findStdLiveriesByNamesOrTelephonyDesignator(search)); if (!liveries.isEmpty()) { return liveries.front(); } } - return CLivery(); + return {}; } CLiveryList CLiveryList::fromDatabaseJsonCaching(const QJsonArray &array, diff --git a/src/misc/aviation/navsystem.h b/src/misc/aviation/navsystem.h index 3d3f875cd..f6f2ef25c 100644 --- a/src/misc/aviation/navsystem.h +++ b/src/misc/aviation/navsystem.h @@ -73,12 +73,12 @@ namespace swift::misc::aviation //! NAV1 unit static CNavSystem getNav1System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) { - return CNavSystem(CModulator::NameNav1(), - swift::misc::physical_quantities::CFrequency( - activeFrequencyMHz, swift::misc::physical_quantities::CFrequencyUnit::MHz()), - swift::misc::physical_quantities::CFrequency( - standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, - swift::misc::physical_quantities::CFrequencyUnit::MHz())); + return { CModulator::NameNav1(), + swift::misc::physical_quantities::CFrequency( + activeFrequencyMHz, swift::misc::physical_quantities::CFrequencyUnit::MHz()), + swift::misc::physical_quantities::CFrequency( + standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, + swift::misc::physical_quantities::CFrequencyUnit::MHz()) }; } //! NAV1 unit @@ -86,19 +86,19 @@ namespace swift::misc::aviation const swift::misc::physical_quantities::CFrequency &standbyFrequency = { 0, swift::misc::physical_quantities::CFrequencyUnit::nullUnit() }) { - return CNavSystem(CModulator::NameNav1(), activeFrequency, - standbyFrequency.isNull() ? activeFrequency : standbyFrequency); + return { CModulator::NameNav1(), activeFrequency, + standbyFrequency.isNull() ? activeFrequency : standbyFrequency }; } //! NAV2 unit static CNavSystem getNav2System(double activeFrequencyMHz, double standbyFrequencyMHz = -1) { - return CNavSystem(CModulator::NameNav2(), - swift::misc::physical_quantities::CFrequency( - activeFrequencyMHz, swift::misc::physical_quantities::CFrequencyUnit::MHz()), - swift::misc::physical_quantities::CFrequency( - standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, - swift::misc::physical_quantities::CFrequencyUnit::MHz())); + return { CModulator::NameNav2(), + swift::misc::physical_quantities::CFrequency( + activeFrequencyMHz, swift::misc::physical_quantities::CFrequencyUnit::MHz()), + swift::misc::physical_quantities::CFrequency( + standbyFrequencyMHz < 0 ? activeFrequencyMHz : standbyFrequencyMHz, + swift::misc::physical_quantities::CFrequencyUnit::MHz()) }; } //! NAV2 unit @@ -106,8 +106,8 @@ namespace swift::misc::aviation const swift::misc::physical_quantities::CFrequency &standbyFrequency = { 0, swift::misc::physical_quantities::CFrequencyUnit::nullUnit() }) { - return CNavSystem(CModulator::NameNav2(), activeFrequency, - standbyFrequency.isNull() ? activeFrequency : standbyFrequency); + return { CModulator::NameNav2(), activeFrequency, + standbyFrequency.isNull() ? activeFrequency : standbyFrequency }; } private: diff --git a/src/misc/aviation/transponder.cpp b/src/misc/aviation/transponder.cpp index 972c2e74e..326b97bfc 100644 --- a/src/misc/aviation/transponder.cpp +++ b/src/misc/aviation/transponder.cpp @@ -145,7 +145,7 @@ namespace swift::misc::aviation CTransponder CTransponder::getStandardTransponder(qint32 transponderCode, CTransponder::TransponderMode mode) { - return CTransponder(transponderCode, mode); + return { transponderCode, mode }; } const QString &CTransponder::modeAsString(CTransponder::TransponderMode mode) diff --git a/src/misc/cachesettingsutils.cpp b/src/misc/cachesettingsutils.cpp index 95333cb91..cd561435b 100644 --- a/src/misc/cachesettingsutils.cpp +++ b/src/misc/cachesettingsutils.cpp @@ -36,17 +36,17 @@ namespace swift::misc QString CCacheSettingsUtils::relativeSettingsPath(const QString &fileName) { - if (!isSetting(fileName)) { return QString(); } + if (!isSetting(fileName)) { return {}; } const int index = fileName.lastIndexOf(binSettings()); - if (index < 0) { return QString(); } + if (index < 0) { return {}; } return fileName.mid(index); } QString CCacheSettingsUtils::relativeCachePath(const QString &fileName) { - if (!isCache(fileName)) { return QString(); } + if (!isCache(fileName)) { return {}; } const int index = fileName.lastIndexOf(binData()); - if (index < 0) { return QString(); } + if (index < 0) { return {}; } return fileName.mid(index); } diff --git a/src/misc/country.cpp b/src/misc/country.cpp index 26ee95983..3ea00fe3f 100644 --- a/src/misc/country.cpp +++ b/src/misc/country.cpp @@ -56,7 +56,7 @@ namespace swift::misc QString CCountry::getCombinedStringIsoName() const { - if (!this->hasIsoCode()) { return QString(); } + if (!this->hasIsoCode()) { return {}; } QString s(m_dbKey); if (m_name.isEmpty()) { return s; } return u" (" % m_name % u')'; @@ -64,7 +64,7 @@ namespace swift::misc QString CCountry::getCombinedStringNameIso() const { - if (!this->isValid()) { return QString(); } + if (!this->isValid()) { return {}; } return m_name % u" - " % m_dbKey; } @@ -172,7 +172,7 @@ namespace swift::misc if (!existsKey(json, prefix)) { // when using relationship, this can be null - return CCountry(); + return {}; } const QString iso(json.value(prefix % u"id").toString()); const QString name(json.value(prefix % u"country").toString()); diff --git a/src/misc/countrylist.cpp b/src/misc/countrylist.cpp index 3da08a772..2e4109b91 100644 --- a/src/misc/countrylist.cpp +++ b/src/misc/countrylist.cpp @@ -16,13 +16,13 @@ namespace swift::misc CCountry CCountryList::findByIsoCode(const QString &isoCode) const { const QString iso(isoCode.trimmed().toUpper()); - if (!CCountry::isValidIsoCode(iso)) { return CCountry(); } + if (!CCountry::isValidIsoCode(iso)) { return {}; } return IDatastoreObjectList::findByKey(isoCode); } CCountry CCountryList::findBestMatchByCountryName(const QString &candidate) const { - if (candidate.isEmpty()) { return CCountry(); } + if (candidate.isEmpty()) { return {}; } thread_local const QRegularExpression reg("^[a-z]+", QRegularExpression::CaseInsensitiveOption); const QRegularExpressionMatch match = reg.match(candidate); @@ -45,13 +45,13 @@ namespace swift::misc CCountry CCountryList::findFirstByAlias(const QString &alias) const { - if (alias.isEmpty()) { return CCountry(); } + if (alias.isEmpty()) { return {}; } const QString a(alias.toUpper().trimmed()); for (const CCountry &country : (*this)) { if (country.matchesAlias(a)) { return country; } } - return CCountry(); + return {}; } QStringList CCountryList::toIsoNameList(bool sorted) const diff --git a/src/misc/datacache.cpp b/src/misc/datacache.cpp index 5e3915c94..0a934f1c1 100644 --- a/src/misc/datacache.cpp +++ b/src/misc/datacache.cpp @@ -555,7 +555,7 @@ namespace swift::misc QMutexLocker lock(&m_mutex); Q_ASSERT(m_updateInProgress); - return QSet(m_timestamps.keyBegin(), m_timestamps.keyEnd()); + return { m_timestamps.keyBegin(), m_timestamps.keyEnd() }; } const QMap &CDataCacheRevision::newerTimestamps() const diff --git a/src/misc/db/artifact.cpp b/src/misc/db/artifact.cpp index d2db3c445..2149a2114 100644 --- a/src/misc/db/artifact.cpp +++ b/src/misc/db/artifact.cpp @@ -56,11 +56,11 @@ namespace swift::misc::db CRemoteFile CArtifact::asRemoteFile() const { - if (!this->hasDistributions()) { return CRemoteFile(); } + if (!this->hasDistributions()) { return {}; } CRemoteFile rf(this->getName(), this->getFileSize()); const CDistribution d = this->getMostStableDistribution(); const CUrl url = d.getDownloadUrl(); - if (url.isEmpty()) { return CRemoteFile(); } + if (url.isEmpty()) { return {}; } rf.setUtcTimestamp(this->getUtcTimestamp()); rf.setUrl(url); rf.setDescription(this->getPlatform().toQString() + " " + d.getChannel()); diff --git a/src/misc/db/artifactlist.cpp b/src/misc/db/artifactlist.cpp index d75802e6e..059f7929a 100644 --- a/src/misc/db/artifactlist.cpp +++ b/src/misc/db/artifactlist.cpp @@ -31,7 +31,7 @@ namespace swift::misc::db { if (artifact.matchesName(name, cs)) { return artifact; } } - return CArtifact(); + return {}; } CArtifactList CArtifactList::findByMatchingPlatform(const CPlatform &platform) const @@ -191,7 +191,7 @@ namespace swift::misc::db CArtifactList CArtifactList::fromDatabaseJson(const QString &json) { - if (json.isEmpty()) { return CArtifactList(); } + if (json.isEmpty()) { return {}; } return CArtifactList::fromDatabaseJson(json::jsonArrayFromString(json)); } } // namespace swift::misc::db diff --git a/src/misc/db/datastore.cpp b/src/misc/db/datastore.cpp index 045b2a5f8..c43359e77 100644 --- a/src/misc/db/datastore.cpp +++ b/src/misc/db/datastore.cpp @@ -72,8 +72,8 @@ namespace swift::misc::db QJsonValue IDatastoreObjectWithIntegerKey::getDbKeyAsJsonValue() const { - if (this->hasValidDbKey()) { return QJsonValue(m_dbKey); } - return QJsonValue(); + if (this->hasValidDbKey()) { return { m_dbKey }; } + return {}; } void IDatastoreObjectWithIntegerKey::setKeyVersionTimestampFromDatabaseJson(const QJsonObject &json, @@ -104,7 +104,7 @@ namespace swift::misc::db case IndexVersion: return QVariant::fromValue(this->getVersion()); default: break; } - return QVariant(); + return {}; } void IDatastoreObjectWithIntegerKey::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) @@ -153,7 +153,7 @@ namespace swift::misc::db QJsonValue IDatastoreObjectWithStringKey::getDbKeyAsJsonValue() const { - if (this->hasValidDbKey()) { return QJsonValue(m_dbKey); } + if (this->hasValidDbKey()) { return { m_dbKey }; } static const QJsonValue null; return null; } @@ -204,7 +204,7 @@ namespace swift::misc::db case IndexVersion: return QVariant::fromValue(this->getVersion()); default: break; } - return QVariant(); + return {}; } void IDatastoreObjectWithStringKey::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) diff --git a/src/misc/db/datastoreobjectlist.h b/src/misc/db/datastoreobjectlist.h index a711349dc..3091be82f 100644 --- a/src/misc/db/datastoreobjectlist.h +++ b/src/misc/db/datastoreobjectlist.h @@ -211,7 +211,7 @@ namespace swift::misc::db { CONTAINER objs(this->container()); objs.removeObjectsWithoutDbKey(); - if (objs.isEmpty()) { return QDateTime(); } + if (objs.isEmpty()) { return {}; } return objs.latestTimestamp(); } @@ -220,7 +220,7 @@ namespace swift::misc::db { CONTAINER objs(this->container()); objs.removeObjectsWithoutDbKey(); - if (objs.isEmpty()) { return QDateTime(); } + if (objs.isEmpty()) { return {}; } return objs.oldestDbTimestamp(); } diff --git a/src/misc/db/datastoreutility.cpp b/src/misc/db/datastoreutility.cpp index 9595a0f9c..4badd2943 100644 --- a/src/misc/db/datastoreutility.cpp +++ b/src/misc/db/datastoreutility.cpp @@ -64,7 +64,7 @@ namespace swift::misc::db QDateTime CDatastoreUtility::parseTimestamp(const QString ×tamp) { - if (timestamp.isEmpty()) { return QDateTime(); } + if (timestamp.isEmpty()) { return {}; } return parseDateTimeStringOptimized(removeDateTimeSeparators(timestamp)); } diff --git a/src/misc/db/dbinfo.cpp b/src/misc/db/dbinfo.cpp index 56d8c489b..5a7a8a105 100644 --- a/src/misc/db/dbinfo.cpp +++ b/src/misc/db/dbinfo.cpp @@ -122,7 +122,7 @@ namespace swift::misc::db if (!existsKey(json, prefix)) { // when using relationship, this can be null - return CDbInfo(); + return {}; } const int id(json.value(prefix % u"id").toInt()); const int entries(json.value(prefix % u"entries").toInt()); diff --git a/src/misc/db/dbinfolist.cpp b/src/misc/db/dbinfolist.cpp index e9ff6c6d4..2d3ca92fb 100644 --- a/src/misc/db/dbinfolist.cpp +++ b/src/misc/db/dbinfolist.cpp @@ -17,7 +17,7 @@ namespace swift::misc::db { if (info.matchesEntity(entity)) { return info; } } - return CDbInfo(); + return {}; } CDbInfoList CDbInfoList::fromDatabaseJson(const QJsonArray &array) diff --git a/src/misc/db/distributionlist.cpp b/src/misc/db/distributionlist.cpp index cad706464..17f6889df 100644 --- a/src/misc/db/distributionlist.cpp +++ b/src/misc/db/distributionlist.cpp @@ -83,7 +83,7 @@ namespace swift::misc::db CDistributionList CDistributionList::fromDatabaseJson(const QString &json) { - if (json.isEmpty()) { return CDistributionList(); } + if (json.isEmpty()) { return {}; } return CDistributionList::fromDatabaseJson(json::jsonArrayFromString(json)); } } // namespace swift::misc::db diff --git a/src/misc/db/updateinfo.cpp b/src/misc/db/updateinfo.cpp index ef31cbece..0735a6331 100644 --- a/src/misc/db/updateinfo.cpp +++ b/src/misc/db/updateinfo.cpp @@ -62,9 +62,9 @@ namespace swift::misc::db CDistribution CUpdateInfo::anticipateOwnDistribution() const { - if (this->isEmpty()) { return CDistribution(); } + if (this->isEmpty()) { return {}; } const CArtifactList ownArtifacts = this->getArtifactsPilotClientForCurrentPlatform(); - if (ownArtifacts.isEmpty()) { return CDistribution(); } + if (ownArtifacts.isEmpty()) { return {}; } const QVersionNumber myVersion = CBuildConfig::getVersion(); const QVersionNumber latestVersion = ownArtifacts.getLatestQVersion(); @@ -136,12 +136,12 @@ namespace swift::misc::db const CArtifactList artifacts = CArtifactList::fromDatabaseJson(jsonArtifacts); Q_ASSERT_X(jsonDistributions.size() == distributions.size(), Q_FUNC_INFO, "size mismatch"); Q_ASSERT_X(artifacts.size() == artifacts.size(), Q_FUNC_INFO, "size mismatch"); - return CUpdateInfo(artifacts, distributions); + return { artifacts, distributions }; } CUpdateInfo CUpdateInfo::fromDatabaseJson(const QString &jsonString) { - if (jsonString.isEmpty()) { return CUpdateInfo(); } + if (jsonString.isEmpty()) { return {}; } return CUpdateInfo::fromDatabaseJson(json::jsonObjectFromString(jsonString)); } diff --git a/src/misc/dbusserver.cpp b/src/misc/dbusserver.cpp index ea2cd3b37..232d0df96 100644 --- a/src/misc/dbusserver.cpp +++ b/src/misc/dbusserver.cpp @@ -188,7 +188,7 @@ namespace swift::misc { const QMetaClassInfo ci = mo->classInfo(i); const QString name = QString(ci.name()).toLower(); - if (name == "d-bus interface") { return QString(ci.value()); } + if (name == "d-bus interface") { return { ci.value() }; } } return {}; } diff --git a/src/misc/directoryutils.cpp b/src/misc/directoryutils.cpp index 21363d462..f6fe8388f 100644 --- a/src/misc/directoryutils.cpp +++ b/src/misc/directoryutils.cpp @@ -44,7 +44,7 @@ namespace swift::misc QStringList CDirectoryUtils::getRelativeSubDirectories(const QString &rootDir) { const QDir dir(rootDir); - if (!dir.exists()) { return QStringList(); } + if (!dir.exists()) { return {}; } return dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); } diff --git a/src/misc/fileutils.cpp b/src/misc/fileutils.cpp index 32274c2ae..3de0074bf 100644 --- a/src/misc/fileutils.cpp +++ b/src/misc/fileutils.cpp @@ -301,7 +301,7 @@ namespace swift::misc const QStringList &excludeDirectories, std::function predicate) { - if (isExcludedDirectory(dir, excludeDirectories)) { return QString(); } + if (isExcludedDirectory(dir, excludeDirectories)) { return {}; } const QFileInfoList result = dir.entryInfoList(nameFilters, QDir::Files); if (predicate) { @@ -349,7 +349,7 @@ namespace swift::misc const QStringList &excludeDirectories, std::function predicate) { - if (isExcludedDirectory(dir, excludeDirectories)) { return QFileInfoList(); } + if (isExcludedDirectory(dir, excludeDirectories)) { return {}; } QFileInfoList result = dir.entryInfoList(nameFilters, QDir::Files); if (predicate) { diff --git a/src/misc/geo/coordinategeodetic.cpp b/src/misc/geo/coordinategeodetic.cpp index e9d5ce263..1b904dfdf 100644 --- a/src/misc/geo/coordinategeodetic.cpp +++ b/src/misc/geo/coordinategeodetic.cpp @@ -29,7 +29,7 @@ namespace swift::misc::geo { const CLatitude lat = CLatitude::fromWgs84(latitudeWgs84); const CLongitude lon = CLongitude::fromWgs84(longitudeWgs84); - return CCoordinateGeodetic(lat, lon, geodeticHeight); + return { lat, lon, geodeticHeight }; } const CCoordinateGeodetic &CCoordinateGeodetic::null() @@ -141,10 +141,10 @@ namespace swift::misc::geo { case IndexLatitude: return this->latitude().propertyByIndex(index.copyFrontRemoved()); case IndexLongitude: return this->longitude().propertyByIndex(index.copyFrontRemoved()); - case IndexLatitudeAsString: return QVariant(this->latitudeAsString()); - case IndexLongitudeAsString: return QVariant(this->longitudeAsString()); + case IndexLatitudeAsString: return { this->latitudeAsString() }; + case IndexLongitudeAsString: return { this->longitudeAsString() }; case IndexGeodeticHeight: return this->geodeticHeight().propertyByIndex(index.copyFrontRemoved()); - case IndexGeodeticHeightAsString: return QVariant(this->geodeticHeightAsString()); + case IndexGeodeticHeightAsString: return { this->geodeticHeightAsString() }; case IndexNormalVector: return QVariant::fromValue(this->normalVector()); default: break; } diff --git a/src/misc/geo/coordinategeodeticlist.cpp b/src/misc/geo/coordinategeodeticlist.cpp index 81e3bbdd0..16cd2cfcf 100644 --- a/src/misc/geo/coordinategeodeticlist.cpp +++ b/src/misc/geo/coordinategeodeticlist.cpp @@ -41,7 +41,7 @@ namespace swift::misc::geo const double MaxDevFt = maxDeviation.value(CLengthUnit::ft()); const QPair elvStdDevMean = CMathUtils::standardDeviationAndMean(valuesInFt); if (elvStdDevMean.first > MaxDevFt) { return CElevationPlane::null(); } - return CElevationPlane(reference, elvStdDevMean.second, CElevationPlane::singlePointRadius()); + return { reference, elvStdDevMean.second, CElevationPlane::singlePointRadius() }; } } // namespace swift::misc::geo diff --git a/src/misc/icon.cpp b/src/misc/icon.cpp index df8ffb810..f3e7e3a4c 100644 --- a/src/misc/icon.cpp +++ b/src/misc/icon.cpp @@ -42,7 +42,7 @@ namespace swift::misc else { return CIcons::pixmapByIndex(this->getIndex()); } } - QIcon CIcon::toQIcon() const { return QIcon(toPixmap()); } + QIcon CIcon::toQIcon() const { return { toPixmap() }; } QString CIcon::convertToQString(bool i18n) const { diff --git a/src/misc/icons.cpp b/src/misc/icons.cpp index fb75f9396..a0a24dfb1 100644 --- a/src/misc/icons.cpp +++ b/src/misc/icons.cpp @@ -1134,7 +1134,7 @@ namespace swift::misc { QImage imgSource(icon.pixmap(targetsize).toImage()); QImage destBackgroundImg(changeImageBackgroundColor(imgSource, backgroundColor)); - return QIcon(QPixmap::fromImage(destBackgroundImg)); + return { QPixmap::fromImage(destBackgroundImg) }; } } // namespace swift::misc diff --git a/src/misc/imageutils.cpp b/src/misc/imageutils.cpp index 09a70cbac..82979746a 100644 --- a/src/misc/imageutils.cpp +++ b/src/misc/imageutils.cpp @@ -17,7 +17,7 @@ bool swift::misc::pixmapToPngByteArray(const QPixmap &pixmap, QByteArray &array) QPixmap swift::misc::pngByteArrayToPixmap(const QByteArray &array) { - if (array.isEmpty()) { return QPixmap(); } + if (array.isEmpty()) { return {}; } QPixmap p; bool s = p.loadFromData(array, "PNG"); return s ? p : QPixmap(); @@ -34,13 +34,13 @@ QString swift::misc::pixmapToPngHexString(const QPixmap &pixmap) { QByteArray ba; bool s = pixmapToPngByteArray(pixmap, ba); - if (!s) { return QString(); } + if (!s) { return {}; } return ba.toHex(); } QPixmap swift::misc::pngHexStringToPixmap(const QString &hexString) { - if (hexString.isEmpty()) { return QPixmap(); } + if (hexString.isEmpty()) { return {}; } QByteArray ba(QByteArray::fromHex(hexString.toLatin1())); return pngByteArrayToPixmap(ba); } @@ -54,7 +54,7 @@ bool swift::misc::pngHexStringToPixmapRef(const QString &hexString, QPixmap &pix QPixmap swift::misc::iconToPixmap(const QIcon &icon) { - if (icon.isNull()) { return QPixmap(); } + if (icon.isNull()) { return {}; } const QList sizes = icon.availableSizes(); if (!sizes.isEmpty()) { return icon.pixmap(sizes.first()); } return icon.pixmap(16, 16); diff --git a/src/misc/input/keyboardkey.cpp b/src/misc/input/keyboardkey.cpp index ea342da9b..11ca279fc 100644 --- a/src/misc/input/keyboardkey.cpp +++ b/src/misc/input/keyboardkey.cpp @@ -24,7 +24,7 @@ namespace swift::misc::input QString CKeyboardKey::getKeyAsString() const { - if (m_keyCode == Key_Unknown) return QString(); + if (m_keyCode == Key_Unknown) return {}; static const QHash keyStrings = { { Key_ShiftLeft, QStringLiteral("ShiftLeft") }, { Key_ShiftRight, QStringLiteral("ShiftRight") }, diff --git a/src/misc/json.cpp b/src/misc/json.cpp index 2377dffbc..023c23217 100644 --- a/src/misc/json.cpp +++ b/src/misc/json.cpp @@ -412,7 +412,7 @@ namespace swift::misc::json { QJsonObject jsonObjectFromString(const QString &json, bool acceptCacheFormat) { - if (json.isEmpty()) { return QJsonObject(); } + if (json.isEmpty()) { return {}; } QJsonParseError error {}; const QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toUtf8(), &error)); @@ -430,7 +430,7 @@ namespace swift::misc::json QJsonArray jsonArrayFromString(const QString &json) { - if (json.isEmpty()) { return QJsonArray(); } + if (json.isEmpty()) { return {}; } const QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toUtf8())); return jsonDoc.array(); } diff --git a/src/misc/math/mathutils.cpp b/src/misc/math/mathutils.cpp index b576dcb7a..823ae395e 100644 --- a/src/misc/math/mathutils.cpp +++ b/src/misc/math/mathutils.cpp @@ -155,6 +155,6 @@ namespace swift::misc::math const double meanValue = mean(values); const double varianceValue = mean(squaredDifferences(values, meanValue)); const double sd = sqrt(varianceValue); - return QPair(sd, meanValue); + return { sd, meanValue }; } } // namespace swift::misc::math diff --git a/src/misc/namevariantpair.cpp b/src/misc/namevariantpair.cpp index bc0bf6c46..f8f209f71 100644 --- a/src/misc/namevariantpair.cpp +++ b/src/misc/namevariantpair.cpp @@ -30,8 +30,8 @@ namespace swift::misc const auto i = index.frontCasted(); switch (i) { - case IndexName: return QVariant(this->m_name); - case IndexVariant: return this->m_variant; + case IndexName: return { this->m_name }; + case IndexVariant: return this->m_variant; // NOLINT(modernize-return-braced-init-list) default: return CValueObject::propertyByIndex(index); } } diff --git a/src/misc/namevariantpairlist.cpp b/src/misc/namevariantpairlist.cpp index bda704f4c..d964afe74 100644 --- a/src/misc/namevariantpairlist.cpp +++ b/src/misc/namevariantpairlist.cpp @@ -20,7 +20,7 @@ namespace swift::misc QStringList CNameVariantPairList::getNames(bool sorted) const { - if (this->isEmpty()) { return QStringList(); } + if (this->isEmpty()) { return {}; } QStringList codes = this->transform(predicates::MemberTransform(&CNameVariantPair::getName)); if (sorted) { codes.sort(); } return codes; @@ -28,21 +28,21 @@ namespace swift::misc CNameVariantPair CNameVariantPairList::getValue(const QString &name) const { - if (name.isEmpty()) { return CNameVariantPair(); } + if (name.isEmpty()) { return {}; } return this->findBy(&CNameVariantPair::getName, name).frontOrDefault(); } CVariant CNameVariantPairList::getVariantValue(const QString &name) const { - if (name.isEmpty()) { return CVariant(); } + if (name.isEmpty()) { return {}; } return getValue(name).getVariant(); } QString CNameVariantPairList::getValueAsString(const QString &name) const { - if (name.isEmpty()) { return QString(); } + if (name.isEmpty()) { return {}; } const CVariant cs(getValue(name).getVariant()); - if (cs.isNull() || !cs.canConvert()) { return QString(); } + if (cs.isNull() || !cs.canConvert()) { return {}; } return cs.value(); } diff --git a/src/misc/network/client.cpp b/src/misc/network/client.cpp index 2463cdda3..8ce7a41e9 100644 --- a/src/misc/network/client.cpp +++ b/src/misc/network/client.cpp @@ -89,15 +89,15 @@ namespace swift::misc::network switch (i) { case IndexCapabilities: return QVariant::fromValue(m_capabilities); - case IndexCapabilitiesString: return QVariant(this->getCapabilitiesAsString()); + case IndexCapabilitiesString: return { this->getCapabilitiesAsString() }; case IndexCallsign: return this->getCallsign().propertyByIndex(index.copyFrontRemoved()); case IndexUser: return this->getUser().propertyByIndex(index.copyFrontRemoved()); - case IndexModelString: return QVariant(m_modelString); - case IndexServer: return QVariant(m_server); + case IndexModelString: return { m_modelString }; + case IndexServer: return { m_server }; case IndexVoiceCapabilities: return m_voiceCapabilities.propertyByIndex(index.copyFrontRemoved()); case IndexVoiceCapabilitiesPixmap: return QVariant::fromValue(CIcon(m_voiceCapabilities.toIcon()).toPixmap()); case IndexVoiceCapabilitiesIcon: return QVariant::fromValue(CIcon(m_voiceCapabilities.toIcon())); - case IndexVoiceCapabilitiesString: return QVariant(m_voiceCapabilities.toQString(true)); + case IndexVoiceCapabilitiesString: return { m_voiceCapabilities.toQString(true) }; default: break; } return CValueObject::propertyByIndex(index); diff --git a/src/misc/network/clientprovider.cpp b/src/misc/network/clientprovider.cpp index d937a481d..37d57a783 100644 --- a/src/misc/network/clientprovider.cpp +++ b/src/misc/network/clientprovider.cpp @@ -17,7 +17,7 @@ namespace swift::misc::network QReadLocker l(&m_lockClient); clients = m_clients.values(); } - return CClientList(clients); + return { clients }; } void CClientProvider::setClients(const CClientList &clients) @@ -46,7 +46,7 @@ namespace swift::misc::network QReadLocker l(&m_lockClient); if (m_clients.contains(callsign)) { return m_clients.value(callsign); } } - return CClient(); + return {}; } bool CClientProvider::setOtherClient(const CClient &client) @@ -152,13 +152,13 @@ namespace swift::misc::network CClientList CClientAware::getClients() const { if (this->provider()) { return this->provider()->getClients(); } - return CClientList(); + return {}; } CClient CClientAware::getClientOrDefaultForCallsign(const aviation::CCallsign &callsign) const { if (this->provider()) { return this->provider()->getClientOrDefaultForCallsign(callsign); } - return CClient(); + return {}; } bool CClientAware::hasClientInfo(const CCallsign &callsign) const diff --git a/src/misc/network/networkutils.cpp b/src/misc/network/networkutils.cpp index e78b7ce80..697652521 100644 --- a/src/misc/network/networkutils.cpp +++ b/src/misc/network/networkutils.cpp @@ -205,7 +205,7 @@ namespace swift::misc::network { return lastModifiedQv.value(); } - return QDateTime(); + return {}; } qint64 CNetworkUtils::lastModifiedSinceNow(const QNetworkReply *nwReply) @@ -246,9 +246,9 @@ namespace swift::misc::network QUrl CNetworkUtils::getHttpRedirectUrl(QNetworkReply *nwReply) { - if (!nwReply) { return QUrl(); } + if (!nwReply) { return {}; } const QVariant possibleRedirectUrl = nwReply->attribute(QNetworkRequest::RedirectionTargetAttribute); - if (!possibleRedirectUrl.isValid()) { return QUrl(); } + if (!possibleRedirectUrl.isValid()) { return {}; } QUrl redirectUrl = possibleRedirectUrl.toUrl(); if (redirectUrl.isRelative()) { redirectUrl = nwReply->url().resolved(redirectUrl); } return redirectUrl; diff --git a/src/misc/network/remotefilelist.cpp b/src/misc/network/remotefilelist.cpp index f8b8753ff..aa07de096 100644 --- a/src/misc/network/remotefilelist.cpp +++ b/src/misc/network/remotefilelist.cpp @@ -32,28 +32,28 @@ namespace swift::misc::network CRemoteFile CRemoteFileList::findFirstByNameOrDefault(const QString &name) const { - if (name.isEmpty()) { return CRemoteFile(); } + if (name.isEmpty()) { return {}; } return this->findFirstByOrDefault(&CRemoteFile::getName, name); } CRemoteFile CRemoteFileList::findFirstContainingNameOrDefault(const QString &name, Qt::CaseSensitivity cs) const { - if (name.isEmpty()) { return CRemoteFile(); } + if (name.isEmpty()) { return {}; } for (const CRemoteFile &rf : *this) { if (rf.getName().contains(name, cs)) { return rf; } } - return CRemoteFile(); + return {}; } CRemoteFile CRemoteFileList::findFirstByMatchingBaseNameOrDefault(const QString &baseName) const { - if (baseName.isEmpty()) { return CRemoteFile(); } + if (baseName.isEmpty()) { return {}; } for (const CRemoteFile &rf : *this) { if (rf.matchesBaseName(baseName)) { return rf; } } - return CRemoteFile(); + return {}; } CRemoteFileList CRemoteFileList::findExecutableFiles() const @@ -87,7 +87,7 @@ namespace swift::misc::network CRemoteFileList CRemoteFileList::fromDatabaseJson(const QString &json) { - if (json.isEmpty()) { return CRemoteFileList(); } + if (json.isEmpty()) { return {}; } return CRemoteFileList::fromDatabaseJson(json::jsonArrayFromString(json)); } } // namespace swift::misc::network diff --git a/src/misc/network/url.cpp b/src/misc/network/url.cpp index 7e209e653..bd15bc04f 100644 --- a/src/misc/network/url.cpp +++ b/src/misc/network/url.cpp @@ -98,7 +98,7 @@ namespace swift::misc::network QString CUrl::getFileName() const { return toQUrl().fileName(); } - QUrl CUrl::toQUrl() const { return QUrl(getFullUrl()); } + QUrl CUrl::toQUrl() const { return { getFullUrl() }; } void CUrl::setQUrl(const QUrl &url) { diff --git a/src/misc/network/urlloglist.cpp b/src/misc/network/urlloglist.cpp index 17cb9bb2c..d1251f0bb 100644 --- a/src/misc/network/urlloglist.cpp +++ b/src/misc/network/urlloglist.cpp @@ -28,7 +28,7 @@ namespace swift::misc::network CUrlLogList CUrlLogList::findOutdatedPending(int outdatedOffsetMs) const { - if (this->isEmpty()) { return CUrlLogList(); } + if (this->isEmpty()) { return {}; } return this->findPending().findBeforeNowMinusOffset(outdatedOffsetMs); } diff --git a/src/misc/network/user.cpp b/src/misc/network/user.cpp index 041abb9c6..d8158d41c 100644 --- a/src/misc/network/user.cpp +++ b/src/misc/network/user.cpp @@ -244,12 +244,12 @@ namespace swift::misc::network const auto i = index.frontCasted(); switch (i) { - case IndexEmail: return QVariant(m_email); - case IndexId: return QVariant(m_id); - case IndexId7Digit: return QVariant(this->get7DigitId()); + case IndexEmail: return { m_email }; + case IndexId: return { m_id }; + case IndexId7Digit: return { this->get7DigitId() }; case IndexIdInteger: return QVariant::fromValue(this->getIntegerId()); - case IndexPassword: return QVariant(m_password); - case IndexRealName: return QVariant(m_realname); + case IndexPassword: return { m_password }; + case IndexRealName: return { m_realname }; case IndexHomebase: return m_homebase.propertyByIndex(index.copyFrontRemoved()); case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved()); default: return CValueObject::propertyByIndex(index); diff --git a/src/misc/network/voicecapabilities.cpp b/src/misc/network/voicecapabilities.cpp index 7c26e7f5c..8708d1c50 100644 --- a/src/misc/network/voicecapabilities.cpp +++ b/src/misc/network/voicecapabilities.cpp @@ -132,10 +132,7 @@ namespace swift::misc::network return u; // normally never reached } - CVoiceCapabilities CVoiceCapabilities::fromFlightPlanRemarks(const QString &remarks) - { - return CVoiceCapabilities(remarks); - } + CVoiceCapabilities CVoiceCapabilities::fromFlightPlanRemarks(const QString &remarks) { return { remarks }; } CVoiceCapabilities CVoiceCapabilities::fromText(const QString &text) { @@ -144,11 +141,11 @@ namespace swift::misc::network const CVoiceCapabilities vc(text); return vc; } - if (text.contains("TEXT", Qt::CaseInsensitive)) { return CVoiceCapabilities(TextOnly); } - if (text.contains("ONLY", Qt::CaseInsensitive)) { return CVoiceCapabilities(TextOnly); } - if (text.contains("RECEIVE", Qt::CaseInsensitive)) { return CVoiceCapabilities(VoiceReceivingOnly); } - if (text.contains("VOICE", Qt::CaseInsensitive)) { return CVoiceCapabilities(Voice); } - return CVoiceCapabilities(Unknown); + if (text.contains("TEXT", Qt::CaseInsensitive)) { return { TextOnly }; } + if (text.contains("ONLY", Qt::CaseInsensitive)) { return { TextOnly }; } + if (text.contains("RECEIVE", Qt::CaseInsensitive)) { return { VoiceReceivingOnly }; } + if (text.contains("VOICE", Qt::CaseInsensitive)) { return { Voice }; } + return { Unknown }; } const QList &CVoiceCapabilities::allCapabilities() diff --git a/src/misc/obfuscation.cpp b/src/misc/obfuscation.cpp index 0d025b9a2..2a2d36b21 100644 --- a/src/misc/obfuscation.cpp +++ b/src/misc/obfuscation.cpp @@ -12,7 +12,7 @@ namespace swift::misc QString CObfuscation::decode(const QString &inString, bool trimmed) { if (!inString.startsWith(prefix())) { return trimmed ? inString.trimmed() : inString; } - if (inString.length() == prefix().length()) { return QString(); } + if (inString.length() == prefix().length()) { return {}; } SimpleCrypt simpleCrypt(Key); const QString decoded = simpleCrypt.decryptToString(inString.mid(prefix().length())); return trimmed ? decoded.trimmed() : decoded; diff --git a/src/misc/propertyindex.cpp b/src/misc/propertyindex.cpp index 06b20c060..27f969dc3 100644 --- a/src/misc/propertyindex.cpp +++ b/src/misc/propertyindex.cpp @@ -26,7 +26,7 @@ namespace swift::misc CPropertyIndex CPropertyIndex::copyFrontRemoved() const { SWIFT_VERIFY_X(!this->isEmpty(), Q_FUNC_INFO, "Empty index"); - if (this->isEmpty()) { return CPropertyIndex(); } + if (this->isEmpty()) { return {}; } CPropertyIndex copy = *this; copy.m_indexes.pop_front(); return copy; diff --git a/src/misc/propertyindexlist.cpp b/src/misc/propertyindexlist.cpp index e6d385064..4ae3e13dd 100644 --- a/src/misc/propertyindexlist.cpp +++ b/src/misc/propertyindexlist.cpp @@ -11,7 +11,7 @@ namespace swift::misc CPropertyIndexList CPropertyIndexList::copyFrontRemoved() const { - if (this->size() < 2) { return CPropertyIndexList(); } + if (this->size() < 2) { return {}; } CPropertyIndexList copy(*this); copy.pop_front(); return copy; diff --git a/src/misc/rgbcolor.cpp b/src/misc/rgbcolor.cpp index 603eb0b49..e2a269e02 100644 --- a/src/misc/rgbcolor.cpp +++ b/src/misc/rgbcolor.cpp @@ -49,7 +49,7 @@ namespace swift::misc } } - QColor CRgbColor::toQColor() const { return QColor(red(), green(), blue()); } + QColor CRgbColor::toQColor() const { return { red(), green(), blue() }; } bool CRgbColor::setQColor(const QColor &color) { diff --git a/src/misc/simulation/aircraftmodel.cpp b/src/misc/simulation/aircraftmodel.cpp index b0063ed9a..eb23812d4 100644 --- a/src/misc/simulation/aircraftmodel.cpp +++ b/src/misc/simulation/aircraftmodel.cpp @@ -251,23 +251,23 @@ namespace swift::misc::simulation const auto i = index.frontCasted(); switch (i) { - case IndexModelString: return QVariant(m_modelString); - case IndexModelStringAlias: return QVariant(m_modelStringAlias); + case IndexModelString: return { m_modelString }; + case IndexModelStringAlias: return { m_modelStringAlias }; case IndexAllModelStrings: return this->getAllModelStringsAndAliases(); case IndexHasQueriedModelString: return QVariant::fromValue(this->hasQueriedModelString()); case IndexModelType: return QVariant::fromValue(m_modelType); - case IndexModelTypeAsString: return QVariant(this->getModelTypeAsString()); + case IndexModelTypeAsString: return { this->getModelTypeAsString() }; case IndexModelMode: return QVariant::fromValue(m_modelMode); case IndexModelModeAsString: return QVariant::fromValue(this->getModelModeAsString()); case IndexModelModeAsIcon: return QVariant::fromValue(this->getModelModeAsIcon()); case IndexDistributor: return m_distributor.propertyByIndex(index.copyFrontRemoved()); case IndexSimulatorInfo: return m_simulator.propertyByIndex(index.copyFrontRemoved()); - case IndexSimulatorInfoAsString: return QVariant(m_simulator.toQString()); - case IndexDescription: return QVariant(m_description); - case IndexName: return QVariant(m_name); - case IndexFileName: return QVariant(m_fileName); + case IndexSimulatorInfoAsString: return { m_simulator.toQString() }; + case IndexDescription: return { m_description }; + case IndexName: return { m_name }; + case IndexFileName: return { m_fileName }; case IndexCG: return m_cg.propertyByIndex(index.copyFrontRemoved()); - case IndexSupportedParts: return QVariant(m_supportedParts); + case IndexSupportedParts: return { m_supportedParts }; case IndexFileTimestamp: return QVariant::fromValue(this->getFileTimestamp()); case IndexFileTimestampFormattedYmdhms: return QVariant::fromValue(this->getFormattedFileTimestampYmdhms()); case IndexAircraftIcaoCode: return m_aircraftIcao.propertyByIndex(index.copyFrontRemoved()); @@ -568,7 +568,7 @@ namespace swift::misc::simulation QString CAircraftModel::getSwiftLiveryString(bool aircraftIcao, bool livery, bool model) const { - if (!aircraftIcao && !livery && !model) { return QString(); } + if (!aircraftIcao && !livery && !model) { return {}; } const QString l = (livery && this->getLivery().hasValidDbKey() ? u'l' % this->getLivery().getDbKeyAsString() : QString()) % (aircraftIcao && this->getAircraftIcaoCode().hasValidDbKey() ? @@ -587,7 +587,7 @@ namespace swift::misc::simulation DBTripleIds CAircraftModel::parseNetworkLiveryString(const QString &liveryString) { // "swift_m22l33a11" - if (!CAircraftModel::isSwiftLiveryString(liveryString)) { return DBTripleIds(); } + if (!CAircraftModel::isSwiftLiveryString(liveryString)) { return {}; } DBTripleIds ids; const QString ls = liveryString.mid(liveryStringPrefix().length()).toLower(); @@ -742,7 +742,7 @@ namespace swift::misc::simulation QDir CAircraftModel::getFileDirectory() const { - if (!this->hasFileName()) { return QDir(); } + if (!this->hasFileName()) { return {}; } const QFileInfo fi(CFileUtils::fixWindowsUncPath(this->getFileName())); return fi.absoluteDir(); } @@ -1095,7 +1095,7 @@ namespace swift::misc::simulation QString CAircraftModel::cleanUpPartsString(const QString &p) { - if (p.isEmpty()) { return QString(); } + if (p.isEmpty()) { return {}; } QString pc = removeChars(p.toUpper(), [](QChar c) { return !supportedParts().contains(c); }); std::sort(pc.begin(), pc.end()); return pc; diff --git a/src/misc/simulation/aircraftmodellist.cpp b/src/misc/simulation/aircraftmodellist.cpp index f5bab0eaf..93d0cc4af 100644 --- a/src/misc/simulation/aircraftmodellist.cpp +++ b/src/misc/simulation/aircraftmodellist.cpp @@ -104,7 +104,7 @@ namespace swift::misc::simulation CAircraftModel CAircraftModelList::findFirstByModelStringOrDefault(const QString &modelString, Qt::CaseSensitivity sensitivity) const { - if (modelString.isEmpty()) { return CAircraftModel(); } + if (modelString.isEmpty()) { return {}; } return this->findFirstByOrDefault( [&](const CAircraftModel &model) { return model.matchesModelString(modelString, sensitivity); }); } @@ -112,14 +112,14 @@ namespace swift::misc::simulation CAircraftModel CAircraftModelList::findFirstByModelStringAliasOrDefault(const QString &modelString, Qt::CaseSensitivity sensitivity) const { - if (modelString.isEmpty()) { return CAircraftModel(); } + if (modelString.isEmpty()) { return {}; } return this->findFirstByOrDefault( [&](const CAircraftModel &model) { return model.matchesModelStringOrAlias(modelString, sensitivity); }); } CAircraftModel CAircraftModelList::findFirstByCallsignOrDefault(const CCallsign &callsign) const { - if (callsign.isEmpty()) { return CAircraftModel(); } + if (callsign.isEmpty()) { return {}; } return this->findFirstByOrDefault([&](const CAircraftModel &model) { return model.getCallsign() == callsign; }); } @@ -156,7 +156,7 @@ namespace swift::misc::simulation CAircraftModelList::findByAircraftDesignatorAndLiveryCombinedCode(const QString &aircraftDesignator, const QString &combinedCode) const { - if (aircraftDesignator.isEmpty()) { return CAircraftModelList(); } + if (aircraftDesignator.isEmpty()) { return {}; } return this->findBy([&](const CAircraftModel &model) { if (!model.getAircraftIcaoCode().matchesDesignator(aircraftDesignator)) { return false; } return model.getLivery().matchesCombinedCode(combinedCode); @@ -207,7 +207,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findByLiveryCode(const CLivery &livery) const { - if (!livery.hasCombinedCode()) { return CAircraftModelList(); } + if (!livery.hasCombinedCode()) { return {}; } const QString code(livery.getCombinedCode()); return this->findBy([&](const CAircraftModel &model) { if (!model.getLivery().hasCombinedCode()) return false; @@ -232,7 +232,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findWithAircraftDesignator(const QSet &designators) const { - if (designators.isEmpty()) { return CAircraftModelList(); } + if (designators.isEmpty()) { return {}; } return this->findBy( [&](const CAircraftModel &model) { return designators.contains(model.getAircraftIcaoCodeDesignator()); }); } @@ -244,7 +244,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findByManufacturer(const QString &manufacturer) const { - if (manufacturer.isEmpty()) { return CAircraftModelList(); } + if (manufacturer.isEmpty()) { return {}; } const QString m(manufacturer.toUpper().trimmed()); return this->findBy( [&](const CAircraftModel &model) { return model.getAircraftIcaoCode().getManufacturer() == m; }); @@ -252,7 +252,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findByFamily(const QString &family) const { - if (family.isEmpty()) { return CAircraftModelList(); } + if (family.isEmpty()) { return {}; } const QString f(family.toUpper().trimmed()); return this->findBy([&](const CAircraftModel &model) { const CAircraftIcaoCode icao(model.getAircraftIcaoCode()); @@ -263,7 +263,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findByFamilyWithColorLivery(const QString &family) const { - if (family.isEmpty()) { return CAircraftModelList(); } + if (family.isEmpty()) { return {}; } const QString f(family.toUpper().trimmed()); return this->findBy([&](const CAircraftModel &model) { if (!model.getLivery().isColorLivery()) { return false; } @@ -297,7 +297,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findByCombinedType(const QString &combinedType) const { const QString cc(combinedType.trimmed().toUpper()); - if (combinedType.length() != 3) { return CAircraftModelList(); } + if (combinedType.length() != 3) { return {}; } return this->findBy([&](const CAircraftModel &model) { const CAircraftIcaoCode icao(model.getAircraftIcaoCode()); return icao.matchesCombinedType(cc); @@ -391,7 +391,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findByCategoryFirstLevel(int firstLevel) const { - if (firstLevel < 0) { return CAircraftModelList(); } + if (firstLevel < 0) { return {}; } return this->findBy([=](const CAircraftModel &model) { return (model.hasCategory() && model.getAircraftIcaoCode().getCategory().getFirstLevel() == firstLevel); }); @@ -399,7 +399,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findByCategory(const CAircraftCategory &category) const { - if (category.isNull()) { return CAircraftModelList(); } + if (category.isNull()) { return {}; } return this->findBy([=](const CAircraftModel &model) { return (model.hasCategory() && model.getAircraftIcaoCode().getCategory() == category); }); @@ -407,7 +407,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findByCategories(const CAircraftCategoryList &categories) const { - if (categories.isEmpty()) { return CAircraftModelList(); } + if (categories.isEmpty()) { return {}; } return this->findBy([=](const CAircraftModel &model) { return (model.hasCategory() && categories.contains(model.getAircraftIcaoCode().getCategory())); }); @@ -576,7 +576,7 @@ namespace swift::misc::simulation if (!icao.hasFamily()) continue; if (icao.matchesDesignator(aircraftIcaoCode.getDesignator())) { return icao.getFamily(); } } - return QString(); + return {}; } CAircraftModelList CAircraftModelList::matchesSimulator(const CSimulatorInfo &simulator) const @@ -629,7 +629,7 @@ namespace swift::misc::simulation CAircraftModelList CAircraftModelList::findByDistributors(const CDistributorList &distributors) const { - if (distributors.isEmpty()) { return CAircraftModelList(); } + if (distributors.isEmpty()) { return {}; } return this->findBy([&](const CAircraftModel &model) { return model.matchesAnyDbDistributor(distributors); }); } @@ -654,7 +654,7 @@ namespace swift::misc::simulation s |= model.getSimulator().getSimulator(); if (s == CSimulatorInfo::All) { break; } } - return CSimulatorInfo(s); + return { s }; } namespace private_ns @@ -925,10 +925,10 @@ namespace swift::misc::simulation CSimulatorInfo CAircraftModelList::simulatorsWithMaxEntries() const { - if (this->isEmpty()) { return CSimulatorInfo(); } // not known + if (this->isEmpty()) { return {}; } // not known const CCountPerSimulator counts(this->countPerSimulator()); const int simulatorsRepresented = counts.simulatorsRepresented(); - if (simulatorsRepresented < 1) { return CSimulatorInfo(); } + if (simulatorsRepresented < 1) { return {}; } const QMultiMap cps(counts.countPerSimulator()); CSimulatorInfo maxSim = cps.last(); const int count = cps.lastKey(); // how many elements @@ -1024,7 +1024,7 @@ namespace swift::misc::simulation CDistributorList CAircraftModelList::getDistributors(bool onlyDbDistributors) const { - if (this->isEmpty()) { return CDistributorList(); } + if (this->isEmpty()) { return {}; } CDistributorList distributors; for (const CAircraftModel &model : *this) { @@ -1038,7 +1038,7 @@ namespace swift::misc::simulation CAircraftIcaoCodeList CAircraftModelList::getAircraftIcaoCodesFromDb() const { - if (this->isEmpty()) { return CAircraftIcaoCodeList(); } + if (this->isEmpty()) { return {}; } QSet keys; CAircraftIcaoCodeList icaos; for (const CAircraftModel &model : *this) @@ -1091,7 +1091,7 @@ namespace swift::misc::simulation CAirlineIcaoCodeList CAircraftModelList::getAirlineIcaoCodesFromDb() const { - if (this->isEmpty()) { return CAirlineIcaoCodeList(); } + if (this->isEmpty()) { return {}; } QSet keys; CAirlineIcaoCodeList icaos; for (const CAircraftModel &model : *this) @@ -1299,7 +1299,7 @@ namespace swift::misc::simulation CStatusMessageList CAircraftModelList::validateForPublishing(CAircraftModelList &validModels, CAircraftModelList &invalidModels) const { - if (this->isEmpty()) { return CStatusMessageList(); } + if (this->isEmpty()) { return {}; } CStatusMessageList msgs; for (const CAircraftModel &model : *this) { diff --git a/src/misc/simulation/data/modelcaches.cpp b/src/misc/simulation/data/modelcaches.cpp index 96946fe4f..a33bd6c2d 100644 --- a/src/misc/simulation/data/modelcaches.cpp +++ b/src/misc/simulation/data/modelcaches.cpp @@ -215,7 +215,7 @@ namespace swift::misc::simulation::data case CSimulatorInfo::FG: return m_modelCacheFG.get(); case CSimulatorInfo::MSFS: return m_modelCacheMsfs.get(); case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.get(); - default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return CAircraftModelList(); + default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return {}; } } @@ -235,7 +235,7 @@ namespace swift::misc::simulation::data case CSimulatorInfo::FG: msg = m_modelCacheFG.set(setModels); break; case CSimulatorInfo::MSFS: msg = m_modelCacheMsfs.set(setModels); break; case CSimulatorInfo::MSFS2024: msg = m_modelCacheMsfs2024.set(setModels); break; - default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return CStatusMessage(); + default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return {}; } this->emitCacheChanged(simulator); // set return msg; @@ -292,7 +292,7 @@ namespace swift::misc::simulation::data case CSimulatorInfo::FG: return m_modelCacheFG.getAvailableTimestamp(); case CSimulatorInfo::MSFS: return m_modelCacheMsfs.getAvailableTimestamp(); case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.getAvailableTimestamp(); - default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return QDateTime(); + default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return {}; } } @@ -315,7 +315,7 @@ namespace swift::misc::simulation::data return m_modelCacheMsfs2024.set(m_modelCacheMsfs2024.get(), ts.toMSecsSinceEpoch()); default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break; } - return CStatusMessage(); + return {}; } void CModelCaches::synchronizeCache(const CSimulatorInfo &simulator) { this->synchronizeCacheImpl(simulator); } @@ -432,7 +432,7 @@ namespace swift::misc::simulation::data case CSimulatorInfo::FG: return m_modelCacheFG.get(); case CSimulatorInfo::MSFS: return m_modelCacheMsfs.get(); case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.get(); - default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return CAircraftModelList(); + default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return {}; } } @@ -463,7 +463,7 @@ namespace swift::misc::simulation::data case CSimulatorInfo::FG: msg = m_modelCacheFG.set(orderedModels); break; case CSimulatorInfo::MSFS: msg = m_modelCacheMsfs.set(orderedModels); break; case CSimulatorInfo::MSFS2024: msg = m_modelCacheMsfs2024.set(orderedModels); break; - default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return CStatusMessage(); + default: Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator"); return {}; } this->emitCacheChanged(simulator); // set return msg; @@ -481,7 +481,7 @@ namespace swift::misc::simulation::data case CSimulatorInfo::FG: return m_modelCacheFG.getAvailableTimestamp(); case CSimulatorInfo::MSFS: return m_modelCacheMsfs.getAvailableTimestamp(); case CSimulatorInfo::MSFS2024: return m_modelCacheMsfs2024.getAvailableTimestamp(); - default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); return QDateTime(); + default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); return {}; } } @@ -504,7 +504,7 @@ namespace swift::misc::simulation::data return m_modelCacheMsfs2024.set(m_modelCacheMsfs2024.get(), ts.toMSecsSinceEpoch()); default: Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator"); break; } - return CStatusMessage(); + return {}; } void CModelSetCaches::synchronizeCache(const CSimulatorInfo &simulator) { this->synchronizeCacheImpl(simulator); } diff --git a/src/misc/simulation/distributor.cpp b/src/misc/simulation/distributor.cpp index 466fd271a..96821623c 100644 --- a/src/misc/simulation/distributor.cpp +++ b/src/misc/simulation/distributor.cpp @@ -173,7 +173,7 @@ namespace swift::misc::simulation if (!existsKey(json, prefix)) { // when using relationship, this can be null - return CDistributor(); + return {}; } const QString description(json.value(prefix % u"description").toString()); diff --git a/src/misc/simulation/distributorlist.cpp b/src/misc/simulation/distributorlist.cpp index 4753ce4d2..031ba01fd 100644 --- a/src/misc/simulation/distributorlist.cpp +++ b/src/misc/simulation/distributorlist.cpp @@ -16,12 +16,12 @@ namespace swift::misc::simulation CDistributor CDistributorList::findByKeyOrAlias(const QString &keyOrAlias) const { - if (keyOrAlias.isEmpty()) { return CDistributor(); } + if (keyOrAlias.isEmpty()) { return {}; } for (const CDistributor &distributor : (*this)) { if (distributor.matchesKeyOrAlias(keyOrAlias)) { return distributor; } } - return CDistributor(); + return {}; } CDistributor CDistributorList::findByModelData(const CAircraftModel &model) const @@ -37,7 +37,7 @@ namespace swift::misc::simulation return this->findByKeyOrAlias("PAI"); } - return CDistributor(); + return {}; } CDistributorList CDistributorList::findFsFamilyStandard() const @@ -58,7 +58,7 @@ namespace swift::misc::simulation // more lenient search return this->findByKeyOrAlias(key); } - return CDistributor(); + return {}; } CDistributor CDistributorList::smartDistributorSelector(const CDistributor &distributorPattern, @@ -81,7 +81,7 @@ namespace swift::misc::simulation QStringList CDistributorList::getDbKeysAndAliases(bool sort) const { - if (this->isEmpty()) { return QStringList(); } + if (this->isEmpty()) { return {}; } QStringList sl; for (const CDistributor &d : *this) { @@ -96,7 +96,7 @@ namespace swift::misc::simulation CDistributorList CDistributorList::matchesSimulator(const CSimulatorInfo &simulator) const { - if (this->isEmpty()) { return CDistributorList(); } + if (this->isEmpty()) { return {}; } CDistributorList distributors; for (const CDistributor &distributor : (*this)) { diff --git a/src/misc/simulation/fscommon/aircraftcfgparser.cpp b/src/misc/simulation/fscommon/aircraftcfgparser.cpp index f9bf5448c..3a7c23ad1 100644 --- a/src/misc/simulation/fscommon/aircraftcfgparser.cpp +++ b/src/misc/simulation/fscommon/aircraftcfgparser.cpp @@ -140,14 +140,14 @@ namespace swift::misc::simulation::fscommon // function has to be threadsafe // - if (m_cancelLoading) { return CAircraftCfgEntriesList(); } + if (m_cancelLoading) { return {}; } // excluded? if (CFileUtils::isExcludedDirectory(directory, excludeDirectories) || isExcludedSubDirectory(directory)) { const CStatusMessage m = CStatusMessage(this).info(u"Skipping directory '%1' (excluded)") << directory; messages.push_back(m); - return CAircraftCfgEntriesList(); + return {}; } // set directory with name filters, get aircraft.cfg and sub directories @@ -160,7 +160,7 @@ namespace swift::misc::simulation::fscommon dir.setNameFilters(fileNameFilters(getSimulator().isMSFS(), getSimulator().isMSFS2024())); if (!dir.exists()) { - return CAircraftCfgEntriesList(); // can happen if there are shortcuts or linked dirs not available + return {}; // can happen if there are shortcuts or linked dirs not available } const QString currentDir = dir.absolutePath(); @@ -187,7 +187,7 @@ namespace swift::misc::simulation::fscommon for (const auto &fileInfo : files) { - if (m_cancelLoading) { return CAircraftCfgEntriesList(); } + if (m_cancelLoading) { return {}; } if (fileInfo.isDir()) { const QString nextDir = fileInfo.absoluteFilePath(); @@ -251,7 +251,7 @@ namespace swift::misc::simulation::fscommon CStatusMessage(static_cast(nullptr)).warning(u"Unable to read file '%1'") << fnFixed; msgs.push_back(m); - return CAircraftCfgEntriesList(); + return {}; } QTextStream in(&file); diff --git a/src/misc/simulation/interpolation/interpolationlogger.cpp b/src/misc/simulation/interpolation/interpolationlogger.cpp index 1bb0adf17..68cd07390 100644 --- a/src/misc/simulation/interpolation/interpolationlogger.cpp +++ b/src/misc/simulation/interpolation/interpolationlogger.cpp @@ -212,56 +212,56 @@ namespace swift::misc::simulation SituationLog CInterpolationLogger::getLastSituationLog() const { QReadLocker l(&m_lockSituations); - if (m_situationLogs.isEmpty()) { return SituationLog(); } + if (m_situationLogs.isEmpty()) { return {}; } return m_situationLogs.last(); } SituationLog CInterpolationLogger::getLastSituationLog(const CCallsign &cs) const { const QList copy(this->getSituationsLog(cs)); - if (copy.isEmpty()) { return SituationLog(); } + if (copy.isEmpty()) { return {}; } return copy.last(); } CAircraftSituation CInterpolationLogger::getLastSituation() const { QReadLocker l(&m_lockSituations); - if (m_situationLogs.isEmpty()) { return CAircraftSituation(); } + if (m_situationLogs.isEmpty()) { return {}; } return m_situationLogs.last().situationCurrent; } CAircraftSituation CInterpolationLogger::getLastSituation(const CCallsign &cs) const { const QList copy(this->getSituationsLog(cs)); - if (copy.isEmpty()) { return CAircraftSituation(); } + if (copy.isEmpty()) { return {}; } return copy.last().situationCurrent; } CAircraftParts CInterpolationLogger::getLastParts() const { QReadLocker l(&m_lockParts); - if (m_partsLogs.isEmpty()) { return CAircraftParts(); } + if (m_partsLogs.isEmpty()) { return {}; } return m_partsLogs.last().parts; } CAircraftParts CInterpolationLogger::getLastParts(const CCallsign &cs) const { const QList copy(this->getPartsLog(cs)); - if (copy.isEmpty()) { return CAircraftParts(); } + if (copy.isEmpty()) { return {}; } return copy.last().parts; } PartsLog CInterpolationLogger::getLastPartsLog() const { QReadLocker l(&m_lockParts); - if (m_partsLogs.isEmpty()) { return PartsLog(); } + if (m_partsLogs.isEmpty()) { return {}; } return m_partsLogs.last(); } PartsLog CInterpolationLogger::getLastPartsLog(const CCallsign &cs) const { const QList copy(this->getPartsLog(cs)); - if (copy.isEmpty()) { return PartsLog(); } + if (copy.isEmpty()) { return {}; } return copy.last(); } diff --git a/src/misc/simulation/interpolation/interpolationsetupprovider.cpp b/src/misc/simulation/interpolation/interpolationsetupprovider.cpp index d64e3f4ab..4f326e9e4 100644 --- a/src/misc/simulation/interpolation/interpolationsetupprovider.cpp +++ b/src/misc/simulation/interpolation/interpolationsetupprovider.cpp @@ -11,17 +11,14 @@ namespace swift::misc::simulation IInterpolationSetupProvider::getInterpolationSetupPerCallsignOrDefault(const CCallsign &callsign) const { QReadLocker l(&m_lockSetup); - if (!m_setupsPerCallsign.contains(callsign)) - { - return CInterpolationAndRenderingSetupPerCallsign(callsign, m_globalSetup); - } + if (!m_setupsPerCallsign.contains(callsign)) { return { callsign, m_globalSetup }; } return m_setupsPerCallsign.value(callsign); } CInterpolationSetupList IInterpolationSetupProvider::getInterpolationSetupsPerCallsign() const { const SetupsPerCallsign setups = this->getSetupsPerCallsign(); - return CInterpolationSetupList(setups.values()); + return { setups.values() }; } bool IInterpolationSetupProvider::hasSetupsPerCallsign() const @@ -200,13 +197,13 @@ namespace swift::misc::simulation CInterpolationAndRenderingSetupPerCallsign CInterpolationSetupAware::getInterpolationSetupPerCallsignOrDefault(const CCallsign &callsign) const { - if (!this->hasProvider()) { return CInterpolationAndRenderingSetupPerCallsign(); } + if (!this->hasProvider()) { return {}; } return this->provider()->getInterpolationSetupPerCallsignOrDefault(callsign); } CInterpolationAndRenderingSetupGlobal CInterpolationSetupAware::getInterpolationSetupGlobal() const { - if (!this->hasProvider()) { return CInterpolationAndRenderingSetupGlobal(); } + if (!this->hasProvider()) { return {}; } return this->provider()->getInterpolationSetupGlobal(); } } // namespace swift::misc::simulation diff --git a/src/misc/simulation/interpolation/interpolatorlinearpbh.cpp b/src/misc/simulation/interpolation/interpolatorlinearpbh.cpp index 40c9b067c..dc8b41037 100644 --- a/src/misc/simulation/interpolation/interpolatorlinearpbh.cpp +++ b/src/misc/simulation/interpolation/interpolatorlinearpbh.cpp @@ -59,8 +59,7 @@ namespace swift::misc::simulation SWIFT_VERIFY_X(headingStart.getReferenceNorth() == headingEnd.getReferenceNorth(), Q_FUNC_INFO, "Need same reference"); } - return CHeading(interpolateAngle(headingStart, headingEnd, m_simulationTimeFraction), - headingEnd.getReferenceNorth()); + return { interpolateAngle(headingStart, headingEnd, m_simulationTimeFraction), headingEnd.getReferenceNorth() }; } CAngle CInterpolatorLinearPbh::getPitch() const diff --git a/src/misc/simulation/interpolation/interpolatormulti.cpp b/src/misc/simulation/interpolation/interpolatormulti.cpp index 487e983bc..670a7d8d6 100644 --- a/src/misc/simulation/interpolation/interpolatormulti.cpp +++ b/src/misc/simulation/interpolation/interpolatormulti.cpp @@ -28,7 +28,7 @@ namespace swift::misc::simulation default: break; } - return CInterpolationResult(); + return {}; } const CAircraftSituation & diff --git a/src/misc/simulation/matchingscript.cpp b/src/misc/simulation/matchingscript.cpp index 55fe02f20..6c42728ce 100644 --- a/src/misc/simulation/matchingscript.cpp +++ b/src/misc/simulation/matchingscript.cpp @@ -227,9 +227,9 @@ namespace swift::misc::simulation QString MSModelSet::findCombinedTypeWithClosestColorLivery(const QString &combinedType, const QString &rgbColor) const { - if (combinedType.isEmpty() || rgbColor.isEmpty()) { return QString(); } + if (combinedType.isEmpty() || rgbColor.isEmpty()) { return {}; } CAircraftModelList models = m_modelSet.findByCombinedTypeWithColorLivery(combinedType); - if (models.isEmpty()) { return QString(); } + if (models.isEmpty()) { return {}; } const CRgbColor color(rgbColor); models = models.findClosestFuselageColorDistance(color); return models.isEmpty() ? QString() : models.front().getModelString(); @@ -242,16 +242,16 @@ namespace swift::misc::simulation if (!ms.isEmpty()) { return ms; } if (combinedType.size() != 3) { return ms; } QString wildCard(combinedType); - if (wildCard.size() != 3) { return QString(); } + if (wildCard.size() != 3) { return {}; } wildCard[1] = '*'; return this->findCombinedTypeWithClosestColorLivery(wildCard, rgbColor); } QString MSModelSet::findAircraftFamilyWithClosestColorLivery(const QString &family, const QString &rgbColor) const { - if (family.isEmpty() || rgbColor.isEmpty()) { return QString(); } + if (family.isEmpty() || rgbColor.isEmpty()) { return {}; } CAircraftModelList models = m_modelSet.findByFamilyWithColorLivery(family); - if (models.isEmpty()) { return QString(); } + if (models.isEmpty()) { return {}; } const CRgbColor color(rgbColor); models = models.findClosestFuselageColorDistance(color); return models.isEmpty() ? QString() : models.front().getModelString(); diff --git a/src/misc/simulation/remoteaircraftprovider.cpp b/src/misc/simulation/remoteaircraftprovider.cpp index d68b79f0d..b3caf8e00 100644 --- a/src/misc/simulation/remoteaircraftprovider.cpp +++ b/src/misc/simulation/remoteaircraftprovider.cpp @@ -33,7 +33,7 @@ namespace swift::misc::simulation QReadLocker l(&m_lockAircraft); const QList aircraftInRange = m_aircraftInRange.values(); l.unlock(); - return CSimulatedAircraftList(aircraftInRange); + return { aircraftInRange }; } CCallsignSet CRemoteAircraftProvider::getAircraftInRangeCallsigns() const @@ -41,7 +41,7 @@ namespace swift::misc::simulation QReadLocker l(&m_lockAircraft); const QList callsigns = m_aircraftInRange.keys(); l.unlock(); - return CCallsignSet(callsigns); + return { callsigns }; } CSimulatedAircraft CRemoteAircraftProvider::getAircraftInRangeForCallsign(const CCallsign &callsign) const @@ -83,7 +83,7 @@ namespace swift::misc::simulation QReadLocker l(&m_lockSituations); const QList situations(m_latestSituationByCallsign.values()); l.unlock(); - return CAircraftSituationList(situations); + return { situations }; } CAircraftSituationList CRemoteAircraftProvider::latestOnGroundProviderElevations() const @@ -91,7 +91,7 @@ namespace swift::misc::simulation QReadLocker l(&m_lockSituations); const QList situations(m_latestOnGroundProviderElevation.values()); l.unlock(); - return CAircraftSituationList(situations); + return { situations }; } int CRemoteAircraftProvider::remoteAircraftSituationsCount(const CCallsign &callsign) const diff --git a/src/misc/simulation/remoteaircraftproviderdummy.cpp b/src/misc/simulation/remoteaircraftproviderdummy.cpp index a87935615..683e77506 100644 --- a/src/misc/simulation/remoteaircraftproviderdummy.cpp +++ b/src/misc/simulation/remoteaircraftproviderdummy.cpp @@ -45,8 +45,5 @@ namespace swift::misc::simulation } } - CAirspaceAircraftSnapshot CRemoteAircraftProviderDummy::getLatestAirspaceAircraftSnapshot() const - { - return CAirspaceAircraftSnapshot(); - } + CAirspaceAircraftSnapshot CRemoteAircraftProviderDummy::getLatestAirspaceAircraftSnapshot() const { return {}; } } // namespace swift::misc::simulation diff --git a/src/misc/simulation/settings/fgswiftbussettings.h b/src/misc/simulation/settings/fgswiftbussettings.h index e209f395a..ef69b5f1d 100644 --- a/src/misc/simulation/settings/fgswiftbussettings.h +++ b/src/misc/simulation/settings/fgswiftbussettings.h @@ -68,7 +68,7 @@ namespace swift::misc::simulation::settings } //! \copydoc swift::misc::TSettingTrait::defaultValue - static CFGSwiftBusSettings defaultValue() { return CFGSwiftBusSettings(); } + static CFGSwiftBusSettings defaultValue() { return {}; } //! \copydoc swift::misc::TSettingTrait::isValid static bool isValid(const CFGSwiftBusSettings &settings, QString &) diff --git a/src/misc/simulation/settings/simulatorsettings.cpp b/src/misc/simulation/settings/simulatorsettings.cpp index 613418e9a..1f1c3e553 100644 --- a/src/misc/simulation/settings/simulatorsettings.cpp +++ b/src/misc/simulation/settings/simulatorsettings.cpp @@ -186,7 +186,7 @@ namespace swift::misc::simulation::settings { // mostly happening with emulated driver, VERIFY for better debugging SWIFT_VERIFY_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); - return CSimulatorSettings(); + return {}; } switch (simulator.getSimulator()) { @@ -200,12 +200,12 @@ namespace swift::misc::simulation::settings default: Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); break; } - return CSimulatorSettings(); + return {}; } CSpecializedSimulatorSettings CMultiSimulatorSettings::getSpecializedSettings(const CSimulatorInfo &simulator) const { - return CSpecializedSimulatorSettings(this->getSettings(simulator), simulator); + return { this->getSettings(simulator), simulator }; } CStatusMessage CMultiSimulatorSettings::setSettings(const CSimulatorSettings &settings, @@ -570,7 +570,7 @@ namespace swift::misc::simulation::settings QStringList CSpecializedSimulatorSettings::getModelDirectoriesFromSimulatorDirectoy() const { - if (!m_genericSettings.hasSimulatorDirectory()) { return QStringList(); } + if (!m_genericSettings.hasSimulatorDirectory()) { return {}; } const QString s(m_genericSettings.getSimulatorDirectory()); QStringList dirs; switch (m_simulator.getSimulator()) diff --git a/src/misc/simulation/simulatedaircraft.cpp b/src/misc/simulation/simulatedaircraft.cpp index 53c5e52b2..4806ac86b 100644 --- a/src/misc/simulation/simulatedaircraft.cpp +++ b/src/misc/simulation/simulatedaircraft.cpp @@ -209,7 +209,7 @@ namespace swift::misc::simulation default: break; } SWIFT_VERIFY_X(false, Q_FUNC_INFO, "Wrong unit"); - return CComSystem(); // avoid warning + return {}; // avoid warning } void CSimulatedAircraft::setCockpit(const CSimulatedAircraft &aircraft) diff --git a/src/misc/simulation/simulationenvironmentprovider.cpp b/src/misc/simulation/simulationenvironmentprovider.cpp index a36ac0f37..b28f781d8 100644 --- a/src/misc/simulation/simulationenvironmentprovider.cpp +++ b/src/misc/simulation/simulationenvironmentprovider.cpp @@ -345,7 +345,7 @@ namespace swift::misc::simulation if (found) { m_elvFound++; - return CElevationPlane(coordinate, reference); // plane with radius = distance to reference + return { coordinate, reference }; // plane with radius = distance to reference } else { @@ -379,7 +379,7 @@ namespace swift::misc::simulation QPair ISimulationEnvironmentProvider::getElevationsFoundMissed() const { QReadLocker l(&m_lockElvCoordinates); - return QPair(m_elvFound, m_elvMissed); + return { m_elvFound, m_elvMissed }; } QString ISimulationEnvironmentProvider::getElevationsFoundMissedInfo() const @@ -403,7 +403,7 @@ namespace swift::misc::simulation QPair ISimulationEnvironmentProvider::getElevationRequestTimes() const { QReadLocker l(&m_lockElvCoordinates); - return QPair(m_statsCurrentElevRequestTimeMs, m_statsMaxElevRequestTimeMs); + return { m_statsCurrentElevRequestTimeMs, m_statsMaxElevRequestTimeMs }; } QString ISimulationEnvironmentProvider::getElevationRequestTimesInfo() const @@ -787,37 +787,37 @@ namespace swift::misc::simulation QPair CSimulationEnvironmentAware::getElevationsFoundMissed() const { - if (!this->hasProvider()) { return QPair(0, 0); } + if (!this->hasProvider()) { return { 0, 0 }; } return this->provider()->getElevationsFoundMissed(); } QString CSimulationEnvironmentAware::getElevationsFoundMissedInfo() const { - if (!this->hasProvider()) { return QString(); } + if (!this->hasProvider()) { return {}; } return this->provider()->getElevationsFoundMissedInfo(); } QPair CSimulationEnvironmentAware::getElevationRequestTimes() const { - if (!this->hasProvider()) { return QPair(-1, -1); } + if (!this->hasProvider()) { return { -1, -1 }; } return this->provider()->getElevationRequestTimes(); } QString CSimulationEnvironmentAware::getElevationRequestTimesInfo() const { - if (!this->hasProvider()) { return QString(); } + if (!this->hasProvider()) { return {}; } return this->provider()->getElevationRequestTimesInfo(); } CSimulatorPluginInfo CSimulationEnvironmentAware::getSimulatorPluginInfo() const { - if (!this->hasProvider()) { return CSimulatorPluginInfo(); } + if (!this->hasProvider()) { return {}; } return this->provider()->getSimulatorPluginInfo(); } CSimulatorInfo CSimulationEnvironmentAware::getSimulatorInfo() const { - if (!this->hasProvider()) { return CSimulatorInfo(); } + if (!this->hasProvider()) { return {}; } return this->provider()->getSimulatorInfo(); } @@ -829,7 +829,7 @@ namespace swift::misc::simulation CAircraftModel CSimulationEnvironmentAware::getDefaultModel() const { - if (!this->hasProvider()) { return CAircraftModel(); } + if (!this->hasProvider()) { return {}; } return this->provider()->getDefaultModel(); } diff --git a/src/misc/simulation/simulatorinfo.cpp b/src/misc/simulation/simulatorinfo.cpp index de1bb720c..ee44265d3 100644 --- a/src/misc/simulation/simulatorinfo.cpp +++ b/src/misc/simulation/simulatorinfo.cpp @@ -416,14 +416,14 @@ namespace swift::misc::simulation { switch (internalIndex) { - case 0: return CSimulatorInfo(CSimulatorInfo::FSX); - case 1: return CSimulatorInfo(CSimulatorInfo::P3D); - case 2: return CSimulatorInfo(CSimulatorInfo::FS9); - case 3: return CSimulatorInfo(CSimulatorInfo::XPLANE); - case 4: return CSimulatorInfo(CSimulatorInfo::FG); - case 5: return CSimulatorInfo(CSimulatorInfo::MSFS); - case 6: return CSimulatorInfo(CSimulatorInfo::MSFS2024); - default: return CSimulatorInfo(CSimulatorInfo::None); + case 0: return { CSimulatorInfo::FSX }; + case 1: return { CSimulatorInfo::P3D }; + case 2: return { CSimulatorInfo::FS9 }; + case 3: return { CSimulatorInfo::XPLANE }; + case 4: return { CSimulatorInfo::FG }; + case 5: return { CSimulatorInfo::MSFS }; + case 6: return { CSimulatorInfo::MSFS2024 }; + default: return { CSimulatorInfo::None }; } } } // namespace swift::misc::simulation diff --git a/src/misc/simulation/simulatorinfolist.cpp b/src/misc/simulation/simulatorinfolist.cpp index 967db56e2..d89c3d2e9 100644 --- a/src/misc/simulation/simulatorinfolist.cpp +++ b/src/misc/simulation/simulatorinfolist.cpp @@ -15,7 +15,7 @@ namespace swift::misc::simulation CSimulatorInfoList CSimulatorInfoList::withNoDuplicates() const { - if (this->isEmpty()) { return CSimulatorInfoList(); } + if (this->isEmpty()) { return {}; } QList simIndexes; CSimulatorInfoList newList; for (const CSimulatorInfo &simulator : *this) @@ -30,7 +30,7 @@ namespace swift::misc::simulation CSimulatorInfoList CSimulatorInfoList::splitIntoSingleSimulators() const { - if (this->isEmpty()) { return CSimulatorInfoList(); } + if (this->isEmpty()) { return {}; } CSimulatorInfoList newList; for (const CSimulatorInfo &simulator : *this) { diff --git a/src/misc/simulation/simulatorplugininfolist.cpp b/src/misc/simulation/simulatorplugininfolist.cpp index 44e558c66..239697346 100644 --- a/src/misc/simulation/simulatorplugininfolist.cpp +++ b/src/misc/simulation/simulatorplugininfolist.cpp @@ -35,6 +35,6 @@ namespace swift::misc::simulation { if (info.getSimulatorInfo() == simulator) { return info; } } - return CSimulatorPluginInfo(); + return {}; } } // namespace swift::misc::simulation diff --git a/src/misc/simulation/xplane/xplaneutil.cpp b/src/misc/simulation/xplane/xplaneutil.cpp index 25b9dda23..07f2efc3c 100644 --- a/src/misc/simulation/xplane/xplaneutil.cpp +++ b/src/misc/simulation/xplane/xplaneutil.cpp @@ -127,7 +127,7 @@ namespace swift::misc::simulation::xplane QStringList CXPlaneUtil::modelDirectoriesFromSimDir(const QString &simulatorDir) { - if (simulatorDir.isEmpty()) { return QStringList(); } + if (simulatorDir.isEmpty()) { return {}; } return QStringList({ simulatorDir }); } @@ -152,7 +152,7 @@ namespace swift::misc::simulation::xplane QStringList CXPlaneUtil::pluginSubdirectories(const QString &pluginDir) { const QString dirName = pluginDir.isEmpty() ? xplaneRootDir() : pluginDir; - if (!CDirectoryUtils::isDirExisting(dirName)) { return QStringList(); } + if (!CDirectoryUtils::isDirExisting(dirName)) { return {}; } const QDir dir(dirName); return dir.entryList(QDir::Dirs, QDir::Name | QDir::IgnoreCase); } @@ -227,7 +227,7 @@ namespace swift::misc::simulation::xplane { const QString dirName = CFileUtils::fixWindowsUncPath(pluginDir.isEmpty() ? xplaneRootDir() : pluginDir); const QDir directory(dirName); - if (!directory.exists()) { return QStringList(); } + if (!directory.exists()) { return {}; } // this finds the current levels XPLs QStringList files = directory.entryList(xplFileFilter(), QDir::Files, QDir::Name | QDir::IgnoreCase); diff --git a/src/misc/statusmessagelist.cpp b/src/misc/statusmessagelist.cpp index cff4638db..9ec5b78c4 100644 --- a/src/misc/statusmessagelist.cpp +++ b/src/misc/statusmessagelist.cpp @@ -177,7 +177,7 @@ namespace swift::misc CStatusMessage CStatusMessageList::toSingleMessage() const { - if (this->isEmpty()) { return CStatusMessage(); } + if (this->isEmpty()) { return {}; } if (this->size() == 1) { return this->front(); } QStringList newMsgs; CStatusMessage::StatusSeverity s = CStatusMessage::SeverityDebug; diff --git a/src/misc/swiftdirectories.cpp b/src/misc/swiftdirectories.cpp index 6b3d1bec8..b185bc081 100644 --- a/src/misc/swiftdirectories.cpp +++ b/src/misc/swiftdirectories.cpp @@ -112,7 +112,7 @@ namespace swift::misc QFileInfoList CSwiftDirectories::currentApplicationDataDirectories() { const QDir swiftAppData(applicationDataDirectory()); // contains 1..n subdirs - if (!swiftAppData.isReadable()) { return QFileInfoList(); } + if (!swiftAppData.isReadable()) { return {}; } return swiftAppData.entryInfoList({}, QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time); } diff --git a/src/misc/timestampbased.cpp b/src/misc/timestampbased.cpp index 90696954c..9ad076d9d 100644 --- a/src/misc/timestampbased.cpp +++ b/src/misc/timestampbased.cpp @@ -20,7 +20,7 @@ namespace swift::misc QDateTime ITimestampBased::getUtcTimestamp() const { - if (m_timestampMSecsSinceEpoch < 0) { return QDateTime(); } + if (m_timestampMSecsSinceEpoch < 0) { return {}; } return QDateTime::fromMSecsSinceEpoch(m_timestampMSecsSinceEpoch); } @@ -289,7 +289,7 @@ namespace swift::misc } const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString()); SWIFT_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); - return QVariant(); + return {}; } void ITimestampWithOffsetBased::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) diff --git a/src/misc/timestampobjectlist.h b/src/misc/timestampobjectlist.h index 014d33c4e..fcd6f589e 100644 --- a/src/misc/timestampobjectlist.h +++ b/src/misc/timestampobjectlist.h @@ -173,7 +173,7 @@ namespace swift::misc //! Oldest timestamp QDateTime oldestTimestamp() const { - if (this->container().isEmpty()) { return QDateTime(); } + if (this->container().isEmpty()) { return {}; } return this->oldestObject().getUtcTimestamp(); } @@ -674,14 +674,14 @@ namespace swift::misc //! Latest adjusted timestamp QDateTime latestAdjustedTimestamp() const { - if (this->container().isEmpty()) { return QDateTime(); } + if (this->container().isEmpty()) { return {}; } return this->latestAdjustedObject().getUtcTimestamp(); } //! Oldest adjusted timestamp QDateTime oldestAdjustedTimestamp() const { - if (this->container().isEmpty()) { return QDateTime(); } + if (this->container().isEmpty()) { return {}; } return this->oldestAdjustedObject().getUtcTimestamp(); } diff --git a/src/misc/valuecache.cpp b/src/misc/valuecache.cpp index 463a90b12..744ec116c 100644 --- a/src/misc/valuecache.cpp +++ b/src/misc/valuecache.cpp @@ -680,7 +680,7 @@ namespace swift::misc { Q_ASSERT_X(!element.m_key.isEmpty(), Q_FUNC_INFO, "Empty key suggests an attempt to use value before objectName available for %%OwnerName%%"); - return element.m_value.read(); + return element.m_value.read(); // NOLINT(modernize-return-braced-init-list) } CStatusMessage CValuePage::setValue(Element &element, CVariant value, qint64 timestamp, bool save) diff --git a/src/misc/variant.cpp b/src/misc/variant.cpp index fdf6bb3c9..4b32e2964 100644 --- a/src/misc/variant.cpp +++ b/src/misc/variant.cpp @@ -597,7 +597,7 @@ namespace swift::misc qFatal("Type cannot be resolved: %s (%d)", name ? name : "", type); } } - return QVariant(); // suppress compiler warning + return {}; // suppress compiler warning } } // namespace swift::misc diff --git a/src/plugins/simulator/emulated/simulatoremulated.cpp b/src/plugins/simulator/emulated/simulatoremulated.cpp index 3cba6e6fc..b7aeedef1 100644 --- a/src/plugins/simulator/emulated/simulatoremulated.cpp +++ b/src/plugins/simulator/emulated/simulatoremulated.cpp @@ -181,7 +181,7 @@ namespace swift::simplugin::emulated CStatusMessageList CSimulatorEmulated::getInterpolationMessages(const CCallsign &callsign) const { if (canLog()) { m_monitorWidget->appendReceivingCall(Q_FUNC_INFO); } - if (!m_interpolators.contains(callsign)) { return CStatusMessageList(); } + if (!m_interpolators.contains(callsign)) { return {}; } const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupPerCallsignOrDefault(callsign); // threadsafe copy return m_interpolators[callsign]->getInterpolationMessages(setup.getInterpolatorMode()); diff --git a/src/plugins/simulator/flightgear/flightgearmpaircraft.cpp b/src/plugins/simulator/flightgear/flightgearmpaircraft.cpp index 02ec254d9..c80f41882 100644 --- a/src/plugins/simulator/flightgear/flightgearmpaircraft.cpp +++ b/src/plugins/simulator/flightgear/flightgearmpaircraft.cpp @@ -55,7 +55,7 @@ namespace swift::simplugin::flightgear return this->getInterpolator() ? this->getInterpolator()->getInterpolationMessages(mode) : CStatusMessageList(); } - CCallsignSet CFlightgearMPAircraftObjects::getAllCallsigns() const { return CCallsignSet(this->keys()); } + CCallsignSet CFlightgearMPAircraftObjects::getAllCallsigns() const { return { this->keys() }; } QStringList CFlightgearMPAircraftObjects::getAllCallsignStrings(bool sorted) const { diff --git a/src/plugins/simulator/flightgear/simulatorflightgear.cpp b/src/plugins/simulator/flightgear/simulatorflightgear.cpp index f51d10b0a..fc57031a6 100644 --- a/src/plugins/simulator/flightgear/simulatorflightgear.cpp +++ b/src/plugins/simulator/flightgear/simulatorflightgear.cpp @@ -131,7 +131,7 @@ namespace swift::simplugin::flightgear CStatusMessageList CSimulatorFlightgear::getInterpolationMessages(const CCallsign &callsign) const { - if (callsign.isEmpty() || !m_flightgearAircraftObjects.contains(callsign)) { return CStatusMessageList(); } + if (callsign.isEmpty() || !m_flightgearAircraftObjects.contains(callsign)) { return {}; } const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign, false); return m_flightgearAircraftObjects[callsign].getInterpolationMessages(setup.getInterpolatorMode()); @@ -975,7 +975,7 @@ namespace swift::simplugin::flightgear if (m_addingInProgressAircraft.isEmpty()) { return empty; } const QList ts = m_addingInProgressAircraft.values(); const auto mm = std::minmax_element(ts.constBegin(), ts.constEnd()); - return QPair(*mm.first, *mm.second); + return { *mm.first, *mm.second }; } bool CSimulatorFlightgear::canAddAircraft() const diff --git a/src/plugins/simulator/xplane/simulatorxplane.cpp b/src/plugins/simulator/xplane/simulatorxplane.cpp index e0a501632..afc6be625 100644 --- a/src/plugins/simulator/xplane/simulatorxplane.cpp +++ b/src/plugins/simulator/xplane/simulatorxplane.cpp @@ -137,7 +137,7 @@ namespace swift::simplugin::xplane CStatusMessageList CSimulatorXPlane::getInterpolationMessages(const CCallsign &callsign) const { - if (callsign.isEmpty() || !m_xplaneAircraftObjects.contains(callsign)) { return CStatusMessageList(); } + if (callsign.isEmpty() || !m_xplaneAircraftObjects.contains(callsign)) { return {}; } const CInterpolationAndRenderingSetupPerCallsign setup = this->getInterpolationSetupConsolidated(callsign, false); return m_xplaneAircraftObjects[callsign].getInterpolationMessages(setup.getInterpolatorMode()); @@ -1085,7 +1085,7 @@ namespace swift::simplugin::xplane // so not to override it with some DB value in X mode, we set it to "0" if (model.getDistributor().matchesKeyOrAlias(CDistributor::xplaneXcsl()) && cg.isNull()) { - return CLength(0.0, CLengthUnit::ft()); + return { 0.0, CLengthUnit::ft() }; } return cg; } @@ -1293,7 +1293,7 @@ namespace swift::simplugin::xplane if (m_addingInProgressAircraft.isEmpty()) { return empty; } const QList ts = m_addingInProgressAircraft.values(); const auto mm = std::minmax_element(ts.constBegin(), ts.constEnd()); - return QPair(*mm.first, *mm.second); + return { *mm.first, *mm.second }; } bool CSimulatorXPlane::canAddAircraft() const diff --git a/src/plugins/simulator/xplane/xplanempaircraft.cpp b/src/plugins/simulator/xplane/xplanempaircraft.cpp index dd3381a52..315c4e739 100644 --- a/src/plugins/simulator/xplane/xplanempaircraft.cpp +++ b/src/plugins/simulator/xplane/xplanempaircraft.cpp @@ -54,7 +54,7 @@ namespace swift::simplugin::xplane return this->getInterpolator() ? this->getInterpolator()->getInterpolationMessages(mode) : CStatusMessageList(); } - CCallsignSet CXPlaneMPAircraftObjects::getAllCallsigns() const { return CCallsignSet(this->keys()); } + CCallsignSet CXPlaneMPAircraftObjects::getAllCallsigns() const { return { this->keys() }; } QStringList CXPlaneMPAircraftObjects::getAllCallsignStrings(bool sorted) const { diff --git a/src/swiftguistandard/swiftguistdapplication.cpp b/src/swiftguistandard/swiftguistdapplication.cpp index c44ac9035..f58a66fa9 100644 --- a/src/swiftguistandard/swiftguistdapplication.cpp +++ b/src/swiftguistandard/swiftguistdapplication.cpp @@ -40,7 +40,7 @@ CStatusMessageList CSwiftGuiStdApplication::startHookIn() const CStatusMessage m = CStatusMessage(this, CLogCategories::validation()).error(u"Inconsistent pair DBus: '%1' and core: '%2'") << dBusAddress << coreModeStr; - return CStatusMessageList(m); + return { m }; } }