diff --git a/.clang-tidy b/.clang-tidy index 4e0120145..244e8cba0 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,6 +3,7 @@ Checks: > -*, + modernize-use-auto, CheckOptions: diff --git a/samples/afvclient/main.cpp b/samples/afvclient/main.cpp index fe0ad97db..042711f43 100644 --- a/samples/afvclient/main.cpp +++ b/samples/afvclient/main.cpp @@ -33,12 +33,12 @@ int main(int argc, char *argv[]) swift::core::registerMetadata(); swift::core::CApplication a("sampleafvclient", CApplicationInfo::Sample); - CAfvMapReader *afvMapReader = new CAfvMapReader(&a); + auto *afvMapReader = new CAfvMapReader(&a); afvMapReader->updateFromMap(); - CAfvClient *voiceClient = new CAfvClient("https://voice1.vatsim.net", &qa); + auto *voiceClient = new CAfvClient("https://voice1.vatsim.net", &qa); voiceClient->start(QThread::TimeCriticalPriority); // background thread - CAfvClientBridge *voiceClientBridge = new CAfvClientBridge(voiceClient, &qa); + auto *voiceClientBridge = new CAfvClientBridge(voiceClient, &qa); QObject::connect(&qa, &QCoreApplication::aboutToQuit, [voiceClient]() { voiceClient->quitAndWait(); }); diff --git a/samples/miscquantities/samplesphysicalquantities.cpp b/samples/miscquantities/samplesphysicalquantities.cpp index 0e781d6b5..53be0a7eb 100644 --- a/samples/miscquantities/samplesphysicalquantities.cpp +++ b/samples/miscquantities/samplesphysicalquantities.cpp @@ -67,9 +67,9 @@ namespace swift::sample out << f1 << " " << f1.valueRoundedWithUnit(CFrequencyUnit::MHz()) << " " << f1.valueRoundedWithUnit(CFrequencyUnit::GHz(), 3); - CSpeed s1 = CSpeed(100, CSpeedUnit::km_h()); - CSpeed s2 = CSpeed(1000, CSpeedUnit::ft_min()); - CSpeed s3 = CSpeed(s2); + CSpeed s1(100, CSpeedUnit::km_h()); + CSpeed s2(1000, CSpeedUnit::ft_min()); + CSpeed s3(s2); s3.switchUnit(CSpeedUnit::m_s()); out << s1 << " " << s1.valueRoundedWithUnit(CSpeedUnit::defaultUnit()) << " " << s1.valueRoundedWithUnit(CSpeedUnit::NM_h()); diff --git a/src/core/afv/audio/soundcardsampleprovider.cpp b/src/core/afv/audio/soundcardsampleprovider.cpp index 02b0607ce..e498f31dc 100644 --- a/src/core/afv/audio/soundcardsampleprovider.cpp +++ b/src/core/afv/audio/soundcardsampleprovider.cpp @@ -33,8 +33,7 @@ namespace swift::core::afv::audio constexpr int voiceInputNumber = 4; // number of CallsignSampleProviders for (quint16 transceiverID : transceiverIDs) { - CReceiverSampleProvider *transceiverInput = - new CReceiverSampleProvider(m_waveFormat, transceiverID, voiceInputNumber, m_mixer); + auto transceiverInput = new CReceiverSampleProvider(m_waveFormat, transceiverID, voiceInputNumber, m_mixer); connect(transceiverInput, &CReceiverSampleProvider::receivingCallsignsChanged, this, &CSoundcardSampleProvider::receivingCallsignsChanged); m_receiverInputs.push_back(transceiverInput); diff --git a/src/core/afv/connection/apiserverconnection.cpp b/src/core/afv/connection/apiserverconnection.cpp index 4a3f1a3ec..74f9f56c7 100644 --- a/src/core/afv/connection/apiserverconnection.cpp +++ b/src/core/afv/connection/apiserverconnection.cpp @@ -305,7 +305,7 @@ namespace swift::core::afv::connection QEventLoop *CApiServerConnection::newEventLoop() { - QEventLoop *loop = new QEventLoop(this); + auto *loop = new QEventLoop(this); if (sApp) { QObject::connect(sApp, &CApplication::aboutToShutdown, loop, &QEventLoop::quit, Qt::QueuedConnection); diff --git a/src/core/afv/connection/clientconnection.cpp b/src/core/afv/connection/clientconnection.cpp index 2b35ba620..2c6509636 100644 --- a/src/core/afv/connection/clientconnection.cpp +++ b/src/core/afv/connection/clientconnection.cpp @@ -162,7 +162,7 @@ namespace swift::core::afv::connection if (deserializer.m_dtoNameBuffer == AudioRxOnTransceiversDto::getShortDtoName()) { // qDebug() << "Received audio data"; - const AudioRxOnTransceiversDto audioOnTransceiverDto = deserializer.getDto(); + const auto audioOnTransceiverDto = deserializer.getDto(); if (m_connection.isReceivingAudio() && m_connection.isConnected()) { emit audioReceived(audioOnTransceiverDto); diff --git a/src/core/aircraftmatcher.cpp b/src/core/aircraftmatcher.cpp index 1fb68626c..b83fd71a6 100644 --- a/src/core/aircraftmatcher.cpp +++ b/src/core/aircraftmatcher.cpp @@ -756,7 +756,7 @@ namespace swift::core { if (ms.isQObject()) { - const MSInOutValues *reverseModelProcessed = qobject_cast(ms.toQObject()); + const auto *reverseModelProcessed = qobject_cast(ms.toQObject()); logMessage = reverseModelProcessed->getLogMessage(); if (!reverseModelProcessed->isModified()) { break; } diff --git a/src/core/context/contextapplicationproxy.cpp b/src/core/context/contextapplicationproxy.cpp index 63c967403..cd5f719bc 100644 --- a/src/core/context/contextapplicationproxy.cpp +++ b/src/core/context/contextapplicationproxy.cpp @@ -75,7 +75,7 @@ namespace swift::core::context CSettingsDictionary CContextApplicationProxy::getUnsavedSettingsKeysDescribed() const { - CSettingsDictionary result = + auto result = m_dBusInterface->callDBusRet(QLatin1String("getUnsavedSettingsKeysDescribed")); for (auto it = result.begin(); it != result.end(); ++it) { diff --git a/src/core/context/contextaudio.cpp b/src/core/context/contextaudio.cpp index 37379661c..ced5251da 100644 --- a/src/core/context/contextaudio.cpp +++ b/src/core/context/contextaudio.cpp @@ -588,7 +588,7 @@ namespace swift::core::context if (!m_voiceClient) { return; } const CCallsign cs = m_voiceClient->getCallsign(); - const CAfvClient::ConnectionStatus s = static_cast(status); + const auto s = static_cast(status); switch (s) { diff --git a/src/core/data/globalsetup.cpp b/src/core/data/globalsetup.cpp index f7cc975c6..c2e7ab3e7 100644 --- a/src/core/data/globalsetup.cpp +++ b/src/core/data/globalsetup.cpp @@ -107,7 +107,7 @@ namespace swift::core::data { if (index.isMyself()) { return CVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDbRootDirectory: return QVariant::fromValue(m_dbRootDirectoryUrl); @@ -136,7 +136,7 @@ namespace swift::core::data return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDbRootDirectory: m_dbRootDirectoryUrl.setPropertyByIndex(index.copyFrontRemoved(), variant); break; diff --git a/src/core/data/launchersetup.cpp b/src/core/data/launchersetup.cpp index 5e23dee48..8598af98d 100644 --- a/src/core/data/launchersetup.cpp +++ b/src/core/data/launchersetup.cpp @@ -22,7 +22,7 @@ namespace swift::core::data QVariant CLauncherSetup::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDBusAddress: return QVariant::fromValue(m_dBusAddress); @@ -40,7 +40,7 @@ namespace swift::core::data (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDBusAddress: this->setDBusAddress(variant.toString()); break; diff --git a/src/core/data/vatsimsetup.cpp b/src/core/data/vatsimsetup.cpp index d501e5723..8237c78bd 100644 --- a/src/core/data/vatsimsetup.cpp +++ b/src/core/data/vatsimsetup.cpp @@ -54,7 +54,7 @@ namespace swift::core::data if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexFsdServers: return QVariant::fromValue(this->m_fsdServers); @@ -76,7 +76,7 @@ namespace swift::core::data return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexFsdServers: this->m_fsdServers = variant.value(); break; diff --git a/src/core/db/databasereader.cpp b/src/core/db/databasereader.cpp index 0262f1a11..40cf66cbd 100644 --- a/src/core/db/databasereader.cpp +++ b/src/core/db/databasereader.cpp @@ -819,7 +819,7 @@ namespace swift::core::db if (started.isValid() && started.canConvert()) { const qint64 now = QDateTime::currentMSecsSinceEpoch(); - const qint64 start = started.value(); + const auto start = started.value(); this->setLoadTimeMs(now - start); m_requestStarted = start; m_responseReceived = now; diff --git a/src/core/db/databasewriter.cpp b/src/core/db/databasewriter.cpp index 952607d26..9ba63d3bb 100644 --- a/src/core/db/databasewriter.cpp +++ b/src/core/db/databasewriter.cpp @@ -71,7 +71,7 @@ namespace swift::core::db } const bool compress = models.size() > 3; - QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType, this); + auto *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType, this); multiPart->append(CDatabaseUtils::getJsonTextMultipart(models.toDatabaseJson(), compress)); if (sApp->getGlobalSetup().dbDebugFlag()) { multiPart->append(CDatabaseUtils::getMultipartWithDebugFlag()); } @@ -105,7 +105,7 @@ namespace swift::core::db const QString json = data.toDatabaseJson(); const bool compress = json.size() > 2048; - QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType, this); + auto *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType, this); multiPart->append(CDatabaseUtils::getJsonTextMultipart(json, compress)); if (sApp->getGlobalSetup().dbDebugFlag()) { diff --git a/src/core/vatsim/vatsimsettings.cpp b/src/core/vatsim/vatsimsettings.cpp index fc8a8265c..7fa05057e 100644 --- a/src/core/vatsim/vatsimsettings.cpp +++ b/src/core/vatsim/vatsimsettings.cpp @@ -34,7 +34,7 @@ namespace swift::core::vatsim QVariant CReaderSettings::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexInitialTime: return this->m_initialTime.propertyByIndex(index.copyFrontRemoved()); @@ -51,7 +51,7 @@ namespace swift::core::vatsim (*this) = variant.value(); return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexInitialTime: this->m_initialTime.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -79,7 +79,7 @@ namespace swift::core::vatsim QVariant CRawFsdMessageSettings::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexRawFsdMessagesEnabled: return QVariant::fromValue(this->m_rawFsdMessagesEnabled); @@ -96,7 +96,7 @@ namespace swift::core::vatsim (*this) = variant.value(); return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexRawFsdMessagesEnabled: this->m_rawFsdMessagesEnabled = variant.toBool(); break; diff --git a/src/gui/components/aircraftmodelstringcompleter.cpp b/src/gui/components/aircraftmodelstringcompleter.cpp index e49a827ff..8119b0e5e 100644 --- a/src/gui/components/aircraftmodelstringcompleter.cpp +++ b/src/gui/components/aircraftmodelstringcompleter.cpp @@ -39,7 +39,7 @@ namespace swift::gui::components connect(&m_modelCaches, &CModelCaches::cacheChanged, this, &CAircraftModelStringCompleter::setSimulator, Qt::QueuedConnection); - CSimulatorInfo simulator = CSimulatorInfo(CSimulatorInfo::P3D); // default + auto simulator = CSimulatorInfo(CSimulatorInfo::P3D); // default if (sGui->getIContextSimulator()) { connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, diff --git a/src/gui/components/applicationclosedialog.cpp b/src/gui/components/applicationclosedialog.cpp index f5a1cd9c4..b7fcf3e4f 100644 --- a/src/gui/components/applicationclosedialog.cpp +++ b/src/gui/components/applicationclosedialog.cpp @@ -76,7 +76,7 @@ namespace swift::gui::components const CSettingsDictionary settingsDictionary(sApp->getIContextApplication()->getUnsavedSettingsKeysDescribed()); QStringList descriptions = settingsDictionary.values(); descriptions.sort(); - QStringListModel *model = new QStringListModel(descriptions, this); + auto *model = new QStringListModel(descriptions, this); ui->lv_UnsavedSettings->setModel(model); ui->lv_UnsavedSettings->selectAll(); diff --git a/src/gui/components/atcbuttoncomponent.cpp b/src/gui/components/atcbuttoncomponent.cpp index b29ed4b64..976572b4b 100644 --- a/src/gui/components/atcbuttoncomponent.cpp +++ b/src/gui/components/atcbuttoncomponent.cpp @@ -50,7 +50,7 @@ namespace swift::gui::components if (stations.isEmpty()) { return; } CGuiUtility::deleteLayout(this->layout(), true); - QGridLayout *layout = new QGridLayout(this); + auto *layout = new QGridLayout(this); layout->setObjectName("gl_CAtcButtonComponent"); layout->setSpacing(4); @@ -67,7 +67,7 @@ namespace swift::gui::components if (!station.getCallsign().hasAtcSuffix()) { continue; } } - QPushButton *button = new QPushButton(this); + auto *button = new QPushButton(this); button->setText(station.getCallsignAsString()); if (m_withIcons) { button->setIcon(CIcon(station.toIcon()).toQIcon()); } QObject::connect(button, &QPushButton::released, this, &CAtcButtonComponent::onButtonClicked); @@ -117,11 +117,11 @@ namespace swift::gui::components void CAtcButtonComponent::onButtonClicked() { - QPushButton *button = qobject_cast(QObject::sender()); + auto *button = qobject_cast(QObject::sender()); if (!button) { return; } const CVariant v(button->property("atc")); if (!v.isValid() || !v.canConvert()) { return; } - const CAtcStation station = v.value(); + const auto station = v.value(); emit this->requestAtcStation(station); } } // namespace swift::gui::components diff --git a/src/gui/components/atcstationcomponent.cpp b/src/gui/components/atcstationcomponent.cpp index d31954302..ce4cff06a 100644 --- a/src/gui/components/atcstationcomponent.cpp +++ b/src/gui/components/atcstationcomponent.cpp @@ -61,7 +61,7 @@ namespace swift::gui::components ui->tw_Atc->setCurrentIndex(0); ui->tw_Atc->tabBar()->setExpanding(false); ui->tw_Atc->tabBar()->setUsesScrollButtons(true); - CUpperCaseValidator *ucv = new CUpperCaseValidator(ui->le_AtcStationsOnlineMetar); + auto *ucv = new CUpperCaseValidator(ui->le_AtcStationsOnlineMetar); ui->le_AtcStationsOnlineMetar->setValidator(ucv); // some icons @@ -367,7 +367,7 @@ namespace swift::gui::components const QStringList airports = sGui->getWebDataServices()->getAirports().allIcaoCodes(true); if (!airports.isEmpty()) { - QCompleter *airportCompleter = new QCompleter(airports, this); + auto *airportCompleter = new QCompleter(airports, this); const int w5chars = airportCompleter->popup()->fontMetrics().size(Qt::TextSingleLine, "FooBa").width(); airportCompleter->popup()->setMinimumWidth(w5chars * 5); ui->le_AtcStationsOnlineMetar->setCompleter(airportCompleter); @@ -470,7 +470,7 @@ namespace swift::gui::components QVBoxLayout *CAtcStationComponent::vLayout() const { - QVBoxLayout *layout = qobject_cast(this->layout()); + auto *layout = qobject_cast(this->layout()); return layout; } } // namespace swift::gui::components diff --git a/src/gui/components/audionotificationcomponent.cpp b/src/gui/components/audionotificationcomponent.cpp index fee69e4dc..06d522f72 100644 --- a/src/gui/components/audionotificationcomponent.cpp +++ b/src/gui/components/audionotificationcomponent.cpp @@ -201,7 +201,7 @@ namespace swift::gui::components const CStatusMessage msg = m_audioSettings.set(as); CLogMessage(this).preformatted(msg); - const QCheckBox *sender = qobject_cast(QObject::sender()); + const auto *sender = qobject_cast(QObject::sender()); if (checked && sGui && sGui->getCContextAudioBase() && sender) { const CNotificationSounds::NotificationFlag f = this->checkBoxToFlag(sender); diff --git a/src/gui/components/callsigncompleter.cpp b/src/gui/components/callsigncompleter.cpp index d849618fd..914810a41 100644 --- a/src/gui/components/callsigncompleter.cpp +++ b/src/gui/components/callsigncompleter.cpp @@ -28,7 +28,7 @@ namespace swift::gui::components Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui"); Q_ASSERT_X(sGui->getIContextNetwork(), Q_FUNC_INFO, "Need network context"); ui->setupUi(this); - CUpperCaseValidator *ucv = new CUpperCaseValidator(ui->le_Callsign); + auto *ucv = new CUpperCaseValidator(ui->le_Callsign); ui->le_Callsign->setValidator(ucv); ui->le_Callsign->setCompleter(*completer()); ui->led_Status->setToolTips("connected", "disconnected"); @@ -129,7 +129,7 @@ namespace swift::gui::components CSharedStringListCompleter *CCallsignCompleter::completer() { - static CSharedStringListCompleter *c = new CSharedStringListCompleter(); + static auto *c = new CSharedStringListCompleter(); return c; } } // namespace swift::gui::components diff --git a/src/gui/components/cockpitinfoareacomponent.cpp b/src/gui/components/cockpitinfoareacomponent.cpp index fb8840022..44da84adf 100644 --- a/src/gui/components/cockpitinfoareacomponent.cpp +++ b/src/gui/components/cockpitinfoareacomponent.cpp @@ -35,7 +35,7 @@ namespace swift::gui::components const QPixmap &CCockpitInfoAreaComponent::indexToPixmap(int areaIndex) const { - const InfoArea area = static_cast(areaIndex); + const auto area = static_cast(areaIndex); switch (area) { case InfoAreaAudio: return CIcons::appAudio16(); diff --git a/src/gui/components/colorselector.cpp b/src/gui/components/colorselector.cpp index c78d80a1e..ff23543eb 100644 --- a/src/gui/components/colorselector.cpp +++ b/src/gui/components/colorselector.cpp @@ -43,7 +43,7 @@ namespace swift::gui::components connect(ui->le_Color, &QLineEdit::editingFinished, this, &CColorSelector::onReturnPressed); connect(ui->le_Color, &QLineEdit::returnPressed, this, &CColorSelector::onReturnPressed); - QCompleter *completer = new QCompleter(QColor::colorNames(), this); + auto *completer = new QCompleter(QColor::colorNames(), this); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setMaxVisibleItems(10); completer->setCompletionMode(QCompleter::PopupCompletion); @@ -114,7 +114,7 @@ namespace swift::gui::components if (mime->hasColor()) { - const QColor color = qvariant_cast(event->mimeData()->colorData()); + const auto color = qvariant_cast(event->mimeData()->colorData()); if (!color.isValid()) { return; } this->setColor(color); } @@ -125,13 +125,13 @@ namespace swift::gui::components { if (valueVariant.canConvert()) { - const CRgbColor rgb(valueVariant.value()); + const auto rgb(valueVariant.value()); if (!rgb.isValid()) { return; } this->setColor(rgb); } else if (valueVariant.canConvert()) { - const QColor qColor(valueVariant.value()); + const auto qColor(valueVariant.value()); if (!qColor.isValid()) { return; } this->setColor(qColor); } @@ -157,8 +157,8 @@ namespace swift::gui::components const CRgbColor c(this->getColor()); if (!c.isValid()) { return; } - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; + auto *drag = new QDrag(this); + auto *mimeData = new QMimeData; mimeData->setColorData(QVariant::fromValue(c.toQColor())); drag->setMimeData(mimeData); diff --git a/src/gui/components/configurationwizard.cpp b/src/gui/components/configurationwizard.cpp index c835eb184..29c6cb470 100644 --- a/src/gui/components/configurationwizard.cpp +++ b/src/gui/components/configurationwizard.cpp @@ -67,7 +67,7 @@ namespace swift::gui::components bool CConfigurationWizard::lastWizardStepSkipped(const QWizard *standardWizard) { - const CConfigurationWizard *wizard = qobject_cast(standardWizard); + const auto *wizard = qobject_cast(standardWizard); return wizard && wizard->lastStepSkipped(); } diff --git a/src/gui/components/coreinfoareacomponent.cpp b/src/gui/components/coreinfoareacomponent.cpp index cfda19c26..8e3bc7ebe 100644 --- a/src/gui/components/coreinfoareacomponent.cpp +++ b/src/gui/components/coreinfoareacomponent.cpp @@ -29,7 +29,7 @@ namespace swift::gui::components QSize CCoreInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const { - InfoArea area = static_cast(areaIndex); + auto area = static_cast(areaIndex); switch (area) { case InfoAreaLog: return QSize(400, 300); @@ -39,7 +39,7 @@ namespace swift::gui::components const QPixmap &CCoreInfoAreaComponent::indexToPixmap(int areaIndex) const { - InfoArea area = static_cast(areaIndex); + auto area = static_cast(areaIndex); switch (area) { case InfoAreaLog: return CIcons::appLog16(); diff --git a/src/gui/components/datainfoareacomponent.cpp b/src/gui/components/datainfoareacomponent.cpp index 57a650a5e..1127115d9 100644 --- a/src/gui/components/datainfoareacomponent.cpp +++ b/src/gui/components/datainfoareacomponent.cpp @@ -101,7 +101,7 @@ namespace swift::gui::components QSize CDataInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const { - InfoArea area = static_cast(areaIndex); + auto area = static_cast(areaIndex); switch (area) { case InfoAreaAircraftIcao: @@ -116,7 +116,7 @@ namespace swift::gui::components const QPixmap &CDataInfoAreaComponent::indexToPixmap(int areaIndex) const { - InfoArea area = static_cast(areaIndex); + auto area = static_cast(areaIndex); switch (area) { case InfoAreaAircraftIcao: return CIcons::appAircraftIcao16(); diff --git a/src/gui/components/datamaininfoareacomponent.cpp b/src/gui/components/datamaininfoareacomponent.cpp index ca9e425f6..45da54171 100644 --- a/src/gui/components/datamaininfoareacomponent.cpp +++ b/src/gui/components/datamaininfoareacomponent.cpp @@ -68,7 +68,7 @@ namespace swift::gui::components QSize CDataMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const { - const InfoArea area = static_cast(areaIndex); + const auto area = static_cast(areaIndex); switch (area) { case InfoAreaData: @@ -81,7 +81,7 @@ namespace swift::gui::components const QPixmap &CDataMainInfoAreaComponent::indexToPixmap(int areaIndex) const { - const InfoArea area = static_cast(areaIndex); + const auto area = static_cast(areaIndex); switch (area) { case InfoAreaData: return CIcons::appDatabase16(); diff --git a/src/gui/components/dbaircrafticaoselectorcomponent.cpp b/src/gui/components/dbaircrafticaoselectorcomponent.cpp index abaf28078..a89c972d8 100644 --- a/src/gui/components/dbaircrafticaoselectorcomponent.cpp +++ b/src/gui/components/dbaircrafticaoselectorcomponent.cpp @@ -151,13 +151,13 @@ namespace swift::gui::components { if (valueVariant.canConvert()) { - CAircraftIcaoCode icao(valueVariant.value()); + auto icao(valueVariant.value()); if (!icao.hasValidDbKey()) { return; } this->setAircraftIcao(icao); } else if (valueVariant.canConvert()) { - CAircraftIcaoCodeList icaos(valueVariant.value()); + auto icaos(valueVariant.value()); if (icaos.isEmpty()) { return; } this->setAircraftIcao(icaos.front()); } @@ -186,7 +186,7 @@ namespace swift::gui::components { if (count > 0) { - QCompleter *c = new QCompleter(this->completerStrings(), this); + auto *c = new QCompleter(this->completerStrings(), this); c->setCaseSensitivity(Qt::CaseInsensitive); c->setCompletionMode(QCompleter::PopupCompletion); c->setMaxVisibleItems(10); diff --git a/src/gui/components/dbairlineicaoselectorbase.cpp b/src/gui/components/dbairlineicaoselectorbase.cpp index d8fc476e3..3ea43da8b 100644 --- a/src/gui/components/dbairlineicaoselectorbase.cpp +++ b/src/gui/components/dbairlineicaoselectorbase.cpp @@ -104,13 +104,13 @@ namespace swift::gui::components { if (valueVariant.canConvert()) { - const CAirlineIcaoCode icao(valueVariant.value()); + const auto icao(valueVariant.value()); if (!icao.hasValidDbKey()) { return; } this->setAirlineIcao(icao); } else if (valueVariant.canConvert()) { - const CAirlineIcaoCodeList icaos(valueVariant.value()); + const auto icaos(valueVariant.value()); if (icaos.isEmpty()) { return; } this->setAirlineIcao(icaos.front()); } diff --git a/src/gui/components/dbairlineicaoselectorcomponent.cpp b/src/gui/components/dbairlineicaoselectorcomponent.cpp index c1a9d7a91..0c1efd373 100644 --- a/src/gui/components/dbairlineicaoselectorcomponent.cpp +++ b/src/gui/components/dbairlineicaoselectorcomponent.cpp @@ -79,7 +79,7 @@ namespace swift::gui::components QCompleter *CDbAirlineIcaoSelectorComponent::createCompleter() { - QCompleter *c = new QCompleter(completerStrings(), this); + auto *c = new QCompleter(completerStrings(), this); c->setCaseSensitivity(Qt::CaseInsensitive); c->setCompletionMode(QCompleter::PopupCompletion); c->setMaxVisibleItems(10); diff --git a/src/gui/components/dbairlinenameselectorcomponent.cpp b/src/gui/components/dbairlinenameselectorcomponent.cpp index 5e9360863..87de02469 100644 --- a/src/gui/components/dbairlinenameselectorcomponent.cpp +++ b/src/gui/components/dbairlinenameselectorcomponent.cpp @@ -51,8 +51,7 @@ namespace swift::gui::components QCompleter *CDbAirlineNameSelectorComponent::createCompleter() { - QCompleter *c = - new QCompleter(sGui->getWebDataServices()->getAirlineIcaoCodes().toNameCompleterStrings(), this); + auto *c = new QCompleter(sGui->getWebDataServices()->getAirlineIcaoCodes().toNameCompleterStrings(), this); c->setCaseSensitivity(Qt::CaseInsensitive); c->setCompletionMode(QCompleter::PopupCompletion); c->setMaxVisibleItems(10); diff --git a/src/gui/components/dbcountryselectorcomponent.cpp b/src/gui/components/dbcountryselectorcomponent.cpp index 83c302b2b..c51819e55 100644 --- a/src/gui/components/dbcountryselectorcomponent.cpp +++ b/src/gui/components/dbcountryselectorcomponent.cpp @@ -129,13 +129,13 @@ namespace swift::gui::components { if (valueVariant.canConvert()) { - const CCountry country(valueVariant.value()); + const auto country(valueVariant.value()); if (!country.hasIsoCode()) { return; } this->setCountry(country); } else if (valueVariant.canConvert()) { - const CCountryList countries(valueVariant.value()); + const auto countries(valueVariant.value()); if (countries.isEmpty()) { return; } this->setCountry(countries.front()); } @@ -150,7 +150,7 @@ namespace swift::gui::components { if (count > 0) { - QCompleter *c = new QCompleter(sGui->getWebDataServices()->getCountries().toNameList(), this); + auto *c = new QCompleter(sGui->getWebDataServices()->getCountries().toNameList(), this); c->setCaseSensitivity(Qt::CaseInsensitive); c->setCompletionMode(QCompleter::PopupCompletion); c->setMaxVisibleItems(10); diff --git a/src/gui/components/dbdistributorselectorcomponent.cpp b/src/gui/components/dbdistributorselectorcomponent.cpp index 7129b0635..e06495989 100644 --- a/src/gui/components/dbdistributorselectorcomponent.cpp +++ b/src/gui/components/dbdistributorselectorcomponent.cpp @@ -147,13 +147,13 @@ namespace swift::gui::components { if (valueVariant.canConvert()) { - CDistributor distributor(valueVariant.value()); + auto distributor(valueVariant.value()); if (!distributor.hasValidDbKey()) { return; } this->setDistributor(distributor); } else if (valueVariant.canConvert()) { - CDistributorList distributors(valueVariant.value()); + auto distributors(valueVariant.value()); if (distributors.isEmpty()) { return; } this->setDistributor(distributors.front()); } @@ -170,7 +170,7 @@ namespace swift::gui::components { const QStringList keysAndAliases( sGui->getWebDataServices()->getDistributors().getDbKeysAndAliases(true)); - QCompleter *c = new QCompleter(keysAndAliases, this); + auto *c = new QCompleter(keysAndAliases, this); c->setCaseSensitivity(Qt::CaseInsensitive); c->setCompletionMode(QCompleter::PopupCompletion); c->setMaxVisibleItems(10); diff --git a/src/gui/components/dbliveryselectorcomponent.cpp b/src/gui/components/dbliveryselectorcomponent.cpp index 560f13afa..076e74309 100644 --- a/src/gui/components/dbliveryselectorcomponent.cpp +++ b/src/gui/components/dbliveryselectorcomponent.cpp @@ -167,13 +167,13 @@ namespace swift::gui::components { if (valueVariant.canConvert()) { - const CLivery livery(valueVariant.value()); + const auto livery(valueVariant.value()); if (!livery.hasValidDbKey()) { return; } this->setLivery(livery); } else if (valueVariant.canConvert()) { - const CLiveryList liveries(valueVariant.value()); + const auto liveries(valueVariant.value()); if (liveries.isEmpty()) { return; } this->setLivery(liveries.front()); } @@ -191,7 +191,7 @@ namespace swift::gui::components if (count > 0) { const QStringList codes(sGui->getWebDataServices()->getLiveries().getCombinedCodesPlusInfoAndId(true)); - QCompleter *c = new QCompleter(codes, this); + auto *c = new QCompleter(codes, this); c->setCaseSensitivity(Qt::CaseInsensitive); c->setCompletionMode(QCompleter::PopupCompletion); c->setMaxVisibleItems(10); diff --git a/src/gui/components/dbloaddatadialog.cpp b/src/gui/components/dbloaddatadialog.cpp index 78f8c7c3b..3376e2c13 100644 --- a/src/gui/components/dbloaddatadialog.cpp +++ b/src/gui/components/dbloaddatadialog.cpp @@ -30,7 +30,7 @@ namespace swift::gui::components Q_ASSERT_X(sGui, Q_FUNC_INFO, "Need sGui"); ui->setupUi(this); this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); - QStringListModel *lvm = new QStringListModel(ui->lv_Entities); + auto *lvm = new QStringListModel(ui->lv_Entities); ui->comp_SimulatorSelector->setMode(CSimulatorSelector::RadioButtons); ui->lv_Entities->setModel(lvm); ui->bb_loadDataDialog->button(QDialogButtonBox::Apply)->setText("Load"); diff --git a/src/gui/components/dbmappingcomponent.cpp b/src/gui/components/dbmappingcomponent.cpp index cb8af7ca7..beaa8de50 100644 --- a/src/gui/components/dbmappingcomponent.cpp +++ b/src/gui/components/dbmappingcomponent.cpp @@ -451,7 +451,7 @@ namespace swift::gui::components m_modelModifyDialog->setValue(ui->comp_StashAircraft->view()->selectedObject()); } - const QDialog::DialogCode s = static_cast(m_modelModifyDialog->exec()); + const auto s = static_cast(m_modelModifyDialog->exec()); if (s == QDialog::Rejected) { return; } const CPropertyIndexVariantMap vm = m_modelModifyDialog->getValues(); ui->comp_StashAircraft->applyToSelected(vm); @@ -564,7 +564,7 @@ namespace swift::gui::components void CDbMappingComponent::onTabIndexChanged(int index) { - const CDbMappingComponent::TabIndex ti = static_cast(index); + const auto ti = static_cast(index); switch (ti) { case CDbMappingComponent::TabOwnModelSet: @@ -850,7 +850,7 @@ namespace swift::gui::components void CDbMappingComponent::CMappingVPilotMenu::customMenu(CMenuActions &menuActions) { - CDbMappingComponent *mapComp = qobject_cast(this->parent()); + auto *mapComp = qobject_cast(this->parent()); Q_ASSERT_X(mapComp, Q_FUNC_INFO, "Cannot access mapping component"); const bool canUseVPilot = mappingComponent()->withVPilot(); diff --git a/src/gui/components/dbmappingcomponentaware.cpp b/src/gui/components/dbmappingcomponentaware.cpp index 2c3720dbb..5a50375b4 100644 --- a/src/gui/components/dbmappingcomponentaware.cpp +++ b/src/gui/components/dbmappingcomponentaware.cpp @@ -21,7 +21,7 @@ namespace swift::gui::components // if we get a mapping component we use it if (!parent) { return; } if (!parent->isWidgetType()) { return; } - CDbMappingComponent *m = qobject_cast(parent); + auto *m = qobject_cast(parent); if (!m) { return; } m_mappingComponent = m; } diff --git a/src/gui/components/dbownmodelscomponent.cpp b/src/gui/components/dbownmodelscomponent.cpp index 6b94c12c2..1a24f7f47 100644 --- a/src/gui/components/dbownmodelscomponent.cpp +++ b/src/gui/components/dbownmodelscomponent.cpp @@ -282,7 +282,7 @@ namespace swift::gui::components QStringLiteral("Completely reload '%1' models from disk?").arg(simulator.toQString(true)), QMessageBox::Ok | QMessageBox::Cancel, this); msgBox.setDefaultButton(QMessageBox::Cancel); - const QMessageBox::StandardButton reply = static_cast(msgBox.exec()); + const auto reply = static_cast(msgBox.exec()); if (reply != QMessageBox::Ok) { return; } this->requestSimulatorModels(simulator, IAircraftModelLoader::InBackgroundNoCache); @@ -497,7 +497,7 @@ namespace swift::gui::components "override the loaded models from the simulator.\nNormally you would not want that (cancel).", QMessageBox::Save | QMessageBox::Cancel, this); msgBox.setDefaultButton(QMessageBox::Cancel); - const QMessageBox::StandardButton reply = static_cast(msgBox.exec()); + const auto reply = static_cast(msgBox.exec()); if (reply != QMessageBox::Cancel) { return; } const CAircraftModelList models = ui->tvp_OwnAircraftModels->container(); if (models.isEmpty()) { return; } diff --git a/src/gui/components/dbownmodelsetcomponent.cpp b/src/gui/components/dbownmodelsetcomponent.cpp index 39fe3a1c9..4c39cb7f0 100644 --- a/src/gui/components/dbownmodelsetcomponent.cpp +++ b/src/gui/components/dbownmodelsetcomponent.cpp @@ -335,7 +335,7 @@ namespace swift::gui::components CAircraftModelList models = ui->tvp_OwnModelSet->containerOrFilteredContainer(); const CSimulatorInfo simulator = this->getModelSetSimulator(); m_reduceModelsDialog->setModels(models, simulator); - const QDialog::DialogCode ret = static_cast(m_reduceModelsDialog->exec()); + const auto ret = static_cast(m_reduceModelsDialog->exec()); if (ret != QDialog::Accepted) { return; } const CAircraftModelList removeModels = m_reduceModelsDialog->getRemoveCandidates(); const CSimulatorInfo removeSimulator = m_reduceModelsDialog->getSimulator(); @@ -412,7 +412,7 @@ namespace swift::gui::components { m_modelSetFormDialog->setModal(true); m_modelSetFormDialog->reloadData(); - const QDialog::DialogCode rc = static_cast(m_modelSetFormDialog->exec()); + const auto rc = static_cast(m_modelSetFormDialog->exec()); if (rc == QDialog::Accepted) { this->setModelSet(m_modelSetFormDialog->getModelSet(), m_modelSetFormDialog->getSimulatorInfo()); @@ -504,13 +504,13 @@ namespace swift::gui::components const bool noSims = sims.isNoSimulator() || sims.isUnspecified(); if (!noSims) { - CDbOwnModelSetComponent *ownModelSetComp = qobject_cast(this->parent()); + auto *ownModelSetComp = qobject_cast(this->parent()); Q_ASSERT_X(ownModelSetComp, Q_FUNC_INFO, "Cannot access parent"); if (m_setActions.isEmpty()) { if (sims.isFSX()) { - QAction *a = new QAction(CIcons::appModels16(), "FSX models", this); + auto *a = new QAction(CIcons::appModels16(), "FSX models", this); connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked) { Q_UNUSED(checked) ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::FSX)); @@ -526,7 +526,7 @@ namespace swift::gui::components } if (sims.isP3D()) { - QAction *a = new QAction(CIcons::appModels16(), "P3D models", this); + auto *a = new QAction(CIcons::appModels16(), "P3D models", this); connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked) { Q_UNUSED(checked) ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::P3D)); @@ -542,7 +542,7 @@ namespace swift::gui::components } if (sims.isFS9()) { - QAction *a = new QAction(CIcons::appModels16(), "FS9 models", this); + auto *a = new QAction(CIcons::appModels16(), "FS9 models", this); connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked) { Q_UNUSED(checked) ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::FS9)); @@ -558,7 +558,7 @@ namespace swift::gui::components } if (sims.isXPlane()) { - QAction *a = new QAction(CIcons::appModels16(), "XPlane models", this); + auto *a = new QAction(CIcons::appModels16(), "XPlane models", this); connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked) { Q_UNUSED(checked) ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::XPLANE)); @@ -574,7 +574,7 @@ namespace swift::gui::components } if (sims.isFG()) { - QAction *a = new QAction(CIcons::appModels16(), "FG models", this); + auto *a = new QAction(CIcons::appModels16(), "FG models", this); connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked) { Q_UNUSED(checked) ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::FG)); @@ -590,7 +590,7 @@ namespace swift::gui::components } if (sims.isMSFS()) { - QAction *a = new QAction(CIcons::appModels16(), "MSFS models", this); + auto *a = new QAction(CIcons::appModels16(), "MSFS models", this); connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked) { Q_UNUSED(checked) ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::MSFS)); @@ -606,7 +606,7 @@ namespace swift::gui::components } if (sims.isMSFS2024()) { - QAction *a = new QAction(CIcons::appModels16(), "MSFS2024 models", this); + auto *a = new QAction(CIcons::appModels16(), "MSFS2024 models", this); connect(a, &QAction::triggered, ownModelSetComp, [ownModelSetComp](bool checked) { Q_UNUSED(checked) ownModelSetComp->setSimulator(CSimulatorInfo(CSimulatorInfo::MSFS2024)); @@ -621,7 +621,7 @@ namespace swift::gui::components m_setNewActions.append(a); } - QAction *a = new QAction(CIcons::appDistributors16(), "Apply distributor preferences", this); + auto *a = new QAction(CIcons::appDistributors16(), "Apply distributor preferences", this); connect(a, &QAction::triggered, ownModelSetComp, &CDbOwnModelSetComponent::distributorPreferencesChanged, Qt::QueuedConnection); m_setActions.append(a); diff --git a/src/gui/components/dbreducemodelduplicates.cpp b/src/gui/components/dbreducemodelduplicates.cpp index 93790acfc..ec14d0874 100644 --- a/src/gui/components/dbreducemodelduplicates.cpp +++ b/src/gui/components/dbreducemodelduplicates.cpp @@ -61,7 +61,7 @@ namespace swift::gui::components const QStringList distributors = models.getDistributors().getDbKeysAndAliases(true); const int distributorCount = m_models.getDistributors().sizeInt(); - QCompleter *c = new QCompleter(distributors, this); + auto *c = new QCompleter(distributors, this); c->setCaseSensitivity(Qt::CaseInsensitive); ui->le_Distributor->setCompleter(c); ui->le_Models->setText(QStringLiteral("%1 models for simulator '%2', distributors: %3") diff --git a/src/gui/components/flightplancomponent.cpp b/src/gui/components/flightplancomponent.cpp index 5f703e803..053eedf78 100644 --- a/src/gui/components/flightplancomponent.cpp +++ b/src/gui/components/flightplancomponent.cpp @@ -107,7 +107,7 @@ namespace swift::gui::components ui->le_NavComEquipment->setReadOnly(true); ui->le_SsrEquipment->setReadOnly(true); - CUpperCaseEventFilter *ef = new CUpperCaseEventFilter(ui->pte_Route); + auto *ef = new CUpperCaseEventFilter(ui->pte_Route); ui->pte_Route->installEventFilter(ef); ef = new CUpperCaseEventFilter(ui->pte_Remarks); ui->pte_Remarks->installEventFilter(ef); @@ -822,7 +822,7 @@ namespace swift::gui::components { if (!m_altitudeDialog) { m_altitudeDialog = new CAltitudeDialog(this); } - const QDialog::DialogCode ret = static_cast(m_altitudeDialog->exec()); + const auto ret = static_cast(m_altitudeDialog->exec()); if (ret != QDialog::Accepted) { return; } if (!m_altitudeDialog->getAltitudeString().isEmpty()) @@ -1073,7 +1073,7 @@ namespace swift::gui::components { if (!sGui || !sGui->hasWebDataServices()) { return; } const QStringList aircraft(sGui->getWebDataServices()->getAircraftIcaoCodes().allDesignators().values()); - QCompleter *aircraftCompleter = new QCompleter(aircraft, this); + auto *aircraftCompleter = new QCompleter(aircraft, this); aircraftCompleter->setMaxVisibleItems(10); const int w5chars1 = aircraftCompleter->popup()->fontMetrics().size(Qt::TextSingleLine, "FooBa").width(); aircraftCompleter->popup()->setMinimumWidth(w5chars1 * 5); @@ -1082,7 +1082,7 @@ namespace swift::gui::components ui->le_AircraftType->setCompleter(aircraftCompleter); const QStringList airports = sGui->getWebDataServices()->getAirports().allIcaoCodes(true); - QCompleter *airportCompleter = new QCompleter(airports, this); + auto *airportCompleter = new QCompleter(airports, this); airportCompleter->setMaxVisibleItems(10); const int w5chars2 = airportCompleter->popup()->fontMetrics().size(Qt::TextSingleLine, "FooBa").width(); airportCompleter->popup()->setMinimumWidth(w5chars2 * 5); diff --git a/src/gui/components/hotkeydialog.cpp b/src/gui/components/hotkeydialog.cpp index 5bba5763e..02389b3f2 100644 --- a/src/gui/components/hotkeydialog.cpp +++ b/src/gui/components/hotkeydialog.cpp @@ -201,7 +201,7 @@ namespace swift::gui::components int currentIndex = 0; const bool select = !keyboardKey.isUnknown(); - CKeySelectionBox *ksb = new CKeySelectionBox(ui->qf_Advanced); + auto *ksb = new CKeySelectionBox(ui->qf_Advanced); ksb->addItem(noKeyButton(), QVariant::fromValue(CKeyboardKey())); // at front for (const CKeyboardKey &supportedKey : allSupportedKeys) { @@ -225,7 +225,7 @@ namespace swift::gui::components { int currentIndex = -1; - CKeySelectionBox *ksb = new CKeySelectionBox(ui->qf_Advanced); + auto *ksb = new CKeySelectionBox(ui->qf_Advanced); ksb->addItem(noKeyButton(), QVariant::fromValue(CJoystickButton())); // at front for (const CJoystickButton &availableButton : allAvailableButtons) { @@ -344,8 +344,8 @@ namespace swift::gui::components if (ksb->itemData(oldIndex).canConvert() && ksb->itemData(newIndex).canConvert()) { - CKeyboardKey oldKey = ksb->itemData(oldIndex).value(); - CKeyboardKey newKey = ksb->itemData(newIndex).value(); + auto oldKey = ksb->itemData(oldIndex).value(); + auto newKey = ksb->itemData(newIndex).value(); CHotkeyCombination combination = m_actionHotkey.getCombination(); if (newKey.isUnknown()) { combination.removeKeyboardKey(oldKey); } @@ -356,8 +356,8 @@ namespace swift::gui::components if (ksb->itemData(oldIndex).canConvert() && ksb->itemData(newIndex).canConvert()) { - CJoystickButton oldButton = ksb->itemData(oldIndex).value(); - CJoystickButton newButton = ksb->itemData(newIndex).value(); + auto oldButton = ksb->itemData(oldIndex).value(); + auto newButton = ksb->itemData(newIndex).value(); CHotkeyCombination combination = m_actionHotkey.getCombination(); if (!newButton.isValid()) { combination.removeJoystickButton(oldButton); } diff --git a/src/gui/components/interpolationsetupcomponent.cpp b/src/gui/components/interpolationsetupcomponent.cpp index 2da8475c0..7769189b8 100644 --- a/src/gui/components/interpolationsetupcomponent.cpp +++ b/src/gui/components/interpolationsetupcomponent.cpp @@ -260,7 +260,7 @@ namespace swift::gui::components { if (deletedObjects.canConvert()) { - const CInterpolationSetupList deletedSetups = deletedObjects.value(); + const auto deletedSetups = deletedObjects.value(); if (deletedSetups.isEmpty()) { return; } // make sure the setups are really deleted diff --git a/src/gui/components/logincomponent.cpp b/src/gui/components/logincomponent.cpp index 308742730..8a083a58c 100644 --- a/src/gui/components/logincomponent.cpp +++ b/src/gui/components/logincomponent.cpp @@ -309,7 +309,7 @@ namespace swift::gui::components void CLoginComponent::onSimulatorStatusChanged(int status) { - ISimulator::SimulatorStatus s = static_cast(status); + auto s = static_cast(status); if (!this->hasValidContexts()) { return; } m_simulatorConnected = s.testFlag(ISimulator::Connected); this->updateUiConnectState(); diff --git a/src/gui/components/maininfoareacomponent.cpp b/src/gui/components/maininfoareacomponent.cpp index de170547c..e07abca16 100644 --- a/src/gui/components/maininfoareacomponent.cpp +++ b/src/gui/components/maininfoareacomponent.cpp @@ -78,7 +78,7 @@ namespace swift::gui::components QSize CMainInfoAreaComponent::getPreferredSizeWhenFloating(int areaIndex) const { - const InfoArea area = static_cast(areaIndex); + const auto area = static_cast(areaIndex); switch (area) { case InfoAreaCockpit: @@ -111,7 +111,7 @@ namespace swift::gui::components const QPixmap &CMainInfoAreaComponent::indexToPixmap(int areaIndex) const { - const InfoArea area = static_cast(areaIndex); + const auto area = static_cast(areaIndex); switch (area) { case InfoAreaCockpit: return CIcons::appCockpit16(); diff --git a/src/gui/components/mainkeypadareacomponent.cpp b/src/gui/components/mainkeypadareacomponent.cpp index 857869dcc..54573393c 100644 --- a/src/gui/components/mainkeypadareacomponent.cpp +++ b/src/gui/components/mainkeypadareacomponent.cpp @@ -113,7 +113,7 @@ namespace swift::gui::components void CMainKeypadAreaComponent::buttonSelected() { if (!sGui || sGui->isShuttingDown()) { return; } - QPushButton *senderButton = static_cast(QObject::sender()); + auto *senderButton = static_cast(QObject::sender()); Q_ASSERT_X(senderButton, Q_FUNC_INFO, "No sender button"); if (!senderButton) { return; } const CMainInfoAreaComponent::InfoArea infoArea = buttonToMainInfoArea(senderButton); diff --git a/src/gui/components/mappingcomponent.cpp b/src/gui/components/mappingcomponent.cpp index f10c29591..6fc561cc8 100644 --- a/src/gui/components/mappingcomponent.cpp +++ b/src/gui/components/mappingcomponent.cpp @@ -239,7 +239,7 @@ namespace swift::gui::components void CMappingComponent::onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index) { if (!index.contains(CSimulatedAircraft::IndexEnabled)) { return; } // we only deal with enabled/disabled here - const CSimulatedAircraft sa = object.to(); // changed in GUI + const auto sa = object.to(); // changed in GUI const CSimulatedAircraft saFromBackend = sGui->getIContextNetwork()->getAircraftInRangeForCallsign(sa.getCallsign()); if (!saFromBackend.hasValidCallsign()) { return; } // obviously deleted @@ -520,7 +520,7 @@ namespace swift::gui::components void CMappingComponent::onTabWidgetChanged(int index) { Q_UNUSED(index); - const TabWidget w = static_cast(index); + const auto w = static_cast(index); const bool show = (w == TabAircraftModels) || (w == TabRenderedAircraft); this->showAircraftModelDetails(show); } diff --git a/src/gui/components/marginsinput.cpp b/src/gui/components/marginsinput.cpp index 53ff6f982..0b6f2f91b 100644 --- a/src/gui/components/marginsinput.cpp +++ b/src/gui/components/marginsinput.cpp @@ -20,7 +20,7 @@ namespace swift::gui::components connect(ui->le_Right, &QLineEdit::returnPressed, this, &CMarginsInput::confirmed); connect(ui->le_Top, &QLineEdit::returnPressed, this, &CMarginsInput::confirmed); - QIntValidator *v = new QIntValidator(0, 100, this); + auto *v = new QIntValidator(0, 100, this); ui->le_Bottom->setValidator(v); ui->le_Left->setValidator(v); ui->le_Right->setValidator(v); diff --git a/src/gui/components/modelmatchercomponent.cpp b/src/gui/components/modelmatchercomponent.cpp index 61adff8a4..0e1c443d1 100644 --- a/src/gui/components/modelmatchercomponent.cpp +++ b/src/gui/components/modelmatchercomponent.cpp @@ -214,7 +214,7 @@ namespace swift::gui::components { if (!m_settingsDialog) { m_settingsDialog = new CSettingsMatchingDialog(this); } m_settingsDialog->setMatchingSetup(m_matcher.getSetup()); - const QDialog::DialogCode r = static_cast(m_settingsDialog->exec()); + const auto r = static_cast(m_settingsDialog->exec()); if (r == QDialog::Accepted) { m_matcher.setSetup(m_settingsDialog->getMatchingSetup()); } } diff --git a/src/gui/components/navigatordialog.cpp b/src/gui/components/navigatordialog.cpp index 3ee0477d6..ff0825442 100644 --- a/src/gui/components/navigatordialog.cpp +++ b/src/gui/components/navigatordialog.cpp @@ -89,7 +89,7 @@ namespace swift::gui::components CGuiUtility::deleteLayout(ui->fr_NavigatorDialogInner->layout(), false); // new layout - QGridLayout *gridLayout = new QGridLayout(ui->fr_NavigatorDialogInner); + auto *gridLayout = new QGridLayout(ui->fr_NavigatorDialogInner); gridLayout->setObjectName("gl_CNavigatorDialog"); gridLayout->setSpacing(0); gridLayout->setContentsMargins(0, 0, 0, 0); @@ -101,7 +101,7 @@ namespace swift::gui::components for (QAction *action : this->actions()) { if (!action) { continue; } - QToolButton *tb = new QToolButton(ui->fr_NavigatorDialogInner); + auto *tb = new QToolButton(ui->fr_NavigatorDialogInner); tb->setDefaultAction(action); tb->setObjectName(this->objectName() % u':' % action->objectName()); if (!action->text().isEmpty()) { tb->setToolTip(action->text()); } @@ -266,7 +266,7 @@ namespace swift::gui::components void CNavigatorDialog::changeLayout() { - QAction *a = qobject_cast(QObject::sender()); + auto *a = qobject_cast(QObject::sender()); if (!a) { return; } QString v(a->data().toString()); if (v == "1c") { buildNavigator(1); } diff --git a/src/gui/components/networkdetailscomponent.cpp b/src/gui/components/networkdetailscomponent.cpp index 01f7a7359..f564da719 100644 --- a/src/gui/components/networkdetailscomponent.cpp +++ b/src/gui/components/networkdetailscomponent.cpp @@ -43,7 +43,7 @@ namespace swift::gui::components constexpr int MaxLength = 10; constexpr int MinLength = 0; - CUpperCaseValidator *ucv = new CUpperCaseValidator(MinLength, MaxLength, ui->le_PartnerCallsign); + auto *ucv = new CUpperCaseValidator(MinLength, MaxLength, ui->le_PartnerCallsign); ucv->setAllowedCharacters09AZ(); ui->le_PartnerCallsign->setMaxLength(MaxLength); ui->le_PartnerCallsign->setValidator(ucv); diff --git a/src/gui/components/otherswiftversionscomponent.cpp b/src/gui/components/otherswiftversionscomponent.cpp index 99df32a00..aac00a3e7 100644 --- a/src/gui/components/otherswiftversionscomponent.cpp +++ b/src/gui/components/otherswiftversionscomponent.cpp @@ -68,7 +68,7 @@ namespace swift::gui::components void COtherSwiftVersionsComponent::onObjectSelected(const CVariant &object) { if (!object.canConvert()) { return; } - const CApplicationInfo info(object.value()); + const auto info(object.value()); emit this->versionChanged(info); } } // namespace swift::gui::components diff --git a/src/gui/components/ownaircraftcomponent.cpp b/src/gui/components/ownaircraftcomponent.cpp index e897cbdea..87be26428 100644 --- a/src/gui/components/ownaircraftcomponent.cpp +++ b/src/gui/components/ownaircraftcomponent.cpp @@ -48,7 +48,7 @@ namespace swift::gui::components constexpr int MaxLength = 10; constexpr int MinLength = 0; - CUpperCaseValidator *ucv = new CUpperCaseValidator(MinLength, MaxLength, ui->le_Callsign); + auto *ucv = new CUpperCaseValidator(MinLength, MaxLength, ui->le_Callsign); ucv->setAllowedCharacters09AZ(); ui->le_Callsign->setMaxLength(MaxLength); ui->le_Callsign->setValidator(ucv); @@ -130,7 +130,7 @@ namespace swift::gui::components void COwnAircraftComponent::onSimulatorStatusChanged(int status) { - ISimulator::SimulatorStatus s = static_cast(status); + auto s = static_cast(status); Q_UNUSED(s); if (!this->hasValidContexts()) { return; } if (sGui->getIContextNetwork()->isConnected()) diff --git a/src/gui/components/radarcomponent.cpp b/src/gui/components/radarcomponent.cpp index 08b76381f..975f2b9d1 100644 --- a/src/gui/components/radarcomponent.cpp +++ b/src/gui/components/radarcomponent.cpp @@ -87,11 +87,11 @@ namespace swift::gui::components { QPen pen(Qt::white, 1); pen.setCosmetic(true); - QGraphicsLineItem *lix = new QGraphicsLineItem { QLineF(-5.0, 0.0, 5.0, 0.0), &m_center }; + auto *lix = new QGraphicsLineItem { QLineF(-5.0, 0.0, 5.0, 0.0), &m_center }; lix->setFlags(QGraphicsItem::ItemIgnoresTransformations); lix->setPen(pen); - QGraphicsLineItem *liy = new QGraphicsLineItem(QLineF(0.0, -5.0, 0.0, 5.0), &m_center); + auto *liy = new QGraphicsLineItem(QLineF(0.0, -5.0, 0.0, 5.0), &m_center); liy->setFlags(QGraphicsItem::ItemIgnoresTransformations); liy->setPen(pen); } @@ -104,8 +104,7 @@ namespace swift::gui::components // Macro graticule, drawn as full line at every 10 nm for (int range = 10; range <= 100; range += 10) { - QGraphicsEllipseItem *circle = - new QGraphicsEllipseItem(-range, -range, 2.0 * range, 2.0 * range, &m_macroGraticule); + auto *circle = new QGraphicsEllipseItem(-range, -range, 2.0 * range, 2.0 * range, &m_macroGraticule); circle->setPen(pen); } pen = QPen(Qt::gray, 1, Qt::DashLine); @@ -114,7 +113,7 @@ namespace swift::gui::components // Micro graticule, drawn as dash line at every 2.5 nm for (qreal range = 1; range <= 3; ++range) { - QGraphicsEllipseItem *circle = + auto *circle = new QGraphicsEllipseItem(-range * 2.5, -range * 2.5, 5.0 * range, 5.0 * range, &m_microGraticule); circle->setPen(pen); } @@ -128,7 +127,7 @@ namespace swift::gui::components for (int angle = 0; angle < 360; angle += 30) { const QLineF line({ 0.0, 0.0 }, polarPoint(1000.0, qDegreesToRadians(static_cast(angle)))); - QGraphicsLineItem *li = new QGraphicsLineItem(line, &m_radials); + auto *li = new QGraphicsLineItem(line, &m_radials); li->setFlags(QGraphicsItem::ItemIgnoresTransformations); li->setPen(pen); } @@ -153,13 +152,13 @@ namespace swift::gui::components QPointF position(polarPoint(distanceNM, bearingRad)); - QGraphicsEllipseItem *dot = new QGraphicsEllipseItem(-2.0, -2.0, 4.0, 4.0, &m_radarTargets); + auto *dot = new QGraphicsEllipseItem(-2.0, -2.0, 4.0, 4.0, &m_radarTargets); dot->setPos(position); dot->setPen(m_radarTargetPen); dot->setBrush(m_radarTargetPen.color()); dot->setFlags(QGraphicsItem::ItemIgnoresTransformations); - QGraphicsTextItem *tag = new QGraphicsTextItem(&m_radarTargets); + auto *tag = new QGraphicsTextItem(&m_radarTargets); QString tagText; if (ui->cb_Callsign->isChecked()) { tagText += sa.getCallsignAsString() % u"\n"; } if (ui->cb_Altitude->isChecked()) @@ -184,7 +183,7 @@ namespace swift::gui::components const double headingRad = sa.getHeading().value(CAngleUnit::rad()); QPen pen(Qt::green, 1); pen.setCosmetic(true); - QGraphicsLineItem *li = + auto *li = new QGraphicsLineItem(QLineF({ 0.0, 0.0 }, polarPoint(5.0, headingRad)), &m_radarTargets); li->setPos(position); li->setPen(pen); diff --git a/src/gui/components/rawfsdmessagescomponent.cpp b/src/gui/components/rawfsdmessagescomponent.cpp index b1eb77f8e..fbd02fddf 100644 --- a/src/gui/components/rawfsdmessagescomponent.cpp +++ b/src/gui/components/rawfsdmessagescomponent.cpp @@ -198,8 +198,7 @@ namespace swift::gui::components void CRawFsdMessagesComponent::changeFileWritingMode() { - const CRawFsdMessageSettings::FileWriteMode mode = - ui->cb_FileWritingMode->currentData().value(); + const auto mode = ui->cb_FileWritingMode->currentData().value(); m_setting.setProperty(vatsim::CRawFsdMessageSettings::IndexFileWriteMode, CVariant::fromValue(mode)); } diff --git a/src/gui/components/settingshotkeycomponent.cpp b/src/gui/components/settingshotkeycomponent.cpp index e0a2e83b7..92f263072 100644 --- a/src/gui/components/settingshotkeycomponent.cpp +++ b/src/gui/components/settingshotkeycomponent.cpp @@ -93,8 +93,7 @@ namespace swift::gui::components const QModelIndex indexHotkey = model->index(index.row(), 0, QModelIndex()); Q_ASSERT_X(indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).canConvert(), Q_FUNC_INFO, "No action hotkey"); - const CActionHotkey actionHotkey = - indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).value(); + const auto actionHotkey = indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).value(); const CActionHotkey selectedActionHotkey = CHotkeyDialog::getActionHotkey(actionHotkey, getAllIdentifiers(), this); if (selectedActionHotkey.isValid() && checkAndConfirmConflicts(selectedActionHotkey, { actionHotkey })) @@ -115,8 +114,7 @@ namespace swift::gui::components const QModelIndexList indexes = ui->tv_Hotkeys->selectionModel()->selectedRows(); for (const auto &index : indexes) { - const CActionHotkey actionHotkey = - index.data(CActionHotkeyListModel::ActionHotkeyRole).value(); + const auto actionHotkey = index.data(CActionHotkeyListModel::ActionHotkeyRole).value(); removeHotkeyFromSettings(actionHotkey); m_model.removeRows(index.row(), 1, QModelIndex()); } @@ -213,7 +211,7 @@ namespace swift::gui::components { if (keyDown) { - QMessageBox *msgBox = new QMessageBox(this); + auto *msgBox = new QMessageBox(this); msgBox->setAttribute(Qt::WA_DeleteOnClose); msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setWindowTitle("Test"); diff --git a/src/gui/components/settingssimulatorcomponent.cpp b/src/gui/components/settingssimulatorcomponent.cpp index 4c87ccb36..6d04a9580 100644 --- a/src/gui/components/settingssimulatorcomponent.cpp +++ b/src/gui/components/settingssimulatorcomponent.cpp @@ -377,7 +377,7 @@ namespace swift::gui::components const CSimulatorPluginInfo selected = simDrivers.findByIdentifier(identifier); const QString configId = m_plugins->getPluginConfigId(selected.getIdentifier()); - IPluginConfig *config = m_plugins->getPluginById(configId); + auto *config = m_plugins->getPluginById(configId); SWIFT_VERIFY_X(config, Q_FUNC_INFO, "Missing config"); if (!config) { return; } diff --git a/src/gui/components/settingstextmessagestyle.cpp b/src/gui/components/settingstextmessagestyle.cpp index fddadb127..47d839cbb 100644 --- a/src/gui/components/settingstextmessagestyle.cpp +++ b/src/gui/components/settingstextmessagestyle.cpp @@ -54,7 +54,7 @@ namespace swift::gui::components m_fontSettingsDialog->setWithColorSelection(false); } - const QDialog::DialogCode r = static_cast(m_fontSettingsDialog->exec()); + const auto r = static_cast(m_fontSettingsDialog->exec()); if (r == QDialog::Accepted) { const QStringList familySizeStyle = this->getFamilySizeStyle(); @@ -72,7 +72,7 @@ namespace swift::gui::components } m_textEditDialog->textEdit()->setPlainText(m_style); - const QDialog::DialogCode r = static_cast(m_textEditDialog->exec()); + const auto r = static_cast(m_textEditDialog->exec()); if (r == QDialog::Accepted) { m_style = m_textEditDialog->textEdit()->toPlainText(); diff --git a/src/gui/components/simulatorcomponent.cpp b/src/gui/components/simulatorcomponent.cpp index aa0b0d6e3..332d3c158 100644 --- a/src/gui/components/simulatorcomponent.cpp +++ b/src/gui/components/simulatorcomponent.cpp @@ -214,7 +214,7 @@ namespace swift::gui::components void CSimulatorComponent::onSimulatorStatusChanged(int status) { - ISimulator::SimulatorStatus simStatus = static_cast(status); + auto simStatus = static_cast(status); this->clear(); // clean up, will be refreshed if (simStatus.testFlag(ISimulator::Connected)) { diff --git a/src/gui/components/statusmessagesdetail.cpp b/src/gui/components/statusmessagesdetail.cpp index 53abba683..355decb53 100644 --- a/src/gui/components/statusmessagesdetail.cpp +++ b/src/gui/components/statusmessagesdetail.cpp @@ -121,7 +121,7 @@ namespace swift::gui::components void CStatusMessagesDetail::CMessageMenu::customMenu(CMenuActions &menuActions) { - CStatusMessagesDetail *messagesDetail = qobject_cast(this->parent()); + auto *messagesDetail = qobject_cast(this->parent()); Q_ASSERT_X(messagesDetail, Q_FUNC_INFO, "Missing parent"); const bool v = messagesDetail->ui->form_StatusMessage->isVisible(); diff --git a/src/gui/components/textmessagecomponent.cpp b/src/gui/components/textmessagecomponent.cpp index b9914cbd5..87c24172c 100644 --- a/src/gui/components/textmessagecomponent.cpp +++ b/src/gui/components/textmessagecomponent.cpp @@ -477,12 +477,12 @@ namespace swift::gui::components const QString tabName = callsign.asString(); const QString style = this->getStyleSheet(); const bool supervisor = callsign.isSupervisorCallsign(); - QWidget *newTabWidget = new QWidget(this); + auto *newTabWidget = new QWidget(this); newTabWidget->setObjectName(u"Tab widget " % tabName); newTabWidget->setProperty("callsign", callsign.asString()); - QPushButton *closeButton = new QPushButton("Close", newTabWidget); - QVBoxLayout *layout = new QVBoxLayout(newTabWidget); - CTextMessageTextEdit *textEdit = new CTextMessageTextEdit(newTabWidget); + auto *closeButton = new QPushButton("Close", newTabWidget); + auto *layout = new QVBoxLayout(newTabWidget); + auto *textEdit = new CTextMessageTextEdit(newTabWidget); textEdit->setObjectName("tep_" + tabName); int marginLeft, marginRight, marginTop, marginBottom; ui->tb_TextMessagesAll->layout()->getContentsMargins(&marginLeft, &marginTop, &marginRight, &marginBottom); @@ -495,7 +495,7 @@ namespace swift::gui::components textEdit->setStyleSheetForContent(style); const int index = ui->tw_TextMessages->addTab(newTabWidget, this->getCallsignAndRealName(callsign)); - QToolButton *closeButtonInTab = new QToolButton(newTabWidget); + auto *closeButtonInTab = new QToolButton(newTabWidget); closeButtonInTab->setText("[X]"); closeButtonInTab->setProperty("supervisormsg", supervisor); QTabBar *bar = ui->tw_TextMessages->tabBar(); @@ -570,7 +570,7 @@ namespace swift::gui::components const QWidget *tab = this->findTextMessageTabByCallsign(cs); if (!tab) { tab = this->addNewTextMessageTab(cs); } Q_ASSERT_X(tab, Q_FUNC_INFO, "Missing tab"); - CTextMessageTextEdit *textEdit = tab->findChild(); + auto *textEdit = tab->findChild(); SWIFT_VERIFY_X(textEdit, Q_FUNC_INFO, "Missing text edit"); if (!textEdit) { return; } // do not crash, though this situation should not happen textEdit->insertTextMessage(textMessage); diff --git a/src/gui/dockwidget.cpp b/src/gui/dockwidget.cpp index 610c82f28..1bd3568e2 100644 --- a/src/gui/dockwidget.cpp +++ b/src/gui/dockwidget.cpp @@ -520,7 +520,7 @@ namespace swift::gui } // Inner widget is supposed to be a QFrame / promoted QFrame - QFrame *innerWidget = qobject_cast( + auto *innerWidget = qobject_cast( outerWidget->layout()->itemAt(0)->widget()); // the inner widget containing the layout Q_ASSERT_X(innerWidget, "CDockWidget::initStatusBar", "No inner widget"); if (!innerWidget) @@ -535,7 +535,7 @@ namespace swift::gui m_statusBar.initStatusBar(); // layout - QVBoxLayout *vLayout = qobject_cast(innerWidget->layout()); + auto *vLayout = qobject_cast(innerWidget->layout()); Q_ASSERT_X(vLayout, "CDockWidget::initStatusBar", "No outer widget layout"); if (!vLayout) { @@ -546,7 +546,7 @@ namespace swift::gui // adjust stretching of the original widget. It was the only widget so far // and should occupy maximum space - QWidget *compWidget = innerWidget->findChild(QString(), Qt::FindDirectChildrenOnly); + auto *compWidget = innerWidget->findChild(QString(), Qt::FindDirectChildrenOnly); Q_ASSERT(compWidget); if (!compWidget) { return; } QSizePolicy sizePolicy = compWidget->sizePolicy(); diff --git a/src/gui/dockwidgetinfoarea.cpp b/src/gui/dockwidgetinfoarea.cpp index 6aa5dbfbc..7e06e4b86 100644 --- a/src/gui/dockwidgetinfoarea.cpp +++ b/src/gui/dockwidgetinfoarea.cpp @@ -22,14 +22,14 @@ namespace swift::gui const CInfoArea *CDockWidgetInfoArea::getParentInfoArea() const { - const CInfoArea *ia = qobject_cast(this->parent()); + const auto *ia = qobject_cast(this->parent()); Q_ASSERT(ia); return ia; } CInfoArea *CDockWidgetInfoArea::getParentInfoArea() { - CInfoArea *ia = qobject_cast(this->parent()); + auto *ia = qobject_cast(this->parent()); Q_ASSERT(ia); return ia; } @@ -105,7 +105,7 @@ namespace swift::gui Q_ASSERT(w); // CEnableForDockWidgetInfoArea is no QObject, so we use dynamic_cast - CEnableForDockWidgetInfoArea *dwc = dynamic_cast(w); + auto *dwc = dynamic_cast(w); if (dwc) { widgetsWithDockWidgetInfoAreaComponent.append(dwc); } } QList nestedInfoAreas = this->findNestedInfoAreas(); diff --git a/src/gui/editors/aircrafticaoform.cpp b/src/gui/editors/aircrafticaoform.cpp index 64c69a1d2..d84eb5692 100644 --- a/src/gui/editors/aircrafticaoform.cpp +++ b/src/gui/editors/aircrafticaoform.cpp @@ -90,7 +90,7 @@ namespace swift::gui::editors CVariant jsonVariant; jsonVariant.convertFromJson(json::jsonObjectFromString(json)); if (!jsonVariant.canConvert()) { return; } - const CAircraftIcaoCodeList icaos = jsonVariant.value(); + const auto icaos = jsonVariant.value(); if (!icaos.isEmpty()) { this->setValue(icaos.front()); } } catch (const CJsonException &ex) @@ -196,7 +196,7 @@ namespace swift::gui::editors if (variantDropped.canConvert()) { icao = variantDropped.value(); } else if (variantDropped.canConvert()) { - const CAircraftIcaoCodeList icaoList(variantDropped.value()); + const auto icaoList(variantDropped.value()); if (icaoList.isEmpty()) { return; } icao = icaoList.front(); } diff --git a/src/gui/editors/airlineicaoform.cpp b/src/gui/editors/airlineicaoform.cpp index 30cd3f499..83c73651c 100644 --- a/src/gui/editors/airlineicaoform.cpp +++ b/src/gui/editors/airlineicaoform.cpp @@ -161,7 +161,7 @@ namespace swift::gui::editors CVariant jsonVariant; jsonVariant.convertFromJson(json::jsonObjectFromString(json)); if (!jsonVariant.canConvert()) { return; } - const CAirlineIcaoCodeList icaos = jsonVariant.value(); + const auto icaos = jsonVariant.value(); if (!icaos.isEmpty()) { this->setValue(icaos.front()); } } catch (const CJsonException &ex) @@ -176,7 +176,7 @@ namespace swift::gui::editors if (variantDropped.canConvert()) { icao = variantDropped.value(); } else if (variantDropped.canConvert()) { - const CAirlineIcaoCodeList icaoList(variantDropped.value()); + const auto icaoList(variantDropped.value()); if (icaoList.isEmpty()) { return; } icao = icaoList.front(); } diff --git a/src/gui/editors/distributorform.cpp b/src/gui/editors/distributorform.cpp index dcceed0dd..6abb1220b 100644 --- a/src/gui/editors/distributorform.cpp +++ b/src/gui/editors/distributorform.cpp @@ -115,7 +115,7 @@ namespace swift::gui::editors if (variantDropped.canConvert()) { distributor = variantDropped.value(); } else if (variantDropped.canConvert()) { - const CDistributorList icaoList(variantDropped.value()); + const auto icaoList(variantDropped.value()); if (icaoList.isEmpty()) { return; } distributor = icaoList.front(); } diff --git a/src/gui/editors/liveryform.cpp b/src/gui/editors/liveryform.cpp index 274a187b3..133ca4103 100644 --- a/src/gui/editors/liveryform.cpp +++ b/src/gui/editors/liveryform.cpp @@ -117,7 +117,7 @@ namespace swift::gui::editors CVariant jsonVariant; jsonVariant.convertFromJson(json::jsonObjectFromString(json)); if (!jsonVariant.canConvert()) { return; } - const CLiveryList liveries = jsonVariant.value(); + const auto liveries = jsonVariant.value(); if (!liveries.isEmpty()) { this->setValue(liveries.front()); } } catch (const CJsonException &ex) @@ -193,7 +193,7 @@ namespace swift::gui::editors if (variantDropped.canConvert()) { livery = variantDropped.value(); } else if (variantDropped.canConvert()) { - CLiveryList liveryList(variantDropped.value()); + auto liveryList(variantDropped.value()); if (liveryList.isEmpty()) { return; } livery = liveryList.front(); } @@ -229,7 +229,7 @@ namespace swift::gui::editors m_colorSearch = new CDbLiveryColorSearchDialog(this); m_colorSearch->setModal(true); } - const QDialog::DialogCode c = static_cast(m_colorSearch->exec()); + const auto c = static_cast(m_colorSearch->exec()); if (c == QDialog::Rejected) { return; } const CLivery found = m_colorSearch->getLivery(); if (found.isLoadedFromDb()) { this->setValue(found); } diff --git a/src/gui/editors/modelmappingform.cpp b/src/gui/editors/modelmappingform.cpp index cbf3c87d2..d9f62362b 100644 --- a/src/gui/editors/modelmappingform.cpp +++ b/src/gui/editors/modelmappingform.cpp @@ -32,7 +32,7 @@ namespace swift::gui::editors ui->le_Id->setReadOnly(true); ui->le_Parts->setPlaceholderText("Allowed: " + CAircraftModel::supportedParts()); ui->lai_Id->set(CIcons::appMappings16(), "Id:"); - CUpperCaseValidator *uc = new CUpperCaseValidator(0, 5, ui->le_Parts); + auto *uc = new CUpperCaseValidator(0, 5, ui->le_Parts); uc->setAllowedCharacters(CAircraftModel::supportedParts()); ui->le_Parts->setValidator(uc); diff --git a/src/gui/editors/modelmappingmodifyform.cpp b/src/gui/editors/modelmappingmodifyform.cpp index 1862c50f0..947163b90 100644 --- a/src/gui/editors/modelmappingmodifyform.cpp +++ b/src/gui/editors/modelmappingmodifyform.cpp @@ -32,8 +32,7 @@ namespace swift::gui::editors ui->le_Parts->setPlaceholderText("Parts " + CAircraftModel::supportedParts()); this->userChanged(); - CUpperCaseValidator *ucv = - new CUpperCaseValidator(true, 0, CAircraftModel::supportedParts().size(), ui->le_Parts); + auto *ucv = new CUpperCaseValidator(true, 0, CAircraftModel::supportedParts().size(), ui->le_Parts); ucv->setAllowedCharacters(CAircraftModel::supportedParts()); ui->le_Parts->setValidator(ucv); diff --git a/src/gui/editors/serverform.cpp b/src/gui/editors/serverform.cpp index 7dc2b617c..fe35a15da 100644 --- a/src/gui/editors/serverform.cpp +++ b/src/gui/editors/serverform.cpp @@ -96,7 +96,7 @@ namespace swift::gui::editors ui->cb_ServerType->clear(); for (const int type : CServer::allServerTypes()) { - const CServer::ServerType st = static_cast(type); + const auto st = static_cast(type); ui->cb_ServerType->insertItem(c++, CServer::serverTypeToString(st), QVariant::fromValue(type)); } } diff --git a/src/gui/enableforframelesswindow.cpp b/src/gui/enableforframelesswindow.cpp index dd7ac80bb..a74fafd91 100644 --- a/src/gui/enableforframelesswindow.cpp +++ b/src/gui/enableforframelesswindow.cpp @@ -292,7 +292,7 @@ namespace swift::gui Qt::QueuedConnection); } - QHBoxLayout *menuBarLayout = new QHBoxLayout; + auto *menuBarLayout = new QHBoxLayout; menuBarLayout->setObjectName("hl_MenuBar"); menuBarLayout->addWidget(menuBar, 0, Qt::AlignTop | Qt::AlignLeft); menuBarLayout->addWidget(m_framelessCloseButton, 0, Qt::AlignTop | Qt::AlignRight); diff --git a/src/gui/eventfilter.cpp b/src/gui/eventfilter.cpp index a0858ac2f..9a9f2e938 100644 --- a/src/gui/eventfilter.cpp +++ b/src/gui/eventfilter.cpp @@ -14,13 +14,13 @@ namespace swift::gui { if (event->type() == QEvent::KeyPress) { - if (QKeyEvent *e = dynamic_cast(event)) + if (auto *e = dynamic_cast(event)) { // If QKeyEvent::text() returns an empty QString then let normal // processing proceed as it may be a control (e.g. cursor movement) // key. Otherwise convert the text to upper case and insert it at // the current cursor position. - QPlainTextEdit *pte = qobject_cast(object); + auto *pte = qobject_cast(object); if (!pte) { return false; } if (pte->isReadOnly()) { return false; } diff --git a/src/gui/filters/aircraftmodelfilterbar.cpp b/src/gui/filters/aircraftmodelfilterbar.cpp index bc9d36e65..0346b188d 100644 --- a/src/gui/filters/aircraftmodelfilterbar.cpp +++ b/src/gui/filters/aircraftmodelfilterbar.cpp @@ -41,7 +41,7 @@ namespace swift::gui::filters ui->comp_DistributorSelector->withDistributorDescription(false); this->setButtonsAndCount(ui->filter_Buttons); - CUpperCaseValidator *ucv = new CUpperCaseValidator(this); + auto *ucv = new CUpperCaseValidator(this); ui->le_AircraftIcao->setValidator(ucv); ui->le_AirlineIcao->setValidator(ucv); ui->le_ModelString->setValidator(ucv); diff --git a/src/gui/filters/countryfilterbar.cpp b/src/gui/filters/countryfilterbar.cpp index b679e80af..bcadce068 100644 --- a/src/gui/filters/countryfilterbar.cpp +++ b/src/gui/filters/countryfilterbar.cpp @@ -25,7 +25,7 @@ namespace swift::gui::filters connect(ui->le_IsoCode, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter); connect(ui->le_Name, &QLineEdit::returnPressed, this, &CFilterWidget::triggerFilter); - CUpperCaseValidator *ucv = new CUpperCaseValidator(this); + auto *ucv = new CUpperCaseValidator(this); ui->le_IsoCode->setValidator(ucv); // reset form diff --git a/src/gui/guiactionbind.cpp b/src/gui/guiactionbind.cpp index 71a7d74c7..9b3353685 100644 --- a/src/gui/guiactionbind.cpp +++ b/src/gui/guiactionbind.cpp @@ -40,7 +40,7 @@ namespace swift::gui if (action->menu()) { CGuiActionBindHandler::bindMenu(action->menu(), pathNew); } const bool hasIcon = !action->icon().isNull(); - CGuiActionBindHandler *bindHandler = new CGuiActionBindHandler(action); + auto *bindHandler = new CGuiActionBindHandler(action); // MS 2019-10-08 [AFV integration] CActionBind constructor needs an icon index, not a QPixmap // CActionBinding actionBinding(CActionBinding::create(pathNew, hasIcon ? // action->icon().pixmap(CIcons::empty16().size()) : CIcons::empty16(), bindHandler, @@ -63,7 +63,7 @@ namespace swift::gui absoluteName ? path : CGuiActionBindHandler::appendPath(path, button->text()).remove('&'); // remove E&xit key codes - CGuiActionBindHandler *bindHandler = new CGuiActionBindHandler(button); + auto *bindHandler = new CGuiActionBindHandler(button); const bool hasIcon = !button->icon().isNull(); // MS 2019-10-08 [AFV integration] CActionBind constructor needs an icon index, not a QPixmap // CActionBinding actionBinding(CActionBinding::create(pathNew, hasIcon ? diff --git a/src/gui/guiutility.cpp b/src/gui/guiutility.cpp index 402d8e7da..2072c2bfe 100644 --- a/src/gui/guiutility.cpp +++ b/src/gui/guiutility.cpp @@ -58,7 +58,7 @@ namespace swift::gui for (QWidget *w : tlw) { // best choice is to check on frameless window - CEnableForFramelessWindow *mw = dynamic_cast(w); + auto *mw = dynamic_cast(w); if (!mw) { continue; } if (mw->isMainApplicationWindow()) { return mw; } } @@ -76,7 +76,7 @@ namespace swift::gui const QWidgetList tlw = CGuiUtility::topLevelApplicationWidgetsWithName(); for (QWidget *w : tlw) { - QMainWindow *qmw = qobject_cast(w); + auto *qmw = qobject_cast(w); if (!qmw) { continue; } if (!qmw->parentWidget()) { return qmw; } } @@ -562,7 +562,7 @@ namespace swift::gui do { widget = widget->parentWidget(); if (!widget) { return nullptr; } - QTabWidget *tw = qobject_cast(widget); + auto *tw = qobject_cast(widget); if (tw) { return tw; } level++; } @@ -671,14 +671,14 @@ namespace swift::gui bool CGuiUtility::isQMainWindow(const QWidget *widget) { if (!widget) { return false; } - const QMainWindow *mw = qobject_cast(widget); + const auto *mw = qobject_cast(widget); return mw; } bool CGuiUtility::isDialog(const QWidget *widget) { if (!widget) { return false; } - const QDialog *mw = qobject_cast(widget); + const auto *mw = qobject_cast(widget); return mw; } @@ -698,9 +698,9 @@ namespace swift::gui { // http://stackoverflow.com/questions/19087822/how-to-make-qt-widgets-fade-in-or-fade-out# Q_ASSERT(widget); - QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(widget); + auto *effect = new QGraphicsOpacityEffect(widget); widget->setGraphicsEffect(effect); - QPropertyAnimation *a = new QPropertyAnimation(effect, "opacity"); + auto *a = new QPropertyAnimation(effect, "opacity"); a->setDuration(durationMs); a->setStartValue(startValue); a->setEndValue(endValue); @@ -713,9 +713,9 @@ namespace swift::gui double endValue) { Q_ASSERT(widget); - QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(widget); + auto *effect = new QGraphicsOpacityEffect(widget); widget->setGraphicsEffect(effect); - QPropertyAnimation *a = new QPropertyAnimation(effect, "opacity"); + auto *a = new QPropertyAnimation(effect, "opacity"); a->setDuration(durationMs); a->setStartValue(startValue); a->setEndValue(endValue); diff --git a/src/gui/guiutility.h b/src/gui/guiutility.h index 16e54d045..5cb585dfe 100644 --- a/src/gui/guiutility.h +++ b/src/gui/guiutility.h @@ -136,7 +136,7 @@ namespace swift::gui static OverlayWidget *nextOverlayMessageWidget(QWidget *widget, int maxLevels = 10) { if (!widget || maxLevels < 1) { return nullptr; } - OverlayWidget *o = qobject_cast(widget); + auto *o = qobject_cast(widget); if (o) { return o; } int cl = 0; QWidget *cw = widget->parentWidget(); diff --git a/src/gui/infoarea.cpp b/src/gui/infoarea.cpp index 30ebfad76..51d83c958 100644 --- a/src/gui/infoarea.cpp +++ b/src/gui/infoarea.cpp @@ -97,7 +97,7 @@ namespace swift::gui menu->addAction(CIcons::floatOne16(), QStringLiteral("Dock / float '%1'").arg(this->windowTitle()), this, &CInfoArea::toggleFloatingWholeInfoArea); - QAction *lockTabBarMenuAction = new QAction(menu); + auto *lockTabBarMenuAction = new QAction(menu); lockTabBarMenuAction->setObjectName(this->objectName().append("LockTabBar")); lockTabBarMenuAction->setIconText("Lock tab bar"); lockTabBarMenuAction->setIcon(CIcons::lockClosed16()); @@ -107,17 +107,17 @@ namespace swift::gui connect(lockTabBarMenuAction, &QAction::toggled, this, &CInfoArea::toggleTabBarLocked); menu->addSeparator(); - QMenu *subMenuToggleFloat = new QMenu("Toggle Float/Dock", menu); - QMenu *subMenuDisplay = new QMenu("Display", menu); - QMenu *subMenuRestore = new QMenu("Restore from settings", menu); - QMenu *subMenuResetPositions = new QMenu("Reset position", menu); + auto *subMenuToggleFloat = new QMenu("Toggle Float/Dock", menu); + auto *subMenuDisplay = new QMenu("Display", menu); + auto *subMenuRestore = new QMenu("Restore from settings", menu); + auto *subMenuResetPositions = new QMenu("Reset position", menu); subMenuRestore->setIcon(CIcons::load16()); subMenuResetPositions->setIcon(CIcons::refresh16()); subMenuRestore->addActions(this->getInfoAreaRestoreActions(subMenuRestore)); subMenuDisplay->addActions(this->getInfoAreaSelectActions(false, subMenuDisplay)); subMenuResetPositions->addActions(this->getInfoAreaResetPositionActions(subMenuResetPositions)); - QSignalMapper *signalMapperToggleFloating = new QSignalMapper(menu); + auto *signalMapperToggleFloating = new QSignalMapper(menu); bool c = false; // check connections for (int i = 0; i < m_dockWidgetInfoAreas.size(); i++) @@ -125,7 +125,7 @@ namespace swift::gui const CDockWidgetInfoArea *dw = m_dockWidgetInfoAreas.at(i); const QString t = dw->windowTitleBackup(); const QPixmap pm = this->indexToPixmap(i); - QAction *toggleFloatingMenuAction = new QAction(menu); + auto *toggleFloatingMenuAction = new QAction(menu); toggleFloatingMenuAction->setObjectName(QString(t).append("ToggleFloatingAction")); toggleFloatingMenuAction->setIconText(t); toggleFloatingMenuAction->setIcon(pm); @@ -151,7 +151,7 @@ namespace swift::gui // where and how to display tab bar menu->addSeparator(); - QAction *showMenuText = new QAction(menu); + auto *showMenuText = new QAction(menu); showMenuText->setObjectName("ShowDockedWidgetTextAction"); showMenuText->setIconText("Show tab text"); showMenuText->setIcon(CIcons::headingOne16()); @@ -161,7 +161,7 @@ namespace swift::gui connect(showMenuText, &QAction::toggled, this, &CInfoArea::showTabTexts); // auto adjust floating widgets - QAction *showTabbar = new QAction(menu); + auto *showTabbar = new QAction(menu); showTabbar->setObjectName("ShowTabBar"); showTabbar->setIconText("Show tab bar"); showTabbar->setIcon(CIcons::dockBottom16()); @@ -223,7 +223,7 @@ namespace swift::gui const QPixmap pm = this->indexToPixmap(i); const QString wt(dockWidgetInfoArea->windowTitleBackup()); static const QString keys("123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - QAction *action = new QAction(QIcon(pm), wt, parent); + auto *action = new QAction(QIcon(pm), wt, parent); action->setData(i); action->setObjectName(this->objectName().append(":getInfoAreaSelectActions:").append(wt)); if (withShortcut && i < keys.length()) @@ -250,7 +250,7 @@ namespace swift::gui { const QPixmap pm = this->indexToPixmap(i); const QString wt(dockWidgetInfoArea->windowTitleBackup()); - QAction *action = new QAction(QIcon(pm), wt, parent); + auto *action = new QAction(QIcon(pm), wt, parent); action->setData(i); action->setObjectName(this->objectName().append(":getInfoAreaResetPositionActions:").append(wt)); connect(action, &QAction::triggered, this, &CInfoArea::resetPositionByAction); @@ -269,7 +269,7 @@ namespace swift::gui { const QPixmap pm = this->indexToPixmap(i); const QString wt(dockWidgetInfoArea->windowTitleBackup()); - QAction *action = new QAction(QIcon(pm), wt, parent); + auto *action = new QAction(QIcon(pm), wt, parent); action->setData(i); action->setObjectName(this->objectName().append(":getInfoAreaToggleFloatingActions:").append(wt)); connect(action, &QAction::triggered, this, &CInfoArea::toggleAreaFloatingByAction, Qt::QueuedConnection); @@ -288,7 +288,7 @@ namespace swift::gui { const QPixmap pm = this->indexToPixmap(i); const QString wt(dockWidgetInfoArea->windowTitleBackup()); - QAction *action = new QAction(QIcon(pm), wt, parent); + auto *action = new QAction(QIcon(pm), wt, parent); action->setData(i); action->setObjectName(this->objectName().append(":getInfoAreaRestoreActions:").append(wt)); connect(action, &QAction::triggered, this, &CInfoArea::restoreDockWidgetInfoArea); @@ -416,7 +416,7 @@ namespace swift::gui void CInfoArea::selectAreaByAction() { const QObject *sender = QObject::sender(); - const QAction *action = qobject_cast(sender); + const auto *action = qobject_cast(sender); SWIFT_VERIFY(action); if (!action) { return; } const int index = action->data().toInt(); @@ -426,7 +426,7 @@ namespace swift::gui void CInfoArea::resetPositionByAction() { const QObject *sender = QObject::sender(); - const QAction *action = qobject_cast(sender); + const auto *action = qobject_cast(sender); SWIFT_VERIFY(action); if (!action) { return; } const int index = action->data().toInt(); @@ -436,7 +436,7 @@ namespace swift::gui void CInfoArea::toggleAreaFloatingByAction() { const QObject *sender = QObject::sender(); - const QAction *action = qobject_cast(sender); + const auto *action = qobject_cast(sender); SWIFT_VERIFY(action); if (!action) { return; } const int index = action->data().toInt(); @@ -446,7 +446,7 @@ namespace swift::gui void CInfoArea::restoreDockWidgetInfoArea() { const QObject *sender = QObject::sender(); - const QAction *action = qobject_cast(sender); + const auto *action = qobject_cast(sender); SWIFT_VERIFY(action); if (!action) { return; } const int index = action->data().toInt(); @@ -503,7 +503,7 @@ namespace swift::gui { for (CDockWidgetInfoArea *dw : std::as_const(m_dockWidgetInfoAreas)) { - Qt::DockWidgetAreas newAreas = static_cast(area); + auto newAreas = static_cast(area); Qt::DockWidgetAreas oldAreas = dw->allowedAreas(); if (oldAreas == newAreas) { continue; } dw->setAllowedAreas(newAreas); diff --git a/src/gui/menus/aircraftmodelmenus.cpp b/src/gui/menus/aircraftmodelmenus.cpp index da1440d8a..066792992 100644 --- a/src/gui/menus/aircraftmodelmenus.cpp +++ b/src/gui/menus/aircraftmodelmenus.cpp @@ -36,7 +36,7 @@ namespace swift::gui::menus CAircraftModelView *IAircraftModelViewMenu::modelView() const { - CAircraftModelView *mv = qobject_cast(parent()); + auto *mv = qobject_cast(parent()); Q_ASSERT_X(mv, Q_FUNC_INFO, "no view"); return mv; } diff --git a/src/gui/models/actionmodel.cpp b/src/gui/models/actionmodel.cpp index 8aa057459..73f2c7d6d 100644 --- a/src/gui/models/actionmodel.cpp +++ b/src/gui/models/actionmodel.cpp @@ -69,7 +69,7 @@ namespace swift::gui::models { if (!index.isValid()) { return {}; } - CActionItem *childItem = static_cast(index.internalPointer()); + auto *childItem = static_cast(index.internalPointer()); CActionItem *parentItem = childItem->getParentItem(); if (parentItem == m_rootItem.data()) { return {}; } diff --git a/src/gui/models/aircraftcategorytreemodel.cpp b/src/gui/models/aircraftcategorytreemodel.cpp index a0e15bacf..6731fc792 100644 --- a/src/gui/models/aircraftcategorytreemodel.cpp +++ b/src/gui/models/aircraftcategorytreemodel.cpp @@ -50,8 +50,8 @@ namespace swift::gui::models QList categoryRow; // ownership of QStandardItem is taken by model - QStandardItem *si = new QStandardItem(category.isAssignable() ? CIcons::paperPlane16() : CIcons::folder16(), - category.getLevelAndName()); + auto *si = new QStandardItem(category.isAssignable() ? CIcons::paperPlane16() : CIcons::folder16(), + category.getLevelAndName()); si->setEditable(false); categoryRow.push_back(si); diff --git a/src/gui/models/atcstationlistmodel.cpp b/src/gui/models/atcstationlistmodel.cpp index 65261ed9a..563ebd188 100644 --- a/src/gui/models/atcstationlistmodel.cpp +++ b/src/gui/models/atcstationlistmodel.cpp @@ -83,7 +83,7 @@ namespace swift::gui::models CAtcStationTreeModel *CAtcStationListModel::toAtcTreeModel() const { - CAtcStationTreeModel *tm = new CAtcStationTreeModel(QObject::parent()); + auto *tm = new CAtcStationTreeModel(QObject::parent()); tm->setColumns(m_columns); tm->updateContainer(this->container()); return tm; diff --git a/src/gui/models/atcstationtreemodel.cpp b/src/gui/models/atcstationtreemodel.cpp index 0f11978d0..c8b8e5616 100644 --- a/src/gui/models/atcstationtreemodel.cpp +++ b/src/gui/models/atcstationtreemodel.cpp @@ -49,8 +49,7 @@ namespace swift::gui::models for (const QString &suffix : std::as_const(m_suffixes)) { // ownership of QStandardItem is taken by model - QStandardItem *typeFolderFirstColumn = - new QStandardItem(CCallsign::atcSuffixToIcon(suffix).toQIcon(), suffix); + auto *typeFolderFirstColumn = new QStandardItem(CCallsign::atcSuffixToIcon(suffix).toQIcon(), suffix); typeFolderFirstColumn->setEditable(false); this->invisibleRootItem()->appendRow(typeFolderFirstColumn); diff --git a/src/gui/models/columnformatters.cpp b/src/gui/models/columnformatters.cpp index 6c2e5a8c1..77f5f367e 100644 --- a/src/gui/models/columnformatters.cpp +++ b/src/gui/models/columnformatters.cpp @@ -48,7 +48,7 @@ namespace swift::gui::models CVariant CDefaultFormatter::decorationRole(const CVariant &dataCVariant) const { // direct return if type is already correct - const QMetaType::Type type = static_cast(dataCVariant.type()); + const auto type = static_cast(dataCVariant.type()); if (type == QMetaType::QPixmap) { return dataCVariant; } if (type == QMetaType::QIcon) { return dataCVariant; } @@ -56,14 +56,14 @@ namespace swift::gui::models // convert to pixmap if (type == QMetaType::QImage) { - const QImage img = dataCVariant.value(); + const auto img = dataCVariant.value(); return CVariant::from(QPixmap::fromImage(img)); } // Our CIcon class if (dataCVariant.canConvert()) { - const CIcon i = dataCVariant.value(); + const auto i = dataCVariant.value(); return CVariant::from(i.toPixmap()); } @@ -96,7 +96,7 @@ namespace swift::gui::models CVariant CDefaultFormatter::data(int role, const CVariant &inputData) const { if (!this->supportsRole(role)) { return CVariant(); } - const Qt::ItemDataRole roleEnum = static_cast(role); + const auto roleEnum = static_cast(role); // always supported if (roleEnum == Qt::TextAlignmentRole) return { alignmentRole() }; @@ -149,7 +149,7 @@ namespace swift::gui::models if (dataCVariant.isNull()) { return {}; } if (dataCVariant.canConvert()) { - const CIcon icon = dataCVariant.value(); + const auto icon = dataCVariant.value(); return icon.getDescriptiveText(); } return emptyStringVariant(); @@ -163,7 +163,7 @@ namespace swift::gui::models QPixmap pm; if (dataCVariant.canConvert()) { - const CIcon icon = dataCVariant.value(); + const auto icon = dataCVariant.value(); pm = icon.toPixmap(); } @@ -199,17 +199,17 @@ namespace swift::gui::models if (dateTime.isNull()) return {}; if (static_cast(dateTime.type()) == QMetaType::QDateTime) { - const QDateTime dt = dateTime.value(); + const auto dt = dateTime.value(); return dt.toString(m_formatString); } else if (static_cast(dateTime.type()) == QMetaType::QDate) { - const QDate d = dateTime.value(); + const auto d = dateTime.value(); return d.toString(m_formatString); } else if (static_cast(dateTime.type()) == QMetaType::QTime) { - const QTime t = dateTime.value(); + const auto t = dateTime.value(); return t.toString(m_formatString); } else if (dateTime.isIntegral()) @@ -229,7 +229,7 @@ namespace swift::gui::models if (dataCVariant.canConvert()) { // special treatment for some cases - const CLength l = dataCVariant.value(); + const auto l = dataCVariant.value(); const bool valid = !l.isNull() && (l.isPositiveWithEpsilonConsidered() || l.isZeroEpsilonConsidered()); return valid ? CPhysiqalQuantiyFormatter::displayRole(dataCVariant) : emptyStringVariant(); } @@ -245,7 +245,7 @@ namespace swift::gui::models if (dataCVariant.canConvert()) { // special treatment for some cases - const CFrequency f = dataCVariant.value(); + const auto f = dataCVariant.value(); if (CComSystem::isValidComFrequency(f)) { return CPhysiqalQuantiyFormatter::displayRole(dataCVariant); } return emptyStringVariant(); } @@ -259,7 +259,7 @@ namespace swift::gui::models CVariant CSpeedKtsFormatter::displayRole(const CVariant &dataCVariant) const { // special treatment for some cases - const CSpeed s = dataCVariant.value(); + const auto s = dataCVariant.value(); if (!s.isNull() && (s.isPositiveWithEpsilonConsidered() || s.isZeroEpsilonConsidered())) { return CPhysiqalQuantiyFormatter::displayRole(dataCVariant); @@ -376,7 +376,7 @@ namespace swift::gui::models CVariant CAltitudeFormatter::displayRole(const CVariant &altitude) const { - CAltitude alt(altitude.to()); + auto alt(altitude.to()); if (m_flightLevel) { alt.toFlightLevel(); } else { alt.switchUnit(m_unit); } return alt.toQString(m_useI18n); @@ -395,7 +395,7 @@ namespace swift::gui::models CVariant CColorFormatter::decorationRole(const CVariant &dataCVariant) const { - const CRgbColor rgbColor(dataCVariant.to()); + const auto rgbColor(dataCVariant.to()); if (!rgbColor.isValid()) { return emptyPixmapVariant(); } return CVariant::fromValue(rgbColor.toPixmap()); } @@ -403,7 +403,7 @@ namespace swift::gui::models CVariant CColorFormatter::tooltipRole(const CVariant &dataCVariant) const { static const CVariant empty(CVariant::fromValue(QPixmap())); - const CRgbColor rgbColor(dataCVariant.to()); + const auto rgbColor(dataCVariant.to()); if (!rgbColor.isValid()) { return emptyStringVariant(); } return rgbColor.hex(true); } diff --git a/src/gui/models/listmodelbase.cpp b/src/gui/models/listmodelbase.cpp index 6805bbc0b..13fe19411 100644 --- a/src/gui/models/listmodelbase.cpp +++ b/src/gui/models/listmodelbase.cpp @@ -58,7 +58,7 @@ namespace swift::gui::models { if (action == Qt::MoveAction) { - const ContainerType container(valueVariant.value()); + const auto container(valueVariant.value()); if (container.isEmpty()) { return false; } const int position = parent.row(); this->moveItems(container, position); @@ -111,7 +111,7 @@ namespace swift::gui::models template bool CListModelBase::setData(const QModelIndex &index, const QVariant &value, int role) { - Qt::ItemDataRole dataRole = static_cast(role); + auto dataRole = static_cast(role); if (!(dataRole == Qt::UserRole || dataRole == Qt::EditRole)) { return false; } // check / init @@ -542,7 +542,7 @@ namespace swift::gui::models template QMimeData *CListModelBase::mimeData(const QModelIndexList &indexes) const { - QMimeData *mimeData = new QMimeData(); + auto *mimeData = new QMimeData(); if (indexes.isEmpty()) { return mimeData; } ContainerType container; diff --git a/src/gui/models/simulatedaircraftlistmodel.cpp b/src/gui/models/simulatedaircraftlistmodel.cpp index 6f6cf1a65..d1ea105cf 100644 --- a/src/gui/models/simulatedaircraftlistmodel.cpp +++ b/src/gui/models/simulatedaircraftlistmodel.cpp @@ -71,7 +71,7 @@ namespace swift::gui::models "icao", "icao and livery info", { CSimulatedAircraft::IndexCombinedIcaoLiveryStringNetworkModel })); // icon column for airline - CPixmapFormatter *pmf = new CPixmapFormatter(); + auto *pmf = new CPixmapFormatter(); pmf->setMaxHeight(25); pmf->setMaxWidth(100); CColumn col("airline", diff --git a/src/gui/overlaymessages.cpp b/src/gui/overlaymessages.cpp index 220c25165..a9202ef4b 100644 --- a/src/gui/overlaymessages.cpp +++ b/src/gui/overlaymessages.cpp @@ -513,7 +513,7 @@ namespace swift::gui void COverlayMessages::addShadow(QColor color) { - QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect(this); + auto *shadow = new QGraphicsDropShadowEffect(this); color.setAlpha(96); shadow->setColor(color); this->setGraphicsEffect(shadow); diff --git a/src/gui/pluginselector.cpp b/src/gui/pluginselector.cpp index d4e304d03..e3146129b 100644 --- a/src/gui/pluginselector.cpp +++ b/src/gui/pluginselector.cpp @@ -21,7 +21,7 @@ namespace swift::gui { setObjectName("CPluginSelector"); - QVBoxLayout *layout = new QVBoxLayout; + auto *layout = new QVBoxLayout; setLayout(layout); connect(m_configButtonMapper, &QSignalMapper::mappedString, this, &CPluginSelector::pluginConfigRequested); @@ -33,12 +33,12 @@ namespace swift::gui SWIFT_VERIFY_X(!identifier.isEmpty(), Q_FUNC_INFO, "Missing identifier"); if (identifier.isEmpty()) { return; } - QWidget *pw = new QWidget; - QHBoxLayout *layout = new QHBoxLayout; + auto *pw = new QWidget; + auto *layout = new QHBoxLayout; layout->setContentsMargins(0, 0, 0, 0); pw->setLayout(layout); - QCheckBox *cb = new QCheckBox(name); + auto *cb = new QCheckBox(name); cb->setObjectName(identifier); cb->setProperty("pluginIdentifier", identifier); connect(cb, &QCheckBox::checkStateChanged, this, &CPluginSelector::handlePluginStateChange); @@ -49,7 +49,7 @@ namespace swift::gui if (hasConfig) { - QPushButton *config = new QPushButton(swift::misc::CIcons::wrench16(), ""); + auto *config = new QPushButton(swift::misc::CIcons::wrench16(), ""); config->setToolTip("Plugin configuration"); m_configButtonMapper->setMapping(config, identifier); connect(config, &QPushButton::clicked, m_configButtonMapper, qOverload<>(&QSignalMapper::map)); @@ -64,14 +64,14 @@ namespace swift::gui void CPluginSelector::setEnabled(const QString &identifier, bool enabled) { - QCheckBox *cb = findChild(identifier); + auto *cb = findChild(identifier); Q_ASSERT(cb); cb->setChecked(enabled); } void CPluginSelector::handlePluginStateChange() { - QCheckBox *cb = qobject_cast(sender()); + auto *cb = qobject_cast(sender()); Q_ASSERT(cb); bool enabled = cb->checkState() != Qt::Unchecked; diff --git a/src/gui/settings/dockwidgetsettings.cpp b/src/gui/settings/dockwidgetsettings.cpp index 17fbb86be..3cbf3468b 100644 --- a/src/gui/settings/dockwidgetsettings.cpp +++ b/src/gui/settings/dockwidgetsettings.cpp @@ -89,7 +89,7 @@ namespace swift::gui::settings QVariant CDockWidgetSettings::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexFloatingMargins: return QVariant::fromValue(m_floatingMargins); @@ -109,7 +109,7 @@ namespace swift::gui::settings return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexFloatingMargins: m_floatingMargins = variant.toString(); break; diff --git a/src/gui/settings/guisettings.cpp b/src/gui/settings/guisettings.cpp index dbeabc6e6..50b99f9f1 100644 --- a/src/gui/settings/guisettings.cpp +++ b/src/gui/settings/guisettings.cpp @@ -45,7 +45,7 @@ namespace swift::gui::settings QVariant CGeneralGuiSettings::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexWidgetStyle: return QVariant::fromValue(this->m_widgetStyle); @@ -61,7 +61,7 @@ namespace swift::gui::settings (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexWidgetStyle: this->setWidgetStyle(variant.toString()); break; diff --git a/src/gui/settings/navigatorsettings.cpp b/src/gui/settings/navigatorsettings.cpp index 66336db37..c94eb407d 100644 --- a/src/gui/settings/navigatorsettings.cpp +++ b/src/gui/settings/navigatorsettings.cpp @@ -49,7 +49,7 @@ namespace swift::gui::settings QVariant CNavigatorSettings::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMargins: return QVariant::fromValue(this->m_margins); @@ -67,7 +67,7 @@ namespace swift::gui::settings return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMargins: this->m_margins = variant.toString(); break; diff --git a/src/gui/settings/textmessagesettings.cpp b/src/gui/settings/textmessagesettings.cpp index 294199439..f2df03c7f 100644 --- a/src/gui/settings/textmessagesettings.cpp +++ b/src/gui/settings/textmessagesettings.cpp @@ -78,7 +78,7 @@ namespace swift::gui::settings QVariant CTextMessageSettings::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexPopupAllMessages: return QVariant::fromValue(this->getPopupAllMessages()); @@ -100,7 +100,7 @@ namespace swift::gui::settings (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexPopupAllMessages: this->setPopupAllMessages(variant.toBool()); break; diff --git a/src/gui/settings/viewupdatesettings.cpp b/src/gui/settings/viewupdatesettings.cpp index 965bdea97..b6b74e4a2 100644 --- a/src/gui/settings/viewupdatesettings.cpp +++ b/src/gui/settings/viewupdatesettings.cpp @@ -47,7 +47,7 @@ namespace swift::gui::settings QVariant CViewUpdateSettings::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAircraft: return QVariant::fromValue(this->m_updateAircraft); @@ -66,7 +66,7 @@ namespace swift::gui::settings return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAircraft: this->m_updateAircraft = variant.value(); break; diff --git a/src/gui/stylesheetutility.cpp b/src/gui/stylesheetutility.cpp index 6287587f6..5da6b0b6e 100644 --- a/src/gui/stylesheetutility.cpp +++ b/src/gui/stylesheetutility.cpp @@ -415,7 +415,7 @@ namespace swift::gui // usedWidget->style()->drawPrimitive(element, &opt, &p, usedWidget); // 2) With viewport based widgets viewport has to be used // see http://stackoverflow.com/questions/37952348/enable-own-widget-for-stylesheet - QAbstractScrollArea *sa = qobject_cast(usedWidget); + auto *sa = qobject_cast(usedWidget); QStylePainter p(sa ? sa->viewport() : usedWidget); if (!p.isActive()) { return false; } diff --git a/src/gui/views/aircraftcategorytreeview.cpp b/src/gui/views/aircraftcategorytreeview.cpp index a0988fba0..94dcff112 100644 --- a/src/gui/views/aircraftcategorytreeview.cpp +++ b/src/gui/views/aircraftcategorytreeview.cpp @@ -89,8 +89,8 @@ namespace swift::gui::views if (!this->categoryModel()) { return; } if (this->categoryModel()->container().isEmpty()) { return; } - QMenu *menu = new QMenu(this); // menu - QAction *resize = new QAction(CIcons::resize16(), "Resize", this); + auto *menu = new QMenu(this); // menu + auto *resize = new QAction(CIcons::resize16(), "Resize", this); connect(resize, &QAction::triggered, this, &CAircraftCategoryTreeView::fullResizeToContentsImpl); menu->addAction(resize); diff --git a/src/gui/views/aircraftmodelvalidationdialog.cpp b/src/gui/views/aircraftmodelvalidationdialog.cpp index fcfafcd8f..7be61238e 100644 --- a/src/gui/views/aircraftmodelvalidationdialog.cpp +++ b/src/gui/views/aircraftmodelvalidationdialog.cpp @@ -24,7 +24,7 @@ namespace swift::gui::views ui->setupUi(this); this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); - QPushButton *validateButton = new QPushButton("Validate", ui->bb_ValidationDialog); + auto *validateButton = new QPushButton("Validate", ui->bb_ValidationDialog); ui->bb_ValidationDialog->addButton(validateButton, QDialogButtonBox::ActionRole); connect(validateButton, &QPushButton::released, this, &CAircraftModelValidationDialog::validate, Qt::QueuedConnection); diff --git a/src/gui/views/aircraftmodelview.cpp b/src/gui/views/aircraftmodelview.cpp index 531220f4e..69a3506ae 100644 --- a/src/gui/views/aircraftmodelview.cpp +++ b/src/gui/views/aircraftmodelview.cpp @@ -49,7 +49,7 @@ namespace swift::gui::views this->setSettingsDirectoryIndex(CDirectories::IndexDirLastModelJsonOrDefault); // shortcut - QShortcut *stashShortcut = new QShortcut(CShortcut::keyStash(), this); + auto *stashShortcut = new QShortcut(CShortcut::keyStash(), this); stashShortcut->setContext(Qt::WidgetShortcut); connect(stashShortcut, &QShortcut::activated, this, &CAircraftModelView::requestedStash); @@ -222,7 +222,7 @@ namespace swift::gui::views { if (valueVariant.canConvert()) { - const CAircraftModel model = valueVariant.value(); + const auto model = valueVariant.value(); if (!model.hasModelString()) { return; } const CAircraftModelList models({ model }); this->derivedModel()->replaceOrAddByModelString(models); @@ -230,7 +230,7 @@ namespace swift::gui::views } else if (valueVariant.canConvert()) { - const CAircraftModelList models(valueVariant.value()); + const auto models(valueVariant.value()); if (models.isEmpty()) { return; } this->derivedModel()->replaceOrAddByModelString(models); return; @@ -240,13 +240,13 @@ namespace swift::gui::views if (!this->hasSelection()) { return; } if (valueVariant.canConvert()) { - const CAircraftIcaoCode icao = valueVariant.value(); + const auto icao = valueVariant.value(); if (icao.validate().hasErrorMessages()) { return; } this->applyToSelected(icao); } else if (valueVariant.canConvert()) { - const CAircraftIcaoCodeList icaos(valueVariant.value()); + const auto icaos(valueVariant.value()); if (icaos.size() != 1) { return; } const CAircraftIcaoCode icao = icaos.front(); if (icao.validate().hasErrorMessages()) { return; } @@ -254,13 +254,13 @@ namespace swift::gui::views } else if (valueVariant.canConvert()) { - const CLivery livery = valueVariant.value(); + const auto livery = valueVariant.value(); if (livery.validate().hasErrorMessages()) { return; } this->applyToSelected(livery); } else if (valueVariant.canConvert()) { - const CLiveryList liveries(valueVariant.value()); + const auto liveries(valueVariant.value()); if (liveries.size() != 1) { return; } const CLivery livery = liveries.front(); if (livery.validate().hasErrorMessages()) { return; } @@ -268,13 +268,13 @@ namespace swift::gui::views } else if (valueVariant.canConvert()) { - const CDistributor distributor = valueVariant.value(); + const auto distributor = valueVariant.value(); if (distributor.validate().hasErrorMessages()) { return; } this->applyToSelected(distributor); } else if (valueVariant.canConvert()) { - const CDistributorList distributors(valueVariant.value()); + const auto distributors(valueVariant.value()); if (distributors.size() != 1) { return; } const CDistributor distributor = distributors.front(); if (distributor.validate().hasErrorMessages()) { return; } @@ -282,14 +282,14 @@ namespace swift::gui::views } else if (valueVariant.canConvert()) { - const CAirlineIcaoCode airline = valueVariant.value(); + const auto airline = valueVariant.value(); if (airline.validate().hasErrorMessages()) { return; } emit requestHandlingOfStashDrop( airline); // I need to convert to stanard livery, which I can`t do here } else if (valueVariant.canConvert()) { - const CAirlineIcaoCodeList airlines(valueVariant.value()); + const auto airlines(valueVariant.value()); if (airlines.size() != 1) { return; } const CAirlineIcaoCode airline = airlines.front(); if (airline.validate().hasErrorMessages()) { return; } diff --git a/src/gui/views/atcstationtreeview.cpp b/src/gui/views/atcstationtreeview.cpp index 0932e921c..680051fc0 100644 --- a/src/gui/views/atcstationtreeview.cpp +++ b/src/gui/views/atcstationtreeview.cpp @@ -116,12 +116,12 @@ namespace swift::gui::views if (!this->stationModel()) { return; } if (this->stationModel()->container().isEmpty()) { return; } - QMenu *menu = new QMenu(this); // menu + auto *menu = new QMenu(this); // menu - QAction *com1 = new QAction(CIcons::appCockpit16(), "Tune in COM1", this); - QAction *com2 = new QAction(CIcons::appCockpit16(), "Tune in COM2", this); - QAction *text = new QAction(CIcons::appTextMessages16(), "Show text messages", this); - QAction *resize = new QAction(CIcons::resize16(), "Resize", this); + auto *com1 = new QAction(CIcons::appCockpit16(), "Tune in COM1", this); + auto *com2 = new QAction(CIcons::appCockpit16(), "Tune in COM2", this); + auto *text = new QAction(CIcons::appTextMessages16(), "Show text messages", this); + auto *resize = new QAction(CIcons::resize16(), "Resize", this); connect(com1, &QAction::triggered, this, &CAtcStationTreeView::tuneInAtcCom1); connect(com2, &QAction::triggered, this, &CAtcStationTreeView::tuneInAtcCom2); diff --git a/src/gui/views/checkboxdelegate.cpp b/src/gui/views/checkboxdelegate.cpp index 4e9b3c63d..3608f266c 100644 --- a/src/gui/views/checkboxdelegate.cpp +++ b/src/gui/views/checkboxdelegate.cpp @@ -32,7 +32,7 @@ namespace swift::gui::views { Q_UNUSED(index); Q_UNUSED(option); - QCheckBox *cb = new QCheckBox(parent); + auto *cb = new QCheckBox(parent); if (!m_iconCheckedUrl.isEmpty() && !m_iconUncheckedUrl.isEmpty()) { const QString style = CStyleSheetUtility::styleForIconCheckBox(m_iconCheckedUrl, m_iconUncheckedUrl); @@ -45,13 +45,13 @@ namespace swift::gui::views void CCheckBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { const bool v = index.model()->data(index, Qt::UserRole).toBool(); - QCheckBox *cb = qobject_cast(editor); + auto *cb = qobject_cast(editor); cb->setChecked(v); } void CCheckBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { - QCheckBox *cb = qobject_cast(editor); + auto *cb = qobject_cast(editor); const bool v = cb->isChecked(); model->setData(index, QVariant(v), Qt::EditRole); } diff --git a/src/gui/views/viewbase.cpp b/src/gui/views/viewbase.cpp index a6ecb85e8..29dd3ffe0 100644 --- a/src/gui/views/viewbase.cpp +++ b/src/gui/views/viewbase.cpp @@ -619,7 +619,7 @@ namespace swift::gui::views template int CViewBase::performUpdateContainer(const swift::misc::CVariant &variant, bool sort, bool resize) { - ContainerType c(variant.to()); + auto c(variant.to()); return this->updateContainer(c, sort, resize); } @@ -844,7 +844,7 @@ namespace swift::gui::views template bool CViewBase::filterDialogFinished(int status) { - const QDialog::DialogCode statusCode = static_cast(status); + const auto statusCode = static_cast(status); return filterWidgetChangedFilter(statusCode == QDialog::Accepted); } @@ -857,8 +857,7 @@ namespace swift::gui::views else { // takes the filter and triggers the filtering - IModelFilterProvider *provider = - dynamic_cast *>(m_filterWidget); + auto *provider = dynamic_cast *>(m_filterWidget); Q_ASSERT_X(provider, Q_FUNC_INFO, "Filter widget does not provide interface"); if (!provider) { return false; } std::unique_ptr> f(provider->createModelFilter()); diff --git a/src/gui/views/viewbasenontemplate.cpp b/src/gui/views/viewbasenontemplate.cpp index 48203cce9..39f9d79ff 100644 --- a/src/gui/views/viewbasenontemplate.cpp +++ b/src/gui/views/viewbasenontemplate.cpp @@ -51,37 +51,37 @@ namespace swift::gui::views this->setTextElideMode(Qt::ElideNone); // shortcuts - QShortcut *filter = new QShortcut(CShortcut::keyDisplayFilter(), this); + auto *filter = new QShortcut(CShortcut::keyDisplayFilter(), this); bool s = connect(filter, &QShortcut::activated, this, &CViewBaseNonTemplate::displayFilterDialog); Q_ASSERT_X(s, Q_FUNC_INFO, "Shortcut"); filter->setObjectName("Filter shortcut for " + this->objectName()); filter->setContext(Qt::WidgetShortcut); - QShortcut *clearSelection = new QShortcut(CShortcut::keyClearSelection(), this); + auto *clearSelection = new QShortcut(CShortcut::keyClearSelection(), this); s = connect(clearSelection, &QShortcut::activated, this, &CViewBaseNonTemplate::clearSelection); Q_ASSERT_X(s, Q_FUNC_INFO, "Shortcut"); clearSelection->setObjectName("Clear selection shortcut for " + this->objectName()); clearSelection->setContext(Qt::WidgetShortcut); - QShortcut *saveJson = new QShortcut(CShortcut::keySaveViews(), this); + auto *saveJson = new QShortcut(CShortcut::keySaveViews(), this); s = connect(saveJson, &QShortcut::activated, this, &CViewBaseNonTemplate::saveJsonAction); Q_ASSERT_X(s, Q_FUNC_INFO, "Shortcut"); saveJson->setObjectName("Save JSON for " + this->objectName()); saveJson->setContext(Qt::WidgetShortcut); - QShortcut *deleteRow = new QShortcut(CShortcut::keyDelete(), this); + auto *deleteRow = new QShortcut(CShortcut::keyDelete(), this); s = connect(deleteRow, &QShortcut::activated, this, &CViewBaseNonTemplate::removeSelectedRowsChecked); Q_ASSERT_X(s, Q_FUNC_INFO, "Shortcut"); deleteRow->setObjectName("Remove selected rows for " + this->objectName()); deleteRow->setContext(Qt::WidgetShortcut); - QShortcut *copy = new QShortcut(CShortcut::keyCopy(), this); + auto *copy = new QShortcut(CShortcut::keyCopy(), this); s = connect(copy, &QShortcut::activated, this, &CViewBaseNonTemplate::copy); Q_ASSERT_X(s, Q_FUNC_INFO, "Shortcut"); copy->setObjectName("Copy selection shortcut for " + this->objectName()); copy->setContext(Qt::WidgetShortcut); - QShortcut *resize = new QShortcut(CShortcut::keyResizeView(), this); + auto *resize = new QShortcut(CShortcut::keyResizeView(), this); s = connect(resize, &QShortcut::activated, this, &CViewBaseNonTemplate::fullResizeToContents); Q_ASSERT_X(s, Q_FUNC_INFO, "Shortcut"); resize->setObjectName("Resize view shortcut for " + this->objectName()); @@ -866,7 +866,7 @@ namespace swift::gui::views void CViewBaseNonTemplate::toggleAutoDisplay() { - const QAction *a = qobject_cast(QObject::sender()); + const auto *a = qobject_cast(QObject::sender()); if (!a) { return; } Q_ASSERT_X(a->isCheckable(), Q_FUNC_INFO, "object not checkable"); m_displayAutomatically = a->isChecked(); diff --git a/src/gui/views/viewdbobjects.cpp b/src/gui/views/viewdbobjects.cpp index 674104df1..8fe2b8246 100644 --- a/src/gui/views/viewdbobjects.cpp +++ b/src/gui/views/viewdbobjects.cpp @@ -143,20 +143,20 @@ namespace swift::gui::views if (!m_menuActions[0]) { m_frame = new QFrame(this); - QHBoxLayout *layout = new QHBoxLayout(m_frame); + auto *layout = new QHBoxLayout(m_frame); layout->setContentsMargins(2, 2, 2, 2); m_frame->setLayout(layout); m_leOrder = new QLineEdit(m_frame); - QLabel *icon = new QLabel(m_frame); + auto *icon = new QLabel(m_frame); icon->setPixmap(menu.getPixmap()); layout->addWidget(icon); - QLabel *label = new QLabel(m_frame); + auto *label = new QLabel(m_frame); label->setText("Order:"); layout->addWidget(label); layout->addWidget(m_leOrder); m_validator = new QIntValidator(0, maxOrder, this); m_leOrder->setValidator(m_validator); - QWidgetAction *orderAction = new QWidgetAction(this); + auto *orderAction = new QWidgetAction(this); orderAction->setDefaultWidget(m_frame); QObject::connect(m_leOrder, &QLineEdit::returnPressed, this, &COrderableViewWithDbObjects::orderToLineEdit); @@ -214,7 +214,7 @@ namespace swift::gui::views void COrderableViewWithDbObjects::orderToLineEdit() { if (this->isEmpty()) { return; } - QLineEdit *le = qobject_cast(QObject::sender()); + auto *le = qobject_cast(QObject::sender()); if (!le || le->text().isEmpty()) { return; } const int order = le->text().toInt(); this->moveSelectedItems(order); diff --git a/src/input/linux/joysticklinux.cpp b/src/input/linux/joysticklinux.cpp index 4aa5a3b0a..224140bf1 100644 --- a/src/input/linux/joysticklinux.cpp +++ b/src/input/linux/joysticklinux.cpp @@ -42,7 +42,7 @@ namespace swift::input /* Forward */ struct js_event event; while (m_fd->read(reinterpret_cast(&event), sizeof(event)) == sizeof(event)) {} - QSocketNotifier *notifier = new QSocketNotifier(m_fd->handle(), QSocketNotifier::Read, m_fd); + auto notifier = new QSocketNotifier(m_fd->handle(), QSocketNotifier::Read, m_fd); connect(notifier, &QSocketNotifier::activated, this, &CJoystickDevice::processInput); m_name = QString(deviceName); } @@ -101,10 +101,10 @@ namespace swift::input void CJoystickLinux::addJoystickDevice(const QString &path) { - QFile *fd = new QFile(path); + auto fd = new QFile(path); if (fd->open(QIODevice::ReadOnly)) { - CJoystickDevice *joystickDevice = new CJoystickDevice(path, fd, this); + auto joystickDevice = new CJoystickDevice(path, fd, this); connect(joystickDevice, &CJoystickDevice::buttonChanged, this, &CJoystickLinux::joystickButtonChanged); m_joystickDevices.push_back(joystickDevice); } diff --git a/src/input/linux/keyboardlinux.cpp b/src/input/linux/keyboardlinux.cpp index bc6badd0e..9a341f2eb 100644 --- a/src/input/linux/keyboardlinux.cpp +++ b/src/input/linux/keyboardlinux.cpp @@ -159,7 +159,7 @@ namespace swift::input { struct input_event eventInput; - QFile *fileInput = qobject_cast(sender()->parent()); + auto fileInput = qobject_cast(sender()->parent()); if (!fileInput) return; bool found = false; diff --git a/src/misc/applicationinfo.cpp b/src/misc/applicationinfo.cpp index d41607b5a..ee71700f9 100644 --- a/src/misc/applicationinfo.cpp +++ b/src/misc/applicationinfo.cpp @@ -96,7 +96,7 @@ namespace swift::misc QVariant CApplicationInfo::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexApplication: return QVariant::fromValue(m_app); @@ -121,7 +121,7 @@ namespace swift::misc (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexApplication: this->setApplication(static_cast(variant.toInt())); break; @@ -142,7 +142,7 @@ namespace swift::misc int CApplicationInfo::comparePropertyByIndex(CPropertyIndexRef index, const CApplicationInfo &compareValue) const { if (index.isMyself()) { return this->getExecutablePath().compare(compareValue.getExecutablePath()); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexApplicationDataPath: diff --git a/src/misc/aviation/aircraftcategory.cpp b/src/misc/aviation/aircraftcategory.cpp index cf8a252bd..2f445b03b 100644 --- a/src/misc/aviation/aircraftcategory.cpp +++ b/src/misc/aviation/aircraftcategory.cpp @@ -142,7 +142,7 @@ namespace swift::misc::aviation { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: return QVariant::fromValue(m_name); @@ -168,7 +168,7 @@ namespace swift::misc::aviation IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: this->setName(variant.value()); break; @@ -185,7 +185,7 @@ namespace swift::misc::aviation { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: return m_name.compare(compareValue.getName(), Qt::CaseInsensitive); diff --git a/src/misc/aviation/aircrafticaocode.cpp b/src/misc/aviation/aircrafticaocode.cpp index 3dbe252fb..0ba3621b4 100644 --- a/src/misc/aviation/aircrafticaocode.cpp +++ b/src/misc/aviation/aircrafticaocode.cpp @@ -651,7 +651,7 @@ namespace swift::misc::aviation { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAircraftDesignator: return QVariant::fromValue(m_designator); @@ -687,7 +687,7 @@ namespace swift::misc::aviation IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAircraftDesignator: this->setDesignator(variant.value()); break; @@ -714,7 +714,7 @@ namespace swift::misc::aviation { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAircraftDesignator: return m_designator.compare(compareValue.getDesignator(), Qt::CaseInsensitive); diff --git a/src/misc/aviation/aircraftlights.cpp b/src/misc/aviation/aircraftlights.cpp index cab9cd0a3..0c822e3fc 100644 --- a/src/misc/aviation/aircraftlights.cpp +++ b/src/misc/aviation/aircraftlights.cpp @@ -47,7 +47,7 @@ namespace swift::misc::aviation { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIsNull: return QVariant::fromValue(this->isNull()); @@ -71,7 +71,7 @@ namespace swift::misc::aviation return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIsNull: m_isNull = variant.toBool(); break; @@ -89,7 +89,7 @@ namespace swift::misc::aviation int CAircraftLights::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftLights &compareValue) const { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIsNull: return Compare::compare(m_isNull, compareValue.isNull()); diff --git a/src/misc/aviation/aircraftparts.cpp b/src/misc/aviation/aircraftparts.cpp index 9f2b367c7..d778493ae 100644 --- a/src/misc/aviation/aircraftparts.cpp +++ b/src/misc/aviation/aircraftparts.cpp @@ -103,7 +103,7 @@ namespace swift::misc::aviation return ITimestampWithOffsetBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEngines: return QVariant::fromValue(m_engines); @@ -130,7 +130,7 @@ namespace swift::misc::aviation return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEngines: m_engines = variant.value(); break; @@ -154,7 +154,7 @@ namespace swift::misc::aviation return ITimestampWithOffsetBased::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEngines: return Compare::compare(this->getEnginesCount(), compareValue.getEnginesCount()); diff --git a/src/misc/aviation/aircraftsituation.cpp b/src/misc/aviation/aircraftsituation.cpp index 8d8127248..66d8d5571 100644 --- a/src/misc/aviation/aircraftsituation.cpp +++ b/src/misc/aviation/aircraftsituation.cpp @@ -273,7 +273,7 @@ namespace swift::misc::aviation } if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexPosition: return m_position.propertyByIndex(index.copyFrontRemoved()); @@ -313,7 +313,7 @@ namespace swift::misc::aviation return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexPosition: m_position.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -346,7 +346,7 @@ namespace swift::misc::aviation { return ICoordinateGeodetic::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexPosition: diff --git a/src/misc/aviation/aircraftsituationchange.cpp b/src/misc/aviation/aircraftsituationchange.cpp index 5d0173ef0..939157c4a 100644 --- a/src/misc/aviation/aircraftsituationchange.cpp +++ b/src/misc/aviation/aircraftsituationchange.cpp @@ -262,7 +262,7 @@ namespace swift::misc::aviation return ITimestampWithOffsetBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsign: return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved()); @@ -297,7 +297,7 @@ namespace swift::misc::aviation return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsign: m_correspondingCallsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -331,7 +331,7 @@ namespace swift::misc::aviation return ITimestampWithOffsetBased::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsign: diff --git a/src/misc/aviation/airlineicaocode.cpp b/src/misc/aviation/airlineicaocode.cpp index d54db5f9f..6baa9dc50 100644 --- a/src/misc/aviation/airlineicaocode.cpp +++ b/src/misc/aviation/airlineicaocode.cpp @@ -177,7 +177,7 @@ namespace swift::misc::aviation { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAirlineDesignator: return QVariant::fromValue(m_designator); @@ -209,7 +209,7 @@ namespace swift::misc::aviation IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAirlineDesignator: this->setDesignator(variant.value()); break; @@ -234,7 +234,7 @@ namespace swift::misc::aviation { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAirlineDesignator: return m_designator.compare(compareValue.getDesignator()); diff --git a/src/misc/aviation/airport.cpp b/src/misc/aviation/airport.cpp index 48856b5b1..64354960d 100644 --- a/src/misc/aviation/airport.cpp +++ b/src/misc/aviation/airport.cpp @@ -93,7 +93,7 @@ namespace swift::misc::aviation QVariant CAirport::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIcao: return m_icao.propertyByIndex(index.copyFrontRemoved()); @@ -116,7 +116,7 @@ namespace swift::misc::aviation (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIcao: m_icao.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -140,7 +140,7 @@ namespace swift::misc::aviation { return m_icao.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getIcao()); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIcao: return m_icao.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getIcao()); diff --git a/src/misc/aviation/altitude.cpp b/src/misc/aviation/altitude.cpp index 855d4e3d9..6768ba780 100644 --- a/src/misc/aviation/altitude.cpp +++ b/src/misc/aviation/altitude.cpp @@ -181,7 +181,7 @@ namespace swift::misc::aviation rd = AboveGround; } - const CLength l = CPqString::parse(v, mode); + const auto l = CPqString::parse(v, mode); *this = CAltitude(l, rd); } diff --git a/src/misc/aviation/atcstation.cpp b/src/misc/aviation/atcstation.cpp index b505148e0..19d8b0520 100644 --- a/src/misc/aviation/atcstation.cpp +++ b/src/misc/aviation/atcstation.cpp @@ -179,7 +179,7 @@ namespace swift::misc::aviation QVariant CAtcStation::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexLogoffTime: return QVariant::fromValue(m_logoffTimeUtc); @@ -211,7 +211,7 @@ namespace swift::misc::aviation (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexLogoffTime: this->setLogoffTimeUtc(variant.value()); break; @@ -248,7 +248,7 @@ namespace swift::misc::aviation { return this->getCallsign().comparePropertyByIndex(CPropertyIndexRef::empty(), compareValue.getCallsign()); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexLogoffTime: return Compare::compare(this->getLogoffTimeUtc(), compareValue.getLogoffTimeUtc()); diff --git a/src/misc/aviation/callsign.cpp b/src/misc/aviation/callsign.cpp index 3da88aae8..d882a6608 100644 --- a/src/misc/aviation/callsign.cpp +++ b/src/misc/aviation/callsign.cpp @@ -310,7 +310,7 @@ namespace swift::misc::aviation QVariant CCallsign::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsignString: return QVariant(this->asString()); @@ -328,7 +328,7 @@ namespace swift::misc::aviation (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsignString: m_callsign = unifyCallsign(variant.toString()); break; @@ -341,7 +341,7 @@ namespace swift::misc::aviation int CCallsign::comparePropertyByIndex(CPropertyIndexRef index, const CCallsign &compareValue) const { if (index.isMyself()) { return m_callsign.compare(compareValue.m_callsign, Qt::CaseInsensitive); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsignString: return m_callsign.compare(compareValue.m_callsign, Qt::CaseInsensitive); diff --git a/src/misc/aviation/flightplan.cpp b/src/misc/aviation/flightplan.cpp index 38363449e..afada2ad8 100644 --- a/src/misc/aviation/flightplan.cpp +++ b/src/misc/aviation/flightplan.cpp @@ -263,7 +263,7 @@ namespace swift::misc::aviation if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAlternateAirportIcao: return m_alternateAirportIcao.propertyByIndex(index.copyFrontRemoved()); @@ -288,7 +288,7 @@ namespace swift::misc::aviation return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAlternateAirportIcao: @@ -616,7 +616,7 @@ namespace swift::misc::aviation variant.convertFromJson(jsonObject); if (variant.canConvert()) { - const CFlightPlan fp = variant.value(); + const auto fp = variant.value(); return fp; } else diff --git a/src/misc/aviation/informationmessage.cpp b/src/misc/aviation/informationmessage.cpp index e1f173755..450d74f5a 100644 --- a/src/misc/aviation/informationmessage.cpp +++ b/src/misc/aviation/informationmessage.cpp @@ -58,7 +58,7 @@ namespace swift::misc::aviation { if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexType: return QVariant::fromValue(m_type); @@ -80,7 +80,7 @@ namespace swift::misc::aviation ITimestampBased::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexType: m_type = static_cast(variant.toInt()); break; @@ -103,7 +103,7 @@ namespace swift::misc::aviation { return ITimestampBased::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMessage: return m_message.compare(compareValue.m_message, Qt::CaseInsensitive); diff --git a/src/misc/aviation/livery.cpp b/src/misc/aviation/livery.cpp index 1ec7683da..a8e3d51df 100644 --- a/src/misc/aviation/livery.cpp +++ b/src/misc/aviation/livery.cpp @@ -340,7 +340,7 @@ namespace swift::misc::aviation { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAirlineIcaoCode: return m_airline.propertyByIndex(index.copyFrontRemoved()); @@ -365,7 +365,7 @@ namespace swift::misc::aviation IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDescription: m_description = variant.toString(); break; @@ -385,7 +385,7 @@ namespace swift::misc::aviation { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDescription: return m_description.compare(compareValue.getDescription(), Qt::CaseInsensitive); diff --git a/src/misc/aviation/modulator.cpp b/src/misc/aviation/modulator.cpp index d73595d43..ca863df6a 100644 --- a/src/misc/aviation/modulator.cpp +++ b/src/misc/aviation/modulator.cpp @@ -112,7 +112,7 @@ namespace swift::misc::aviation QVariant CModulator::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*derived()); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexActiveFrequency: return this->getFrequencyActive().propertyByIndex(index.copyFrontRemoved()); @@ -133,7 +133,7 @@ namespace swift::misc::aviation Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong index to base template"); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexActiveFrequency: m_frequencyActive.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -153,7 +153,7 @@ namespace swift::misc::aviation { return m_frequencyActive.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_frequencyActive); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexActiveFrequency: diff --git a/src/misc/aviation/ongroundinfo.cpp b/src/misc/aviation/ongroundinfo.cpp index 615accf8f..b9f1d50ee 100644 --- a/src/misc/aviation/ongroundinfo.cpp +++ b/src/misc/aviation/ongroundinfo.cpp @@ -132,7 +132,7 @@ namespace swift::misc::aviation { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexOnGroundFactor: return QVariant::fromValue(m_onGroundFactor); @@ -149,7 +149,7 @@ namespace swift::misc::aviation return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexOnGroundFactor: m_onGroundFactor = variant.toDouble(); break; diff --git a/src/misc/aviation/simbriefdata.cpp b/src/misc/aviation/simbriefdata.cpp index 6ff0c4aa9..e6167b04c 100644 --- a/src/misc/aviation/simbriefdata.cpp +++ b/src/misc/aviation/simbriefdata.cpp @@ -33,7 +33,7 @@ namespace swift::misc::aviation QVariant CSimBriefData::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexUrl: return QVariant::fromValue(m_url); @@ -49,7 +49,7 @@ namespace swift::misc::aviation (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexUrl: m_url = variant.toString(); break; diff --git a/src/misc/aviation/transponder.cpp b/src/misc/aviation/transponder.cpp index f2328f812..972c2e74e 100644 --- a/src/misc/aviation/transponder.cpp +++ b/src/misc/aviation/transponder.cpp @@ -207,7 +207,7 @@ namespace swift::misc::aviation QVariant CTransponder::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMode: return QVariant::fromValue(this->getTransponderMode()); @@ -231,7 +231,7 @@ namespace swift::misc::aviation (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMode: m_transponderMode = variant.toInt(); break; diff --git a/src/misc/country.cpp b/src/misc/country.cpp index 9878ea9a8..26ee95983 100644 --- a/src/misc/country.cpp +++ b/src/misc/country.cpp @@ -106,7 +106,7 @@ namespace swift::misc QVariant CCountry::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIsoCode: return QVariant::fromValue(m_dbKey); @@ -130,7 +130,7 @@ namespace swift::misc (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIsoCode: this->setIsoCode(variant.toString()); break; @@ -154,7 +154,7 @@ namespace swift::misc { return IDatastoreObjectWithStringKey::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIsoCode: return getIsoCode().compare(compareValue.getIsoCode(), Qt::CaseInsensitive); diff --git a/src/misc/db/artifact.cpp b/src/misc/db/artifact.cpp index ba31aede9..eb2c5e83a 100644 --- a/src/misc/db/artifact.cpp +++ b/src/misc/db/artifact.cpp @@ -94,7 +94,7 @@ namespace swift::misc::db return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: return QVariant::fromValue(m_name); @@ -123,7 +123,7 @@ namespace swift::misc::db return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: this->setName(variant.toString()); break; diff --git a/src/misc/db/datastore.cpp b/src/misc/db/datastore.cpp index 2c8a7d268..045b2a5f8 100644 --- a/src/misc/db/datastore.cpp +++ b/src/misc/db/datastore.cpp @@ -94,7 +94,7 @@ namespace swift::misc::db QVariant IDatastoreObjectWithIntegerKey::propertyByIndex(CPropertyIndexRef index) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDbIntegerKey: return QVariant::fromValue(m_dbKey); @@ -114,7 +114,7 @@ namespace swift::misc::db ITimestampBased::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDbIntegerKey: m_dbKey = variant.toInt(); break; @@ -131,7 +131,7 @@ namespace swift::misc::db { return ITimestampBased::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDbKeyAsString: // fall thru @@ -194,7 +194,7 @@ namespace swift::misc::db QVariant IDatastoreObjectWithStringKey::propertyByIndex(CPropertyIndexRef index) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDbKeyAsString: // fall thru @@ -214,7 +214,7 @@ namespace swift::misc::db ITimestampBased::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDbStringKey: @@ -232,7 +232,7 @@ namespace swift::misc::db { return ITimestampBased::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDbKeyAsString: // fall thru diff --git a/src/misc/db/dbinfo.cpp b/src/misc/db/dbinfo.cpp index e081f3a5d..56d8c489b 100644 --- a/src/misc/db/dbinfo.cpp +++ b/src/misc/db/dbinfo.cpp @@ -63,7 +63,7 @@ namespace swift::misc::db QVariant CDbInfo::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexTableName: return QVariant::fromValue(m_tableName); @@ -83,7 +83,7 @@ namespace swift::misc::db (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexTableName: this->setTableName(variant.toString()); break; @@ -106,7 +106,7 @@ namespace swift::misc::db { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexTableName: return this->getTableName().compare(compareValue.getTableName(), Qt::CaseInsensitive); diff --git a/src/misc/db/distribution.cpp b/src/misc/db/distribution.cpp index da31bda11..f67da4fa4 100644 --- a/src/misc/db/distribution.cpp +++ b/src/misc/db/distribution.cpp @@ -64,7 +64,7 @@ namespace swift::misc::db return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexChannel: return QVariant::fromValue(m_channel); @@ -88,7 +88,7 @@ namespace swift::misc::db return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexChannel: this->setChannel(variant.value()); break; diff --git a/src/misc/db/updateinfo.cpp b/src/misc/db/updateinfo.cpp index 911fd9a6c..ef31cbece 100644 --- a/src/misc/db/updateinfo.cpp +++ b/src/misc/db/updateinfo.cpp @@ -100,7 +100,7 @@ namespace swift::misc::db QVariant CUpdateInfo::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexArtifactsPilotClient: return QVariant::fromValue(m_artifactsPilotClient); @@ -117,7 +117,7 @@ namespace swift::misc::db (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexArtifactsPilotClient: m_artifactsPilotClient = variant.value(); break; diff --git a/src/misc/directories.cpp b/src/misc/directories.cpp index 7a79eda30..cd90cc408 100644 --- a/src/misc/directories.cpp +++ b/src/misc/directories.cpp @@ -62,7 +62,7 @@ namespace swift::misc QVariant CDirectories::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDirFlightPlan: return QVariant::fromValue(m_dirFlightPlan); @@ -86,7 +86,7 @@ namespace swift::misc (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDirFlightPlan: this->setFlightPlanDirectory(variant.toString()); break; diff --git a/src/misc/geo/coordinategeodetic.cpp b/src/misc/geo/coordinategeodetic.cpp index 1b3597a2a..400f465a8 100644 --- a/src/misc/geo/coordinategeodetic.cpp +++ b/src/misc/geo/coordinategeodetic.cpp @@ -138,7 +138,7 @@ namespace swift::misc::geo { if (!index.isMyself()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexLatitude: return this->latitude().propertyByIndex(index.copyFrontRemoved()); @@ -162,7 +162,7 @@ namespace swift::misc::geo { if (!index.isMyself()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexLatitude: @@ -284,7 +284,7 @@ namespace swift::misc::geo (*this) = variant.value(); return; } - const ICoordinateGeodetic::ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexGeodeticHeight: m_geodeticHeight.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -459,7 +459,7 @@ namespace swift::misc::geo if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::propertyByIndex(index); } if (!index.isMyself()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexRelativeBearing: return this->getRelativeBearing().propertyByIndex(index.copyFrontRemoved()); @@ -477,7 +477,7 @@ namespace swift::misc::geo if (ICoordinateGeodetic::canHandleIndex(index)) { return; } if (!index.isMyself()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexRelativeBearing: m_relativeBearing.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -500,7 +500,7 @@ namespace swift::misc::geo } if (!index.isMyself()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexRelativeBearing: diff --git a/src/misc/geo/elevationplane.cpp b/src/misc/geo/elevationplane.cpp index 4871904a3..5717e4fc7 100644 --- a/src/misc/geo/elevationplane.cpp +++ b/src/misc/geo/elevationplane.cpp @@ -136,7 +136,7 @@ namespace swift::misc::geo QVariant CElevationPlane::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexRadius: return m_radius.propertyByIndex(index.copyFrontRemoved()); @@ -152,7 +152,7 @@ namespace swift::misc::geo (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexRadius: m_radius.setPropertyByIndex(index.copyFrontRemoved(), variant); break; diff --git a/src/misc/identifier.cpp b/src/misc/identifier.cpp index d7bbd0b1e..44272c441 100644 --- a/src/misc/identifier.cpp +++ b/src/misc/identifier.cpp @@ -214,7 +214,7 @@ namespace swift::misc { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { @@ -235,7 +235,7 @@ namespace swift::misc { if (index.isMyself()) { return Compare::compare(m_processId, compareValue.m_processId); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { diff --git a/src/misc/input/actionhotkey.cpp b/src/misc/input/actionhotkey.cpp index 31170199d..d10f0d2df 100644 --- a/src/misc/input/actionhotkey.cpp +++ b/src/misc/input/actionhotkey.cpp @@ -52,7 +52,7 @@ namespace swift::misc::input QVariant CActionHotkey::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIdentifier: return QVariant::fromValue(m_identifier); @@ -72,7 +72,7 @@ namespace swift::misc::input (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAction: diff --git a/src/misc/input/joystickbutton.cpp b/src/misc/input/joystickbutton.cpp index 70722cea0..da84736f8 100644 --- a/src/misc/input/joystickbutton.cpp +++ b/src/misc/input/joystickbutton.cpp @@ -33,7 +33,7 @@ namespace swift::misc::input (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDeviceName: this->setDeviceName(variant.value()); break; @@ -47,7 +47,7 @@ namespace swift::misc::input QVariant CJoystickButton::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDeviceName: return QVariant::fromValue(this->getDeviceName()); diff --git a/src/misc/input/keyboardkey.cpp b/src/misc/input/keyboardkey.cpp index 63f1f9b7a..ea342da9b 100644 --- a/src/misc/input/keyboardkey.cpp +++ b/src/misc/input/keyboardkey.cpp @@ -113,7 +113,7 @@ namespace swift::misc::input QVariant CKeyboardKey::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexKey: return QVariant::fromValue(m_keyCode); @@ -133,7 +133,7 @@ namespace swift::misc::input (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexKey: diff --git a/src/misc/namevariantpair.cpp b/src/misc/namevariantpair.cpp index b57d4d4e8..bc0bf6c46 100644 --- a/src/misc/namevariantpair.cpp +++ b/src/misc/namevariantpair.cpp @@ -27,7 +27,7 @@ namespace swift::misc QVariant CNameVariantPair::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: return QVariant(this->m_name); @@ -43,7 +43,7 @@ namespace swift::misc (*this) = variant.value(); return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); // special case, handle icon and allow to set it // doing this in the switch gives gcc warning as IndexIcon is no member of ColumnIndex @@ -51,7 +51,7 @@ namespace swift::misc { if (static_cast(variant.typeId()) == QMetaType::Int) { - CIcons::IconIndex iconIndex = variant.value(); + const auto iconIndex = variant.value(); this->m_icon = CIcon::iconByIndex(iconIndex); } else { this->m_icon = variant.value(); } diff --git a/src/misc/network/authenticateduser.cpp b/src/misc/network/authenticateduser.cpp index 95a9d6daf..95ae12b02 100644 --- a/src/misc/network/authenticateduser.cpp +++ b/src/misc/network/authenticateduser.cpp @@ -109,7 +109,7 @@ namespace swift::misc::network { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexVatsimId: return QVariant::fromValue(m_vatsimId); @@ -133,7 +133,7 @@ namespace swift::misc::network IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexVatsimId: this->setVatsimId(variant.toInt()); break; diff --git a/src/misc/network/client.cpp b/src/misc/network/client.cpp index e9b97d10a..2463cdda3 100644 --- a/src/misc/network/client.cpp +++ b/src/misc/network/client.cpp @@ -85,7 +85,7 @@ namespace swift::misc::network QVariant CClient::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCapabilities: return QVariant::fromValue(m_capabilities); @@ -110,7 +110,7 @@ namespace swift::misc::network (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCapabilities: m_capabilities = variant.toInt(); break; diff --git a/src/misc/network/clientprovider.cpp b/src/misc/network/clientprovider.cpp index 666d483c4..d937a481d 100644 --- a/src/misc/network/clientprovider.cpp +++ b/src/misc/network/clientprovider.cpp @@ -206,7 +206,7 @@ namespace swift::misc::network CClientProviderDummy *CClientProviderDummy::instance() { - static CClientProviderDummy *dummy = new CClientProviderDummy(); + static auto dummy = new CClientProviderDummy(); return dummy; } } // namespace swift::misc::network diff --git a/src/misc/network/ecosystem.cpp b/src/misc/network/ecosystem.cpp index 23c384990..771f9469a 100644 --- a/src/misc/network/ecosystem.cpp +++ b/src/misc/network/ecosystem.cpp @@ -71,7 +71,7 @@ namespace swift::misc::network QVariant CEcosystem::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSystem: return QVariant::fromValue(m_system); @@ -87,7 +87,7 @@ namespace swift::misc::network (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSystem: m_system = variant.toInt(); break; @@ -98,7 +98,7 @@ namespace swift::misc::network int CEcosystem::comparePropertyByIndex(CPropertyIndexRef index, const CEcosystem &compareValue) const { if (index.isMyself()) { return Compare::compare(m_system, compareValue.m_system); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSystem: return Compare::compare(m_system, compareValue.m_system); diff --git a/src/misc/network/networkutils.cpp b/src/misc/network/networkutils.cpp index a9219deea..e78b7ce80 100644 --- a/src/misc/network/networkutils.cpp +++ b/src/misc/network/networkutils.cpp @@ -222,7 +222,7 @@ namespace swift::misc::network if (started.isValid() && started.canConvert()) { const qint64 now = QDateTime::currentMSecsSinceEpoch(); - const qint64 start = started.value(); + const auto start = started.value(); return (now - start); } return -1; diff --git a/src/misc/network/rawfsdmessage.cpp b/src/misc/network/rawfsdmessage.cpp index 8d0f728bc..13cd2eba6 100644 --- a/src/misc/network/rawfsdmessage.cpp +++ b/src/misc/network/rawfsdmessage.cpp @@ -66,7 +66,7 @@ namespace swift::misc::network if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexRawMessage: return QVariant::fromValue(m_rawMessage); @@ -87,7 +87,7 @@ namespace swift::misc::network return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexRawMessage: this->setRawMessage(variant.value()); break; diff --git a/src/misc/network/remotefile.cpp b/src/misc/network/remotefile.cpp index 9904405f1..60450abfb 100644 --- a/src/misc/network/remotefile.cpp +++ b/src/misc/network/remotefile.cpp @@ -70,7 +70,7 @@ namespace swift::misc::network { if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: return QVariant::fromValue(m_name); @@ -93,7 +93,7 @@ namespace swift::misc::network ITimestampBased::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: this->setName(variant.value()); break; diff --git a/src/misc/network/role.cpp b/src/misc/network/role.cpp index ef87536db..1e092dbc3 100644 --- a/src/misc/network/role.cpp +++ b/src/misc/network/role.cpp @@ -26,7 +26,7 @@ namespace swift::misc::network { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: return QVariant::fromValue(m_name); @@ -48,7 +48,7 @@ namespace swift::misc::network IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexName: this->setName(variant.value()); break; diff --git a/src/misc/network/server.cpp b/src/misc/network/server.cpp index 3139ea36e..3117f2570 100644 --- a/src/misc/network/server.cpp +++ b/src/misc/network/server.cpp @@ -167,7 +167,7 @@ namespace swift::misc::network if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAddress: return QVariant::fromValue(m_address); @@ -197,7 +197,7 @@ namespace swift::misc::network return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAddress: this->setAddress(variant.value()); break; @@ -220,7 +220,7 @@ namespace swift::misc::network { return ITimestampBased::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAddress: return this->getAddress().compare(compareValue.getAddress(), Qt::CaseInsensitive); diff --git a/src/misc/network/textmessage.cpp b/src/misc/network/textmessage.cpp index 4e075439b..e906c6366 100644 --- a/src/misc/network/textmessage.cpp +++ b/src/misc/network/textmessage.cpp @@ -287,7 +287,7 @@ namespace swift::misc::network if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSenderCallsign: return m_senderCallsign.propertyByIndex(index.copyFrontRemoved()); @@ -311,7 +311,7 @@ namespace swift::misc::network return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSenderCallsign: m_senderCallsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -327,7 +327,7 @@ namespace swift::misc::network { return ITimestampBased::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSenderCallsign: diff --git a/src/misc/network/url.cpp b/src/misc/network/url.cpp index 393ed6ced..7e209e653 100644 --- a/src/misc/network/url.cpp +++ b/src/misc/network/url.cpp @@ -231,7 +231,7 @@ namespace swift::misc::network QVariant CUrl::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexHost: return QVariant::fromValue(m_host); @@ -249,7 +249,7 @@ namespace swift::misc::network (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexHost: this->setHost(variant.value()); break; diff --git a/src/misc/network/urllog.cpp b/src/misc/network/urllog.cpp index 18e7aaf9e..04ee8a3e8 100644 --- a/src/misc/network/urllog.cpp +++ b/src/misc/network/urllog.cpp @@ -34,7 +34,7 @@ namespace swift::misc::network if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexId: return QVariant::fromValue(m_id); @@ -59,7 +59,7 @@ namespace swift::misc::network return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexId: m_id = variant.toInt(); break; diff --git a/src/misc/network/user.cpp b/src/misc/network/user.cpp index 73fec72c5..041abb9c6 100644 --- a/src/misc/network/user.cpp +++ b/src/misc/network/user.cpp @@ -241,7 +241,7 @@ namespace swift::misc::network QVariant CUser::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEmail: return QVariant(m_email); @@ -263,7 +263,7 @@ namespace swift::misc::network (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEmail: this->setEmail(variant.value()); break; @@ -281,7 +281,7 @@ namespace swift::misc::network int CUser::comparePropertyByIndex(CPropertyIndexRef index, const CUser &compareValue) const { if (index.isMyself()) { return this->getRealName().compare(compareValue.getRealName(), Qt::CaseInsensitive); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEmail: return m_email.compare(compareValue.getEmail(), Qt::CaseInsensitive); diff --git a/src/misc/orderable.cpp b/src/misc/orderable.cpp index f94053ec2..5d63967ad 100644 --- a/src/misc/orderable.cpp +++ b/src/misc/orderable.cpp @@ -41,7 +41,7 @@ namespace swift::misc { if (!index.isEmpty()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexOrder: return QVariant::fromValue(this->m_order); @@ -58,7 +58,7 @@ namespace swift::misc { if (!index.isEmpty()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexOrder: this->setOrder(variant.toInt()); return; diff --git a/src/misc/platform.cpp b/src/misc/platform.cpp index 5851272f5..20d5a7f06 100644 --- a/src/misc/platform.cpp +++ b/src/misc/platform.cpp @@ -71,7 +71,7 @@ namespace swift::misc QVariant CPlatform::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexPlatform: return QVariant::fromValue(m_platform); @@ -86,7 +86,7 @@ namespace swift::misc (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexPlatform: this->setPlatform(static_cast(variant.toInt())); break; @@ -97,7 +97,7 @@ namespace swift::misc int CPlatform::comparePropertyByIndex(CPropertyIndexRef index, const CPlatform &compareValue) const { if (index.isMyself()) { return Compare::compare(m_platform, compareValue.m_platform); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexPlatform: return Compare::compare(m_platform, compareValue.m_platform); diff --git a/src/misc/pq/physicalquantity.cpp b/src/misc/pq/physicalquantity.cpp index 2a48d3dad..4f27ae589 100644 --- a/src/misc/pq/physicalquantity.cpp +++ b/src/misc/pq/physicalquantity.cpp @@ -492,7 +492,7 @@ namespace swift::misc::physical_quantities QVariant CPhysicalQuantity::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*derived()); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexValue: return QVariant::fromValue(m_value); @@ -514,7 +514,7 @@ namespace swift::misc::physical_quantities (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexValue: m_value = variant.toDouble(); break; @@ -532,7 +532,7 @@ namespace swift::misc::physical_quantities int CPhysicalQuantity::comparePropertyByIndex(CPropertyIndexRef index, const PQ &pq) const { if (index.isMyself()) { return compareImpl(*derived(), pq); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexValue: return Compare::compare(m_value, pq.m_value); diff --git a/src/misc/provider.h b/src/misc/provider.h index 4aae20a01..8bb7a5297 100644 --- a/src/misc/provider.h +++ b/src/misc/provider.h @@ -59,7 +59,7 @@ namespace swift::misc if (m_provider == provider) { return; } if (m_provider) { m_lastProviderConnections.disconnectAll(); } m_provider = provider; // new provider - IProvider *iProvider = dynamic_cast(provider); + auto iProvider = dynamic_cast(provider); if (iProvider && iProvider->asQObject()) { QMetaObject::Connection con = QObject::connect(iProvider->asQObject(), &QObject::destroyed, diff --git a/src/misc/rgbcolor.cpp b/src/misc/rgbcolor.cpp index 2e69ab222..603eb0b49 100644 --- a/src/misc/rgbcolor.cpp +++ b/src/misc/rgbcolor.cpp @@ -169,7 +169,7 @@ namespace swift::misc QVariant CRgbColor::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexBlue: return QVariant::fromValue(blue()); @@ -187,7 +187,7 @@ namespace swift::misc (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexBlue: m_b = variant.toInt(); break; @@ -201,7 +201,7 @@ namespace swift::misc int CRgbColor::comparePropertyByIndex(CPropertyIndexRef index, const CRgbColor &compareValue) const { if (index.isMyself()) { return this->compare(compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexBlue: return Compare::compare(m_b, compareValue.m_b); diff --git a/src/misc/simulation/aircraftmatchersetup.cpp b/src/misc/simulation/aircraftmatchersetup.cpp index 69e8b31a2..e7a5d3124 100644 --- a/src/misc/simulation/aircraftmatchersetup.cpp +++ b/src/misc/simulation/aircraftmatchersetup.cpp @@ -96,7 +96,7 @@ namespace swift::misc::simulation QVariant CAircraftMatcherSetup::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMatchingAlgorithm: return QVariant::fromValue(m_algorithm); @@ -119,7 +119,7 @@ namespace swift::misc::simulation (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMatchingAlgorithm: m_algorithm = variant.toInt(); break; diff --git a/src/misc/simulation/aircraftmodel.cpp b/src/misc/simulation/aircraftmodel.cpp index f63aa00c0..b0063ed9a 100644 --- a/src/misc/simulation/aircraftmodel.cpp +++ b/src/misc/simulation/aircraftmodel.cpp @@ -248,7 +248,7 @@ namespace swift::misc::simulation } if (IOrderable::canHandleIndex(index)) { return IOrderable::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexModelString: return QVariant(m_modelString); @@ -296,7 +296,7 @@ namespace swift::misc::simulation return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexModelString: m_modelString = variant.toString(); break; @@ -347,7 +347,7 @@ namespace swift::misc::simulation } if (IOrderable::canHandleIndex(index)) { return IOrderable::comparePropertyByIndex(index, compareValue); } if (index.isMyself()) { return m_modelString.compare(compareValue.getModelString(), Qt::CaseInsensitive); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexModelString: return m_modelString.compare(compareValue.getModelString(), Qt::CaseInsensitive); diff --git a/src/misc/simulation/distributor.cpp b/src/misc/simulation/distributor.cpp index f60997b8e..d0631dbd6 100644 --- a/src/misc/simulation/distributor.cpp +++ b/src/misc/simulation/distributor.cpp @@ -65,7 +65,7 @@ namespace swift::misc::simulation } if (IOrderable::canHandleIndex(index)) { return IOrderable::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAlias1: return QVariant::fromValue(m_alias1); @@ -94,7 +94,7 @@ namespace swift::misc::simulation return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAlias1: m_alias1 = variant.value(); break; @@ -113,7 +113,7 @@ namespace swift::misc::simulation } if (IOrderable::canHandleIndex(index)) { return IOrderable::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAlias1: return m_alias1.compare(compareValue.m_alias1, Qt::CaseInsensitive); diff --git a/src/misc/simulation/fscommon/aircraftcfgentries.cpp b/src/misc/simulation/fscommon/aircraftcfgentries.cpp index 09fce8f2a..feae23bf8 100644 --- a/src/misc/simulation/fscommon/aircraftcfgentries.cpp +++ b/src/misc/simulation/fscommon/aircraftcfgentries.cpp @@ -128,7 +128,7 @@ namespace swift::misc::simulation::fscommon { if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEntryIndex: return QVariant::fromValue(m_index); @@ -163,7 +163,7 @@ namespace swift::misc::simulation::fscommon ITimestampBased::setPropertyByIndex(index, variant); return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEntryIndex: this->setIndex(variant.toInt()); break; diff --git a/src/misc/simulation/fscommon/bcdconversions.cpp b/src/misc/simulation/fscommon/bcdconversions.cpp index 904bb752b..ca701f038 100644 --- a/src/misc/simulation/fscommon/bcdconversions.cpp +++ b/src/misc/simulation/fscommon/bcdconversions.cpp @@ -22,7 +22,7 @@ namespace swift::misc::simulation::fscommon quint32 CBcdConversions::transponderCodeToBcd(const swift::misc::aviation::CTransponder &transponder) { // FSX documentation is wrong, we need to use kHz + 2 digits, not Hz - quint32 t = static_cast(transponder.getTransponderCode()); + auto t = static_cast(transponder.getTransponderCode()); t = dec2Bcd(t); return t; } diff --git a/src/misc/simulation/fscommon/vpilotmodelrule.cpp b/src/misc/simulation/fscommon/vpilotmodelrule.cpp index 51c98bdfd..0f5340af5 100644 --- a/src/misc/simulation/fscommon/vpilotmodelrule.cpp +++ b/src/misc/simulation/fscommon/vpilotmodelrule.cpp @@ -48,7 +48,7 @@ namespace swift::misc::simulation::fscommon { if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexModelName: return QVariant::fromValue(this->m_modelName); @@ -71,7 +71,7 @@ namespace swift::misc::simulation::fscommon ITimestampBased::setPropertyByIndex(index, variant); return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexModelName: this->setModelName(variant.value()); break; diff --git a/src/misc/simulation/interpolation/interpolationrenderingsetup.cpp b/src/misc/simulation/interpolation/interpolationrenderingsetup.cpp index 1c749d828..51797bedb 100644 --- a/src/misc/simulation/interpolation/interpolationrenderingsetup.cpp +++ b/src/misc/simulation/interpolation/interpolationrenderingsetup.cpp @@ -95,7 +95,7 @@ namespace swift::misc::simulation QVariant CInterpolationAndRenderingSetupBase::propertyByIndex(CPropertyIndexRef index) const { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexLogInterpolation: return QVariant::fromValue(m_logInterpolation); @@ -115,7 +115,7 @@ namespace swift::misc::simulation void CInterpolationAndRenderingSetupBase::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexLogInterpolation: m_logInterpolation = variant.toBool(); return; @@ -272,7 +272,7 @@ namespace swift::misc::simulation QVariant CInterpolationAndRenderingSetupGlobal::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMaxRenderedAircraft: return QVariant::fromValue(m_maxRenderedAircraft); @@ -293,7 +293,7 @@ namespace swift::misc::simulation *this = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMaxRenderedAircraft: m_maxRenderedAircraft = variant.toInt(); return; @@ -355,7 +355,7 @@ namespace swift::misc::simulation QVariant CInterpolationAndRenderingSetupPerCallsign::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved()); @@ -372,7 +372,7 @@ namespace swift::misc::simulation *this = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsign: m_callsign.setPropertyByIndex(index.copyFrontRemoved(), variant); return; diff --git a/src/misc/simulation/interpolation/interpolatorspline.cpp b/src/misc/simulation/interpolation/interpolatorspline.cpp index ba037767c..5bd7911f7 100644 --- a/src/misc/simulation/interpolation/interpolatorspline.cpp +++ b/src/misc/simulation/interpolation/interpolatorspline.cpp @@ -42,7 +42,7 @@ namespace swift::misc::simulation // back substitution for (int i = N - 2; i >= 0; --i) { - const size_t it = static_cast(i); + const auto it = static_cast(i); d[it] -= c(it) * d[it + 1]; } return d; @@ -243,8 +243,8 @@ namespace swift::misc::simulation // we use different offset times for fast pos. updates // KB: is that correct with dt2, or would it be m_nextSampleTime - m_prevSampleTime // as long as the offset time is constant, it does not matter - const double dt1 = static_cast(m_currentTimeMsSinceEpoch - m_prevSampleAdjustedTime); - const double dt2 = static_cast(m_nextSampleAdjustedTime - m_prevSampleAdjustedTime); + const auto dt1 = static_cast(m_currentTimeMsSinceEpoch - m_prevSampleAdjustedTime); + const auto dt2 = static_cast(m_nextSampleAdjustedTime - m_prevSampleAdjustedTime); double timeFraction = dt1 / dt2; if (CBuildConfig::isLocalDeveloperDebugBuild()) diff --git a/src/misc/simulation/matchingstatisticsentry.cpp b/src/misc/simulation/matchingstatisticsentry.cpp index a9d0c5826..37c196b81 100644 --- a/src/misc/simulation/matchingstatisticsentry.cpp +++ b/src/misc/simulation/matchingstatisticsentry.cpp @@ -79,7 +79,7 @@ namespace swift::misc::simulation if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSessionId: return QVariant::fromValue(m_sessionId); @@ -109,7 +109,7 @@ namespace swift::misc::simulation return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSessionId: this->setSessionId(variant.value()); break; @@ -130,7 +130,7 @@ namespace swift::misc::simulation { return ITimestampBased::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSessionId: return m_sessionId.compare(compareValue.m_sessionId, Qt::CaseInsensitive); diff --git a/src/misc/simulation/modelconverterx.cpp b/src/misc/simulation/modelconverterx.cpp index ebfdfb067..21426ad3e 100644 --- a/src/misc/simulation/modelconverterx.cpp +++ b/src/misc/simulation/modelconverterx.cpp @@ -46,7 +46,7 @@ namespace swift::misc::simulation else { old->deleteLater(); } } - QProcess *process = new QProcess(parent); + auto process = new QProcess(parent); const QString argument = QDir::toNativeSeparators(model.getFileName()); process->setProgram(modelConverterX); process->setArguments({ argument }); diff --git a/src/misc/simulation/ownaircraftproviderdummy.cpp b/src/misc/simulation/ownaircraftproviderdummy.cpp index 7dfb53cad..b2f397b6b 100644 --- a/src/misc/simulation/ownaircraftproviderdummy.cpp +++ b/src/misc/simulation/ownaircraftproviderdummy.cpp @@ -140,7 +140,7 @@ namespace swift::misc::simulation COwnAircraftProviderDummy *COwnAircraftProviderDummy::instance() { - static COwnAircraftProviderDummy *dummy = new COwnAircraftProviderDummy(); + static auto dummy = new COwnAircraftProviderDummy(); return dummy; } } // namespace swift::misc::simulation diff --git a/src/misc/simulation/remoteaircraftproviderdummy.cpp b/src/misc/simulation/remoteaircraftproviderdummy.cpp index df6d61ae3..a87935615 100644 --- a/src/misc/simulation/remoteaircraftproviderdummy.cpp +++ b/src/misc/simulation/remoteaircraftproviderdummy.cpp @@ -13,7 +13,7 @@ namespace swift::misc::simulation { CRemoteAircraftProviderDummy *CRemoteAircraftProviderDummy::instance() { - static CRemoteAircraftProviderDummy *dummy = new CRemoteAircraftProviderDummy(); + static auto dummy = new CRemoteAircraftProviderDummy(); return dummy; } diff --git a/src/misc/simulation/settings/fgswiftbussettings.cpp b/src/misc/simulation/settings/fgswiftbussettings.cpp index 47886436d..9c1098bb7 100644 --- a/src/misc/simulation/settings/fgswiftbussettings.cpp +++ b/src/misc/simulation/settings/fgswiftbussettings.cpp @@ -10,7 +10,7 @@ namespace swift::misc::simulation::settings QVariant CFGSwiftBusSettings::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDBusServerAddress: return QVariant::fromValue(m_dBusServerAddress); @@ -27,7 +27,7 @@ namespace swift::misc::simulation::settings return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDBusServerAddress: m_dBusServerAddress = variant.toString(); break; diff --git a/src/misc/simulation/settings/modelsettings.cpp b/src/misc/simulation/settings/modelsettings.cpp index 6c5844293..397bdcfa4 100644 --- a/src/misc/simulation/settings/modelsettings.cpp +++ b/src/misc/simulation/settings/modelsettings.cpp @@ -20,7 +20,7 @@ namespace swift::misc::simulation::settings QVariant CModelSettings::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAllowExclude: return QVariant::fromValue(this->m_allowExcludeModels); @@ -35,7 +35,7 @@ namespace swift::misc::simulation::settings (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexAllowExclude: this->setAllowExcludedModels(variant.toBool()); break; diff --git a/src/misc/simulation/settings/simulatorsettings.cpp b/src/misc/simulation/settings/simulatorsettings.cpp index 896d80d5a..5a1757663 100644 --- a/src/misc/simulation/settings/simulatorsettings.cpp +++ b/src/misc/simulation/settings/simulatorsettings.cpp @@ -140,7 +140,7 @@ namespace swift::misc::simulation::settings QVariant CSimulatorSettings::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSimulatorDirectory: return QVariant::fromValue(m_simulatorDirectory); @@ -161,7 +161,7 @@ namespace swift::misc::simulation::settings (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexSimulatorDirectory: this->setSimulatorDirectory(variant.toString()); break; @@ -509,7 +509,7 @@ namespace swift::misc::simulation::settings QVariant CSimulatorMessagesSettings::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexTechnicalLogSeverity: return QVariant::fromValue(m_technicalLogLevel); @@ -526,7 +526,7 @@ namespace swift::misc::simulation::settings (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexTechnicalLogSeverity: diff --git a/src/misc/simulation/settings/swiftpluginsettings.cpp b/src/misc/simulation/settings/swiftpluginsettings.cpp index 1a9508ad8..e28b4bfde 100644 --- a/src/misc/simulation/settings/swiftpluginsettings.cpp +++ b/src/misc/simulation/settings/swiftpluginsettings.cpp @@ -28,7 +28,7 @@ namespace swift::misc::simulation::settings QVariant CSwiftPluginSettings::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEmulatedSimulator: return this->m_emulatedSimulator.propertyByIndex(index.copyFrontRemoved()); @@ -46,7 +46,7 @@ namespace swift::misc::simulation::settings (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexEmulatedSimulator: diff --git a/src/misc/simulation/settings/xswiftbussettings.cpp b/src/misc/simulation/settings/xswiftbussettings.cpp index 976f81038..73c1ec585 100644 --- a/src/misc/simulation/settings/xswiftbussettings.cpp +++ b/src/misc/simulation/settings/xswiftbussettings.cpp @@ -17,7 +17,7 @@ namespace swift::misc::simulation::settings { if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMaxPlanes: return QVariant::fromValue(m_maxPlanes); @@ -42,7 +42,7 @@ namespace swift::misc::simulation::settings } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMaxPlanes: m_maxPlanes = variant.toInt(); break; diff --git a/src/misc/simulation/simulatedaircraft.cpp b/src/misc/simulation/simulatedaircraft.cpp index a689eadd2..53c5e52b2 100644 --- a/src/misc/simulation/simulatedaircraft.cpp +++ b/src/misc/simulation/simulatedaircraft.cpp @@ -321,7 +321,7 @@ namespace swift::misc::simulation QVariant CSimulatedAircraft::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexModel: return this->getModel().propertyByIndex(index.copyFrontRemoved()); @@ -362,7 +362,7 @@ namespace swift::misc::simulation (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsign: m_callsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -401,7 +401,7 @@ namespace swift::misc::simulation { return m_callsign.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCallsign()); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexCallsign: diff --git a/src/misc/simulation/simulatorinternals.cpp b/src/misc/simulation/simulatorinternals.cpp index 310cfd923..57fc251bf 100644 --- a/src/misc/simulation/simulatorinternals.cpp +++ b/src/misc/simulation/simulatorinternals.cpp @@ -62,7 +62,7 @@ namespace swift::misc::simulation QVariant CSimulatorInternals::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexData: return QVariant::fromValue(m_data); @@ -77,7 +77,7 @@ namespace swift::misc::simulation (*this) = variant.value(); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexData: m_data = variant.value(); break; diff --git a/src/misc/statusmessage.cpp b/src/misc/statusmessage.cpp index b7eb924d7..f1eb9edd9 100644 --- a/src/misc/statusmessage.cpp +++ b/src/misc/statusmessage.cpp @@ -397,7 +397,7 @@ namespace swift::misc if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } if (IOrderable::canHandleIndex(index)) { return IOrderable::propertyByIndex(index); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMessage: return QVariant::fromValue(this->getMessage()); @@ -427,7 +427,7 @@ namespace swift::misc IOrderable::setPropertyByIndex(index, variant); return; } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMessage: @@ -448,7 +448,7 @@ namespace swift::misc return ITimestampBased::comparePropertyByIndex(index, compareValue); } if (IOrderable::canHandleIndex(index)) { return IOrderable::comparePropertyByIndex(index, compareValue); } - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexMessageAsHtml: diff --git a/src/misc/test/testservice.cpp b/src/misc/test/testservice.cpp index 606b7c800..08cc9e061 100644 --- a/src/misc/test/testservice.cpp +++ b/src/misc/test/testservice.cpp @@ -56,7 +56,7 @@ namespace swift::misc::test CTestService *CTestService::registerTestService(QDBusConnection &connection, bool verbose, QObject *parent) { - CTestService *pTestService = new CTestService( + const auto pTestService = new CTestService( verbose, parent); // just a QObject with signals / slots and Q_CLASSINFO("D-Bus Interface", some service name) if (!connection.registerService(CTestService::InterfaceName())) diff --git a/src/misc/timestampbased.cpp b/src/misc/timestampbased.cpp index 3af490ee5..eaf5ed9d9 100644 --- a/src/misc/timestampbased.cpp +++ b/src/misc/timestampbased.cpp @@ -154,7 +154,7 @@ namespace swift::misc { if (!index.isEmpty()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexUtcTimestamp: return QVariant::fromValue(this->getUtcTimestamp()); @@ -178,7 +178,7 @@ namespace swift::misc { if (!index.isEmpty()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexUtcTimestamp: this->setUtcTimestamp(variant.toDateTime()); return; @@ -271,7 +271,7 @@ namespace swift::misc if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } if (!index.isEmpty()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexOffsetMs: @@ -303,7 +303,7 @@ namespace swift::misc } if (!index.isEmpty()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexOffsetMs: @@ -329,7 +329,7 @@ namespace swift::misc } if (!index.isEmpty()) { - const ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexOffsetWithUnit: diff --git a/src/misc/variant.cpp b/src/misc/variant.cpp index 4a7eee011..fdf6bb3c9 100644 --- a/src/misc/variant.cpp +++ b/src/misc/variant.cpp @@ -533,7 +533,7 @@ namespace swift::misc // complex, user type // it has to be made sure, that the cast works - const QDBusArgument arg = variant.value(); + const auto arg = variant.value(); constexpr int userType = static_cast(QMetaType::User); if (localUserType.id() < userType) { diff --git a/src/misc/weather/presentweather.cpp b/src/misc/weather/presentweather.cpp index aca47a513..17086b38a 100644 --- a/src/misc/weather/presentweather.cpp +++ b/src/misc/weather/presentweather.cpp @@ -24,7 +24,7 @@ namespace swift::misc::weather QVariant CPresentWeather::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIntensity: return QVariant::fromValue(m_intensity); @@ -41,7 +41,7 @@ namespace swift::misc::weather (*this) = variant.value(); return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexIntensity: setIntensity(variant.value()); break; diff --git a/src/misc/weather/windlayer.cpp b/src/misc/weather/windlayer.cpp index 464af8637..75d5ead3e 100644 --- a/src/misc/weather/windlayer.cpp +++ b/src/misc/weather/windlayer.cpp @@ -22,7 +22,7 @@ namespace swift::misc::weather QVariant CWindLayer::propertyByIndex(swift::misc::CPropertyIndexRef index) const { if (index.isMyself()) { return QVariant::fromValue(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexLevel: return QVariant::fromValue(m_level); @@ -41,7 +41,7 @@ namespace swift::misc::weather (*this) = variant.value(); return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexLevel: setLevel(variant.value()); break; diff --git a/src/plugins/simulator/flightgearconfig/simulatorflightgearconfig.cpp b/src/plugins/simulator/flightgearconfig/simulatorflightgearconfig.cpp index 87137822c..6e9998c1e 100644 --- a/src/plugins/simulator/flightgearconfig/simulatorflightgearconfig.cpp +++ b/src/plugins/simulator/flightgearconfig/simulatorflightgearconfig.cpp @@ -13,7 +13,7 @@ namespace swift::simplugin::flightgear swift::gui::CPluginConfigWindow *CSimulatorFlightgearConfig::createConfigWindow(QWidget *parent) { - CSimulatorFlightgearConfigWindow *w = new CSimulatorFlightgearConfigWindow(parent); + auto w = new CSimulatorFlightgearConfigWindow(parent); return w; } } // namespace swift::simplugin::flightgear diff --git a/src/plugins/simulator/plugincommon/simulatorplugincommon.cpp b/src/plugins/simulator/plugincommon/simulatorplugincommon.cpp index 815f72b92..b4133006d 100644 --- a/src/plugins/simulator/plugincommon/simulatorplugincommon.cpp +++ b/src/plugins/simulator/plugincommon/simulatorplugincommon.cpp @@ -45,7 +45,7 @@ namespace swift::simplugin::common if (!m_interpolationDisplayDialog) { QWidget *parentWidget = sGui ? sGui->mainApplicationWidget() : nullptr; - CInterpolationLogDisplayDialog *dialog = new CInterpolationLogDisplayDialog(this, nullptr, parentWidget); + auto *dialog = new CInterpolationLogDisplayDialog(this, nullptr, parentWidget); m_interpolationDisplayDialog = dialog; m_interpolationDisplayDialog->setModal(false); } diff --git a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfig.cpp b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfig.cpp index d120088ee..c5d4661d3 100644 --- a/src/plugins/simulator/xplaneconfig/simulatorxplaneconfig.cpp +++ b/src/plugins/simulator/xplaneconfig/simulatorxplaneconfig.cpp @@ -16,7 +16,7 @@ namespace swift::simplugin::xplane swift::gui::CPluginConfigWindow *CSimulatorXPlaneConfig::createConfigWindow(QWidget *parent) { - CSimulatorXPlaneConfigWindow *w = new CSimulatorXPlaneConfigWindow(parent); + auto *w = new CSimulatorXPlaneConfigWindow(parent); return w; } } // namespace swift::simplugin::xplane diff --git a/src/sound/notificationplayer.cpp b/src/sound/notificationplayer.cpp index 511be0f1b..bc7862f04 100644 --- a/src/sound/notificationplayer.cpp +++ b/src/sound/notificationplayer.cpp @@ -91,7 +91,7 @@ namespace swift::sound // new effect // QString fn = url.toLocalFile(); - QSoundEffect *effect = new QSoundEffect(this); + auto effect = new QSoundEffect(this); effect->setSource(url); effect->setLoopCount(1); effect->setMuted(false); diff --git a/src/sound/sampleprovider/pinknoisegenerator.cpp b/src/sound/sampleprovider/pinknoisegenerator.cpp index afe24813c..1b004765e 100644 --- a/src/sound/sampleprovider/pinknoisegenerator.cpp +++ b/src/sound/sampleprovider/pinknoisegenerator.cpp @@ -26,7 +26,7 @@ namespace swift::sound::sample_provider double pink = m_pinkNoiseBuffer[0] + m_pinkNoiseBuffer[1] + m_pinkNoiseBuffer[2] + m_pinkNoiseBuffer[3] + m_pinkNoiseBuffer[4] + m_pinkNoiseBuffer[5] + m_pinkNoiseBuffer[6] + white * 0.5362; m_pinkNoiseBuffer[6] = white * 0.115926; - const float sampleValue = static_cast(m_gain * (pink / 5)); + const auto sampleValue = static_cast(m_gain * (pink / 5)); samples[sampleCount] = sampleValue; } return c; diff --git a/src/sound/threadedtonepairplayer.cpp b/src/sound/threadedtonepairplayer.cpp index f61d31ac2..d86e4923d 100644 --- a/src/sound/threadedtonepairplayer.cpp +++ b/src/sound/threadedtonepairplayer.cpp @@ -134,7 +134,7 @@ namespace swift::sound qint64 bytesPerTonePair = m_audioFormat.sampleRate() * bytesForAllChannels * tonePair.getDurationMs().count() / 1000; bufferData.resize(static_cast(bytesPerTonePair)); - unsigned char *bufferPointer = reinterpret_cast(bufferData.data()); + auto bufferPointer = reinterpret_cast(bufferData.data()); qint64 last0AmplitudeSample = bytesPerTonePair; // last sample when amplitude was 0 int sampleIndexPerTonePair = 0; @@ -201,7 +201,7 @@ namespace swift::sound { Q_ASSERT(this->m_audioFormat.sampleFormat() == QAudioFormat::Int16); static_assert(Q_BYTE_ORDER == Q_LITTLE_ENDIAN); - const qint16 value = static_cast(amplitude * 32767); + const auto value = static_cast(amplitude * 32767); #if Q_BYTE_ORDER == Q_BIG_ENDIAN qToBigEndian(value, bufferPointer); diff --git a/src/sound/wav/wavfile.cpp b/src/sound/wav/wavfile.cpp index 7035895e3..19624d864 100644 --- a/src/sound/wav/wavfile.cpp +++ b/src/sound/wav/wavfile.cpp @@ -109,7 +109,7 @@ namespace swift::sound::wav if (memcmp(&dataHeader.descriptor.id, "data", 4) == 0) { - const qint32 dataLength = qFromLittleEndian(dataHeader.descriptor.size); + const auto dataLength = qFromLittleEndian(dataHeader.descriptor.size); m_audioData = read(dataLength); if (m_audioData.size() != dataLength) { diff --git a/src/swiftguistandard/swiftguistd.cpp b/src/swiftguistandard/swiftguistd.cpp index f644c9532..78a0781b3 100644 --- a/src/swiftguistandard/swiftguistd.cpp +++ b/src/swiftguistandard/swiftguistd.cpp @@ -184,7 +184,7 @@ QAction *SwiftGuiStd::getWindowMinimizeAction(QObject *parent) { const QIcon i(CIcons::changeIconBackgroundColor(this->style()->standardIcon(QStyle::SP_TitleBarMinButton), Qt::white, QSize(16, 16))); - QAction *a = new QAction(i, "Window minimized", parent); + auto a = new QAction(i, "Window minimized", parent); connect(a, &QAction::triggered, this, &SwiftGuiStd::showMinimized); return a; } @@ -193,7 +193,7 @@ QAction *SwiftGuiStd::getWindowNormalAction(QObject *parent) { const QIcon i(CIcons::changeIconBackgroundColor(this->style()->standardIcon(QStyle::SP_TitleBarNormalButton), Qt::white, QSize(16, 16))); - QAction *a = new QAction(i, "Window normal", parent); + auto a = new QAction(i, "Window normal", parent); connect(a, &QAction::triggered, this, &SwiftGuiStd::showNormal); return a; } @@ -202,7 +202,7 @@ QAction *SwiftGuiStd::getToggleWindowVisibilityAction(QObject *parent) { const QIcon i(CIcons::changeIconBackgroundColor(this->style()->standardIcon(QStyle::SP_TitleBarShadeButton), Qt::white, QSize(16, 16))); - QAction *a = new QAction(i, "Toogle main window visibility", parent); + auto a = new QAction(i, "Toogle main window visibility", parent); connect(a, &QAction::triggered, this, &SwiftGuiStd::toggleWindowVisibility); return a; } @@ -211,7 +211,7 @@ QAction *SwiftGuiStd::getToggleStayOnTopAction(QObject *parent) { const QIcon i(CIcons::changeIconBackgroundColor(this->style()->standardIcon(QStyle::SP_TitleBarUnshadeButton), Qt::white, QSize(16, 16))); - QAction *a = new QAction(i, "Toogle main window on top", parent); + auto a = new QAction(i, "Toogle main window on top", parent); connect(a, &QAction::triggered, this, &SwiftGuiStd::toggleWindowStayOnTop); return a; } diff --git a/tests/core/fsd/testfsdclient/testfsdclient.cpp b/tests/core/fsd/testfsdclient/testfsdclient.cpp index 53885d2f5..35cf4d4cc 100644 --- a/tests/core/fsd/testfsdclient/testfsdclient.cpp +++ b/tests/core/fsd/testfsdclient/testfsdclient.cpp @@ -194,7 +194,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); - CTextMessageList messages = arguments.at(0).value(); + auto messages = arguments.at(0).value(); QCOMPARE(messages.size(), 1); CTextMessage message = messages.front(); QCOMPARE(message.getMessage(), "Hey how are you doing?"); @@ -216,7 +216,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); - CTextMessageList receivedMessages = arguments.at(0).value(); + auto receivedMessages = arguments.at(0).value(); QCOMPARE(receivedMessages.size(), 1); CTextMessage message = receivedMessages.front(); QCOMPARE(message.getMessage(), text); @@ -247,7 +247,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CQABCD:EDLW_TWR:ATIS"); } @@ -293,8 +293,8 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 2); - const CAircraftSituation situation = arguments.at(0).value(); - const CTransponder transponder = arguments.at(1).value(); + const auto situation = arguments.at(0).value(); + const auto transponder = arguments.at(1).value(); QCOMPARE(situation.getCallsign().asString(), "ABCD"); QCOMPARE(transponder.getTransponderMode(), CTransponder::ModeC); @@ -390,7 +390,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 2); - CClient::Capabilities caps = arguments.at(1).value(); + auto caps = arguments.at(1).value(); QVERIFY(caps.testFlag(CClient::FsdWithAircraftConfig)); } @@ -433,7 +433,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#APABCD:SERVER:1234567:123456:1:101:16:Test User"); } @@ -447,7 +447,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#AAABCD:SERVER:Test User:1234567:123456:5:101"); } @@ -460,7 +460,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#DPABCD:1234567"); } @@ -473,7 +473,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#DAABCD:1234567"); } @@ -503,7 +503,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 2); const QList arguments = spy.takeLast(); QCOMPARE(arguments.size(), 1); - const CRawFsdMessage fsdMessage = arguments.at(0).value(); + const auto fsdMessage = arguments.at(0).value(); const QString fsdRawMessage = fsdMessage.getRawMessage(); // PilotRating::Student @@ -536,7 +536,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 2); QList arguments = spy.takeLast(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); // changed after we changed to PB inversion to *-1 // now also Pilot rating to Student @@ -570,7 +570,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 2); QList arguments = spy.takeLast(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); // changed after we changed to PB inversion to *-1 // pilot rating now STUDENT @@ -585,7 +585,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>%ABCD:99998:0:300:1:48.11028:8.56972:0"); } @@ -597,7 +597,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QVERIFY(fsdMessage.getRawMessage().contains("FSD Sent=>$PIABCD:SERVER:")); } @@ -609,7 +609,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$POABCD:SERVER:123456789"); } @@ -621,7 +621,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CRABCD:ZZZZ_TWR:RN:Test User::1"); } @@ -633,7 +633,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CRABCD:ZZZZ_TWR:CAPS:ATCINFO=1:MODELDESC=1:ACCONFIG=1"); } @@ -645,7 +645,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CQABCD:ZZZZ_TWR:RN"); } @@ -657,7 +657,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CQABCD:SERVER:ATC:EDDM_TWR"); } @@ -669,7 +669,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CQABCD:DLH123:ACC:{\"request\":\"full\"}"); } @@ -681,7 +681,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#TMABCD:ZZZZ_TWR:hey dude!"); } @@ -693,7 +693,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#TMABCD:*S:Please help!!!"); } @@ -706,7 +706,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#TMABCD:@24050:hey dude!"); } @@ -719,7 +719,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#TMABCD:@24050&@35725:hey dude!"); } @@ -741,7 +741,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE( fsdMessage.getRawMessage(), "FSD Sent=>$FPABCD:SERVER:V:H/B744/L:420:EGLL:1530:1535:FL350:KORD:8:15:9:30:NONE:UNIT TEST:EGLL.KORD"); @@ -768,7 +768,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE( fsdMessage.getRawMessage(), "FSD Sent=>$FPABCD:SERVER:V:B748/H-SDE3FGHIM1M2RWXY/LB1:420:EGLL:1530:1535:FL350:KORD:8:15:9:30:NONE:UNIT " @@ -783,7 +783,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#SBABCD:XYZ:PIR"); } @@ -795,7 +795,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#SBABCD:XYZ:PI:GEN:EQUIPMENT=B744:AIRLINE=BAW"); } @@ -807,7 +807,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#SBABCD:XYZ:PI:GEN:EQUIPMENT=B744:AIRLINE=BAW:LIVERY=UNION"); } @@ -819,7 +819,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#SBABCD:XYZ:PI:GEN:EQUIPMENT=B744"); } @@ -831,19 +831,19 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#SBABCD:XYZ:PI:GEN:LIVERY=UNION"); } void CTestFSDClient::testSendAircraftConfiguration() { QSignalSpy spy(m_client, &CFSDClient::rawFsdMessage); - m_client->sendAircraftConfiguration("XYZ", "{\"request\":\"full\"}"); + m_client->sendAircraftConfiguration("XYZ", R"({"request":"full"})"); QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CQABCD:XYZ:ACC:{\"request\":\"full\"}"); } @@ -860,7 +860,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 1); QList arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CQABCD:@94836:ACC:{\"config\":{\"gear_down\":true}}"); } @@ -872,7 +872,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 2); QList arguments = spy.takeAt(1); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CRABCD:EDMM_CTR:C?:123.000"); } @@ -884,7 +884,7 @@ namespace SwiftFsdTest QCOMPARE(spy.count(), 2); QList arguments = spy.takeAt(1); QCOMPARE(arguments.size(), 1); - CRawFsdMessage fsdMessage = arguments.at(0).value(); + auto fsdMessage = arguments.at(0).value(); QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>#SBABCD:EDMM_CTR:PI:GEN:EQUIPMENT=B737:AIRLINE=BER"); } diff --git a/tests/misc/pq/testphysicalquantities/testphysicalquantities.cpp b/tests/misc/pq/testphysicalquantities/testphysicalquantities.cpp index d69a5913e..d32ffcc1d 100644 --- a/tests/misc/pq/testphysicalquantities/testphysicalquantities.cpp +++ b/tests/misc/pq/testphysicalquantities/testphysicalquantities.cpp @@ -285,13 +285,13 @@ namespace MiscTest void CTestPhysicalQuantities::memoryTests() { - CLength *c = new CLength(100, CLengthUnit::m()); + auto c = new CLength(100, CLengthUnit::m()); c->switchUnit(CLengthUnit::NM()); QVERIFY2(c->getUnit() == CLengthUnit::NM() && CLengthUnit::defaultUnit() == CLengthUnit::m(), "Testing distance units failed"); delete c; - CAngle *a = new CAngle(100, CAngleUnit::rad()); + auto a = new CAngle(100, CAngleUnit::rad()); a->switchUnit(CAngleUnit::deg()); QVERIFY2(a->getUnit() == CAngleUnit::deg() && CAngleUnit::defaultUnit() == CAngleUnit::deg(), "Testing angle units failed"); @@ -307,13 +307,13 @@ namespace MiscTest QVERIFY2(CMass(33.45, CMassUnit::kg()) == CMass("33.45000 kg"), "CMass"); // parsing via variant - CSpeed parsedPq1 = CPqString::parseToVariant("100.123 km/h").value(); + auto parsedPq1 = CPqString::parseToVariant("100.123 km/h").value(); QVERIFY2(CSpeed(100.123, CSpeedUnit::km_h()) == parsedPq1, "Parsed speed via variant"); - CLength parsedPq2 = CPqString::parseToVariant("-33.123ft").value(); + auto parsedPq2 = CPqString::parseToVariant("-33.123ft").value(); QVERIFY2(CLength(-33.123, CLengthUnit::ft()) == parsedPq2, "Parsed length via variant"); - CFrequency parsedPq3 = CPqString::parse("122.8MHz"); + auto parsedPq3 = CPqString::parse("122.8MHz"); QVERIFY2(CFrequency(122.8, CFrequencyUnit::MHz()) == parsedPq3, "Parsed frequency via variant"); } diff --git a/tests/misc/testpropertyindex/testpropertyindex.cpp b/tests/misc/testpropertyindex/testpropertyindex.cpp index a94d384e9..3d987f1c8 100644 --- a/tests/misc/testpropertyindex/testpropertyindex.cpp +++ b/tests/misc/testpropertyindex/testpropertyindex.cpp @@ -42,7 +42,7 @@ namespace MiscTest aircraft.setCallsign("DEIHL"); aircraft.setCom1ActiveFrequency(f); CVariant vf = aircraft.propertyByIndex(i); - const CFrequency pf = vf.value(); + const auto pf = vf.value(); QVERIFY2(pf == f, "Frequencies should have same value"); } diff --git a/tests/misc/testslot/testslot.cpp b/tests/misc/testslot/testslot.cpp index b8a66182c..bfd23f61d 100644 --- a/tests/misc/testslot/testslot.cpp +++ b/tests/misc/testslot/testslot.cpp @@ -27,7 +27,7 @@ namespace MiscTest void CTestSlot::slotBasics() { - QObject *obj = new QObject(this); + auto obj = new QObject(this); CSlot slot1 = { obj, [&](const QString &name) { obj->setObjectName(name); } }; QVERIFY2(slot1, "Slot has valid object and function - can be called."); diff --git a/tests/misc/testvalueobject.h b/tests/misc/testvalueobject.h index 02e4d2086..ac84aed42 100644 --- a/tests/misc/testvalueobject.h +++ b/tests/misc/testvalueobject.h @@ -62,7 +62,7 @@ namespace swift::misc CVariant propertyByIndex(const swift::misc::CPropertyIndex &index) const { if (index.isMyself()) { return CVariant::from(*this); } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDescription: return CVariant::fromValue(this->m_description); @@ -79,7 +79,7 @@ namespace swift::misc (*this) = variant.to(); return; } - ColumnIndex i = index.frontCasted(); + const auto i = index.frontCasted(); switch (i) { case IndexDescription: this->setDescription(variant.value()); break; diff --git a/tests/misc/testvariantandmap/testvariantandmap.cpp b/tests/misc/testvariantandmap/testvariantandmap.cpp index be59422c5..a8b460149 100644 --- a/tests/misc/testvariantandmap/testvariantandmap.cpp +++ b/tests/misc/testvariantandmap/testvariantandmap.cpp @@ -129,7 +129,7 @@ namespace MiscTest CVariant variant = CVariant::from(ints); QVERIFY2(variant.canConvert(), "Variant containing list can convert to CVariantList"); QVERIFY2(variant.convert(qMetaTypeId()), "Variant containing list can convert to CVariantList"); - const CVariantList variantInts = variant.to(); + const auto variantInts = variant.to(); QVERIFY2(ints.size() == variantInts.size(), "Variant list has same size as original list"); QVERIFY2(ints[0] == variantInts[0].to(), "Variant list has same element"); QVERIFY2(variant.canConvert>(), "Variant containing can convert back"); @@ -139,7 +139,7 @@ namespace MiscTest variant = CVariant::from(list); QVERIFY2(variant.canConvert(), "Variant containing list can convert to CVariantList"); QVERIFY2(variant.convert(qMetaTypeId()), "Variant containing list can convert to CVariantList"); - CVariantList variantList = variant.to(); + auto variantList = variant.to(); QVERIFY2(list.size() == variantList.size(), "Variant list has same size as original list"); QVERIFY2(list[0] == variantList[0].to(), "Variant list has same element"); QVERIFY2(variant.canConvert(), "Variant containing can convert back");