From 0971c8ce68178ca76ca242df8d8ceee4b7acb897 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Sun, 1 Nov 2020 20:05:34 +0000 Subject: [PATCH] Issue #77 All classes propertyindex methods use CPropertyIndexRef and QVariant --- samples/blackmisc/samplesperformance.cpp | 14 ++-- src/blackcore/data/globalsetup.cpp | 50 +++++++------- src/blackcore/data/globalsetup.h | 4 +- src/blackcore/data/launchersetup.cpp | 18 ++--- src/blackcore/data/launchersetup.h | 4 +- src/blackcore/data/vatsimsetup.cpp | 12 ++-- src/blackcore/data/vatsimsetup.h | 4 +- src/blackcore/vatsim/vatsimsettings.cpp | 28 ++++---- src/blackcore/vatsim/vatsimsettings.h | 8 +-- src/blackgui/settings/atcstationssettings.cpp | 12 ++-- src/blackgui/settings/atcstationssettings.h | 4 +- src/blackgui/settings/dockwidgetsettings.cpp | 24 +++---- src/blackgui/settings/dockwidgetsettings.h | 4 +- src/blackgui/settings/guisettings.cpp | 14 ++-- src/blackgui/settings/guisettings.h | 4 +- src/blackgui/settings/navigatorsettings.cpp | 16 ++--- src/blackgui/settings/navigatorsettings.h | 4 +- src/blackgui/settings/textmessagesettings.cpp | 26 ++++---- src/blackgui/settings/textmessagesettings.h | 4 +- src/blackgui/settings/viewupdatesettings.cpp | 16 ++--- src/blackgui/settings/viewupdatesettings.h | 4 +- src/blackgui/views/viewbasenontemplate.cpp | 4 +- src/blackmisc/applicationinfo.cpp | 38 +++++------ src/blackmisc/applicationinfo.h | 6 +- src/blackmisc/audio/audiodeviceinfo.cpp | 18 ++--- src/blackmisc/audio/audiodeviceinfo.h | 6 +- src/blackmisc/audio/voicesetup.cpp | 18 ++--- src/blackmisc/audio/voicesetup.h | 6 +- src/blackmisc/aviation/aircraftcategory.cpp | 24 +++---- src/blackmisc/aviation/aircraftcategory.h | 6 +- src/blackmisc/aviation/aircrafticaocode.cpp | 42 ++++++------ src/blackmisc/aviation/aircrafticaocode.h | 6 +- src/blackmisc/aviation/aircraftlights.cpp | 28 ++++---- src/blackmisc/aviation/aircraftlights.h | 6 +- src/blackmisc/aviation/aircraftparts.cpp | 24 +++---- src/blackmisc/aviation/aircraftparts.h | 6 +- src/blackmisc/aviation/aircraftsituation.cpp | 30 ++++----- src/blackmisc/aviation/aircraftsituation.h | 6 +- .../aviation/aircraftsituationchange.cpp | 38 +++++------ .../aviation/aircraftsituationchange.h | 6 +- src/blackmisc/aviation/airlineicaocode.cpp | 40 +++++------ src/blackmisc/aviation/airlineicaocode.h | 6 +- src/blackmisc/aviation/airport.cpp | 20 +++--- src/blackmisc/aviation/airport.h | 6 +- src/blackmisc/aviation/airporticaocode.cpp | 10 +-- src/blackmisc/aviation/airporticaocode.h | 6 +- src/blackmisc/aviation/altitude.cpp | 2 +- src/blackmisc/aviation/altitude.h | 2 +- src/blackmisc/aviation/atcstation.cpp | 22 +++---- src/blackmisc/aviation/atcstation.h | 6 +- src/blackmisc/aviation/callsign.cpp | 24 +++---- src/blackmisc/aviation/callsign.h | 6 +- src/blackmisc/aviation/flightplan.cpp | 12 ++-- src/blackmisc/aviation/flightplan.h | 4 +- src/blackmisc/aviation/informationmessage.cpp | 16 ++--- src/blackmisc/aviation/informationmessage.h | 6 +- src/blackmisc/aviation/livery.cpp | 20 +++--- src/blackmisc/aviation/livery.h | 6 +- src/blackmisc/aviation/modulator.cpp | 16 ++--- src/blackmisc/aviation/modulator.h | 6 +- src/blackmisc/aviation/simbriefdata.cpp | 16 ++--- src/blackmisc/aviation/simbriefdata.h | 4 +- src/blackmisc/aviation/transponder.cpp | 24 +++---- src/blackmisc/aviation/transponder.h | 4 +- src/blackmisc/country.cpp | 34 +++++----- src/blackmisc/country.h | 6 +- src/blackmisc/crashinfo.cpp | 26 ++++---- src/blackmisc/crashinfo.h | 6 +- src/blackmisc/crashsettings.cpp | 14 ++-- src/blackmisc/crashsettings.h | 6 +- src/blackmisc/datacache.h | 6 +- src/blackmisc/db/artifact.cpp | 30 ++++----- src/blackmisc/db/artifact.h | 4 +- src/blackmisc/db/datastore.cpp | 44 ++++++------- src/blackmisc/db/datastore.h | 16 ++--- src/blackmisc/db/dbinfo.cpp | 20 +++--- src/blackmisc/db/dbinfo.h | 6 +- src/blackmisc/db/distribution.cpp | 16 ++--- src/blackmisc/db/distribution.h | 4 +- src/blackmisc/db/updateinfo.cpp | 14 ++-- src/blackmisc/db/updateinfo.h | 4 +- src/blackmisc/directories.cpp | 36 +++++----- src/blackmisc/directories.h | 4 +- src/blackmisc/geo/coordinategeodetic.cpp | 42 ++++++------ src/blackmisc/geo/coordinategeodetic.h | 20 +++--- src/blackmisc/geo/elevationplane.cpp | 10 +-- src/blackmisc/geo/elevationplane.h | 6 +- src/blackmisc/identifier.cpp | 26 ++++---- src/blackmisc/identifier.h | 6 +- src/blackmisc/inheritancetraits.h | 4 +- src/blackmisc/input/actionhotkey.cpp | 24 +++---- src/blackmisc/input/actionhotkey.h | 4 +- src/blackmisc/input/joystickbutton.cpp | 18 ++--- src/blackmisc/input/joystickbutton.h | 4 +- src/blackmisc/input/keyboardkey.cpp | 14 ++-- src/blackmisc/input/keyboardkey.h | 4 +- src/blackmisc/mixin/mixinindex.h | 50 +++++++------- src/blackmisc/namevariantpair.cpp | 10 +-- src/blackmisc/namevariantpair.h | 4 +- src/blackmisc/network/authenticateduser.cpp | 18 ++--- src/blackmisc/network/authenticateduser.h | 4 +- src/blackmisc/network/client.cpp | 26 ++++---- src/blackmisc/network/client.h | 4 +- src/blackmisc/network/ecosystem.cpp | 14 ++-- src/blackmisc/network/ecosystem.h | 6 +- src/blackmisc/network/fsdsetup.cpp | 14 ++-- src/blackmisc/network/fsdsetup.h | 6 +- src/blackmisc/network/rawfsdmessage.cpp | 10 +-- src/blackmisc/network/rawfsdmessage.h | 4 +- src/blackmisc/network/remotefile.cpp | 16 ++--- src/blackmisc/network/remotefile.h | 4 +- src/blackmisc/network/role.cpp | 12 ++-- src/blackmisc/network/role.h | 4 +- src/blackmisc/network/server.cpp | 24 +++---- src/blackmisc/network/server.h | 6 +- .../network/settings/networksettings.cpp | 8 +-- .../network/settings/networksettings.h | 4 +- src/blackmisc/network/textmessage.cpp | 14 ++-- src/blackmisc/network/textmessage.h | 6 +- src/blackmisc/network/url.cpp | 16 ++--- src/blackmisc/network/url.h | 4 +- src/blackmisc/network/urllog.cpp | 16 ++--- src/blackmisc/network/urllog.h | 4 +- src/blackmisc/network/user.cpp | 22 +++---- src/blackmisc/network/user.h | 6 +- src/blackmisc/orderable.cpp | 14 ++-- src/blackmisc/orderable.h | 8 +-- src/blackmisc/platform.cpp | 12 ++-- src/blackmisc/platform.h | 6 +- src/blackmisc/pq/physicalquantity.cpp | 28 ++++---- src/blackmisc/pq/physicalquantity.h | 6 +- src/blackmisc/rgbcolor.cpp | 20 +++--- src/blackmisc/rgbcolor.h | 6 +- src/blackmisc/settingscache.h | 4 +- .../simulation/aircraftmatchersetup.cpp | 28 ++++---- .../simulation/aircraftmatchersetup.h | 4 +- src/blackmisc/simulation/aircraftmodel.cpp | 60 ++++++++--------- src/blackmisc/simulation/aircraftmodel.h | 6 +- .../simulation/airspaceaircraftsnapshot.cpp | 8 +-- .../simulation/airspaceaircraftsnapshot.h | 4 +- src/blackmisc/simulation/distributor.cpp | 16 ++--- src/blackmisc/simulation/distributor.h | 6 +- .../fscommon/aircraftcfgentries.cpp | 66 +++++++++---------- .../simulation/fscommon/aircraftcfgentries.h | 4 +- .../simulation/fscommon/vpilotmodelrule.cpp | 16 ++--- .../simulation/fscommon/vpilotmodelrule.h | 4 +- .../interpolationrenderingsetup.cpp | 40 +++++------ .../simulation/interpolationrenderingsetup.h | 12 ++-- .../simulation/matchingstatisticsentry.cpp | 30 ++++----- .../simulation/matchingstatisticsentry.h | 6 +- .../simulation/settings/modelsettings.cpp | 10 +-- .../simulation/settings/modelsettings.h | 4 +- .../simulation/settings/simulatorsettings.cpp | 42 ++++++------ .../simulation/settings/simulatorsettings.h | 12 ++-- .../settings/swiftpluginsettings.cpp | 14 ++-- .../simulation/settings/swiftpluginsettings.h | 4 +- .../simulation/settings/xswiftbussettings.cpp | 30 ++++----- .../simulation/settings/xswiftbussettings.h | 4 +- .../simulation/simulatedaircraft.cpp | 26 ++++---- src/blackmisc/simulation/simulatedaircraft.h | 6 +- src/blackmisc/simulation/simulatorinfo.cpp | 2 +- src/blackmisc/simulation/simulatorinfo.h | 2 +- .../simulation/simulatorinternals.cpp | 12 ++-- src/blackmisc/simulation/simulatorinternals.h | 4 +- .../simulation/xplane/navdatareference.cpp | 8 +-- .../simulation/xplane/navdatareference.h | 4 +- src/blackmisc/statusmessage.cpp | 26 ++++---- src/blackmisc/statusmessage.h | 6 +- src/blackmisc/statusmessagelist.cpp | 3 +- src/blackmisc/timestampbased.cpp | 42 ++++++------ src/blackmisc/timestampbased.h | 16 ++--- src/blackmisc/typetraits.h | 10 +-- src/blackmisc/valuecache.h | 4 +- src/blackmisc/variant.cpp | 8 +-- src/blackmisc/variant.h | 15 +++-- src/blackmisc/variantprivate.h | 29 ++++---- src/blackmisc/weather/cloudlayer.cpp | 20 +++--- src/blackmisc/weather/cloudlayer.h | 4 +- src/blackmisc/weather/gridpoint.cpp | 20 +++--- src/blackmisc/weather/gridpoint.h | 4 +- src/blackmisc/weather/presentweather.cpp | 14 ++-- src/blackmisc/weather/presentweather.h | 4 +- src/blackmisc/weather/temperaturelayer.cpp | 16 ++--- src/blackmisc/weather/temperaturelayer.h | 4 +- src/blackmisc/weather/visibilitylayer.cpp | 14 ++-- src/blackmisc/weather/visibilitylayer.h | 4 +- src/blackmisc/weather/weatherscenario.cpp | 14 ++-- src/blackmisc/weather/weatherscenario.h | 4 +- src/blackmisc/weather/windlayer.cpp | 18 ++--- src/blackmisc/weather/windlayer.h | 4 +- 190 files changed, 1298 insertions(+), 1293 deletions(-) diff --git a/samples/blackmisc/samplesperformance.cpp b/samples/blackmisc/samplesperformance.cpp index 733cbee56..80bfc86fc 100644 --- a/samples/blackmisc/samplesperformance.cpp +++ b/samples/blackmisc/samplesperformance.cpp @@ -840,13 +840,13 @@ namespace BlackSample QString r; if (byPropertyIndex) { - r.append(station.propertyByIndex({ CAtcStation::IndexCallsign, CCallsign::IndexString}).toQString()); - r.append(station.propertyByIndex({ CAtcStation::IndexController, CUser::IndexRealName}).toQString()); - r.append(station.propertyByIndex({ CAtcStation::IndexPosition, CCoordinateGeodetic::IndexLatitudeAsString}).toQString()); - r.append(station.propertyByIndex({ CAtcStation::IndexPosition, CCoordinateGeodetic::IndexLongitudeAsString}).toQString()); - r.append(station.propertyByIndex({ CAtcStation::IndexRelativeDistance, CLength::IndexValueRounded2DigitsWithUnit}).toQString()); - r.append(station.propertyByIndex({ CAtcStation::IndexBookedFrom}).toDateTime().toString("yyyy-MM-dd hh:mm")); - r.append(station.propertyByIndex({ CAtcStation::IndexBookedUntil}).toDateTime().toString("yyyy-MM-dd hh:mm")); + r.append(station.propertyByIndex(CPropertyIndex { CAtcStation::IndexCallsign, CCallsign::IndexString}).toString()); + r.append(station.propertyByIndex(CPropertyIndex { CAtcStation::IndexController, CUser::IndexRealName}).toString()); + r.append(station.propertyByIndex(CPropertyIndex { CAtcStation::IndexPosition, CCoordinateGeodetic::IndexLatitudeAsString}).toString()); + r.append(station.propertyByIndex(CPropertyIndex { CAtcStation::IndexPosition, CCoordinateGeodetic::IndexLongitudeAsString}).toString()); + r.append(station.propertyByIndex(CPropertyIndex { CAtcStation::IndexRelativeDistance, CLength::IndexValueRounded2DigitsWithUnit}).toString()); + r.append(station.propertyByIndex(CPropertyIndex { CAtcStation::IndexBookedFrom}).toDateTime().toString("yyyy-MM-dd hh:mm")); + r.append(station.propertyByIndex(CPropertyIndex { CAtcStation::IndexBookedUntil}).toDateTime().toString("yyyy-MM-dd hh:mm")); } else { diff --git a/src/blackcore/data/globalsetup.cpp b/src/blackcore/data/globalsetup.cpp index 6580d6c5b..c02d6ef31 100644 --- a/src/blackcore/data/globalsetup.cpp +++ b/src/blackcore/data/globalsetup.cpp @@ -378,41 +378,41 @@ namespace BlackCore return s; } - CVariant CGlobalSetup::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CGlobalSetup::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return CVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDbRootDirectory: return CVariant::fromValue(m_dbRootDirectoryUrl); - case IndexDbHttpPort: return CVariant::fromValue(m_dbHttpPort); - case IndexDbHttpsPort: return CVariant::fromValue(m_dbHttpsPort); - case IndexDbLoginService: return CVariant::fromValue(this->getDbLoginServiceUrl()); - case IndexDbClientPingService: return CVariant::fromValue(this->getDbClientPingServiceUrl()); - case IndexVatsimStatus: return CVariant::fromValue(m_vatsimStatusFileUrls); - case IndexVatsimData: return CVariant::fromValue(m_vatsimDataFileUrls); - case IndexVatsimBookings: return CVariant::fromValue(m_vatsimDataFileUrls); - case IndexVatsimMetars: return CVariant::fromValue(m_vatsimMetarsUrls); - case IndexBootstrapFileUrls: return CVariant::fromValue(this->getSwiftBootstrapFileUrls()); - case IndexUpdateInfoFileUrls: return CVariant::fromValue(this->getSwiftUpdateInfoFileUrls()); - case IndexSharedUrls: return CVariant::fromValue(m_sharedUrls); - case IndexNewsUrls: return CVariant::fromValue(m_newsUrls); - case IndexSwiftMapUrls: return CVariant::fromValue(m_mapUrls); - case IndexOnlineHelpUrls: return CVariant::fromValue(m_onlineHelpUrls); - case IndexCrashReportServerUrl: return CVariant::fromValue(m_crashReportServerUrl); - case IndexWasLoadedFromWeb: return CVariant::fromValue(m_wasLoadedFromWeb); - case IndexWasLoadedFromFile: return CVariant::fromValue(m_wasLoadedFromFile); - case IndexMappingMinimumVersion: return CVariant::fromValue(m_mappingMinimumVersion); - case IndexPredefinedServers: return CVariant::fromValue(m_predefinedServers); + case IndexDbRootDirectory: return QVariant::fromValue(m_dbRootDirectoryUrl); + case IndexDbHttpPort: return QVariant::fromValue(m_dbHttpPort); + case IndexDbHttpsPort: return QVariant::fromValue(m_dbHttpsPort); + case IndexDbLoginService: return QVariant::fromValue(this->getDbLoginServiceUrl()); + case IndexDbClientPingService: return QVariant::fromValue(this->getDbClientPingServiceUrl()); + case IndexVatsimStatus: return QVariant::fromValue(m_vatsimStatusFileUrls); + case IndexVatsimData: return QVariant::fromValue(m_vatsimDataFileUrls); + case IndexVatsimBookings: return QVariant::fromValue(m_vatsimDataFileUrls); + case IndexVatsimMetars: return QVariant::fromValue(m_vatsimMetarsUrls); + case IndexBootstrapFileUrls: return QVariant::fromValue(this->getSwiftBootstrapFileUrls()); + case IndexUpdateInfoFileUrls: return QVariant::fromValue(this->getSwiftUpdateInfoFileUrls()); + case IndexSharedUrls: return QVariant::fromValue(m_sharedUrls); + case IndexNewsUrls: return QVariant::fromValue(m_newsUrls); + case IndexSwiftMapUrls: return QVariant::fromValue(m_mapUrls); + case IndexOnlineHelpUrls: return QVariant::fromValue(m_onlineHelpUrls); + case IndexCrashReportServerUrl: return QVariant::fromValue(m_crashReportServerUrl); + case IndexWasLoadedFromWeb: return QVariant::fromValue(m_wasLoadedFromWeb); + case IndexWasLoadedFromFile: return QVariant::fromValue(m_wasLoadedFromFile); + case IndexMappingMinimumVersion: return QVariant::fromValue(m_mappingMinimumVersion); + case IndexPredefinedServers: return QVariant::fromValue(m_predefinedServers); default: return CValueObject::propertyByIndex(index); } } - void CGlobalSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CGlobalSetup::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); @@ -437,7 +437,7 @@ namespace BlackCore case IndexCrashReportServerUrl: m_crashReportServerUrl = variant.value(); break; case IndexWasLoadedFromWeb: m_wasLoadedFromWeb = variant.toBool(); break; case IndexWasLoadedFromFile: m_wasLoadedFromFile = variant.toBool(); break; - case IndexMappingMinimumVersion: m_mappingMinimumVersion = variant.toQString(); break; + case IndexMappingMinimumVersion: m_mappingMinimumVersion = variant.toString(); break; case IndexPredefinedServers: m_predefinedServers = variant.value(); break; default: CValueObject::setPropertyByIndex(index, variant); break; } diff --git a/src/blackcore/data/globalsetup.h b/src/blackcore/data/globalsetup.h index 5b6d3590d..e91e1a276 100644 --- a/src/blackcore/data/globalsetup.h +++ b/src/blackcore/data/globalsetup.h @@ -223,10 +223,10 @@ namespace BlackCore QString convertToQString(const QString &separator, bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! Schema version (shared files, bootstrap file) static const QString &schemaVersionString(); diff --git a/src/blackcore/data/launchersetup.cpp b/src/blackcore/data/launchersetup.cpp index 771bcd223..5774503ce 100644 --- a/src/blackcore/data/launchersetup.cpp +++ b/src/blackcore/data/launchersetup.cpp @@ -21,27 +21,27 @@ namespace BlackCore return QStringLiteral("DBus: %1 frameless: %2 mode: %3").arg(m_dBusAddress, boolToYesNo(m_windowFrameless)).arg(m_coreMode); } - CVariant CLauncherSetup::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CLauncherSetup::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDBusAddress: return CVariant::fromValue(m_dBusAddress); - case IndexFramelessWindow: return CVariant::fromValue(m_windowFrameless); - case IndexCoreMode: return CVariant::fromValue(m_coreMode); - case IndexAudioMode: return CVariant::fromValue(m_audioMode); + case IndexDBusAddress: return QVariant::fromValue(m_dBusAddress); + case IndexFramelessWindow: return QVariant::fromValue(m_windowFrameless); + case IndexCoreMode: return QVariant::fromValue(m_coreMode); + case IndexAudioMode: return QVariant::fromValue(m_audioMode); default: return CValueObject::propertyByIndex(index); } } - void CLauncherSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CLauncherSetup::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDBusAddress: this->setDBusAddress(variant.toQString()); break; + case IndexDBusAddress: this->setDBusAddress(variant.toString()); break; case IndexFramelessWindow: m_windowFrameless = variant.toBool(); break; case IndexCoreMode: m_coreMode = variant.toInt(); break; case IndexAudioMode: m_audioMode = variant.toInt(); break; diff --git a/src/blackcore/data/launchersetup.h b/src/blackcore/data/launchersetup.h index 309346ac5..9c650f220 100644 --- a/src/blackcore/data/launchersetup.h +++ b/src/blackcore/data/launchersetup.h @@ -85,10 +85,10 @@ namespace BlackCore QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); private: QString m_dBusAddress { "tcp:host=127.0.0.1,port=45000" }; //!< DBus address diff --git a/src/blackcore/data/vatsimsetup.cpp b/src/blackcore/data/vatsimsetup.cpp index e0b79bcce..05ee4be9b 100644 --- a/src/blackcore/data/vatsimsetup.cpp +++ b/src/blackcore/data/vatsimsetup.cpp @@ -58,23 +58,23 @@ namespace BlackCore return s; } - CVariant CVatsimSetup::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CVatsimSetup::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexFsdServers: return CVariant::fromValue(this->m_fsdServers); - case IndexDataFiles: return CVariant::fromValue(this->m_dataFileUrls); + case IndexFsdServers: return QVariant::fromValue(this->m_fsdServers); + case IndexDataFiles: return QVariant::fromValue(this->m_dataFileUrls); default: return CValueObject::propertyByIndex(index); } } - void CVatsimSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CVatsimSetup::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); diff --git a/src/blackcore/data/vatsimsetup.h b/src/blackcore/data/vatsimsetup.h index ff04cb5f5..76ade5282 100644 --- a/src/blackcore/data/vatsimsetup.h +++ b/src/blackcore/data/vatsimsetup.h @@ -91,10 +91,10 @@ namespace BlackCore QString convertToQString(const QString &separator, bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); private: BlackMisc::Network::CUrlList m_serverFileUrls; //!< only the FSD servers diff --git a/src/blackcore/vatsim/vatsimsettings.cpp b/src/blackcore/vatsim/vatsimsettings.cpp index 9f03ca83d..a5cad1517 100644 --- a/src/blackcore/vatsim/vatsimsettings.cpp +++ b/src/blackcore/vatsim/vatsimsettings.cpp @@ -36,9 +36,9 @@ namespace BlackCore return s; } - CVariant CReaderSettings::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CReaderSettings::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { @@ -47,15 +47,15 @@ namespace BlackCore case IndexPeriodicTime: return this->m_periodicTime.propertyByIndex(index.copyFrontRemoved()); case IndexNeverUpdate: - return CVariant::fromValue(this->m_neverUpdate); + return QVariant::fromValue(this->m_neverUpdate); default: return CValueObject::propertyByIndex(index); } } - void CReaderSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CReaderSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { @@ -90,28 +90,28 @@ namespace BlackCore return s; } - CVariant CRawFsdMessageSettings::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CRawFsdMessageSettings::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { - case IndexRawFsdMessagesEnabled: return CVariant::fromValue(this->m_rawFsdMessagesEnabled); - case IndexFileDir: return CVariant::fromValue(this->m_FileDir); - case IndexFileWriteMode: return CVariant::fromValue(this->m_fileWriteMode); + case IndexRawFsdMessagesEnabled: return QVariant::fromValue(this->m_rawFsdMessagesEnabled); + case IndexFileDir: return QVariant::fromValue(this->m_FileDir); + case IndexFileWriteMode: return QVariant::fromValue(this->m_fileWriteMode); default: return CValueObject::propertyByIndex(index); } } - void CRawFsdMessageSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CRawFsdMessageSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { case IndexRawFsdMessagesEnabled: this->m_rawFsdMessagesEnabled = variant.toBool(); break; - case IndexFileDir: this->m_FileDir = variant.toQString(); break; - case IndexFileWriteMode: this->m_fileWriteMode = variant.to(); break; + case IndexFileDir: this->m_FileDir = variant.toString(); break; + case IndexFileWriteMode: this->m_fileWriteMode = variant.value(); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } diff --git a/src/blackcore/vatsim/vatsimsettings.h b/src/blackcore/vatsim/vatsimsettings.h index a26ebb419..93c696e55 100644 --- a/src/blackcore/vatsim/vatsimsettings.h +++ b/src/blackcore/vatsim/vatsimsettings.h @@ -60,10 +60,10 @@ namespace BlackCore bool isNeverUpdate() const { return m_neverUpdate; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; @@ -172,10 +172,10 @@ namespace BlackCore FileWriteMode getFileWriteMode () const { return m_fileWriteMode; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackgui/settings/atcstationssettings.cpp b/src/blackgui/settings/atcstationssettings.cpp index 04e5f2383..deb05cc71 100644 --- a/src/blackgui/settings/atcstationssettings.cpp +++ b/src/blackgui/settings/atcstationssettings.cpp @@ -24,21 +24,21 @@ namespace BlackGui return s.arg(boolToOnOff(this->showOnlyInRange()), boolToOnOff(this->showOnlyWithValidFrequency())); } - CVariant CAtcStationsSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CAtcStationsSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexInRangeOnly: return CVariant::fromValue(m_showOnlyInRange); - case IndexValidFrequencyOnly: return CVariant::fromValue(m_onlyWithValidFrequency); + case IndexInRangeOnly: return QVariant::fromValue(m_showOnlyInRange); + case IndexValidFrequencyOnly: return QVariant::fromValue(m_onlyWithValidFrequency); default: return CValueObject::propertyByIndex(index); } } - void CAtcStationsSettings::setPropertyByIndex(const CPropertyIndex &index, const BlackMisc::CVariant &variant) + void CAtcStationsSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackgui/settings/atcstationssettings.h b/src/blackgui/settings/atcstationssettings.h index 064c7a9f4..35d84097a 100644 --- a/src/blackgui/settings/atcstationssettings.h +++ b/src/blackgui/settings/atcstationssettings.h @@ -49,10 +49,10 @@ namespace BlackGui QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); private: bool m_showOnlyInRange = true; diff --git a/src/blackgui/settings/dockwidgetsettings.cpp b/src/blackgui/settings/dockwidgetsettings.cpp index 32c76f590..1f60cc142 100644 --- a/src/blackgui/settings/dockwidgetsettings.cpp +++ b/src/blackgui/settings/dockwidgetsettings.cpp @@ -102,42 +102,42 @@ namespace BlackGui return s; } - CVariant CDockWidgetSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CDockWidgetSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexFloatingMargins: - return CVariant::fromValue(m_floatingMargins); + return QVariant::fromValue(m_floatingMargins); case IndexFloatingFramelessMargins: - return CVariant::fromValue(m_floatingFramelessMargins); + return QVariant::fromValue(m_floatingFramelessMargins); case IndexDockedMargins: - return CVariant::fromValue(m_dockedMargins); + return QVariant::fromValue(m_dockedMargins); case IndexFrameless: - return CVariant::fromValue(m_floating); + return QVariant::fromValue(m_floating); case IndexFloating: - return CVariant::fromValue(m_floating); + return QVariant::fromValue(m_floating); default: return CValueObject::propertyByIndex(index); } } - void CDockWidgetSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CDockWidgetSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { case IndexFloatingMargins: - m_floatingMargins = variant.toQString(); + m_floatingMargins = variant.toString(); break; case IndexFloatingFramelessMargins: - m_floatingFramelessMargins = variant.toQString(); + m_floatingFramelessMargins = variant.toString(); break; case IndexDockedMargins: - m_dockedMargins = variant.toQString(); + m_dockedMargins = variant.toString(); break; case IndexFloating: m_floating = variant.toBool(); diff --git a/src/blackgui/settings/dockwidgetsettings.h b/src/blackgui/settings/dockwidgetsettings.h index c504922fc..ee923679d 100644 --- a/src/blackgui/settings/dockwidgetsettings.h +++ b/src/blackgui/settings/dockwidgetsettings.h @@ -92,10 +92,10 @@ namespace BlackGui QString convertToQString(const QString &separator, bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); private: QString m_floatingMargins {"0:0:0:0"}; //!< margins: when floating diff --git a/src/blackgui/settings/guisettings.cpp b/src/blackgui/settings/guisettings.cpp index c2e7f2751..1d378ce60 100644 --- a/src/blackgui/settings/guisettings.cpp +++ b/src/blackgui/settings/guisettings.cpp @@ -50,29 +50,29 @@ namespace BlackGui return QStringLiteral("Widget style: %1").arg(this->m_widgetStyle); } - BlackMisc::CVariant CGeneralGuiSettings::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CGeneralGuiSettings::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexWidgetStyle: - return CVariant::fromValue(this->m_widgetStyle); + return QVariant::fromValue(this->m_widgetStyle); case IndexPreferredSelection: - return CVariant::fromValue(this->m_preferredSelection); + return QVariant::fromValue(this->m_preferredSelection); default: return CValueObject::propertyByIndex(index); } } - void CGeneralGuiSettings::setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant) + void CGeneralGuiSettings::setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexWidgetStyle: - this->setWidgetStyle(variant.toQString()); + this->setWidgetStyle(variant.toString()); break; case IndexPreferredSelection: this->m_preferredSelection = variant.toInt(); diff --git a/src/blackgui/settings/guisettings.h b/src/blackgui/settings/guisettings.h index 15bcd0ace..90a161e13 100644 --- a/src/blackgui/settings/guisettings.h +++ b/src/blackgui/settings/guisettings.h @@ -56,10 +56,10 @@ namespace BlackGui QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); private: QString m_widgetStyle { "Fusion" }; diff --git a/src/blackgui/settings/navigatorsettings.cpp b/src/blackgui/settings/navigatorsettings.cpp index ae3892d37..1ca22f295 100644 --- a/src/blackgui/settings/navigatorsettings.cpp +++ b/src/blackgui/settings/navigatorsettings.cpp @@ -63,32 +63,32 @@ namespace BlackGui return s; } - CVariant CNavigatorSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CNavigatorSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexMargins: - return CVariant::fromValue(this->m_margins); + return QVariant::fromValue(this->m_margins); case IndexFrameless: - return CVariant::fromValue(this->isFramless()); + return QVariant::fromValue(this->isFramless()); case IndexColumns: - return CVariant::fromValue(this->m_columns); + return QVariant::fromValue(this->m_columns); default: return CValueObject::propertyByIndex(index); } } - void CNavigatorSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CNavigatorSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { case IndexMargins: - this->m_margins = variant.toQString(); + this->m_margins = variant.toString(); break; case IndexColumns: this->m_columns = variant.toInt(); diff --git a/src/blackgui/settings/navigatorsettings.h b/src/blackgui/settings/navigatorsettings.h index f435b4df0..a45b6de7a 100644 --- a/src/blackgui/settings/navigatorsettings.h +++ b/src/blackgui/settings/navigatorsettings.h @@ -77,10 +77,10 @@ namespace BlackGui QString convertToQString(const QString &separator, bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); private: QString m_margins {"0:0:0:0"}; //!< margins diff --git a/src/blackgui/settings/textmessagesettings.cpp b/src/blackgui/settings/textmessagesettings.cpp index e382d53cb..2cd45cbd0 100644 --- a/src/blackgui/settings/textmessagesettings.cpp +++ b/src/blackgui/settings/textmessagesettings.cpp @@ -84,27 +84,27 @@ namespace BlackGui ); } - CVariant CTextMessageSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CTextMessageSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexPopupAllMessages: return CVariant::fromValue(this->getPopupAllMessages()); - case IndexPopupFrequencyMessages: return CVariant::fromValue(this->popupFrequencyMessages()); - case IndexPopupPrivateMessages: return CVariant::fromValue(this->popupPrivateMessages()); - case IndexPopupSupervisorMessages: return CVariant::fromValue(this->popupSupervisorMessages()); - case IndexPopupSelcalMessages: return CVariant::fromValue(this->popupSelcalMessages()); - case IndexStyle: return CVariant::fromValue(this->getStyleSheet()); - case IndexLatestFirst: return CVariant::fromValue(this->isLatestFirst()); - case IndexFocus: return CVariant::fromValue(this->focusOverlayWindow()); + case IndexPopupAllMessages: return QVariant::fromValue(this->getPopupAllMessages()); + case IndexPopupFrequencyMessages: return QVariant::fromValue(this->popupFrequencyMessages()); + case IndexPopupPrivateMessages: return QVariant::fromValue(this->popupPrivateMessages()); + case IndexPopupSupervisorMessages: return QVariant::fromValue(this->popupSupervisorMessages()); + case IndexPopupSelcalMessages: return QVariant::fromValue(this->popupSelcalMessages()); + case IndexStyle: return QVariant::fromValue(this->getStyleSheet()); + case IndexLatestFirst: return QVariant::fromValue(this->isLatestFirst()); + case IndexFocus: return QVariant::fromValue(this->focusOverlayWindow()); default: return CValueObject::propertyByIndex(index); } } - void CTextMessageSettings::setPropertyByIndex(const CPropertyIndex &index, const BlackMisc::CVariant &variant) + void CTextMessageSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -115,7 +115,7 @@ namespace BlackGui case IndexPopupSelcalMessages: this->setPopupSelcalMessages(variant.toBool()); break; case IndexFocus: this->setFocusOverlayWindows(variant.toBool()); break; case IndexLatestFirst: this->setLatestFirst(variant.toBool()); break; - case IndexStyle: this->setStyleSheet(variant.toQString()); break; + case IndexStyle: this->setStyleSheet(variant.toString()); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } diff --git a/src/blackgui/settings/textmessagesettings.h b/src/blackgui/settings/textmessagesettings.h index f4284929a..412eb00f2 100644 --- a/src/blackgui/settings/textmessagesettings.h +++ b/src/blackgui/settings/textmessagesettings.h @@ -121,10 +121,10 @@ namespace BlackGui QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); private: bool m_popupPrivateMessages = true; diff --git a/src/blackgui/settings/viewupdatesettings.cpp b/src/blackgui/settings/viewupdatesettings.cpp index 7c3c624d3..dcbc8c817 100644 --- a/src/blackgui/settings/viewupdatesettings.cpp +++ b/src/blackgui/settings/viewupdatesettings.cpp @@ -49,28 +49,28 @@ namespace BlackGui .arg(m_updateUser.valueRounded(CTimeUnit::s(), 2)).arg(m_updateRendering.valueRounded(CTimeUnit::s(), 2)); } - CVariant CViewUpdateSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CViewUpdateSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexAircraft: - return CVariant::fromValue(this->m_updateAircraft); + return QVariant::fromValue(this->m_updateAircraft); case IndexAtc: - return CVariant::fromValue(this->m_updateAtc); + return QVariant::fromValue(this->m_updateAtc); case IndexRendering: - return CVariant::fromValue(this->m_updateRendering); + return QVariant::fromValue(this->m_updateRendering); case IndexUser: - return CVariant::fromValue(this->m_updateUser); + return QVariant::fromValue(this->m_updateUser); default: return CValueObject::propertyByIndex(index); } } - void CViewUpdateSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CViewUpdateSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) diff --git a/src/blackgui/settings/viewupdatesettings.h b/src/blackgui/settings/viewupdatesettings.h index 76a388876..00598a0c1 100644 --- a/src/blackgui/settings/viewupdatesettings.h +++ b/src/blackgui/settings/viewupdatesettings.h @@ -76,10 +76,10 @@ namespace BlackGui QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); private: BlackMisc::PhysicalQuantities::CTime m_updateAtc {10.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()}; diff --git a/src/blackgui/views/viewbasenontemplate.cpp b/src/blackgui/views/viewbasenontemplate.cpp index 12598140b..f22d23cea 100644 --- a/src/blackgui/views/viewbasenontemplate.cpp +++ b/src/blackgui/views/viewbasenontemplate.cpp @@ -323,7 +323,7 @@ namespace BlackGui QString CViewBaseNonTemplate::getRememberedLastJsonDirectory() const { const CDirectories directories = m_dirSettings.get(); - return directories.propertyByIndex(m_dirSettingsIndex).toQString(); + return directories.propertyByIndex(m_dirSettingsIndex).toString(); } Components::CTextEditDialog *CViewBaseNonTemplate::textEditDialog() @@ -590,7 +590,7 @@ namespace BlackGui } // Save file path - const QString dir = m_dirSettings.get().propertyByIndex(m_dirSettingsIndex).toQString(); + const QString dir = m_dirSettings.get().propertyByIndex(m_dirSettingsIndex).toString(); QString name(m_saveFileName); if (name.isEmpty()) { diff --git a/src/blackmisc/applicationinfo.cpp b/src/blackmisc/applicationinfo.cpp index 86d51c595..54f88eedc 100644 --- a/src/blackmisc/applicationinfo.cpp +++ b/src/blackmisc/applicationinfo.cpp @@ -107,49 +107,49 @@ namespace BlackMisc return CIcons::StandardIconUnknown16; } - CVariant CApplicationInfo::propertyByIndex(const CPropertyIndex &index) const + QVariant CApplicationInfo::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexApplication: return CVariant::fromValue(m_app); - case IndexApplicationAsString: return CVariant::fromValue(this->getApplicationAsString()); - case IndexApplicationDataPath: return CVariant::fromValue(this->getApplicationDataDirectory()); - case IndexCompileInfo: return CVariant::fromValue(this->getCompileInfo()); - case IndexExecutablePath: return CVariant::fromValue(this->getExecutablePath()); - case IndexExecutablePathExisting: return CVariant::fromValue(this->isExecutablePathExisting()); - case IndexPlatformInfo: return CVariant::fromValue(this->getPlatform()); + case IndexApplication: return QVariant::fromValue(m_app); + case IndexApplicationAsString: return QVariant::fromValue(this->getApplicationAsString()); + case IndexApplicationDataPath: return QVariant::fromValue(this->getApplicationDataDirectory()); + case IndexCompileInfo: return QVariant::fromValue(this->getCompileInfo()); + case IndexExecutablePath: return QVariant::fromValue(this->getExecutablePath()); + case IndexExecutablePathExisting: return QVariant::fromValue(this->isExecutablePathExisting()); + case IndexPlatformInfo: return QVariant::fromValue(this->getPlatform()); case IndexProcessInfo: return m_process.propertyByIndex(index.copyFrontRemoved()); - case IndexVersionString: return CVariant::fromValue(this->getVersionString()); - case IndexWordSize: return CVariant::fromValue(this->getWordSize()); + case IndexVersionString: return QVariant::fromValue(this->getVersionString()); + case IndexWordSize: return QVariant::fromValue(this->getWordSize()); default: break; } return CValueObject::propertyByIndex(index); } - void CApplicationInfo::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CApplicationInfo::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexApplication: this->setApplication(static_cast(variant.toInt())); break; case IndexApplicationAsString: break; - case IndexApplicationDataPath: this->setApplicationDataDirectory(variant.toQString()); break; - case IndexCompileInfo: this->setCompileInfo(variant.toQString()); break; - case IndexExecutablePath: this->setExecutablePath(variant.toQString()); break; + case IndexApplicationDataPath: this->setApplicationDataDirectory(variant.toString()); break; + case IndexCompileInfo: this->setCompileInfo(variant.toString()); break; + case IndexExecutablePath: this->setExecutablePath(variant.toString()); break; case IndexExecutablePathExisting: break; - case IndexPlatformInfo: this->setPlatformInfo(variant.toQString()); break; + case IndexPlatformInfo: this->setPlatformInfo(variant.toString()); break; case IndexProcessInfo: m_process.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexVersionString: this->setVersionString(variant.toQString()); break; + case IndexVersionString: this->setVersionString(variant.toString()); break; case IndexWordSize: this->setWordSize(variant.toInt()); break; default: break; } CValueObject::setPropertyByIndex(index, variant); } - int CApplicationInfo::comparePropertyByIndex(const CPropertyIndex &index, const CApplicationInfo &compareValue) const + int CApplicationInfo::comparePropertyByIndex(CPropertyIndexRef index, const CApplicationInfo &compareValue) const { if (index.isMyself()) { return this->getExecutablePath().compare(compareValue.getExecutablePath()); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/applicationinfo.h b/src/blackmisc/applicationinfo.h index eee33a3fd..6dc1e89c5 100644 --- a/src/blackmisc/applicationinfo.h +++ b/src/blackmisc/applicationinfo.h @@ -137,13 +137,13 @@ namespace BlackMisc CIcons::IconIndex toIcon() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CApplicationInfo &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CApplicationInfo &compareValue) const; //! Name of pilot client GUI static const QString &swiftPilotClientGui(); diff --git a/src/blackmisc/audio/audiodeviceinfo.cpp b/src/blackmisc/audio/audiodeviceinfo.cpp index 58e9fa890..170320a91 100644 --- a/src/blackmisc/audio/audiodeviceinfo.cpp +++ b/src/blackmisc/audio/audiodeviceinfo.cpp @@ -74,36 +74,36 @@ namespace BlackMisc return CAudioDeviceInfo(InputDevice, QAudioDeviceInfo::defaultInputDevice().deviceName()); } - CVariant CAudioDeviceInfo::propertyByIndex(const CPropertyIndex &index) const + QVariant CAudioDeviceInfo::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::fromValue(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDeviceType: return CVariant::fromValue(this->getType()); - case IndexDeviceTypeAsString: return CVariant::fromValue(this->getTypeAsString()); - case IndexName: return CVariant::fromValue(this->getName()); + case IndexDeviceType: return QVariant::fromValue(this->getType()); + case IndexDeviceTypeAsString: return QVariant::fromValue(this->getTypeAsString()); + case IndexName: return QVariant::fromValue(this->getName()); case IndexIdentifier: return m_identifier.propertyByIndex(index.copyFrontRemoved()); default: break; } return CValueObject::propertyByIndex(index); } - void CAudioDeviceInfo::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAudioDeviceInfo::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexDeviceType: m_type = static_cast(variant.toInt()); return; - case IndexName: m_deviceName = variant.toQString(); return; + case IndexName: m_deviceName = variant.toString(); return; case IndexIdentifier: m_identifier.setPropertyByIndex(index.copyFrontRemoved(), variant); return; default: break; } CValueObject::setPropertyByIndex(index, variant); } - int CAudioDeviceInfo::comparePropertyByIndex(const CPropertyIndex &index, const CAudioDeviceInfo &compareValue) const + int CAudioDeviceInfo::comparePropertyByIndex(CPropertyIndexRef index, const CAudioDeviceInfo &compareValue) const { if (index.isMyself()) { return m_deviceName.compare(compareValue.m_deviceName, Qt::CaseInsensitive); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/audio/audiodeviceinfo.h b/src/blackmisc/audio/audiodeviceinfo.h index 3b3c82064..d75fea80f 100644 --- a/src/blackmisc/audio/audiodeviceinfo.h +++ b/src/blackmisc/audio/audiodeviceinfo.h @@ -98,16 +98,16 @@ namespace BlackMisc static CAudioDeviceInfo getDefaultInputDevice(); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAudioDeviceInfo &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAudioDeviceInfo &compareValue) const; //! Device type as string static const QString &deviceTypeToString(DeviceType t); diff --git a/src/blackmisc/audio/voicesetup.cpp b/src/blackmisc/audio/voicesetup.cpp index ec38842a3..286e5f001 100644 --- a/src/blackmisc/audio/voicesetup.cpp +++ b/src/blackmisc/audio/voicesetup.cpp @@ -45,33 +45,33 @@ namespace BlackMisc m_afvVoiceServerUrl(afvVoiceServerUrl), m_afvMapUrl(afvMapUrl) { } - CVariant CVoiceSetup::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CVoiceSetup::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAfvVoiceServerUrl: return CVariant::fromValue(m_afvVoiceServerUrl); - case IndexAfvMapUrl: return CVariant::fromValue(m_afvMapUrl); + case IndexAfvVoiceServerUrl: return QVariant::fromValue(m_afvVoiceServerUrl); + case IndexAfvMapUrl: return QVariant::fromValue(m_afvMapUrl); default: return CValueObject::propertyByIndex(index); } } - void CVoiceSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CVoiceSetup::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAfvVoiceServerUrl: m_afvVoiceServerUrl = variant.toQString(); break; - case IndexAfvMapUrl: m_afvMapUrl = variant.toQString(); break; + case IndexAfvVoiceServerUrl: m_afvVoiceServerUrl = variant.toString(); break; + case IndexAfvMapUrl: m_afvMapUrl = variant.toString(); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } - int CVoiceSetup::comparePropertyByIndex(const CPropertyIndex &index, const CVoiceSetup &compareValue) const + int CVoiceSetup::comparePropertyByIndex(CPropertyIndexRef index, const CVoiceSetup &compareValue) const { if (index.isMyself()) { return this->convertToQString(true).compare(compareValue.convertToQString()); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/audio/voicesetup.h b/src/blackmisc/audio/voicesetup.h index f6c7a8713..63c5e8b7b 100644 --- a/src/blackmisc/audio/voicesetup.h +++ b/src/blackmisc/audio/voicesetup.h @@ -56,13 +56,13 @@ namespace BlackMisc const QString &getAfvMapUrl() const { return m_afvMapUrl; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CVoiceSetup &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CVoiceSetup &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/aircraftcategory.cpp b/src/blackmisc/aviation/aircraftcategory.cpp index f9fdd9fd0..cd0cafec4 100644 --- a/src/blackmisc/aviation/aircraftcategory.cpp +++ b/src/blackmisc/aviation/aircraftcategory.cpp @@ -160,27 +160,27 @@ namespace BlackMisc return this->matchesLevel(l1, l2, l3); } - CVariant CAircraftCategory::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CAircraftCategory::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexName: return CVariant::fromValue(m_name); - case IndexDescription: return CVariant::fromValue(m_description); - case IndexAssignable: return CVariant::fromValue(m_assignable); - case IndexPath: return CVariant::fromValue(m_path); - case IndexLevelString: return CVariant::fromValue(this->getLevelString()); - case IndexLevelStringAndName: return CVariant::fromValue(this->getLevelAndName()); - case IndexLevelStringAndPath: return CVariant::fromValue(this->getLevelAndPath()); + case IndexName: return QVariant::fromValue(m_name); + case IndexDescription: return QVariant::fromValue(m_description); + case IndexAssignable: return QVariant::fromValue(m_assignable); + case IndexPath: return QVariant::fromValue(m_path); + case IndexLevelString: return QVariant::fromValue(this->getLevelString()); + case IndexLevelStringAndName: return QVariant::fromValue(this->getLevelAndName()); + case IndexLevelStringAndPath: return QVariant::fromValue(this->getLevelAndPath()); default: return CValueObject::propertyByIndex(index); } } - void CAircraftCategory::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAircraftCategory::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) @@ -192,7 +192,7 @@ namespace BlackMisc } } - int CAircraftCategory::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftCategory &compareValue) const + int CAircraftCategory::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftCategory &compareValue) const { if (index.isMyself()) { return m_path.compare(compareValue.getPath(), Qt::CaseInsensitive); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);} diff --git a/src/blackmisc/aviation/aircraftcategory.h b/src/blackmisc/aviation/aircraftcategory.h index c3dcf18df..0ad18d614 100644 --- a/src/blackmisc/aviation/aircraftcategory.h +++ b/src/blackmisc/aviation/aircraftcategory.h @@ -129,13 +129,13 @@ namespace BlackMisc void setAssignable(bool assignable) { m_assignable = assignable; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftCategory &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftCategory &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/aircrafticaocode.cpp b/src/blackmisc/aviation/aircrafticaocode.cpp index e6b37e5e6..d63501e58 100644 --- a/src/blackmisc/aviation/aircrafticaocode.cpp +++ b/src/blackmisc/aviation/aircrafticaocode.cpp @@ -653,37 +653,37 @@ namespace BlackMisc matchesFamily(icaoIataOrFamily); } - CVariant CAircraftIcaoCode::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CAircraftIcaoCode::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAircraftDesignator: return CVariant::fromValue(m_designator); + case IndexAircraftDesignator: return QVariant::fromValue(m_designator); case IndexCategory: return m_category.propertyByIndex(index.copyFrontRemoved()); - case IndexIataCode: return CVariant::fromValue(m_iataCode); - case IndexFamily: return CVariant::fromValue(m_family); - case IndexCombinedAircraftType: return CVariant::fromValue(m_combinedType); - case IndexModelDescription: return CVariant::fromValue(m_modelDescription); - case IndexModelIataDescription: return CVariant::fromValue(m_modelIataDescription); - case IndexModelSwiftDescription: return CVariant::fromValue(m_modelSwiftDescription); - case IndexCombinedDescription: return CVariant::fromValue(this->getCombinedModelDescription()); - case IndexManufacturer: return CVariant::fromValue(m_manufacturer); - case IndexWtc: return CVariant::fromValue(m_wtc); - case IndexIsVtol: return CVariant::fromValue(this->isVtol()); - case IndexIsLegacy: return CVariant::fromValue(m_legacy); - case IndexIsMilitary: return CVariant::fromValue(m_military); - case IndexIsRealworld: return CVariant::fromValue(m_realWorld); - case IndexRank: return CVariant::fromValue(m_rank); - case IndexDesignatorManufacturer: return CVariant::fromValue(this->getDesignatorManufacturer()); + case IndexIataCode: return QVariant::fromValue(m_iataCode); + case IndexFamily: return QVariant::fromValue(m_family); + case IndexCombinedAircraftType: return QVariant::fromValue(m_combinedType); + case IndexModelDescription: return QVariant::fromValue(m_modelDescription); + case IndexModelIataDescription: return QVariant::fromValue(m_modelIataDescription); + case IndexModelSwiftDescription: return QVariant::fromValue(m_modelSwiftDescription); + case IndexCombinedDescription: return QVariant::fromValue(this->getCombinedModelDescription()); + case IndexManufacturer: return QVariant::fromValue(m_manufacturer); + case IndexWtc: return QVariant::fromValue(m_wtc); + case IndexIsVtol: return QVariant::fromValue(this->isVtol()); + case IndexIsLegacy: return QVariant::fromValue(m_legacy); + case IndexIsMilitary: return QVariant::fromValue(m_military); + case IndexIsRealworld: return QVariant::fromValue(m_realWorld); + case IndexRank: return QVariant::fromValue(m_rank); + case IndexDesignatorManufacturer: return QVariant::fromValue(this->getDesignatorManufacturer()); default: return CValueObject::propertyByIndex(index); } } - void CAircraftIcaoCode::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAircraftIcaoCode::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) @@ -705,7 +705,7 @@ namespace BlackMisc } } - int CAircraftIcaoCode::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftIcaoCode &compareValue) const + int CAircraftIcaoCode::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftIcaoCode &compareValue) const { if (index.isMyself()) { return m_designator.compare(compareValue.getDesignator(), Qt::CaseInsensitive); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);} diff --git a/src/blackmisc/aviation/aircrafticaocode.h b/src/blackmisc/aviation/aircrafticaocode.h index 6827a0771..916b34e71 100644 --- a/src/blackmisc/aviation/aircrafticaocode.h +++ b/src/blackmisc/aviation/aircrafticaocode.h @@ -293,13 +293,13 @@ namespace BlackMisc bool matchesDesignatorIataOrFamily(const QString &icaoIataOrFamily) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftIcaoCode &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftIcaoCode &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/aircraftlights.cpp b/src/blackmisc/aviation/aircraftlights.cpp index 3e4fc3d8f..29746fcb9 100644 --- a/src/blackmisc/aviation/aircraftlights.cpp +++ b/src/blackmisc/aviation/aircraftlights.cpp @@ -97,29 +97,29 @@ namespace BlackMisc return s; } - CVariant CAircraftLights::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CAircraftLights::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexIsNull: return CVariant::from(this->isNull()); - case IndexBeacon: return CVariant::from(m_beaconOn); - case IndexLanding: return CVariant::from(m_landingOn); - case IndexLogo: return CVariant::from(m_logoOn); - case IndexNav: return CVariant::from(m_navOn); - case IndexStrobe: return CVariant::from(m_strobeOn); - case IndexTaxi: return CVariant::from(m_taxiOn); - case IndexRecognition: return CVariant::from(m_recognition); - case IndexCabin: return CVariant::from(m_cabin); + case IndexIsNull: return QVariant::fromValue(this->isNull()); + case IndexBeacon: return QVariant::fromValue(m_beaconOn); + case IndexLanding: return QVariant::fromValue(m_landingOn); + case IndexLogo: return QVariant::fromValue(m_logoOn); + case IndexNav: return QVariant::fromValue(m_navOn); + case IndexStrobe: return QVariant::fromValue(m_strobeOn); + case IndexTaxi: return QVariant::fromValue(m_taxiOn); + case IndexRecognition: return QVariant::fromValue(m_recognition); + case IndexCabin: return QVariant::fromValue(m_cabin); default: return CValueObject::propertyByIndex(index); } } - void CAircraftLights::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAircraftLights::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) @@ -137,7 +137,7 @@ namespace BlackMisc } } - int CAircraftLights::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftLights &compareValue) const + int CAircraftLights::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftLights &compareValue) const { const ColumnIndex i = index.frontCasted(); switch (i) diff --git a/src/blackmisc/aviation/aircraftlights.h b/src/blackmisc/aviation/aircraftlights.h index fe502c549..c706ab282 100644 --- a/src/blackmisc/aviation/aircraftlights.h +++ b/src/blackmisc/aviation/aircraftlights.h @@ -114,13 +114,13 @@ namespace BlackMisc void guessLights(const CAircraftSituation &situation); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! Compare by index - int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftLights &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftLights &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/aircraftparts.cpp b/src/blackmisc/aviation/aircraftparts.cpp index 282d94bfa..16c21a8fb 100644 --- a/src/blackmisc/aviation/aircraftparts.cpp +++ b/src/blackmisc/aviation/aircraftparts.cpp @@ -239,34 +239,34 @@ namespace BlackMisc return a; } - CVariant CAircraftParts::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CAircraftParts::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexEngines: return CVariant::fromValue(m_engines); - case IndexEnginesAsString: return CVariant::fromValue(m_engines.toQString(true)); - case IndexFlapsPercentage: return CVariant::fromValue(m_flapsPercentage); - case IndexGearDown: return CVariant::fromValue(m_gearDown); + case IndexEngines: return QVariant::fromValue(m_engines); + case IndexEnginesAsString: return QVariant::fromValue(m_engines.toQString(true)); + case IndexFlapsPercentage: return QVariant::fromValue(m_flapsPercentage); + case IndexGearDown: return QVariant::fromValue(m_gearDown); case IndexLights: return m_lights.propertyByIndex(index.copyFrontRemoved()); - case IndexSpoilersOut: return CVariant::fromValue(m_spoilersOut); - case IndexIsOnGround: return CVariant::fromValue(m_isOnGround); + case IndexSpoilersOut: return QVariant::fromValue(m_spoilersOut); + case IndexIsOnGround: return QVariant::fromValue(m_isOnGround); default: return CValueObject::propertyByIndex(index); } } - void CAircraftParts::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAircraftParts::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampWithOffsetBased::canHandleIndex(index)) { ITimestampWithOffsetBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexEngines: m_engines = variant.to (); break; + case IndexEngines: m_engines = variant.value (); break; case IndexFlapsPercentage: m_flapsPercentage = variant.toInt(); break; case IndexGearDown: m_gearDown = variant.toBool(); break; case IndexLights: m_lights.setPropertyByIndex(index.copyFrontRemoved(), variant); break; @@ -276,7 +276,7 @@ namespace BlackMisc } } - int CAircraftParts::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftParts &compareValue) const + int CAircraftParts::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftParts &compareValue) const { if (index.isMyself()) { return ITimestampWithOffsetBased::comparePropertyByIndex(CPropertyIndex(), compareValue); } if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::comparePropertyByIndex(index, compareValue); } diff --git a/src/blackmisc/aviation/aircraftparts.h b/src/blackmisc/aviation/aircraftparts.h index ac7357492..bafd3ad3b 100644 --- a/src/blackmisc/aviation/aircraftparts.h +++ b/src/blackmisc/aviation/aircraftparts.h @@ -72,13 +72,13 @@ namespace BlackMisc const CAircraftEngineList &engines, bool onGround, qint64 timestamp); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftParts &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftParts &compareValue) const; //! Get aircraft lights CAircraftLights getLights() const { return m_lights; } diff --git a/src/blackmisc/aviation/aircraftsituation.cpp b/src/blackmisc/aviation/aircraftsituation.cpp index c960f42e4..677b9501f 100644 --- a/src/blackmisc/aviation/aircraftsituation.cpp +++ b/src/blackmisc/aviation/aircraftsituation.cpp @@ -327,9 +327,9 @@ namespace BlackMisc return false; } - CVariant CAircraftSituation::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CAircraftSituation::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::propertyByIndex(index); } if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::propertyByIndex(index); } @@ -342,29 +342,29 @@ namespace BlackMisc case IndexAltitude: return this->getAltitude().propertyByIndex(index.copyFrontRemoved()); case IndexHeading: return m_heading.propertyByIndex(index.copyFrontRemoved()); case IndexPitch: return m_pitch.propertyByIndex(index.copyFrontRemoved()); - case IndexPBHInfo: return CVariant::fromValue(this->getPBHInfo()); + case IndexPBHInfo: return QVariant::fromValue(this->getPBHInfo()); case IndexBank: return m_bank.propertyByIndex(index.copyFrontRemoved()); case IndexCG: return m_cg.propertyByIndex(index.copyFrontRemoved()); case IndexSceneryOffset: return m_sceneryOffset.propertyByIndex(index.copyFrontRemoved()); case IndexGroundSpeed: return m_groundSpeed.propertyByIndex(index.copyFrontRemoved()); case IndexGroundElevationPlane: return m_groundElevationPlane.propertyByIndex(index.copyFrontRemoved()); case IndexCallsign: return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved()); - case IndexIsOnGround: return CVariant::fromValue(m_onGround); - case IndexIsOnGroundString: return CVariant::fromValue(this->onGroundAsString()); - case IndexOnGroundReliability: return CVariant::fromValue(m_onGroundDetails); - case IndexOnGroundReliabilityString: return CVariant::fromValue(this->getOnGroundDetailsAsString()); - case IndexGroundElevationInfo: return CVariant::fromValue(this->getGroundElevationInfo()); - case IndexGroundElevationInfoTransferred: return CVariant::fromValue(this->isGroundElevationInfoTransferred()); - case IndexGroundElevationInfoString: return CVariant::fromValue(this->getGroundElevationInfoAsString()); - case IndexGroundElevationPlusInfo: return CVariant::fromValue(this->getGroundElevationAndInfo()); - case IndexCanLikelySkipNearGroundInterpolation: return CVariant::fromValue(this->canLikelySkipNearGroundInterpolation()); + case IndexIsOnGround: return QVariant::fromValue(m_onGround); + case IndexIsOnGroundString: return QVariant::fromValue(this->onGroundAsString()); + case IndexOnGroundReliability: return QVariant::fromValue(m_onGroundDetails); + case IndexOnGroundReliabilityString: return QVariant::fromValue(this->getOnGroundDetailsAsString()); + case IndexGroundElevationInfo: return QVariant::fromValue(this->getGroundElevationInfo()); + case IndexGroundElevationInfoTransferred: return QVariant::fromValue(this->isGroundElevationInfoTransferred()); + case IndexGroundElevationInfoString: return QVariant::fromValue(this->getGroundElevationInfoAsString()); + case IndexGroundElevationPlusInfo: return QVariant::fromValue(this->getGroundElevationAndInfo()); + case IndexCanLikelySkipNearGroundInterpolation: return QVariant::fromValue(this->canLikelySkipNearGroundInterpolation()); default: return CValueObject::propertyByIndex(index); } } - void CAircraftSituation::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAircraftSituation::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampWithOffsetBased::canHandleIndex(index)) { ITimestampWithOffsetBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); @@ -388,7 +388,7 @@ namespace BlackMisc } } - int CAircraftSituation::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituation &compareValue) const + int CAircraftSituation::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftSituation &compareValue) const { if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::comparePropertyByIndex(index, compareValue); } if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::comparePropertyByIndex(index, compareValue); } diff --git a/src/blackmisc/aviation/aircraftsituation.h b/src/blackmisc/aviation/aircraftsituation.h index ab5c8080c..5bb8de58f 100644 --- a/src/blackmisc/aviation/aircraftsituation.h +++ b/src/blackmisc/aviation/aircraftsituation.h @@ -155,13 +155,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituation &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftSituation &compareValue) const; //! Get position const Geo::CCoordinateGeodetic &getPosition() const { return m_position; } diff --git a/src/blackmisc/aviation/aircraftsituationchange.cpp b/src/blackmisc/aviation/aircraftsituationchange.cpp index 296937a2e..08d940a8d 100644 --- a/src/blackmisc/aviation/aircraftsituationchange.cpp +++ b/src/blackmisc/aviation/aircraftsituationchange.cpp @@ -129,36 +129,36 @@ namespace BlackMisc u" elv. " % m_elvMean.valueRoundedWithUnit(1) % u'/' % m_elvStdDev.valueRoundedWithUnit(1); } - CVariant CAircraftSituationChange::propertyByIndex(const CPropertyIndex &index) const + QVariant CAircraftSituationChange::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::fromValue(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexCallsign: return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved()); - case IndexSituationsCount: return CVariant::fromValue(m_situationsCount); - case IndexConstAscending: return CVariant::fromValue(m_constAscending); - case IndexConstDescending: return CVariant::fromValue(m_constDescending); - case IndexConstNotOnGround: return CVariant::fromValue(m_constNotOnGround); - case IndexConstOnGround: return CVariant::fromValue(m_constOnGround); - case IndexIsNull: return CVariant::fromValue(this->isNull()); - case IndexJustTakingOff: return CVariant::fromValue(m_justTakeoff); - case IndexJustTouchingDown: return CVariant::fromValue(m_justTouchdown); - case IndexRotatingUp: return CVariant::fromValue(m_rotateUp); - case IndexContainsPushBack: return CVariant::fromValue(m_containsPushBack); - case IndexAltitudeMean: return CVariant::fromValue(m_altMean); - case IndexAltitudeStdDev: return CVariant::fromValue(m_altStdDev); - case IndexElevationMean: return CVariant::fromValue(m_elvMean); - case IndexElevationStdDev: return CVariant::fromValue(m_elvStdDev); + case IndexSituationsCount: return QVariant::fromValue(m_situationsCount); + case IndexConstAscending: return QVariant::fromValue(m_constAscending); + case IndexConstDescending: return QVariant::fromValue(m_constDescending); + case IndexConstNotOnGround: return QVariant::fromValue(m_constNotOnGround); + case IndexConstOnGround: return QVariant::fromValue(m_constOnGround); + case IndexIsNull: return QVariant::fromValue(this->isNull()); + case IndexJustTakingOff: return QVariant::fromValue(m_justTakeoff); + case IndexJustTouchingDown: return QVariant::fromValue(m_justTouchdown); + case IndexRotatingUp: return QVariant::fromValue(m_rotateUp); + case IndexContainsPushBack: return QVariant::fromValue(m_containsPushBack); + case IndexAltitudeMean: return QVariant::fromValue(m_altMean); + case IndexAltitudeStdDev: return QVariant::fromValue(m_altStdDev); + case IndexElevationMean: return QVariant::fromValue(m_elvMean); + case IndexElevationStdDev: return QVariant::fromValue(m_elvStdDev); default: return CValueObject::propertyByIndex(index); } } - void CAircraftSituationChange::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAircraftSituationChange::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampWithOffsetBased::canHandleIndex(index)) { ITimestampWithOffsetBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); @@ -184,7 +184,7 @@ namespace BlackMisc } } - int CAircraftSituationChange::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituationChange &compareValue) const + int CAircraftSituationChange::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftSituationChange &compareValue) const { if (index.isMyself()) { return ITimestampWithOffsetBased::comparePropertyByIndex(CPropertyIndex(), compareValue); } if (ITimestampWithOffsetBased::canHandleIndex(index)) { return ITimestampWithOffsetBased::comparePropertyByIndex(index, compareValue); } diff --git a/src/blackmisc/aviation/aircraftsituationchange.h b/src/blackmisc/aviation/aircraftsituationchange.h index 68c33f563..f0a8c10a6 100644 --- a/src/blackmisc/aviation/aircraftsituationchange.h +++ b/src/blackmisc/aviation/aircraftsituationchange.h @@ -161,13 +161,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftSituationChange &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftSituationChange &compareValue) const; //! Calculate the standard deviiations bool calculateStdDeviations(const CAircraftSituationList &situations, const PhysicalQuantities::CLength &cg); diff --git a/src/blackmisc/aviation/airlineicaocode.cpp b/src/blackmisc/aviation/airlineicaocode.cpp index fdee829d4..1bad66ef7 100644 --- a/src/blackmisc/aviation/airlineicaocode.cpp +++ b/src/blackmisc/aviation/airlineicaocode.cpp @@ -216,34 +216,34 @@ namespace BlackMisc return s.trimmed(); } - CVariant CAirlineIcaoCode::propertyByIndex(const CPropertyIndex &index) const + QVariant CAirlineIcaoCode::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAirlineDesignator: return CVariant::fromValue(m_designator); - case IndexIataCode: return CVariant::fromValue(m_iataCode); - case IndexAirlineCountryIso: return CVariant::fromValue(this->getCountryIso()); + case IndexAirlineDesignator: return QVariant::fromValue(m_designator); + case IndexIataCode: return QVariant::fromValue(m_iataCode); + case IndexAirlineCountryIso: return QVariant::fromValue(this->getCountryIso()); case IndexAirlineCountry: return m_country.propertyByIndex(index.copyFrontRemoved()); - case IndexAirlineName: return CVariant::fromValue(m_name); - case IndexAirlineIconHTML: return CVariant::fromValue(this->getIconAsHTMLImage()); - case IndexTelephonyDesignator: return CVariant::fromValue(m_telephonyDesignator); - case IndexIsVirtualAirline: return CVariant::fromValue(m_isVa); - case IndexIsOperating: return CVariant::fromValue(m_isOperating); - case IndexIsMilitary: return CVariant::fromValue(m_isMilitary); - case IndexDesignatorNameCountry: return CVariant::fromValue(this->getDesignatorNameCountry()); - case IndexGroupDesignator: return CVariant::fromValue(this->getGroupDesignator()); - case IndexGroupName: return CVariant::fromValue(this->getGroupName()); - case IndexGroupId: return CVariant::fromValue(this->getGroupId()); + case IndexAirlineName: return QVariant::fromValue(m_name); + case IndexAirlineIconHTML: return QVariant::fromValue(this->getIconAsHTMLImage()); + case IndexTelephonyDesignator: return QVariant::fromValue(m_telephonyDesignator); + case IndexIsVirtualAirline: return QVariant::fromValue(m_isVa); + case IndexIsOperating: return QVariant::fromValue(m_isOperating); + case IndexIsMilitary: return QVariant::fromValue(m_isMilitary); + case IndexDesignatorNameCountry: return QVariant::fromValue(this->getDesignatorNameCountry()); + case IndexGroupDesignator: return QVariant::fromValue(this->getGroupDesignator()); + case IndexGroupName: return QVariant::fromValue(this->getGroupName()); + case IndexGroupId: return QVariant::fromValue(this->getGroupId()); default: return CValueObject::propertyByIndex(index); } } - void CAirlineIcaoCode::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAirlineIcaoCode::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) @@ -256,14 +256,14 @@ namespace BlackMisc case IndexIsVirtualAirline: this->setVirtualAirline(variant.toBool()); break; case IndexIsOperating: this->setOperating(variant.toBool()); break; case IndexIsMilitary: this->setMilitary(variant.toBool()); break; - case IndexGroupDesignator: this->setGroupDesignator(variant.toQString()); break; - case IndexGroupName: this->setGroupName(variant.toQString()); break; + case IndexGroupDesignator: this->setGroupDesignator(variant.toString()); break; + case IndexGroupName: this->setGroupName(variant.toString()); break; case IndexGroupId: this->setGroupId(variant.toInt()); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } - int CAirlineIcaoCode::comparePropertyByIndex(const CPropertyIndex &index, const CAirlineIcaoCode &compareValue) const + int CAirlineIcaoCode::comparePropertyByIndex(CPropertyIndexRef index, const CAirlineIcaoCode &compareValue) const { if (index.isMyself()) { return m_designator.compare(compareValue.getDesignator(), Qt::CaseInsensitive); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);} diff --git a/src/blackmisc/aviation/airlineicaocode.h b/src/blackmisc/aviation/airlineicaocode.h index b3ab22e67..30aa8fcf6 100644 --- a/src/blackmisc/aviation/airlineicaocode.h +++ b/src/blackmisc/aviation/airlineicaocode.h @@ -214,13 +214,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAirlineIcaoCode &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAirlineIcaoCode &compareValue) const; //! Get icon resource path QString getIconResourcePath() const; diff --git a/src/blackmisc/aviation/airport.cpp b/src/blackmisc/aviation/airport.cpp index 7b6f2d434..ec4157d6d 100644 --- a/src/blackmisc/aviation/airport.cpp +++ b/src/blackmisc/aviation/airport.cpp @@ -104,18 +104,18 @@ namespace BlackMisc return airport; } - CVariant CAirport::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CAirport::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexIcao: return m_icao.propertyByIndex(index.copyFrontRemoved()); - case IndexLocation: return CVariant(m_location); - case IndexDescriptiveName: return CVariant(m_descriptiveName); + case IndexLocation: return QVariant(m_location); + case IndexDescriptiveName: return QVariant(m_descriptiveName); case IndexPosition: return m_position.propertyByIndex(index.copyFrontRemoved()); case IndexElevation: return this->getElevation().propertyByIndex(index.copyFrontRemoved()); - case IndexOperating: return CVariant::from(this->isOperating()); + case IndexOperating: return QVariant::fromValue(this->isOperating()); default: return (ICoordinateWithRelativePosition::canHandleIndex(index)) ? ICoordinateWithRelativePosition::propertyByIndex(index) : @@ -123,9 +123,9 @@ namespace BlackMisc } } - void CAirport::setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant) + void CAirport::setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -133,10 +133,10 @@ namespace BlackMisc m_icao.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexLocation: - this->setLocation(variant.toQString()); + this->setLocation(variant.toString()); break; case IndexDescriptiveName: - this->setDescriptiveName(variant.toQString()); + this->setDescriptiveName(variant.toString()); break; case IndexPosition: m_position.setPropertyByIndex(index.copyFrontRemoved(), variant); @@ -157,7 +157,7 @@ namespace BlackMisc } } - int CAirport::comparePropertyByIndex(const CPropertyIndex &index, const CAirport &compareValue) const + int CAirport::comparePropertyByIndex(CPropertyIndexRef index, const CAirport &compareValue) const { if (index.isMyself()) { return m_icao.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getIcao()); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/aviation/airport.h b/src/blackmisc/aviation/airport.h index 0ce35fab9..8c5891332 100644 --- a/src/blackmisc/aviation/airport.h +++ b/src/blackmisc/aviation/airport.h @@ -151,13 +151,13 @@ namespace BlackMisc virtual std::array normalVectorDouble() const override { return this->getPosition().normalVectorDouble(); } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! Compare by index - int comparePropertyByIndex(const CPropertyIndex &index, const CAirport &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAirport &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/airporticaocode.cpp b/src/blackmisc/aviation/airporticaocode.cpp index 3ae297c94..ae6e880ad 100644 --- a/src/blackmisc/aviation/airporticaocode.cpp +++ b/src/blackmisc/aviation/airporticaocode.cpp @@ -55,19 +55,19 @@ namespace BlackMisc return (containsChar(icaoCode, [](QChar c) { return c.isDigit(); })); } - CVariant CAirportIcaoCode::propertyByIndex(const CPropertyIndex &index) const + QVariant CAirportIcaoCode::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } return CValueObject::propertyByIndex(index); } - void CAirportIcaoCode::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAirportIcaoCode::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } CValueObject::setPropertyByIndex(index, variant); } - int CAirportIcaoCode::comparePropertyByIndex(const CPropertyIndex &index, const CAirportIcaoCode &compareValue) const + int CAirportIcaoCode::comparePropertyByIndex(CPropertyIndexRef index, const CAirportIcaoCode &compareValue) const { Q_UNUSED(index); return m_icaoCode.compare(compareValue.getIcaoCode(), Qt::CaseInsensitive); diff --git a/src/blackmisc/aviation/airporticaocode.h b/src/blackmisc/aviation/airporticaocode.h index e83f74f33..77e3a015f 100644 --- a/src/blackmisc/aviation/airporticaocode.h +++ b/src/blackmisc/aviation/airporticaocode.h @@ -65,13 +65,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAirportIcaoCode &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAirportIcaoCode &compareValue) const; //! Valid code lenght static bool validCodeLength(int l, bool strict); diff --git a/src/blackmisc/aviation/altitude.cpp b/src/blackmisc/aviation/altitude.cpp index 3cbee082a..e847eb26e 100644 --- a/src/blackmisc/aviation/altitude.cpp +++ b/src/blackmisc/aviation/altitude.cpp @@ -119,7 +119,7 @@ namespace BlackMisc } } - int CAltitude::comparePropertyByIndex(const CPropertyIndex &index, const CAltitude &compareValue) const + int CAltitude::comparePropertyByIndex(CPropertyIndexRef index, const CAltitude &compareValue) const { if (index.isMyself()) { return this->compare(compareValue); } return CLength::comparePropertyByIndex(index, compareValue); diff --git a/src/blackmisc/aviation/altitude.h b/src/blackmisc/aviation/altitude.h index c3575b42b..498b5895a 100644 --- a/src/blackmisc/aviation/altitude.h +++ b/src/blackmisc/aviation/altitude.h @@ -202,7 +202,7 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc Mixin::Index::setPropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAltitude &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAltitude &compareValue) const; //! Round to the nearest 100ft, like needed for China and Russia //! \remark https://en.wikipedia.org/wiki/Flight_level diff --git a/src/blackmisc/aviation/atcstation.cpp b/src/blackmisc/aviation/atcstation.cpp index 53317fe87..28f2c9bb7 100644 --- a/src/blackmisc/aviation/atcstation.cpp +++ b/src/blackmisc/aviation/atcstation.cpp @@ -366,28 +366,28 @@ namespace BlackMisc return m_position.normalVectorDouble(); } - CVariant CAtcStation::propertyByIndex(const CPropertyIndex &index) const + QVariant CAtcStation::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexBookedFrom: return CVariant::from(m_bookedFromUtc); - case IndexBookedUntil: return CVariant::from(m_bookedUntilUtc); + case IndexBookedFrom: return QVariant::fromValue(m_bookedFromUtc); + case IndexBookedUntil: return QVariant::fromValue(m_bookedUntilUtc); case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved()); case IndexCallsignString: return this->getCallsignAsString(); case IndexCallsignStringCrossCopuled: return this->getCallsignAsStringCrossCoupled(); case IndexController: return m_controller.propertyByIndex(index.copyFrontRemoved()); case IndexFrequency: return m_frequency.propertyByIndex(index.copyFrontRemoved()); - case IndexIsOnline: return CVariant::from(m_isOnline); + case IndexIsOnline: return QVariant::fromValue(m_isOnline); case IndexLatitude: return this->latitude().propertyByIndex(index.copyFrontRemoved()); case IndexLongitude: return this->longitude().propertyByIndex(index.copyFrontRemoved()); case IndexPosition: return m_position.propertyByIndex(index.copyFrontRemoved()); case IndexRange: return m_range.propertyByIndex(index.copyFrontRemoved()); - case IndexIsInRange: return CVariant::fromValue(isInRange()); + case IndexIsInRange: return QVariant::fromValue(isInRange()); case IndexAtis: return m_atis.propertyByIndex(index.copyFrontRemoved()); case IndexMetar: return m_metar.propertyByIndex(index.copyFrontRemoved()); - case IndexIsAfvCrossCoupled: return CVariant::from(m_isAfvCrossCoupled); + case IndexIsAfvCrossCoupled: return QVariant::fromValue(m_isAfvCrossCoupled); default: return (ICoordinateWithRelativePosition::canHandleIndex(index)) ? ICoordinateWithRelativePosition::propertyByIndex(index) : @@ -395,9 +395,9 @@ namespace BlackMisc } } - void CAtcStation::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAtcStation::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -415,7 +415,7 @@ namespace BlackMisc case IndexCallsignString: case IndexCallsignStringCrossCopuled: { - const QString cs = variant.toQString(); + const QString cs = variant.toString(); *this = CAtcStation(); this->setAfvCrossCoupled(cs.startsWith('*')); } @@ -433,7 +433,7 @@ namespace BlackMisc } } - int CAtcStation::comparePropertyByIndex(const CPropertyIndex &index, const CAtcStation &compareValue) const + int CAtcStation::comparePropertyByIndex(CPropertyIndexRef index, const CAtcStation &compareValue) const { if (index.isMyself()) { return this->getCallsign().comparePropertyByIndex(CPropertyIndexRef::empty(), compareValue.getCallsign()); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/aviation/atcstation.h b/src/blackmisc/aviation/atcstation.h index 9eb616c7b..a5f1d3106 100644 --- a/src/blackmisc/aviation/atcstation.h +++ b/src/blackmisc/aviation/atcstation.h @@ -256,13 +256,13 @@ namespace BlackMisc virtual std::array normalVectorDouble() const override; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAtcStation &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAtcStation &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/callsign.cpp b/src/blackmisc/aviation/callsign.cpp index e0b67bfee..6adfc1d2e 100644 --- a/src/blackmisc/aviation/callsign.cpp +++ b/src/blackmisc/aviation/callsign.cpp @@ -311,36 +311,36 @@ namespace BlackMisc return other == (*this); } - CVariant CCallsign::propertyByIndex(const CPropertyIndex &index) const + QVariant CCallsign::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexCallsignString: return CVariant(this->asString()); - case IndexCallsignStringAsSet: return CVariant(this->getStringAsSet()); - case IndexTelephonyDesignator: return CVariant(this->getTelephonyDesignator()); - case IndexSuffix: return CVariant(this->getSuffix()); + case IndexCallsignString: return QVariant(this->asString()); + case IndexCallsignStringAsSet: return QVariant(this->getStringAsSet()); + case IndexTelephonyDesignator: return QVariant(this->getTelephonyDesignator()); + case IndexSuffix: return QVariant(this->getSuffix()); default: return CValueObject::propertyByIndex(index); } } - void CCallsign::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CCallsign::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexCallsignString: m_callsign = unifyCallsign(variant.toQString()); break; - case IndexCallsignStringAsSet: m_callsignAsSet = variant.toQString(); break; - case IndexTelephonyDesignator: m_telephonyDesignator = variant.toQString(); break; + case IndexCallsignString: m_callsign = unifyCallsign(variant.toString()); break; + case IndexCallsignStringAsSet: m_callsignAsSet = variant.toString(); break; + case IndexTelephonyDesignator: m_telephonyDesignator = variant.toString(); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } - int CCallsign::comparePropertyByIndex(const CPropertyIndex &index, const CCallsign &compareValue) const + 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(); diff --git a/src/blackmisc/aviation/callsign.h b/src/blackmisc/aviation/callsign.h index 6f83135f7..2368ef358 100644 --- a/src/blackmisc/aviation/callsign.h +++ b/src/blackmisc/aviation/callsign.h @@ -158,13 +158,13 @@ namespace BlackMisc CIcons::IconIndex toIcon() const { return convertToIcon(*this).getIndex(); } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CCallsign &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CCallsign &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/flightplan.cpp b/src/blackmisc/aviation/flightplan.cpp index 219bed2f3..aa77dafad 100644 --- a/src/blackmisc/aviation/flightplan.cpp +++ b/src/blackmisc/aviation/flightplan.cpp @@ -320,9 +320,9 @@ namespace BlackMisc return CFlightPlan::concatPrefixIcaoSuffix(m_prefix, m_aircraftIcao.getDesignator(), m_equipmentSuffix); } - CVariant CFlightPlan::propertyByIndex(const CPropertyIndex &index) const + QVariant CFlightPlan::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); @@ -332,14 +332,14 @@ namespace BlackMisc case IndexDestinationAirportIcao: return m_destinationAirportIcao.propertyByIndex(index.copyFrontRemoved()); case IndexOriginAirportIcao: return m_originAirportIcao.propertyByIndex(index.copyFrontRemoved()); case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved()); - case IndexRemarks: return CVariant::from(m_remarks); + case IndexRemarks: return QVariant::fromValue(m_remarks); default: return CValueObject::propertyByIndex(index); } } - void CFlightPlan::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CFlightPlan::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); @@ -353,7 +353,7 @@ namespace BlackMisc case IndexDestinationAirportIcao: m_destinationAirportIcao.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexOriginAirportIcao: m_originAirportIcao.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexCallsign: m_callsign.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexRemarks: this->setRemarks(variant.toQString()); break; + case IndexRemarks: this->setRemarks(variant.toString()); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } diff --git a/src/blackmisc/aviation/flightplan.h b/src/blackmisc/aviation/flightplan.h index 3759f4d02..283a4bfd7 100644 --- a/src/blackmisc/aviation/flightplan.h +++ b/src/blackmisc/aviation/flightplan.h @@ -372,10 +372,10 @@ namespace BlackMisc QString getCombinedPrefixIcaoSuffix() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Icon::toIcon CIcons::IconIndex toIcon() const; diff --git a/src/blackmisc/aviation/informationmessage.cpp b/src/blackmisc/aviation/informationmessage.cpp index 4882f3644..01c60872a 100644 --- a/src/blackmisc/aviation/informationmessage.cpp +++ b/src/blackmisc/aviation/informationmessage.cpp @@ -58,35 +58,35 @@ namespace BlackMisc } } - CVariant CInformationMessage::propertyByIndex(const CPropertyIndex &index) const + QVariant CInformationMessage::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexType: return CVariant::from(m_type); - case IndexMessage: return CVariant::from(m_message); + case IndexType: return QVariant::fromValue(m_type); + case IndexMessage: return QVariant::fromValue(m_message); default: break; } return CValueObject::propertyByIndex(index); } - void CInformationMessage::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CInformationMessage::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexType: m_type = static_cast(variant.toInt()); break; - case IndexMessage: m_message = variant.toQString(); break; + case IndexMessage: m_message = variant.toString(); break; default: break; } CValueObject::setPropertyByIndex(index, variant); } - int CInformationMessage::comparePropertyByIndex(const CPropertyIndex &index, const CInformationMessage &compareValue) const + int CInformationMessage::comparePropertyByIndex(CPropertyIndexRef index, const CInformationMessage &compareValue) const { if (index.isMyself()) { diff --git a/src/blackmisc/aviation/informationmessage.h b/src/blackmisc/aviation/informationmessage.h index 00627314c..0d93c7385 100644 --- a/src/blackmisc/aviation/informationmessage.h +++ b/src/blackmisc/aviation/informationmessage.h @@ -99,13 +99,13 @@ namespace BlackMisc bool isEmpty() const { return m_message.isEmpty(); } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CInformationMessage &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CInformationMessage &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/livery.cpp b/src/blackmisc/aviation/livery.cpp index 275df3a23..b9ff90e27 100644 --- a/src/blackmisc/aviation/livery.cpp +++ b/src/blackmisc/aviation/livery.cpp @@ -352,9 +352,9 @@ namespace BlackMisc return temp; } - CVariant CLivery::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CLivery::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) @@ -362,31 +362,31 @@ namespace BlackMisc case IndexAirlineIcaoCode: return m_airline.propertyByIndex(index.copyFrontRemoved()); case IndexColorFuselage: return m_colorFuselage.propertyByIndex(index.copyFrontRemoved());; case IndexColorTail: return m_colorTail.propertyByIndex(index.copyFrontRemoved()); - case IndexDescription: return CVariant::fromValue(m_description); - case IndexCombinedCode: return CVariant::fromValue(m_combinedCode); - case IndexIsMilitary: return CVariant::fromValue(m_military); + case IndexDescription: return QVariant::fromValue(m_description); + case IndexCombinedCode: return QVariant::fromValue(m_combinedCode); + case IndexIsMilitary: return QVariant::fromValue(m_military); default: return CValueObject::propertyByIndex(index); } } - void CLivery::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CLivery::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDescription: m_description = variant.toQString(false); break; + case IndexDescription: m_description = variant.toString(); break; case IndexAirlineIcaoCode: m_airline.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexColorFuselage: m_colorFuselage.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexColorTail: m_colorTail.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexCombinedCode: this->setCombinedCode(variant.toQString(false)); break; + case IndexCombinedCode: this->setCombinedCode(variant.toString()); break; case IndexIsMilitary: this->setMilitary(variant.toBool()); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } - int CLivery::comparePropertyByIndex(const CPropertyIndex &index, const CLivery &compareValue) const + int CLivery::comparePropertyByIndex(CPropertyIndexRef index, const CLivery &compareValue) const { if (index.isMyself()) { return this->getCombinedCode().compare(compareValue.getCombinedCode()); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);} diff --git a/src/blackmisc/aviation/livery.h b/src/blackmisc/aviation/livery.h index 4cc82330c..4559c3853 100644 --- a/src/blackmisc/aviation/livery.h +++ b/src/blackmisc/aviation/livery.h @@ -138,13 +138,13 @@ namespace BlackMisc bool matchesColors(const CRgbColor &fuselage, const CRgbColor &tail) const; //! \copydoc Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! Compare for index - int comparePropertyByIndex(const CPropertyIndex &index, const CLivery &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CLivery &compareValue) const; //! \copydoc Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/modulator.cpp b/src/blackmisc/aviation/modulator.cpp index 8a605b3ea..242a44b26 100644 --- a/src/blackmisc/aviation/modulator.cpp +++ b/src/blackmisc/aviation/modulator.cpp @@ -116,25 +116,25 @@ namespace BlackMisc } template - CVariant CModulator::propertyByIndex(const CPropertyIndex &index) const + QVariant CModulator::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*derived()); } + if (index.isMyself()) { return QVariant::fromValue(*derived()); } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexActiveFrequency: return this->getFrequencyActive().propertyByIndex(index.copyFrontRemoved()); case IndexStandbyFrequency: return this->getFrequencyStandby().propertyByIndex(index.copyFrontRemoved()); - case IndexEnabledTransmit: return CVariant::from(this->isTransmitEnabled()); - case IndexEnabledReceive: return CVariant::from(this->isReceiveEnabled()); - case IndexTransmitVolume: return CVariant::from(this->getVolumeTransmit()); - case IndexReceiveVolume: return CVariant::from(this->getVolumeReceive()); + case IndexEnabledTransmit: return QVariant::fromValue(this->isTransmitEnabled()); + case IndexEnabledReceive: return QVariant::fromValue(this->isReceiveEnabled()); + case IndexTransmitVolume: return QVariant::fromValue(this->getVolumeTransmit()); + case IndexReceiveVolume: return QVariant::fromValue(this->getVolumeReceive()); default: return CValueObject>::propertyByIndex(index); } } template - void CModulator::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CModulator::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (index.isMyself()) { Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong index to base template"); return; } const ColumnIndex i = index.frontCasted(); @@ -153,7 +153,7 @@ namespace BlackMisc } template - int CModulator::comparePropertyByIndex(const CPropertyIndex &index, const AVIO &compareValue) const + int CModulator::comparePropertyByIndex(CPropertyIndexRef index, const AVIO &compareValue) const { if (index.isMyself()) { return m_frequencyActive.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.m_frequencyActive); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/aviation/modulator.h b/src/blackmisc/aviation/modulator.h index 2cf9453a5..da32bf226 100644 --- a/src/blackmisc/aviation/modulator.h +++ b/src/blackmisc/aviation/modulator.h @@ -70,13 +70,13 @@ namespace BlackMisc void setReceiveEnabled(bool enable); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! Compare by property index - int comparePropertyByIndex(const BlackMisc::CPropertyIndex &index, const AVIO &compareValue) const; + int comparePropertyByIndex(BlackMisc::CPropertyIndexRef index, const AVIO &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/simbriefdata.cpp b/src/blackmisc/aviation/simbriefdata.cpp index 80189df0c..1285e31f1 100644 --- a/src/blackmisc/aviation/simbriefdata.cpp +++ b/src/blackmisc/aviation/simbriefdata.cpp @@ -36,26 +36,26 @@ namespace BlackMisc return url; } - CVariant CSimBriefData::propertyByIndex(const CPropertyIndex &index) const + QVariant CSimBriefData::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexUrl: return CVariant::from(m_url); - case IndexUsername: return CVariant::from(m_username); + case IndexUrl: return QVariant::fromValue(m_url); + case IndexUsername: return QVariant::fromValue(m_username); default: return CValueObject::propertyByIndex(index); } } - void CSimBriefData::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CSimBriefData::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexUrl: m_url = variant.toQString(); break; - case IndexUsername: m_username = variant.toQString(); break; + case IndexUrl: m_url = variant.toString(); break; + case IndexUsername: m_username = variant.toString(); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } diff --git a/src/blackmisc/aviation/simbriefdata.h b/src/blackmisc/aviation/simbriefdata.h index f6b62c78e..5e7ad4f2d 100644 --- a/src/blackmisc/aviation/simbriefdata.h +++ b/src/blackmisc/aviation/simbriefdata.h @@ -60,10 +60,10 @@ namespace BlackMisc void setUrl(const QString &url) { m_url = url; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/aviation/transponder.cpp b/src/blackmisc/aviation/transponder.cpp index 5513691bd..5eb57f9c9 100644 --- a/src/blackmisc/aviation/transponder.cpp +++ b/src/blackmisc/aviation/transponder.cpp @@ -221,33 +221,33 @@ namespace BlackMisc return i; } - CVariant CTransponder::propertyByIndex(const CPropertyIndex &index) const + QVariant CTransponder::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexMode: return CVariant::from(this->getTransponderMode()); - case IndexModeAsString: return CVariant::from(this->getModeAsString()); - case IndexTransponderCode: return CVariant::from(this->getTransponderCode()); - case IndexTransponderCodeFormatted: return CVariant::from(this->getTransponderCodeFormatted()); - case IndexTransponderCodeAndModeFormatted: return CVariant::from(this->getTransponderCodeAndModeFormatted()); + case IndexMode: return QVariant::fromValue(this->getTransponderMode()); + case IndexModeAsString: return QVariant::fromValue(this->getModeAsString()); + case IndexTransponderCode: return QVariant::fromValue(this->getTransponderCode()); + case IndexTransponderCodeFormatted: return QVariant::fromValue(this->getTransponderCodeFormatted()); + case IndexTransponderCodeAndModeFormatted: return QVariant::fromValue(this->getTransponderCodeAndModeFormatted()); default: break; } Q_ASSERT_X(false, "CTransponder", "index unknown"); const QString m = QString("no property, index ").append(index.toQString()); - return CVariant::fromValue(m); + return QVariant::fromValue(m); } - void CTransponder::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CTransponder::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexMode: m_transponderMode = variant.toInt(); break; - case IndexModeAsString: this->setTransponderMode(modeFromString(variant.toQString())); break; + case IndexModeAsString: this->setTransponderMode(modeFromString(variant.toString())); break; case IndexTransponderCode: case IndexTransponderCodeFormatted: if (variant.canConvert()) @@ -256,7 +256,7 @@ namespace BlackMisc } else { - this->setTransponderCode(variant.toQString()); + this->setTransponderCode(variant.toString()); } break; case IndexTransponderCodeAndModeFormatted: diff --git a/src/blackmisc/aviation/transponder.h b/src/blackmisc/aviation/transponder.h index 072ace019..a2f1a48d9 100644 --- a/src/blackmisc/aviation/transponder.h +++ b/src/blackmisc/aviation/transponder.h @@ -135,10 +135,10 @@ namespace BlackMisc void setIFR() { m_transponderCode = 2000; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/country.cpp b/src/blackmisc/country.cpp index db54024f6..5a671c9fa 100644 --- a/src/blackmisc/country.cpp +++ b/src/blackmisc/country.cpp @@ -120,19 +120,19 @@ namespace BlackMisc return this->getCombinedStringIsoName(); } - CVariant CCountry::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CCountry::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { - case IndexIsoCode: return CVariant::fromValue(m_dbKey); - case IndexIso3Code: return CVariant::fromValue(getIso3Code()); - case IndexName: return CVariant::fromValue(m_name); - case IndexIsoName: return CVariant::fromValue(getCombinedStringIsoName()); - case IndexAlias1: return CVariant::fromValue(this->getAlias1()); - case IndexAlias2: return CVariant::fromValue(this->getAlias2()); - case IndexHistoric: return CVariant::fromValue(this->isHistoric()); + case IndexIsoCode: return QVariant::fromValue(m_dbKey); + case IndexIso3Code: return QVariant::fromValue(getIso3Code()); + case IndexName: return QVariant::fromValue(m_name); + case IndexIsoName: return QVariant::fromValue(getCombinedStringIsoName()); + case IndexAlias1: return QVariant::fromValue(this->getAlias1()); + case IndexAlias2: return QVariant::fromValue(this->getAlias2()); + case IndexHistoric: return QVariant::fromValue(this->isHistoric()); default: return (IDatastoreObjectWithStringKey::canHandleIndex(index)) ? IDatastoreObjectWithStringKey::propertyByIndex(index) : @@ -140,17 +140,17 @@ namespace BlackMisc } } - void CCountry::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CCountry::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexIsoCode: this->setIsoCode(variant.toQString()); break; - case IndexIso3Code: this->setIso3Code(variant.toQString()); break; - case IndexName: this->setName(variant.toQString()); break; - case IndexAlias1: this->setAlias1(variant.toQString()); break; - case IndexAlias2: this->setAlias1(variant.toQString()); break; + case IndexIsoCode: this->setIsoCode(variant.toString()); break; + case IndexIso3Code: this->setIso3Code(variant.toString()); break; + case IndexName: this->setName(variant.toString()); break; + case IndexAlias1: this->setAlias1(variant.toString()); break; + case IndexAlias2: this->setAlias1(variant.toString()); break; case IndexHistoric: this->setHistoric(variant.toBool()); break; default: IDatastoreObjectWithStringKey::canHandleIndex(index) ? @@ -160,7 +160,7 @@ namespace BlackMisc } } - int CCountry::comparePropertyByIndex(const CPropertyIndex &index, const CCountry &compareValue) const + int CCountry::comparePropertyByIndex(CPropertyIndexRef index, const CCountry &compareValue) const { if (index.isMyself()) { return getIsoCode().compare(compareValue.getIsoCode(), Qt::CaseInsensitive); } if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { return IDatastoreObjectWithStringKey::comparePropertyByIndex(index, compareValue);} diff --git a/src/blackmisc/country.h b/src/blackmisc/country.h index d99244b0e..78978844d 100644 --- a/src/blackmisc/country.h +++ b/src/blackmisc/country.h @@ -118,13 +118,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! Compare for index - int comparePropertyByIndex(const CPropertyIndex &index, const CCountry &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CCountry &compareValue) const; //! From our database JSON format static CCountry fromDatabaseJson(const QJsonObject &json, const QString &prefix = QString()); diff --git a/src/blackmisc/crashinfo.cpp b/src/blackmisc/crashinfo.cpp index cd8cf650c..367f7cc33 100644 --- a/src/blackmisc/crashinfo.cpp +++ b/src/blackmisc/crashinfo.cpp @@ -35,36 +35,36 @@ namespace BlackMisc m_logFileAndPath = fileName; } - CVariant CCrashInfo::propertyByIndex(const CPropertyIndex &index) const + QVariant CCrashInfo::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexUserName: return CVariant::fromValue(m_userName); - case IndexInfo: return CVariant::fromValue(m_info); - case IndexSimulatorString: return CVariant::fromValue(m_simulatorString); - case IndexFlightNetworkInfo: return CVariant::fromValue(m_flightNetwork); + case IndexUserName: return QVariant::fromValue(m_userName); + case IndexInfo: return QVariant::fromValue(m_info); + case IndexSimulatorString: return QVariant::fromValue(m_simulatorString); + case IndexFlightNetworkInfo: return QVariant::fromValue(m_flightNetwork); default: break; } return CValueObject::propertyByIndex(index); } - void CCrashInfo::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CCrashInfo::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexUserName: this->setUserName(variant.toQString()); break; - case IndexInfo: this->setUserName(variant.toQString()); break; - case IndexSimulatorString: this->setSimulatorString(variant.toQString()); break; - case IndexFlightNetworkInfo: this->setFlightNetworkString(variant.toQString()); break; + case IndexUserName: this->setUserName(variant.toString()); break; + case IndexInfo: this->setUserName(variant.toString()); break; + case IndexSimulatorString: this->setSimulatorString(variant.toString()); break; + case IndexFlightNetworkInfo: this->setFlightNetworkString(variant.toString()); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } - int CCrashInfo::comparePropertyByIndex(const CPropertyIndex &index, const CCrashInfo &compareValue) const + int CCrashInfo::comparePropertyByIndex(CPropertyIndexRef index, const CCrashInfo &compareValue) const { if (index.isMyself()) { return this->getInfo().compare(compareValue.getInfo()); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/crashinfo.h b/src/blackmisc/crashinfo.h index 5c6f37e4c..89b363d42 100644 --- a/src/blackmisc/crashinfo.h +++ b/src/blackmisc/crashinfo.h @@ -71,13 +71,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CCrashInfo &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CCrashInfo &compareValue) const; //! Trigger writing this to file (in background) void triggerWritingFile() const; diff --git a/src/blackmisc/crashsettings.cpp b/src/blackmisc/crashsettings.cpp index 320dc36a3..f27e85bc1 100644 --- a/src/blackmisc/crashsettings.cpp +++ b/src/blackmisc/crashsettings.cpp @@ -24,22 +24,22 @@ namespace BlackMisc return QStringLiteral("{ %1, %2 }").arg(boolToYesNo(this->isEnabled()), boolToYesNo(this->withPrivacyInfo())); } - CVariant CCrashSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CCrashSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexEnabled: return CVariant::fromValue(this->isEnabled()); - case IndexPrivateInfo: return CVariant::fromValue(this->withPrivacyInfo()); + case IndexEnabled: return QVariant::fromValue(this->isEnabled()); + case IndexPrivateInfo: return QVariant::fromValue(this->withPrivacyInfo()); default: break; } return CValueObject::propertyByIndex(index); } - void CCrashSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CCrashSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -49,7 +49,7 @@ namespace BlackMisc } } - int CCrashSettings::comparePropertyByIndex(const CPropertyIndex &index, const CCrashSettings &compareValue) const + int CCrashSettings::comparePropertyByIndex(CPropertyIndexRef index, const CCrashSettings &compareValue) const { if (index.isMyself()) { return this->convertToQString().compare(compareValue.convertToQString()); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/crashsettings.h b/src/blackmisc/crashsettings.h index ce72dc423..229aa8bf9 100644 --- a/src/blackmisc/crashsettings.h +++ b/src/blackmisc/crashsettings.h @@ -49,13 +49,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CCrashSettings &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CCrashSettings &compareValue) const; private: bool m_enabled = false; diff --git a/src/blackmisc/datacache.h b/src/blackmisc/datacache.h index dfce7d360..cce790e8f 100644 --- a/src/blackmisc/datacache.h +++ b/src/blackmisc/datacache.h @@ -354,7 +354,7 @@ namespace BlackMisc } //! \copydoc BlackMisc::CCached::setProperty - CStatusMessage setProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) + CStatusMessage setProperty(CPropertyIndexRef index, const CVariant &value, qint64 timestamp = 0) { CDataCache::instance()->admitValue(this->getKey(), false); return CCached::setProperty(index, value, timestamp); @@ -410,7 +410,7 @@ namespace BlackMisc //! Data cache doesn't support setAndSave (because set() already causes save anyway). //! @{ CStatusMessage setAndSave(const typename Trait::type &value, qint64 timestamp = 0) = delete; - CStatusMessage setAndSaveProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) = delete; + CStatusMessage setAndSaveProperty(CPropertyIndexRef index, const CVariant &value, qint64 timestamp = 0) = delete; //! @} //! Data cache doesn't support save (because currently set value is saved already). @@ -431,7 +431,7 @@ namespace BlackMisc //! Deleted mutators. //! @{ CStatusMessage set(const typename Trait::type &value, qint64 timestamp = 0) = delete; - CStatusMessage setProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) = delete; + CStatusMessage setProperty(CPropertyIndexRef index, const CVariant &value, qint64 timestamp = 0) = delete; CStatusMessage setDefault() = delete; void renewTimestamp(qint64 timestamp) = delete; //! @} diff --git a/src/blackmisc/db/artifact.cpp b/src/blackmisc/db/artifact.cpp index 30ae77b80..84e7acaf0 100644 --- a/src/blackmisc/db/artifact.cpp +++ b/src/blackmisc/db/artifact.cpp @@ -113,30 +113,30 @@ namespace BlackMisc this->getFormattedUtcTimestampYmdhms(); } - CVariant CArtifact::propertyByIndex(const CPropertyIndex &index) const + QVariant CArtifact::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexName: return CVariant::fromValue(m_name); - case IndexMd5: return CVariant::fromValue(m_md5); + case IndexName: return QVariant::fromValue(m_name); + case IndexMd5: return QVariant::fromValue(m_md5); case IndexPlatform: return m_platform.propertyByIndex(index.copyFrontRemoved()); - case IndexType: return CVariant::fromValue(m_type); - case IndexSize: return CVariant::fromValue(m_size); - case IndexSizeHumanReadable: return CVariant::fromValue(this->getFileSizeHumanReadable()); - case IndexVersionString: return CVariant::fromValue(m_version); - case IndexQVersion: return CVariant::fromValue(this->getQVersion()); - case IndexDistributions: return CVariant::fromValue(m_distributions); + case IndexType: return QVariant::fromValue(m_type); + case IndexSize: return QVariant::fromValue(m_size); + case IndexSizeHumanReadable: return QVariant::fromValue(this->getFileSizeHumanReadable()); + case IndexVersionString: return QVariant::fromValue(m_version); + case IndexQVersion: return QVariant::fromValue(this->getQVersion()); + case IndexDistributions: return QVariant::fromValue(m_distributions); default: return CValueObject::propertyByIndex(index); } } - void CArtifact::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CArtifact::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); @@ -146,12 +146,12 @@ namespace BlackMisc const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexName: this->setName(variant.toQString()); break; - case IndexMd5: m_md5 = variant.toQString(); break; + case IndexName: this->setName(variant.toString()); break; + case IndexMd5: m_md5 = variant.toString(); break; case IndexPlatform: m_platform.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexType: m_type = variant.toInt(); break; case IndexSize: m_size = variant.toInt(); break; - case IndexVersionString: m_version = variant.toQString(); break; + case IndexVersionString: m_version = variant.toString(); break; case IndexDistributions: m_distributions = variant.value(); break; default: CValueObject::setPropertyByIndex(index, variant); break; } diff --git a/src/blackmisc/db/artifact.h b/src/blackmisc/db/artifact.h index e33472a26..9b502da04 100644 --- a/src/blackmisc/db/artifact.h +++ b/src/blackmisc/db/artifact.h @@ -132,10 +132,10 @@ namespace BlackMisc QString convertToQString(const QString &separator, bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! Object from database JSON format static CArtifact fromDatabaseJson(const QJsonObject &json, const QString &prefix = {}); diff --git a/src/blackmisc/db/datastore.cpp b/src/blackmisc/db/datastore.cpp index af2ce8264..d927c2e52 100644 --- a/src/blackmisc/db/datastore.cpp +++ b/src/blackmisc/db/datastore.cpp @@ -102,36 +102,36 @@ namespace BlackMisc return !(jv.isNull() || jv.isUndefined()); } - CVariant IDatastoreObjectWithIntegerKey::propertyByIndex(const CPropertyIndex &index) const + QVariant IDatastoreObjectWithIntegerKey::propertyByIndex(CPropertyIndexRef index) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDbIntegerKey: return CVariant::from(m_dbKey); - case IndexDbKeyAsString: return CVariant::from(this->getDbKeyAsString()); - case IndexIsLoadedFromDb: return CVariant::from(this->hasValidDbKey()); - case IndexDatabaseIcon: return CVariant::from(this->toDatabaseIcon()); - case IndexVersion: return CVariant::from(this->getVersion()); + case IndexDbIntegerKey: return QVariant::fromValue(m_dbKey); + case IndexDbKeyAsString: return QVariant::fromValue(this->getDbKeyAsString()); + case IndexIsLoadedFromDb: return QVariant::fromValue(this->hasValidDbKey()); + case IndexDatabaseIcon: return QVariant::fromValue(this->toDatabaseIcon()); + case IndexVersion: return QVariant::fromValue(this->getVersion()); default: break; } - return CVariant(); + return QVariant(); } - void IDatastoreObjectWithIntegerKey::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void IDatastoreObjectWithIntegerKey::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexDbIntegerKey: m_dbKey = variant.toInt(); break; - case IndexDbKeyAsString: m_dbKey = stringToDbKey(variant.toQString()); break; - case IndexVersion: this->setVersion(variant.toQString()); break; + case IndexDbKeyAsString: m_dbKey = stringToDbKey(variant.toString()); break; + case IndexVersion: this->setVersion(variant.toString()); break; default: break; } } - int IDatastoreObjectWithIntegerKey::comparePropertyByIndex(const CPropertyIndex &index, const IDatastoreObjectWithIntegerKey &compareValue) const + int IDatastoreObjectWithIntegerKey::comparePropertyByIndex(CPropertyIndexRef index, const IDatastoreObjectWithIntegerKey &compareValue) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::comparePropertyByIndex(index, compareValue); } const ColumnIndex i = index.frontCasted(); @@ -147,7 +147,7 @@ namespace BlackMisc return 0; } - bool IDatastoreObjectWithIntegerKey::canHandleIndex(const BlackMisc::CPropertyIndex &index) + bool IDatastoreObjectWithIntegerKey::canHandleIndex(BlackMisc::CPropertyIndexRef index) { if (ITimestampBased::canHandleIndex(index)) { return true; } const int i = index.frontCasted(); @@ -193,23 +193,23 @@ namespace BlackMisc return !(jv.isNull() || jv.isUndefined()); } - CVariant IDatastoreObjectWithStringKey::propertyByIndex(const CPropertyIndex &index) const + QVariant IDatastoreObjectWithStringKey::propertyByIndex(CPropertyIndexRef index) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexDbKeyAsString: // fall thru - case IndexDbStringKey: return CVariant::from(m_dbKey); - case IndexDatabaseIcon: return CVariant::from(this->toDatabaseIcon()); - case IndexIsLoadedFromDb: return CVariant::from(m_loadedFromDb); - case IndexVersion: return CVariant::from(this->getVersion()); + case IndexDbStringKey: return QVariant::fromValue(m_dbKey); + case IndexDatabaseIcon: return QVariant::fromValue(this->toDatabaseIcon()); + case IndexIsLoadedFromDb: return QVariant::fromValue(m_loadedFromDb); + case IndexVersion: return QVariant::fromValue(this->getVersion()); default: break; } - return CVariant(); + return QVariant(); } - void IDatastoreObjectWithStringKey::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void IDatastoreObjectWithStringKey::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); @@ -220,13 +220,13 @@ namespace BlackMisc m_dbKey = variant.value(); break; case IndexIsLoadedFromDb: m_loadedFromDb = variant.toBool(); break; - case IndexVersion: this->setVersion(variant.toQString()); break; + case IndexVersion: this->setVersion(variant.toString()); break; default: break; } } - int IDatastoreObjectWithStringKey::comparePropertyByIndex(const CPropertyIndex &index, const IDatastoreObjectWithStringKey &compareValue) const + int IDatastoreObjectWithStringKey::comparePropertyByIndex(CPropertyIndexRef index, const IDatastoreObjectWithStringKey &compareValue) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::comparePropertyByIndex(index, compareValue); } const ColumnIndex i = index.frontCasted(); @@ -242,7 +242,7 @@ namespace BlackMisc return 0; } - bool IDatastoreObjectWithStringKey::canHandleIndex(const CPropertyIndex &index) + bool IDatastoreObjectWithStringKey::canHandleIndex(CPropertyIndexRef index) { if (index.isEmpty()) { return false; } if (ITimestampBased::canHandleIndex(index)) { return true;} diff --git a/src/blackmisc/db/datastore.h b/src/blackmisc/db/datastore.h index 277efae7b..4f81b13de 100644 --- a/src/blackmisc/db/datastore.h +++ b/src/blackmisc/db/datastore.h @@ -143,16 +143,16 @@ namespace BlackMisc static bool existsKey(const QJsonObject &json, const QString &prefix = QString()); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const IDatastoreObjectWithIntegerKey &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const IDatastoreObjectWithIntegerKey &compareValue) const; //! Can given index be handled? - static bool canHandleIndex(const BlackMisc::CPropertyIndex &index); + static bool canHandleIndex(BlackMisc::CPropertyIndexRef index); int m_dbKey = -1; //!< key }; @@ -227,16 +227,16 @@ namespace BlackMisc static bool existsKey(const QJsonObject &json, const QString &prefix = QString()); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const BlackMisc::CPropertyIndex &index, const IDatastoreObjectWithStringKey &compareValue) const; + int comparePropertyByIndex(BlackMisc::CPropertyIndexRef index, const IDatastoreObjectWithStringKey &compareValue) const; //! Can given index be handled - static bool canHandleIndex(const BlackMisc::CPropertyIndex &index); + static bool canHandleIndex(BlackMisc::CPropertyIndexRef index); QString m_dbKey; //!< key bool m_loadedFromDb = false; //!< as we have no artificial key, it can happen key is set, but not loaded from DB diff --git a/src/blackmisc/db/dbinfo.cpp b/src/blackmisc/db/dbinfo.cpp index e5c9c3eff..5eb15c949 100644 --- a/src/blackmisc/db/dbinfo.cpp +++ b/src/blackmisc/db/dbinfo.cpp @@ -70,15 +70,15 @@ namespace BlackMisc return QStringLiteral("Table %1 with entries %1").arg(m_tableName).arg(m_entries); } - CVariant CDbInfo::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CDbInfo::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexTableName: return CVariant::fromValue(m_tableName); - case IndexEntries: return CVariant::fromValue(m_entries); - case IndexEntity: return CVariant::fromValue(m_entity); + case IndexTableName: return QVariant::fromValue(m_tableName); + case IndexEntries: return QVariant::fromValue(m_entries); + case IndexEntity: return QVariant::fromValue(m_entity); default: return (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) ? IDatastoreObjectWithIntegerKey::propertyByIndex(index) : @@ -86,14 +86,14 @@ namespace BlackMisc } } - void CDbInfo::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CDbInfo::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexTableName: this->setTableName(variant.toQString()); break; - case IndexEntries: this->setTableName(variant.toQString()); break; + case IndexTableName: this->setTableName(variant.toString()); break; + case IndexEntries: this->setTableName(variant.toString()); break; case IndexEntity: this->setEntity(static_cast(variant.toInt())); break; default: if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) @@ -108,7 +108,7 @@ namespace BlackMisc } } - int CDbInfo::comparePropertyByIndex(const CPropertyIndex &index, const CDbInfo &compareValue) const + int CDbInfo::comparePropertyByIndex(CPropertyIndexRef index, const CDbInfo &compareValue) const { if (index.isMyself()) { return getTableName().compare(compareValue.getTableName(), Qt::CaseInsensitive); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);} diff --git a/src/blackmisc/db/dbinfo.h b/src/blackmisc/db/dbinfo.h index 7588f4892..7d3e7e877 100644 --- a/src/blackmisc/db/dbinfo.h +++ b/src/blackmisc/db/dbinfo.h @@ -76,13 +76,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! Compare by index - int comparePropertyByIndex(const CPropertyIndex &index, const CDbInfo &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CDbInfo &compareValue) const; //! From our database JSON format static CDbInfo fromDatabaseJson(const QJsonObject &json, const QString &prefix = QString()); diff --git a/src/blackmisc/db/distribution.cpp b/src/blackmisc/db/distribution.cpp index 78eff9395..95e6b6b54 100644 --- a/src/blackmisc/db/distribution.cpp +++ b/src/blackmisc/db/distribution.cpp @@ -79,25 +79,25 @@ namespace BlackMisc return this->getRestrictionIcon(); } - CVariant CDistribution::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CDistribution::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexChannel: return CVariant::fromValue(m_channel); - case IndexStability : return CVariant::fromValue(m_stability); - case IndexDownloadUrls: return CVariant::fromValue(m_downloadUrls); - case IndexRestricted: return CVariant::fromValue(m_restricted); + case IndexChannel: return QVariant::fromValue(m_channel); + case IndexStability : return QVariant::fromValue(m_stability); + case IndexDownloadUrls: return QVariant::fromValue(m_downloadUrls); + case IndexRestricted: return QVariant::fromValue(m_restricted); default: return CValueObject::propertyByIndex(index); } } - void CDistribution::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CDistribution::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); diff --git a/src/blackmisc/db/distribution.h b/src/blackmisc/db/distribution.h index cca840e38..337dbc200 100644 --- a/src/blackmisc/db/distribution.h +++ b/src/blackmisc/db/distribution.h @@ -98,10 +98,10 @@ namespace BlackMisc CIcons::IconIndex toIcon() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! Pseudo distribution for local builds const static CDistribution &localDeveloperBuild(); diff --git a/src/blackmisc/db/updateinfo.cpp b/src/blackmisc/db/updateinfo.cpp index 57d09760f..359d211ce 100644 --- a/src/blackmisc/db/updateinfo.cpp +++ b/src/blackmisc/db/updateinfo.cpp @@ -109,22 +109,22 @@ namespace BlackMisc this->getDistributions().toQString(i18n); } - CVariant CUpdateInfo::propertyByIndex(const CPropertyIndex &index) const + QVariant CUpdateInfo::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexArtifactsPilotClient: return CVariant::fromValue(m_artifactsPilotClient); - case IndexArtifactsXSwiftBus: return CVariant::fromValue(m_artifactsXSwiftBus); - case IndexDistributions: return CVariant::fromValue(m_distributions); + case IndexArtifactsPilotClient: return QVariant::fromValue(m_artifactsPilotClient); + case IndexArtifactsXSwiftBus: return QVariant::fromValue(m_artifactsXSwiftBus); + case IndexDistributions: return QVariant::fromValue(m_distributions); default: return CValueObject::propertyByIndex(index); } } - void CUpdateInfo::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CUpdateInfo::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/db/updateinfo.h b/src/blackmisc/db/updateinfo.h index 07c558e88..796df5b6c 100644 --- a/src/blackmisc/db/updateinfo.h +++ b/src/blackmisc/db/updateinfo.h @@ -86,10 +86,10 @@ namespace BlackMisc QString convertToQString(const QString &separator, bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! Object from database JSON format static CUpdateInfo fromDatabaseJson(const QJsonObject &json, const QString &prefix = {}); diff --git a/src/blackmisc/directories.cpp b/src/blackmisc/directories.cpp index b7e12c116..99ba27a93 100644 --- a/src/blackmisc/directories.cpp +++ b/src/blackmisc/directories.cpp @@ -63,39 +63,39 @@ namespace BlackMisc return m_dirFlightPlan; } - CVariant CDirectories::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CDirectories::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDirFlightPlan: return CVariant::fromValue(m_dirFlightPlan); - case IndexDirFlightPlanOrDefault: return CVariant::fromValue(this->getFlightPlanDirectoryOrDefault()); - case IndexDirLastViewJson: return CVariant::fromValue(m_dirLastViewJson); - case IndexDirLastViewJsonOrDefault: return CVariant::fromValue(this->getLastViewJsonDirectoryOrDefault()); - case IndexDirLastModelJson: return CVariant::fromValue(m_dirLastModelStashJson); - case IndexDirLastModelJsonOrDefault: return CVariant::fromValue(this->getLastModelDirectoryOrDefault()); - case IndexDirLastModelStashJson: return CVariant::fromValue(m_dirLastModelStashJson); - case IndexDirMatchingScript: return CVariant::fromValue(this->getMatchingScriptDirectoryOrDefault()); - case IndexDirLastModelStashJsonOrDefault: return CVariant::fromValue(this->getLastModelStashDirectoryOrDefault()); + case IndexDirFlightPlan: return QVariant::fromValue(m_dirFlightPlan); + case IndexDirFlightPlanOrDefault: return QVariant::fromValue(this->getFlightPlanDirectoryOrDefault()); + case IndexDirLastViewJson: return QVariant::fromValue(m_dirLastViewJson); + case IndexDirLastViewJsonOrDefault: return QVariant::fromValue(this->getLastViewJsonDirectoryOrDefault()); + case IndexDirLastModelJson: return QVariant::fromValue(m_dirLastModelStashJson); + case IndexDirLastModelJsonOrDefault: return QVariant::fromValue(this->getLastModelDirectoryOrDefault()); + case IndexDirLastModelStashJson: return QVariant::fromValue(m_dirLastModelStashJson); + case IndexDirMatchingScript: return QVariant::fromValue(this->getMatchingScriptDirectoryOrDefault()); + case IndexDirLastModelStashJsonOrDefault: return QVariant::fromValue(this->getLastModelStashDirectoryOrDefault()); default: return CValueObject::propertyByIndex(index); } } - void CDirectories::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CDirectories::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDirFlightPlan: this->setFlightPlanDirectory(variant.toQString()); break; + case IndexDirFlightPlan: this->setFlightPlanDirectory(variant.toString()); break; case IndexDirLastViewJsonOrDefault: - case IndexDirLastViewJson: this->setLastViewJsonDirectory(variant.toQString()); break; + case IndexDirLastViewJson: this->setLastViewJsonDirectory(variant.toString()); break; case IndexDirLastModelJsonOrDefault: - case IndexDirLastModelJson: this->setLastModelDirectory(variant.toQString()); break; + case IndexDirLastModelJson: this->setLastModelDirectory(variant.toString()); break; case IndexDirLastModelStashJsonOrDefault: - case IndexDirLastModelStashJson: this->setLastModelStashDirectory(variant.toQString()); break; - case IndexDirMatchingScript: this->setMatchingScriptDirectory(variant.toQString()); break; + case IndexDirLastModelStashJson: this->setLastModelStashDirectory(variant.toString()); break; + case IndexDirMatchingScript: this->setMatchingScriptDirectory(variant.toString()); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } diff --git a/src/blackmisc/directories.h b/src/blackmisc/directories.h index cdfe40e13..2272e4e42 100644 --- a/src/blackmisc/directories.h +++ b/src/blackmisc/directories.h @@ -96,10 +96,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! Convert to directory static QString fileNameToDirectory(const QString &fileName); diff --git a/src/blackmisc/geo/coordinategeodetic.cpp b/src/blackmisc/geo/coordinategeodetic.cpp index 352ce6a61..b26058634 100644 --- a/src/blackmisc/geo/coordinategeodetic.cpp +++ b/src/blackmisc/geo/coordinategeodetic.cpp @@ -127,13 +127,13 @@ namespace BlackMisc return Geo::calculateBearing((*this), otherCoordinate); } - bool ICoordinateGeodetic::canHandleIndex(const CPropertyIndex &index) + bool ICoordinateGeodetic::canHandleIndex(CPropertyIndexRef index) { const int i = index.frontCasted(); return (i >= static_cast(IndexLatitude)) && (i <= static_cast(IndexNormalVector)); } - CVariant ICoordinateGeodetic::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant ICoordinateGeodetic::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { if (!index.isMyself()) { @@ -142,21 +142,21 @@ namespace BlackMisc { case IndexLatitude: return this->latitude().propertyByIndex(index.copyFrontRemoved()); case IndexLongitude: return this->longitude().propertyByIndex(index.copyFrontRemoved()); - case IndexLatitudeAsString: return CVariant(this->latitudeAsString()); - case IndexLongitudeAsString: return CVariant(this->longitudeAsString()); + case IndexLatitudeAsString: return QVariant(this->latitudeAsString()); + case IndexLongitudeAsString: return QVariant(this->longitudeAsString()); case IndexGeodeticHeight: return this->geodeticHeight().propertyByIndex(index.copyFrontRemoved()); - case IndexGeodeticHeightAsString: return CVariant(this->geodeticHeightAsString()); - case IndexNormalVector: return CVariant::fromValue(this->normalVector()); + case IndexGeodeticHeightAsString: return QVariant(this->geodeticHeightAsString()); + case IndexNormalVector: return QVariant::fromValue(this->normalVector()); default: break; } } const QString m = QString("no property, index ").append(index.toQString()); BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); - return CVariant::fromValue(m); + return QVariant::fromValue(m); } - int ICoordinateGeodetic::comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateGeodetic &compareValue) const + int ICoordinateGeodetic::comparePropertyByIndex(CPropertyIndexRef index, const ICoordinateGeodetic &compareValue) const { if (!index.isMyself()) { @@ -238,32 +238,32 @@ namespace BlackMisc return c; } - CVariant CCoordinateGeodetic::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CCoordinateGeodetic::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } return (ICoordinateGeodetic::canHandleIndex(index)) ? ICoordinateGeodetic::propertyByIndex(index) : CValueObject::propertyByIndex(index); } - void CCoordinateGeodetic::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CCoordinateGeodetic::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ICoordinateGeodetic::ColumnIndex i = index.frontCasted(); switch (i) { case IndexGeodeticHeight: m_geodeticHeight.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexLatitude: this->setLatitude(variant.value()); break; case IndexLongitude: this->setLongitude(variant.value()); break; - case IndexLatitudeAsString: this->setLatitude(CLatitude::fromWgs84(variant.toQString())); break; - case IndexLongitudeAsString: this->setLongitude(CLongitude::fromWgs84(variant.toQString())); break; - case IndexGeodeticHeightAsString: m_geodeticHeight.parseFromString(variant.toQString()); break; + case IndexLatitudeAsString: this->setLatitude(CLatitude::fromWgs84(variant.toString())); break; + case IndexLongitudeAsString: this->setLongitude(CLongitude::fromWgs84(variant.toString())); break; + case IndexGeodeticHeightAsString: m_geodeticHeight.parseFromString(variant.toString()); break; case IndexNormalVector: this->setNormalVector(variant.value()); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } - int CCoordinateGeodetic::comparePropertyByIndex(const CPropertyIndex &index, const CCoordinateGeodetic &compareValue) const + int CCoordinateGeodetic::comparePropertyByIndex(CPropertyIndexRef index, const CCoordinateGeodetic &compareValue) const { return ICoordinateGeodetic::canHandleIndex(index) ? ICoordinateGeodetic::comparePropertyByIndex(index, compareValue) : @@ -425,7 +425,7 @@ namespace BlackMisc return m_relativeDistance; } - CVariant ICoordinateWithRelativePosition::propertyByIndex(const CPropertyIndex &index) const + QVariant ICoordinateWithRelativePosition::propertyByIndex(CPropertyIndexRef index) const { if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::propertyByIndex(index); } if (!index.isMyself()) @@ -440,10 +440,10 @@ namespace BlackMisc } const QString m = QString("no property, index ").append(index.toQString()); BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); - return CVariant::fromValue(m); + return QVariant::fromValue(m); } - void ICoordinateWithRelativePosition::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void ICoordinateWithRelativePosition::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (ICoordinateGeodetic::canHandleIndex(index)) { return; } if (!index.isMyself()) @@ -461,7 +461,7 @@ namespace BlackMisc } } - int ICoordinateWithRelativePosition::comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateWithRelativePosition &compareValue) const + int ICoordinateWithRelativePosition::comparePropertyByIndex(CPropertyIndexRef index, const ICoordinateWithRelativePosition &compareValue) const { if (ICoordinateGeodetic::canHandleIndex(index)) { return ICoordinateGeodetic::comparePropertyByIndex(index, compareValue); } if (!index.isMyself()) @@ -491,7 +491,7 @@ namespace BlackMisc ICoordinateWithRelativePosition::ICoordinateWithRelativePosition() { } - bool ICoordinateWithRelativePosition::canHandleIndex(const CPropertyIndex &index) + bool ICoordinateWithRelativePosition::canHandleIndex(CPropertyIndexRef index) { if (ICoordinateGeodetic::canHandleIndex(index)) { return true; } const int i = index.frontCasted(); diff --git a/src/blackmisc/geo/coordinategeodetic.h b/src/blackmisc/geo/coordinategeodetic.h index ceca8e358..ee2408a5c 100644 --- a/src/blackmisc/geo/coordinategeodetic.h +++ b/src/blackmisc/geo/coordinategeodetic.h @@ -129,10 +129,10 @@ namespace BlackMisc PhysicalQuantities::CAngle calculateBearing(const ICoordinateGeodetic &otherCoordinate) const; //! \copydoc Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateGeodetic &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const ICoordinateGeodetic &compareValue) const; //! \copydoc Mixin::String::toQString QString convertToQString(bool i18n = false) const; @@ -149,7 +149,7 @@ namespace BlackMisc protected: //! Can given index be handled? - static bool canHandleIndex(const CPropertyIndex &index); + static bool canHandleIndex(CPropertyIndexRef index); }; //! Great circle distance between points @@ -200,13 +200,13 @@ namespace BlackMisc PhysicalQuantities::CLength calculcateAndUpdateRelativeDistanceAndBearing(const Geo::ICoordinateGeodetic &position); //! \copydoc Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateWithRelativePosition &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const ICoordinateWithRelativePosition &compareValue) const; //! \copydoc Mixin::String::toQString QString convertToQString(bool i18n = false) const; @@ -216,7 +216,7 @@ namespace BlackMisc ICoordinateWithRelativePosition(); //! Can given index be handled? - static bool canHandleIndex(const CPropertyIndex &index); + static bool canHandleIndex(CPropertyIndexRef index); PhysicalQuantities::CAngle m_relativeBearing { 0, nullptr }; //!< temporary stored value PhysicalQuantities::CLength m_relativeDistance { 0, nullptr }; //!< temporary stored value @@ -269,13 +269,13 @@ namespace BlackMisc virtual std::array normalVectorDouble() const override; //! \copydoc Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc Mixin::Index::setPropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CCoordinateGeodetic &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CCoordinateGeodetic &compareValue) const; //! Switch unit of height CCoordinateGeodetic &switchUnit(const PhysicalQuantities::CLengthUnit &unit); diff --git a/src/blackmisc/geo/elevationplane.cpp b/src/blackmisc/geo/elevationplane.cpp index 5893513b1..74b2e5e79 100644 --- a/src/blackmisc/geo/elevationplane.cpp +++ b/src/blackmisc/geo/elevationplane.cpp @@ -147,9 +147,9 @@ namespace BlackMisc m_radius = majorAirportRadius(); } - CVariant CElevationPlane::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CElevationPlane::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -159,9 +159,9 @@ namespace BlackMisc return CCoordinateGeodetic::propertyByIndex(index); } - void CElevationPlane::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CElevationPlane::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -170,7 +170,7 @@ namespace BlackMisc } } - int CElevationPlane::comparePropertyByIndex(const CPropertyIndex &index, const CElevationPlane &elevationPlane) const + int CElevationPlane::comparePropertyByIndex(CPropertyIndexRef index, const CElevationPlane &elevationPlane) const { Q_UNUSED(index) return this->getAltitude().compare(elevationPlane.getAltitude()); diff --git a/src/blackmisc/geo/elevationplane.h b/src/blackmisc/geo/elevationplane.h index fcdb569f8..99896761b 100644 --- a/src/blackmisc/geo/elevationplane.h +++ b/src/blackmisc/geo/elevationplane.h @@ -119,13 +119,13 @@ namespace BlackMisc void setMajorAirportRadius(); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CElevationPlane &elevationPlane) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CElevationPlane &elevationPlane) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/identifier.cpp b/src/blackmisc/identifier.cpp index 73ca95351..aa08418f5 100644 --- a/src/blackmisc/identifier.cpp +++ b/src/blackmisc/identifier.cpp @@ -276,28 +276,28 @@ namespace BlackMisc return s; } - CVariant CIdentifier::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CIdentifier::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexName: return CVariant::fromValue(m_name); - case IndexMachineIdBase64: return CVariant::fromValue(m_machineIdBase64); - case IndexMachineName: return CVariant::fromValue(getMachineName()); - case IndexMachineId: return CVariant::fromValue(getMachineId()); - case IndexProcessId: return CVariant::fromValue(m_processId); - case IndexProcessName: return CVariant::fromValue(m_processName); - case IndexIsFromLocalMachine: return CVariant::fromValue(isFromLocalMachine()); - case IndexIsFromSameProcess: return CVariant::fromValue(hasApplicationProcessId()); - case IndexIsFromSameProcessName: return CVariant::fromValue(hasApplicationProcessName()); + case IndexName: return QVariant::fromValue(m_name); + case IndexMachineIdBase64: return QVariant::fromValue(m_machineIdBase64); + case IndexMachineName: return QVariant::fromValue(getMachineName()); + case IndexMachineId: return QVariant::fromValue(getMachineId()); + case IndexProcessId: return QVariant::fromValue(m_processId); + case IndexProcessName: return QVariant::fromValue(m_processName); + case IndexIsFromLocalMachine: return QVariant::fromValue(isFromLocalMachine()); + case IndexIsFromSameProcess: return QVariant::fromValue(hasApplicationProcessId()); + case IndexIsFromSameProcessName: return QVariant::fromValue(hasApplicationProcessName()); default: return CValueObject::propertyByIndex(index); } } - int CIdentifier::comparePropertyByIndex(const CPropertyIndex &index, const CIdentifier &compareValue) const + int CIdentifier::comparePropertyByIndex(CPropertyIndexRef index, const CIdentifier &compareValue) const { if (index.isMyself()) { return Compare::compare(m_processId, compareValue.m_processId); } @@ -318,7 +318,7 @@ namespace BlackMisc } } - void CIdentifier::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CIdentifier::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { CValueObject::setPropertyByIndex(index, variant); } diff --git a/src/blackmisc/identifier.h b/src/blackmisc/identifier.h index af4552516..ec1f78601 100644 --- a/src/blackmisc/identifier.h +++ b/src/blackmisc/identifier.h @@ -142,13 +142,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CIdentifier &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CIdentifier &compareValue) const; private: //! Constructor. diff --git a/src/blackmisc/inheritancetraits.h b/src/blackmisc/inheritancetraits.h index 79ff05e54..d49d4eaa6 100644 --- a/src/blackmisc/inheritancetraits.h +++ b/src/blackmisc/inheritancetraits.h @@ -19,7 +19,7 @@ struct QMetaTypeId; namespace BlackMisc { - class CPropertyIndex; + class CPropertyIndexRef; /*! * If T has a member typedef base_type, this trait will obtain it, otherwise void. @@ -57,7 +57,7 @@ namespace BlackMisc }; //! \cond template - struct TIndexBaseOf().propertyByIndex(std::declval()))>> + struct TIndexBaseOf().propertyByIndex(std::declval()))>> { using type = typename T::base_type; //!< T::base_type }; diff --git a/src/blackmisc/input/actionhotkey.cpp b/src/blackmisc/input/actionhotkey.cpp index a8ccc27fe..f76781cb1 100644 --- a/src/blackmisc/input/actionhotkey.cpp +++ b/src/blackmisc/input/actionhotkey.cpp @@ -64,36 +64,36 @@ namespace BlackMisc m_combination = obj.m_combination; } - CVariant CActionHotkey::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CActionHotkey::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexIdentifier: return CVariant::from(m_identifier); - case IndexIdentifierAsString: return CVariant::from(m_identifier.getMachineName()); - case IndexAction: return CVariant::from(m_action); - case IndexActionAsString: return CVariant::from(m_action); - case IndexCombination: return CVariant::from(m_combination); - case IndexCombinationAsString: return CVariant::from(QString(m_combination.toQString())); + case IndexIdentifier: return QVariant::fromValue(m_identifier); + case IndexIdentifierAsString: return QVariant::fromValue(m_identifier.getMachineName()); + case IndexAction: return QVariant::fromValue(m_action); + case IndexActionAsString: return QVariant::fromValue(m_action); + case IndexCombination: return QVariant::fromValue(m_combination); + case IndexCombinationAsString: return QVariant::fromValue(QString(m_combination.toQString())); default: return CValueObject::propertyByIndex(index); } } - void CActionHotkey::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CActionHotkey::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexAction: { - m_action = variant.to(); + m_action = variant.value(); break; } case IndexCombination: case IndexCombinationAsString: - m_combination = variant.to(); + m_combination = variant.value(); break; case IndexObject: this->setObject(variant.value()); diff --git a/src/blackmisc/input/actionhotkey.h b/src/blackmisc/input/actionhotkey.h index 0f61f883c..6d0072650 100644 --- a/src/blackmisc/input/actionhotkey.h +++ b/src/blackmisc/input/actionhotkey.h @@ -91,10 +91,10 @@ namespace BlackMisc bool isValid() const { return !m_identifier.getMachineName().isEmpty() && !m_combination.isEmpty() && !m_action.isEmpty(); } //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/input/joystickbutton.cpp b/src/blackmisc/input/joystickbutton.cpp index 236f63034..2d44888f0 100644 --- a/src/blackmisc/input/joystickbutton.cpp +++ b/src/blackmisc/input/joystickbutton.cpp @@ -38,9 +38,9 @@ namespace BlackMisc m_buttonIndex = button.m_buttonIndex; } - void CJoystickButton::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CJoystickButton::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -60,21 +60,21 @@ namespace BlackMisc } } - CVariant CJoystickButton::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CJoystickButton::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexDeviceName: return CVariant::from(this->getDeviceName()); - case IndexButton: return CVariant::from(this->getButtonIndex()); - case IndexButtonAsString: return CVariant::from(this->getButtonAsString()); - case IndexButtonObject: return CVariant::from(*this); + case IndexDeviceName: return QVariant::fromValue(this->getDeviceName()); + case IndexButton: return QVariant::fromValue(this->getButtonIndex()); + case IndexButtonAsString: return QVariant::fromValue(this->getButtonAsString()); + case IndexButtonObject: return QVariant::fromValue(*this); } Q_ASSERT_X(false, "CJoystickButton", "index unknown"); QString m = QString("no property, index ").append(index.toQString()); - return CVariant::fromValue(m); + return QVariant::fromValue(m); } QString CJoystickButton::buttonIndexToString(qint32 buttonIndex) diff --git a/src/blackmisc/input/joystickbutton.h b/src/blackmisc/input/joystickbutton.h index 6541fb719..297e8f255 100644 --- a/src/blackmisc/input/joystickbutton.h +++ b/src/blackmisc/input/joystickbutton.h @@ -69,10 +69,10 @@ namespace BlackMisc void setButtonObject(CJoystickButton button); //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! Button index to string static QString buttonIndexToString(qint32 buttonIndex); diff --git a/src/blackmisc/input/keyboardkey.cpp b/src/blackmisc/input/keyboardkey.cpp index b2b3d9df9..b313ae4f0 100644 --- a/src/blackmisc/input/keyboardkey.cpp +++ b/src/blackmisc/input/keyboardkey.cpp @@ -103,25 +103,25 @@ namespace BlackMisc return allModifiers; } - CVariant CKeyboardKey::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CKeyboardKey::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexKey: return CVariant::from(m_keyCode); - case IndexKeyAsString: return CVariant::from(getKeyAsString()); + case IndexKey: return QVariant::fromValue(m_keyCode); + case IndexKeyAsString: return QVariant::fromValue(getKeyAsString()); default: break; } Q_ASSERT_X(false, "CKeyboardKey", "index unknown"); QString m = QString("no property, index ").append(index.toQString()); - return CVariant::fromValue(m); + return QVariant::fromValue(m); } - void CKeyboardKey::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CKeyboardKey::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/input/keyboardkey.h b/src/blackmisc/input/keyboardkey.h index 1302ad815..0478f730c 100644 --- a/src/blackmisc/input/keyboardkey.h +++ b/src/blackmisc/input/keyboardkey.h @@ -78,10 +78,10 @@ namespace BlackMisc void setKeyObject(CKeyboardKey key); //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/mixin/mixinindex.h b/src/blackmisc/mixin/mixinindex.h index 14ac0e58b..6f5129964 100644 --- a/src/blackmisc/mixin/mixinindex.h +++ b/src/blackmisc/mixin/mixinindex.h @@ -14,9 +14,8 @@ #include "blackmisc/icon.h" #include "blackmisc/inheritancetraits.h" #include "blackmisc/predicates.h" +#include "blackmisc/propertyindexref.h" #include "blackmisc/propertyindex.h" -#include "blackmisc/propertyindexlist.h" -#include "blackmisc/propertyindexvariantmap.h" #include "blackmisc/variant.h" #include @@ -31,6 +30,9 @@ namespace BlackMisc { + class CPropertyIndexList; + class CPropertyIndexVariantMap; + namespace Mixin { /*! @@ -56,44 +58,46 @@ namespace BlackMisc CPropertyIndexList apply(const CPropertyIndexVariantMap &indexMap, bool skipEqualValues = false); // impl in propertyindexvariantmap.h //! Set property by index - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! Property by index - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! Compare for index - int comparePropertyByIndex(const CPropertyIndex &index, const Derived &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const Derived &compareValue) const; //! Is given variant equal to value of property index? - bool equalsPropertyByIndex(const CVariant &compareValue, const CPropertyIndex &index) const; + bool equalsPropertyByIndex(const QVariant &compareValue, CPropertyIndexRef index) const; private: const Derived *derived() const { return static_cast(this); } Derived *derived() { return static_cast(this); } template ::value, int> = 0> - CVariant myself() const { return CVariant::from(*derived()); } + QVariant myself() const { return QVariant::fromValue(*derived()); } template ::value, int> = 0> - void myself(const CVariant &variant) { *derived() = variant.to(); } + void myself(const QVariant &variant) { *derived() = variant.value(); } template ::value, int> = 0> - CVariant myself() const { qFatal("isMyself should have been handled before reaching here"); return {}; } + QVariant myself() const { qFatal("isMyself should have been handled before reaching here"); return {}; } template ::value, int> = 0> - void myself(const CVariant &) { qFatal("isMyself should have been handled before reaching here"); } + void myself(const QVariant &) { qFatal("isMyself should have been handled before reaching here"); } template - CVariant basePropertyByIndex(const T *base, const CPropertyIndex &index) const { return base->propertyByIndex(index); } + QVariant basePropertyByIndex(const T *base, CPropertyIndexRef index) const { return base->propertyByIndex(index); } template - void baseSetPropertyByIndex(T *base, const CVariant &var, const CPropertyIndex &index) { base->setPropertyByIndex(index, var); } + void baseSetPropertyByIndex(T *base, const QVariant &var, CPropertyIndexRef index) { base->setPropertyByIndex(index, var); } - CVariant basePropertyByIndex(const void *, const CPropertyIndex &index) const + QVariant basePropertyByIndex(const void *, CPropertyIndexRef) const { - qFatal("%s", qPrintable("Property by index not found, index: " + index.toQString())); return {}; + //qFatal("%s", qPrintable("Property by index not found, index: " + index.toQString())); return {}; + qFatal("Property by index not found"); return {}; } - void baseSetPropertyByIndex(void *, const CVariant &, const CPropertyIndex &index) + void baseSetPropertyByIndex(void *, const QVariant &, CPropertyIndexRef) { - qFatal("%s", qPrintable("Property by index not found (setter), index: " + index.toQString())); + //qFatal("%s", qPrintable("Property by index not found (setter), index: " + index.toQString())); + qFatal("Property by index not found"); } }; @@ -111,7 +115,7 @@ namespace BlackMisc // *INDENT-ON* template - void Index::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void Index::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (index.isMyself()) { @@ -124,27 +128,27 @@ namespace BlackMisc } template - CVariant Index::propertyByIndex(const CPropertyIndex &index) const + QVariant Index::propertyByIndex(CPropertyIndexRef index) const { if (index.isMyself()) { return myself(); } const auto i = index.frontCasted(); // keep that "auto", otherwise I won's compile switch (i) { - case IndexIcon: return CVariant::from(CIcon(derived()->toIcon())); - case IndexPixmap: return CVariant::from(CIcon(derived()->toIcon()).toPixmap()); - case IndexString: return CVariant(derived()->toQString()); + case IndexIcon: return CIcons::toVariant(derived()->toIcon()); + case IndexPixmap: return CIcons::toVariantPixmap(derived()->toIcon()); + case IndexString: return QVariant(derived()->toQString()); default: return basePropertyByIndex(static_cast *>(derived()), index); } } template - bool Index::equalsPropertyByIndex(const CVariant &compareValue, const CPropertyIndex &index) const + bool Index::equalsPropertyByIndex(const QVariant &compareValue, CPropertyIndexRef index) const { return derived()->propertyByIndex(index) == compareValue; } template - int Index::comparePropertyByIndex(const CPropertyIndex &index, const Derived &compareValue) const + int Index::comparePropertyByIndex(CPropertyIndexRef index, const Derived &compareValue) const { if (this == &compareValue) { return 0; } if (index.isMyself()) { diff --git a/src/blackmisc/namevariantpair.cpp b/src/blackmisc/namevariantpair.cpp index 2ff72b0b4..1a458e552 100644 --- a/src/blackmisc/namevariantpair.cpp +++ b/src/blackmisc/namevariantpair.cpp @@ -30,14 +30,14 @@ namespace BlackMisc return s; } - CVariant CNameVariantPair::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CNameVariantPair::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexName: - return CVariant(this->m_name); + return QVariant(this->m_name); case IndexVariant: return this->m_variant; default: @@ -45,9 +45,9 @@ namespace BlackMisc } } - void CNameVariantPair::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CNameVariantPair::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); // special case, handle icon and allow to set it diff --git a/src/blackmisc/namevariantpair.h b/src/blackmisc/namevariantpair.h index 888f4f916..822f78633 100644 --- a/src/blackmisc/namevariantpair.h +++ b/src/blackmisc/namevariantpair.h @@ -61,10 +61,10 @@ namespace BlackMisc bool hasIcon() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/authenticateduser.cpp b/src/blackmisc/network/authenticateduser.cpp index c8726f586..cfd23cd67 100644 --- a/src/blackmisc/network/authenticateduser.cpp +++ b/src/blackmisc/network/authenticateduser.cpp @@ -126,25 +126,25 @@ namespace BlackMisc return CIcons::StandardIconUser16; } - CVariant CAuthenticatedUser::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CAuthenticatedUser::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexVatsimId: return CVariant::fromValue(m_vatsimId); - case IndexEmail: return CVariant::fromValue(m_email); - case IndexPassword: return CVariant::fromValue(m_password); - case IndexRealName: return CVariant::fromValue(m_realname); - case IndexUsername: return CVariant::fromValue(m_username); + case IndexVatsimId: return QVariant::fromValue(m_vatsimId); + case IndexEmail: return QVariant::fromValue(m_email); + case IndexPassword: return QVariant::fromValue(m_password); + case IndexRealName: return QVariant::fromValue(m_realname); + case IndexUsername: return QVariant::fromValue(m_username); default: return CValueObject::propertyByIndex(index); } } - void CAuthenticatedUser::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAuthenticatedUser::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) diff --git a/src/blackmisc/network/authenticateduser.h b/src/blackmisc/network/authenticateduser.h index d49d1ab9f..b8e4e6736 100644 --- a/src/blackmisc/network/authenticateduser.h +++ b/src/blackmisc/network/authenticateduser.h @@ -157,10 +157,10 @@ namespace BlackMisc BlackMisc::CIcons::IconIndex toIcon() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/client.cpp b/src/blackmisc/network/client.cpp index 769357231..143d25576 100644 --- a/src/blackmisc/network/client.cpp +++ b/src/blackmisc/network/client.cpp @@ -103,36 +103,36 @@ namespace BlackMisc return CIcons::Swift16; } - CVariant CClient::propertyByIndex(const CPropertyIndex &index) const + QVariant CClient::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexCapabilities: return CVariant::fromValue(m_capabilities); - case IndexCapabilitiesString: return CVariant(this->getCapabilitiesAsString()); + case IndexCapabilities: return QVariant::fromValue(m_capabilities); + case IndexCapabilitiesString: return QVariant(this->getCapabilitiesAsString()); case IndexCallsign: return this->getCallsign().propertyByIndex(index.copyFrontRemoved()); case IndexUser: return this->getUser().propertyByIndex(index.copyFrontRemoved()); - case IndexModelString: return CVariant(m_modelString); - case IndexServer: return CVariant(m_server); + case IndexModelString: return QVariant(m_modelString); + case IndexServer: return QVariant(m_server); case IndexVoiceCapabilities: return m_voiceCapabilities.propertyByIndex(index.copyFrontRemoved()); - case IndexVoiceCapabilitiesPixmap: return CVariant::from(CIcon(m_voiceCapabilities.toIcon()).toPixmap()); - case IndexVoiceCapabilitiesIcon: return CVariant::from(CIcon(m_voiceCapabilities.toIcon())); - case IndexVoiceCapabilitiesString: return CVariant(m_voiceCapabilities.toQString(true)); + case IndexVoiceCapabilitiesPixmap: return QVariant::fromValue(CIcon(m_voiceCapabilities.toIcon()).toPixmap()); + case IndexVoiceCapabilitiesIcon: return QVariant::fromValue(CIcon(m_voiceCapabilities.toIcon())); + case IndexVoiceCapabilitiesString: return QVariant(m_voiceCapabilities.toQString(true)); default: break; } return CValueObject::propertyByIndex(index); } - void CClient::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CClient::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexCapabilities: m_capabilities = variant.toInt(); break; - case IndexModelString: m_modelString = variant.toQString(); break; - case IndexServer: m_server = variant.toQString(); break; + case IndexModelString: m_modelString = variant.toString(); break; + case IndexServer: m_server = variant.toString(); break; case IndexUser: m_user.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexCallsign: m_user.setCallsign(variant.value()); break; case IndexVoiceCapabilities: m_voiceCapabilities.setPropertyByIndex(index.copyFrontRemoved(), variant); break; diff --git a/src/blackmisc/network/client.h b/src/blackmisc/network/client.h index 7381f42a2..b91a55c4c 100644 --- a/src/blackmisc/network/client.h +++ b/src/blackmisc/network/client.h @@ -147,10 +147,10 @@ namespace BlackMisc CIcons::IconIndex toIcon() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/ecosystem.cpp b/src/blackmisc/network/ecosystem.cpp index a7c3f88b9..53d864eaf 100644 --- a/src/blackmisc/network/ecosystem.cpp +++ b/src/blackmisc/network/ecosystem.cpp @@ -86,21 +86,21 @@ namespace BlackMisc } } - CVariant CEcosystem::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CEcosystem::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexSystem: return CVariant::fromValue(m_system); - case IndexSystemString: return CVariant::fromValue(this->getSystemString()); + case IndexSystem: return QVariant::fromValue(m_system); + case IndexSystemString: return QVariant::fromValue(this->getSystemString()); default: return CValueObject::propertyByIndex(index); } } - void CEcosystem::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CEcosystem::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -109,7 +109,7 @@ namespace BlackMisc } } - int CEcosystem::comparePropertyByIndex(const CPropertyIndex &index, const CEcosystem &compareValue) const + 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(); diff --git a/src/blackmisc/network/ecosystem.h b/src/blackmisc/network/ecosystem.h index f19057c70..85f7c7594 100644 --- a/src/blackmisc/network/ecosystem.h +++ b/src/blackmisc/network/ecosystem.h @@ -69,13 +69,13 @@ namespace BlackMisc CIcons::IconIndex toIcon() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CEcosystem &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CEcosystem &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/fsdsetup.cpp b/src/blackmisc/network/fsdsetup.cpp index 0530135cc..fd623d1bd 100644 --- a/src/blackmisc/network/fsdsetup.cpp +++ b/src/blackmisc/network/fsdsetup.cpp @@ -90,21 +90,21 @@ namespace BlackMisc return msgs; } - CVariant CFsdSetup::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CFsdSetup::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexTextCodec: return CVariant::fromValue(m_textCodec); - case IndexSendReceiveDetails: return CVariant::fromValue(m_sendReceive); + case IndexTextCodec: return QVariant::fromValue(m_textCodec); + case IndexSendReceiveDetails: return QVariant::fromValue(m_sendReceive); default: return CValueObject::propertyByIndex(index); } } - void CFsdSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CFsdSetup::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -116,7 +116,7 @@ namespace BlackMisc } } - int CFsdSetup::comparePropertyByIndex(const CPropertyIndex &index, const CFsdSetup &compareValue) const + int CFsdSetup::comparePropertyByIndex(CPropertyIndexRef index, const CFsdSetup &compareValue) const { if (index.isMyself()) { return this->convertToQString(true).compare(compareValue.convertToQString()); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/network/fsdsetup.h b/src/blackmisc/network/fsdsetup.h index 859938d5b..4727414d5 100644 --- a/src/blackmisc/network/fsdsetup.h +++ b/src/blackmisc/network/fsdsetup.h @@ -116,13 +116,13 @@ namespace BlackMisc CStatusMessageList validate() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CFsdSetup &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CFsdSetup &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/rawfsdmessage.cpp b/src/blackmisc/network/rawfsdmessage.cpp index 4fee6ec68..a69b683b0 100644 --- a/src/blackmisc/network/rawfsdmessage.cpp +++ b/src/blackmisc/network/rawfsdmessage.cpp @@ -50,22 +50,22 @@ namespace BlackMisc return allPacketTypes; } - CVariant CRawFsdMessage::propertyByIndex(const CPropertyIndex &index) const + QVariant CRawFsdMessage::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexRawMessage: return CVariant::fromValue(m_rawMessage); + case IndexRawMessage: return QVariant::fromValue(m_rawMessage); default: return CValueObject::propertyByIndex(index); } } - void CRawFsdMessage::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CRawFsdMessage::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/network/rawfsdmessage.h b/src/blackmisc/network/rawfsdmessage.h index 5c7810609..fb3da90c9 100644 --- a/src/blackmisc/network/rawfsdmessage.h +++ b/src/blackmisc/network/rawfsdmessage.h @@ -60,10 +60,10 @@ namespace BlackMisc static const QStringList &getAllPacketTypes(); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/remotefile.cpp b/src/blackmisc/network/remotefile.cpp index cf4920912..9b5a5d5d3 100644 --- a/src/blackmisc/network/remotefile.cpp +++ b/src/blackmisc/network/remotefile.cpp @@ -87,24 +87,24 @@ namespace BlackMisc " URL: " + m_url.getFullUrl(); } - CVariant CRemoteFile::propertyByIndex(const CPropertyIndex &index) const + QVariant CRemoteFile::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexName: return CVariant::fromValue(m_name); - case IndexDescription: return CVariant::fromValue(m_description); - case IndexUrl: return CVariant::fromValue(m_url); - case IndexSize: return CVariant::fromValue(m_size); + case IndexName: return QVariant::fromValue(m_name); + case IndexDescription: return QVariant::fromValue(m_description); + case IndexUrl: return QVariant::fromValue(m_url); + case IndexSize: return QVariant::fromValue(m_size); default: return CValueObject::propertyByIndex(index); } } - void CRemoteFile::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CRemoteFile::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) diff --git a/src/blackmisc/network/remotefile.h b/src/blackmisc/network/remotefile.h index 409a72d09..a43a009bd 100644 --- a/src/blackmisc/network/remotefile.h +++ b/src/blackmisc/network/remotefile.h @@ -120,10 +120,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! Role from DB JSON static CRemoteFile fromDatabaseJson(const QJsonObject &json); diff --git a/src/blackmisc/network/role.cpp b/src/blackmisc/network/role.cpp index 01f444e88..21ab649b6 100644 --- a/src/blackmisc/network/role.cpp +++ b/src/blackmisc/network/role.cpp @@ -27,23 +27,23 @@ namespace BlackMisc this->getDbKeyAsStringInParentheses(" "); } - CVariant CRole::propertyByIndex(const CPropertyIndex &index) const + QVariant CRole::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexName: return CVariant::fromValue(m_name); - case IndexDescription: return CVariant::fromValue(m_description); + case IndexName: return QVariant::fromValue(m_name); + case IndexDescription: return QVariant::fromValue(m_description); default: break; } return CValueObject::propertyByIndex(index); } - void CRole::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CRole::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) diff --git a/src/blackmisc/network/role.h b/src/blackmisc/network/role.h index 886778514..54d07af14 100644 --- a/src/blackmisc/network/role.h +++ b/src/blackmisc/network/role.h @@ -63,10 +63,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! Role from DB JSON static CRole fromDatabaseJson(const QJsonObject &json); diff --git a/src/blackmisc/network/server.cpp b/src/blackmisc/network/server.cpp index 1f488fd97..5cf0ab477 100644 --- a/src/blackmisc/network/server.cpp +++ b/src/blackmisc/network/server.cpp @@ -201,32 +201,32 @@ namespace BlackMisc return session.arg(isConnected ? u"connected" : u"disconnected").arg(this->getName(), this->getAddress()).arg(this->getPort()).arg(this->getEcosystem().getSystemString(), this->getUser().getRealName(), this->getFormattedUtcTimestampHms()); } - CVariant CServer::propertyByIndex(const CPropertyIndex &index) const + QVariant CServer::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAddress: return CVariant::fromValue(m_address); - case IndexDescription: return CVariant::fromValue(m_description); - case IndexName: return CVariant::fromValue(m_name); - case IndexPort: return CVariant::fromValue(m_port); + case IndexAddress: return QVariant::fromValue(m_address); + case IndexDescription: return QVariant::fromValue(m_description); + case IndexName: return QVariant::fromValue(m_name); + case IndexPort: return QVariant::fromValue(m_port); case IndexUser: return m_user.propertyByIndex(index.copyFrontRemoved()); case IndexFsdSetup: return m_fsdSetup.propertyByIndex(index.copyFrontRemoved()); case IndexVoiceSetup: return m_voiceSetup.propertyByIndex(index.copyFrontRemoved()); case IndexEcosystem: return m_ecosystem.propertyByIndex(index.copyFrontRemoved()); - case IndexIsAcceptingConnections: return CVariant::fromValue(m_isAcceptingConnections); - case IndexServerType: return CVariant::fromValue(m_serverType); - case IndexServerTypeAsString: return CVariant::fromValue(getServerTypeAsString()); + case IndexIsAcceptingConnections: return QVariant::fromValue(m_isAcceptingConnections); + case IndexServerType: return QVariant::fromValue(m_serverType); + case IndexServerTypeAsString: return QVariant::fromValue(getServerTypeAsString()); default: return CValueObject::propertyByIndex(index); } } - void CServer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CServer::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); @@ -246,7 +246,7 @@ namespace BlackMisc } } - int CServer::comparePropertyByIndex(const CPropertyIndex &index, const CServer &compareValue) const + int CServer::comparePropertyByIndex(CPropertyIndexRef index, const CServer &compareValue) const { if (index.isMyself()) { return this->getName().compare(compareValue.getName()); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::comparePropertyByIndex(index, compareValue);} diff --git a/src/blackmisc/network/server.h b/src/blackmisc/network/server.h index 26379c205..a178ccc5b 100644 --- a/src/blackmisc/network/server.h +++ b/src/blackmisc/network/server.h @@ -205,13 +205,13 @@ namespace BlackMisc QString getServerSessionId(bool onlyConnected) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CServer &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CServer &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/settings/networksettings.cpp b/src/blackmisc/network/settings/networksettings.cpp index 0ae618410..223da9215 100644 --- a/src/blackmisc/network/settings/networksettings.cpp +++ b/src/blackmisc/network/settings/networksettings.cpp @@ -24,9 +24,9 @@ namespace BlackMisc return QStringLiteral("NOT USED"); } - CVariant CNetworkSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CNetworkSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } // const ColumnIndex i = index.frontCasted(); // switch (i) // { @@ -36,9 +36,9 @@ namespace BlackMisc return CValueObject::propertyByIndex(index); } - void CNetworkSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CNetworkSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } // const ColumnIndex i = index.frontCasted(); // switch (i) // { diff --git a/src/blackmisc/network/settings/networksettings.h b/src/blackmisc/network/settings/networksettings.h index a6ed471fc..94d4d18e4 100644 --- a/src/blackmisc/network/settings/networksettings.h +++ b/src/blackmisc/network/settings/networksettings.h @@ -45,10 +45,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); private: bool m_dummy = false; diff --git a/src/blackmisc/network/textmessage.cpp b/src/blackmisc/network/textmessage.cpp index 02b534f48..3f92f16ca 100644 --- a/src/blackmisc/network/textmessage.cpp +++ b/src/blackmisc/network/textmessage.cpp @@ -302,9 +302,9 @@ namespace BlackMisc return CIcon(toIcon()).toPixmap(); } - CVariant CTextMessage::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CTextMessage::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); @@ -312,15 +312,15 @@ namespace BlackMisc { case IndexSenderCallsign: return m_senderCallsign.propertyByIndex(index.copyFrontRemoved()); case IndexRecipientCallsign: return m_recipientCallsign.propertyByIndex(index.copyFrontRemoved()); - case IndexRecipientCallsignOrFrequency: return CVariant::fromValue(this->getRecipientCallsignOrFrequency()); - case IndexMessage: return CVariant::fromValue(m_message); + case IndexRecipientCallsignOrFrequency: return QVariant::fromValue(this->getRecipientCallsignOrFrequency()); + case IndexMessage: return QVariant::fromValue(m_message); default: return CValueObject::propertyByIndex(index); } } - void CTextMessage::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CTextMessage::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); @@ -333,7 +333,7 @@ namespace BlackMisc } } - int CTextMessage::comparePropertyByIndex(const CPropertyIndex &index, const CTextMessage &compareValue) const + int CTextMessage::comparePropertyByIndex(CPropertyIndexRef index, const CTextMessage &compareValue) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::comparePropertyByIndex(index, compareValue); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/network/textmessage.h b/src/blackmisc/network/textmessage.h index 5ae009048..0ba91f7f6 100644 --- a/src/blackmisc/network/textmessage.h +++ b/src/blackmisc/network/textmessage.h @@ -186,13 +186,13 @@ namespace BlackMisc QPixmap toPixmap() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CTextMessage &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CTextMessage &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/url.cpp b/src/blackmisc/network/url.cpp index ba13481d8..81a5ab3ab 100644 --- a/src/blackmisc/network/url.cpp +++ b/src/blackmisc/network/url.cpp @@ -284,23 +284,23 @@ namespace BlackMisc return q; } - CVariant CUrl::propertyByIndex(const CPropertyIndex &index) const + QVariant CUrl::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexHost: return CVariant::fromValue(m_host); - case IndexPort: return CVariant::fromValue(m_port); - case IndexScheme: return CVariant::fromValue(m_scheme); - case IndexPath: return CVariant::fromValue(m_path); + case IndexHost: return QVariant::fromValue(m_host); + case IndexPort: return QVariant::fromValue(m_port); + case IndexScheme: return QVariant::fromValue(m_scheme); + case IndexPath: return QVariant::fromValue(m_path); default: return CValueObject::propertyByIndex(index); } } - void CUrl::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CUrl::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/network/url.h b/src/blackmisc/network/url.h index 5bc128dc3..34c04eb39 100644 --- a/src/blackmisc/network/url.h +++ b/src/blackmisc/network/url.h @@ -168,10 +168,10 @@ namespace BlackMisc bool isSwiftInstaller() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/urllog.cpp b/src/blackmisc/network/urllog.cpp index 586793738..18bad9b2d 100644 --- a/src/blackmisc/network/urllog.cpp +++ b/src/blackmisc/network/urllog.cpp @@ -40,26 +40,26 @@ namespace BlackMisc return m_responseTimeMs < 0; } - CVariant CUrlLog::propertyByIndex(const CPropertyIndex &index) const + QVariant CUrlLog::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexId: return CVariant::from(m_id); - case IndexSuccess: return CVariant::from(m_success); + case IndexId: return QVariant::fromValue(m_id); + case IndexSuccess: return QVariant::fromValue(m_success); case IndexUrl: return this->m_url.propertyByIndex(index.copyFrontRemoved()); - case IndexResponseTimestamp: return CVariant::fromValue(this->getResponseTimestamp()); - case IndexResponseTime: return CVariant::fromValue(m_responseTimeMs); + case IndexResponseTimestamp: return QVariant::fromValue(this->getResponseTimestamp()); + case IndexResponseTime: return QVariant::fromValue(m_responseTimeMs); default: return CValueObject::propertyByIndex(index); } } - void CUrlLog::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CUrlLog::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/network/urllog.h b/src/blackmisc/network/urllog.h index aa5654257..f065f0dca 100644 --- a/src/blackmisc/network/urllog.h +++ b/src/blackmisc/network/urllog.h @@ -71,10 +71,10 @@ namespace BlackMisc void setSuccess(bool s) { m_success = s; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/network/user.cpp b/src/blackmisc/network/user.cpp index 3de103e6f..96d43a465 100644 --- a/src/blackmisc/network/user.cpp +++ b/src/blackmisc/network/user.cpp @@ -241,27 +241,27 @@ namespace BlackMisc return newRealName; } - CVariant CUser::propertyByIndex(const CPropertyIndex &index) const + QVariant CUser::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexEmail: return CVariant(m_email); - case IndexId: return CVariant(m_id); - case IndexId7Digit: return CVariant(this->get7DigitId()); - case IndexIdInteger: return CVariant::fromValue(this->getIntegerId()); - case IndexPassword: return CVariant(m_password); - case IndexRealName: return CVariant(m_realname); + case IndexEmail: return QVariant(m_email); + case IndexId: return QVariant(m_id); + case IndexId7Digit: return QVariant(this->get7DigitId()); + case IndexIdInteger: return QVariant::fromValue(this->getIntegerId()); + case IndexPassword: return QVariant(m_password); + case IndexRealName: return QVariant(m_realname); case IndexHomebase: return m_homebase.propertyByIndex(index.copyFrontRemoved()); case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved()); default: return CValueObject::propertyByIndex(index); } } - void CUser::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CUser::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -277,7 +277,7 @@ namespace BlackMisc } } - int CUser::comparePropertyByIndex(const CPropertyIndex &index, const CUser &compareValue) const + 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(); diff --git a/src/blackmisc/network/user.h b/src/blackmisc/network/user.h index 310034d34..036156f85 100644 --- a/src/blackmisc/network/user.h +++ b/src/blackmisc/network/user.h @@ -154,13 +154,13 @@ namespace BlackMisc CIcons::IconIndex toIcon() const { return this->getCallsign().toIcon(); } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CUser &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CUser &compareValue) const; //! This and another user exchange missing data, This user has priority and overrides first. void synchronizeData(CUser &otherUser); diff --git a/src/blackmisc/orderable.cpp b/src/blackmisc/orderable.cpp index 6b54e2b62..024df1112 100644 --- a/src/blackmisc/orderable.cpp +++ b/src/blackmisc/orderable.cpp @@ -38,31 +38,31 @@ namespace BlackMisc return (index >= static_cast(IndexOrder)) && (index <= static_cast(IndexOrderString)); } - bool IOrderable::canHandleIndex(const CPropertyIndex &index) + bool IOrderable::canHandleIndex(CPropertyIndexRef index) { if (index.isEmpty()) { return false; } const int i = index.frontCasted(); return isAnyOrderIndex(i); } - CVariant IOrderable::propertyByIndex(const CPropertyIndex &index) const + QVariant IOrderable::propertyByIndex(CPropertyIndexRef index) const { if (!index.isEmpty()) { const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexOrder: return CVariant::fromValue(this->m_order); - case IndexOrderString: return CVariant::fromValue(this->getOrderAsString()); + case IndexOrder: return QVariant::fromValue(this->m_order); + case IndexOrderString: return QVariant::fromValue(this->getOrderAsString()); default: break; } } const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString()); BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); - return CVariant::fromValue(m); + return QVariant::fromValue(m); } - void IOrderable::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void IOrderable::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (!index.isEmpty()) { @@ -79,7 +79,7 @@ namespace BlackMisc BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); } - int IOrderable::comparePropertyByIndex(const CPropertyIndex &index, const IOrderable &compareValue) const + int IOrderable::comparePropertyByIndex(CPropertyIndexRef index, const IOrderable &compareValue) const { Q_UNUSED(index) static const int max = std::numeric_limits::max(); diff --git a/src/blackmisc/orderable.h b/src/blackmisc/orderable.h index 4c1b8582e..b0371b336 100644 --- a/src/blackmisc/orderable.h +++ b/src/blackmisc/orderable.h @@ -47,7 +47,7 @@ namespace BlackMisc protected: //! Can given index be handled - static bool canHandleIndex(const CPropertyIndex &index); + static bool canHandleIndex(CPropertyIndexRef index); //! Constructor IOrderable(); @@ -56,13 +56,13 @@ namespace BlackMisc IOrderable(int order); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const IOrderable &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const IOrderable &compareValue) const; int m_order = -1; //!< order number }; diff --git a/src/blackmisc/platform.cpp b/src/blackmisc/platform.cpp index d49651071..d473494a2 100644 --- a/src/blackmisc/platform.cpp +++ b/src/blackmisc/platform.cpp @@ -92,20 +92,20 @@ namespace BlackMisc return QStringLiteral("unknown"); } - CVariant CPlatform::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CPlatform::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexPlatform: return CVariant::fromValue(m_platform); + case IndexPlatform: return QVariant::fromValue(m_platform); default: return CValueObject::propertyByIndex(index); } } - void CPlatform::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CPlatform::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -114,7 +114,7 @@ namespace BlackMisc } } - int CPlatform::comparePropertyByIndex(const CPropertyIndex &index, const CPlatform &compareValue) const + 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(); diff --git a/src/blackmisc/platform.h b/src/blackmisc/platform.h index 246de5a4f..8a200c7fc 100644 --- a/src/blackmisc/platform.h +++ b/src/blackmisc/platform.h @@ -96,13 +96,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CPlatform &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CPlatform &compareValue) const; //! Convert to QString operator QString() { return this->toQString(); } diff --git a/src/blackmisc/pq/physicalquantity.cpp b/src/blackmisc/pq/physicalquantity.cpp index 7e9f89d29..6cbfc37ae 100644 --- a/src/blackmisc/pq/physicalquantity.cpp +++ b/src/blackmisc/pq/physicalquantity.cpp @@ -500,27 +500,27 @@ namespace BlackMisc } template - CVariant CPhysicalQuantity::propertyByIndex(const CPropertyIndex &index) const + QVariant CPhysicalQuantity::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*derived()); } + if (index.isMyself()) { return QVariant::fromValue(*derived()); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexValue: return CVariant::from(m_value); - case IndexUnit: return CVariant::from(m_unit); - case IndexValueRounded0DigitsWithUnit: return CVariant::from(this->valueRoundedWithUnit(0)); - case IndexValueRounded1DigitsWithUnit: return CVariant::from(this->valueRoundedWithUnit(1)); - case IndexValueRounded2DigitsWithUnit: return CVariant::from(this->valueRoundedWithUnit(2)); - case IndexValueRounded3DigitsWithUnit: return CVariant::from(this->valueRoundedWithUnit(3)); - case IndexValueRounded6DigitsWithUnit: return CVariant::from(this->valueRoundedWithUnit(6)); + case IndexValue: return QVariant::fromValue(m_value); + case IndexUnit: return QVariant::fromValue(m_unit); + case IndexValueRounded0DigitsWithUnit: return QVariant::fromValue(this->valueRoundedWithUnit(0)); + case IndexValueRounded1DigitsWithUnit: return QVariant::fromValue(this->valueRoundedWithUnit(1)); + case IndexValueRounded2DigitsWithUnit: return QVariant::fromValue(this->valueRoundedWithUnit(2)); + case IndexValueRounded3DigitsWithUnit: return QVariant::fromValue(this->valueRoundedWithUnit(3)); + case IndexValueRounded6DigitsWithUnit: return QVariant::fromValue(this->valueRoundedWithUnit(6)); default: return Mixin::Index::propertyByIndex(index); } } template - void CPhysicalQuantity::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CPhysicalQuantity::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -528,14 +528,14 @@ namespace BlackMisc m_value = variant.toDouble(); break; case IndexUnit: - m_unit = variant.to(); + m_unit = variant.value(); break; case IndexValueRounded0DigitsWithUnit: case IndexValueRounded1DigitsWithUnit: case IndexValueRounded2DigitsWithUnit: case IndexValueRounded3DigitsWithUnit: case IndexValueRounded6DigitsWithUnit: - this->parseFromString(variant.toQString()); + this->parseFromString(variant.toString()); break; default: Mixin::Index::setPropertyByIndex(index, variant); @@ -544,7 +544,7 @@ namespace BlackMisc } template - int CPhysicalQuantity::comparePropertyByIndex(const CPropertyIndex &index, const PQ &pq) const + int CPhysicalQuantity::comparePropertyByIndex(CPropertyIndexRef index, const PQ &pq) const { if (index.isMyself()) { return compareImpl(*derived(), pq); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/pq/physicalquantity.h b/src/blackmisc/pq/physicalquantity.h index daa7c81e0..93a1980bf 100644 --- a/src/blackmisc/pq/physicalquantity.h +++ b/src/blackmisc/pq/physicalquantity.h @@ -250,13 +250,13 @@ namespace BlackMisc void convertFromJson(const QJsonObject &json); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const PQ &pq) const; + int comparePropertyByIndex(CPropertyIndexRef index, const PQ &pq) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/rgbcolor.cpp b/src/blackmisc/rgbcolor.cpp index 27b32b81b..b42b28420 100644 --- a/src/blackmisc/rgbcolor.cpp +++ b/src/blackmisc/rgbcolor.cpp @@ -184,35 +184,35 @@ namespace BlackMisc return this->hex(); } - CVariant CRgbColor::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CRgbColor::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexBlue: return CVariant::fromValue(blue()); - case IndexRed: return CVariant::fromValue(red()); - case IndexGreen: return CVariant::fromValue(green()); - case IndexWebHex: return CVariant::fromValue(hex()); + case IndexBlue: return QVariant::fromValue(blue()); + case IndexRed: return QVariant::fromValue(red()); + case IndexGreen: return QVariant::fromValue(green()); + case IndexWebHex: return QVariant::fromValue(hex()); default: return CValueObject::propertyByIndex(index); } } - void CRgbColor::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CRgbColor::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexBlue: m_b = variant.toInt(); break; case IndexRed: m_r = variant.toInt(); break; case IndexGreen: m_g = variant.toInt(); break; - case IndexWebHex: this->setByString(variant.toQString()); break; + case IndexWebHex: this->setByString(variant.toString()); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } - int CRgbColor::comparePropertyByIndex(const CPropertyIndex &index, const CRgbColor &compareValue) const + int CRgbColor::comparePropertyByIndex(CPropertyIndexRef index, const CRgbColor &compareValue) const { if (index.isMyself()) { return this->compare(compareValue); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/rgbcolor.h b/src/blackmisc/rgbcolor.h index 1cdc99a8b..c26e5ba53 100644 --- a/src/blackmisc/rgbcolor.h +++ b/src/blackmisc/rgbcolor.h @@ -107,13 +107,13 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! Compare for index - int comparePropertyByIndex(const CPropertyIndex &index, const CRgbColor &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CRgbColor &compareValue) const; //! Compare with other color int compare(const CRgbColor &color) const; diff --git a/src/blackmisc/settingscache.h b/src/blackmisc/settingscache.h index dfa2969a2..85bab6a48 100644 --- a/src/blackmisc/settingscache.h +++ b/src/blackmisc/settingscache.h @@ -124,8 +124,8 @@ namespace BlackMisc CStatusMessage set(const typename Trait::type &value, qint64 timestamp = 0) = delete; CStatusMessage setAndSave(const typename Trait::type &value, qint64 timestamp = 0) = delete; CStatusMessage save() = delete; - CStatusMessage setProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) = delete; - CStatusMessage setAndSaveProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) = delete; + CStatusMessage setProperty(CPropertyIndexRef index, const CVariant &value, qint64 timestamp = 0) = delete; + CStatusMessage setAndSaveProperty(CPropertyIndexRef index, const CVariant &value, qint64 timestamp = 0) = delete; CStatusMessage setDefault() = delete; //! @} }; diff --git a/src/blackmisc/simulation/aircraftmatchersetup.cpp b/src/blackmisc/simulation/aircraftmatchersetup.cpp index 0eb89a14f..7df266fbd 100644 --- a/src/blackmisc/simulation/aircraftmatchersetup.cpp +++ b/src/blackmisc/simulation/aircraftmatchersetup.cpp @@ -106,28 +106,28 @@ namespace BlackMisc u"\' matching script: " % boolToOnOff(m_msReverseEnabled) % u'/' % boolToOnOff(m_msMatchingEnabled); } - CVariant CAircraftMatcherSetup::propertyByIndex(const CPropertyIndex &index) const + QVariant CAircraftMatcherSetup::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexMatchingAlgorithm: return CVariant::fromValue(m_algorithm); - case IndexMatchingMode: return CVariant::fromValue(m_mode); - case IndexPickStrategy: return CVariant::fromValue(m_strategy); - case IndexForceMode: return CVariant::fromValue(m_force); - case IndexMsNetworkEntryFile: return CVariant::fromValue(m_msReverseLookupFile); - case IndexMsMatchingStageFile: return CVariant::fromValue(m_msMatchingStageFile); - case IndexMsNetworkEnabled: return CVariant::fromValue(m_msReverseEnabled); - case IndexMsMatchingStageEnabled: return CVariant::fromValue(m_msMatchingEnabled); + case IndexMatchingAlgorithm: return QVariant::fromValue(m_algorithm); + case IndexMatchingMode: return QVariant::fromValue(m_mode); + case IndexPickStrategy: return QVariant::fromValue(m_strategy); + case IndexForceMode: return QVariant::fromValue(m_force); + case IndexMsNetworkEntryFile: return QVariant::fromValue(m_msReverseLookupFile); + case IndexMsMatchingStageFile: return QVariant::fromValue(m_msMatchingStageFile); + case IndexMsNetworkEnabled: return QVariant::fromValue(m_msReverseEnabled); + case IndexMsMatchingStageEnabled: return QVariant::fromValue(m_msMatchingEnabled); default: break; } return CValueObject::propertyByIndex(index); } - void CAircraftMatcherSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAircraftMatcherSetup::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -135,8 +135,8 @@ namespace BlackMisc case IndexMatchingMode: m_mode = variant.toInt(); break; case IndexForceMode: m_force = variant.toInt(); break; case IndexPickStrategy: m_strategy = variant.toInt(); break; - case IndexMsNetworkEntryFile: m_msReverseLookupFile = variant.toQString(); break; - case IndexMsMatchingStageFile: m_msMatchingStageFile = variant.toQString(); break; + case IndexMsNetworkEntryFile: m_msReverseLookupFile = variant.toString(); break; + case IndexMsMatchingStageFile: m_msMatchingStageFile = variant.toString(); break; case IndexMsNetworkEnabled: m_msReverseEnabled = variant.toBool(); break; case IndexMsMatchingStageEnabled: m_msReverseEnabled = variant.toBool(); break; default: break; diff --git a/src/blackmisc/simulation/aircraftmatchersetup.h b/src/blackmisc/simulation/aircraftmatchersetup.h index fbfd5cabd..603ba57b4 100644 --- a/src/blackmisc/simulation/aircraftmatchersetup.h +++ b/src/blackmisc/simulation/aircraftmatchersetup.h @@ -231,10 +231,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! Reset void reset(); diff --git a/src/blackmisc/simulation/aircraftmodel.cpp b/src/blackmisc/simulation/aircraftmodel.cpp index 044042ed3..6af87ca4c 100644 --- a/src/blackmisc/simulation/aircraftmodel.cpp +++ b/src/blackmisc/simulation/aircraftmodel.cpp @@ -231,35 +231,35 @@ namespace BlackMisc return this->getAircraftIcaoCode().isVtol(); } - CVariant CAircraftModel::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CAircraftModel::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::propertyByIndex(index); } if (IOrderable::canHandleIndex(index)) { return IOrderable::propertyByIndex(index);} const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexModelString: return CVariant(m_modelString); - case IndexModelStringAlias: return CVariant(m_modelStringAlias); + case IndexModelString: return QVariant(m_modelString); + case IndexModelStringAlias: return QVariant(m_modelStringAlias); case IndexAllModelStrings: return this->getAllModelStringsAndAliases(); - case IndexHasQueriedModelString: return CVariant::fromValue(this->hasQueriedModelString()); - case IndexModelType: return CVariant::fromValue(m_modelType); - case IndexModelTypeAsString: return CVariant(this->getModelTypeAsString()); - case IndexModelMode: return CVariant::fromValue(m_modelMode); - case IndexModelModeAsString: return CVariant::fromValue(this->getModelModeAsString()); - case IndexModelModeAsIcon: return CVariant::fromValue(this->getModelModeAsIcon()); + case IndexHasQueriedModelString: return QVariant::fromValue(this->hasQueriedModelString()); + case IndexModelType: return QVariant::fromValue(m_modelType); + case IndexModelTypeAsString: return QVariant(this->getModelTypeAsString()); + case IndexModelMode: return QVariant::fromValue(m_modelMode); + case IndexModelModeAsString: return QVariant::fromValue(this->getModelModeAsString()); + case IndexModelModeAsIcon: return QVariant::fromValue(this->getModelModeAsIcon()); case IndexDistributor: return m_distributor.propertyByIndex(index.copyFrontRemoved()); case IndexSimulatorInfo: return m_simulator.propertyByIndex(index.copyFrontRemoved()); - case IndexSimulatorInfoAsString: return CVariant(m_simulator.toQString()); - case IndexDescription: return CVariant(m_description); - case IndexName: return CVariant(m_name); - case IndexFileName: return CVariant(m_fileName); + case IndexSimulatorInfoAsString: return QVariant(m_simulator.toQString()); + case IndexDescription: return QVariant(m_description); + case IndexName: return QVariant(m_name); + case IndexFileName: return QVariant(m_fileName); case IndexCG: return m_cg.propertyByIndex(index.copyFrontRemoved()); - case IndexSupportedParts: return CVariant(m_supportedParts); - case IndexFileTimestamp: return CVariant::fromValue(this->getFileTimestamp()); - case IndexFileTimestampFormattedYmdhms: return CVariant::fromValue(this->getFormattedFileTimestampYmdhms()); - case IndexIconPath: return CVariant(m_iconFile); + case IndexSupportedParts: return QVariant(m_supportedParts); + case IndexFileTimestamp: return QVariant::fromValue(this->getFileTimestamp()); + case IndexFileTimestampFormattedYmdhms: return QVariant::fromValue(this->getFormattedFileTimestampYmdhms()); + case IndexIconPath: return QVariant(m_iconFile); case IndexAircraftIcaoCode: return m_aircraftIcao.propertyByIndex(index.copyFrontRemoved()); case IndexLivery: return m_livery.propertyByIndex(index.copyFrontRemoved()); case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved()); @@ -268,28 +268,28 @@ namespace BlackMisc } } - void CAircraftModel::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAircraftModel::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IOrderable::canHandleIndex(index)) { IOrderable::setPropertyByIndex(index, variant); return; } if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexModelString: m_modelString = variant.toQString(); break; - case IndexModelStringAlias: m_modelStringAlias = variant.toQString(); break; + case IndexModelString: m_modelString = variant.toString(); break; + case IndexModelStringAlias: m_modelStringAlias = variant.toString(); break; case IndexAircraftIcaoCode: m_aircraftIcao.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexLivery: m_livery.setPropertyByIndex(index.copyFrontRemoved(), variant); break; case IndexDistributor: m_distributor.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexDescription: m_description = variant.toQString(); break; + case IndexDescription: m_description = variant.toString(); break; case IndexSimulatorInfo: m_simulator.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexName: m_name = variant.toQString(); break; - case IndexIconPath: m_iconFile = variant.toQString(); break; + case IndexName: m_name = variant.toString(); break; + case IndexIconPath: m_iconFile = variant.toString(); break; case IndexCG: m_cg.setPropertyByIndex(index.copyFrontRemoved(), variant); break; - case IndexSupportedParts: this->setSupportedParts(variant.toQString()); break; + case IndexSupportedParts: this->setSupportedParts(variant.toString()); break; case IndexModelType: m_modelType = variant.value(); break; - case IndexFileName: m_fileName = variant.toQString(); break; + case IndexFileName: m_fileName = variant.toString(); break; case IndexCallsign: m_callsign.setPropertyByIndex(index.copyFrontRemoved(), variant); m_callsign.setTypeHint(CCallsign::Aircraft); @@ -305,9 +305,9 @@ namespace BlackMisc } break; case IndexModelMode: - if (variant.type() == QMetaType::QString) + if (static_cast(variant.type()) == QMetaType::QString) { - this->setModelModeAsString(variant.toQString()); + this->setModelModeAsString(variant.toString()); } else { @@ -327,7 +327,7 @@ namespace BlackMisc } } - int CAircraftModel::comparePropertyByIndex(const CPropertyIndex &index, const CAircraftModel &compareValue) const + int CAircraftModel::comparePropertyByIndex(CPropertyIndexRef index, const CAircraftModel &compareValue) const { if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { return IDatastoreObjectWithIntegerKey::comparePropertyByIndex(index, compareValue);} if (IOrderable::canHandleIndex(index)) { return IOrderable::comparePropertyByIndex(index, compareValue);} diff --git a/src/blackmisc/simulation/aircraftmodel.h b/src/blackmisc/simulation/aircraftmodel.h index 918320b86..4316418ea 100644 --- a/src/blackmisc/simulation/aircraftmodel.h +++ b/src/blackmisc/simulation/aircraftmodel.h @@ -156,13 +156,13 @@ namespace BlackMisc CAircraftModel(const QString &model, ModelType type, const CSimulatorInfo &simulator, const QString &name, const QString &description, const Aviation::CAircraftIcaoCode &icao, const Aviation::CLivery &livery = Aviation::CLivery()); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CAircraftModel &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftModel &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/airspaceaircraftsnapshot.cpp b/src/blackmisc/simulation/airspaceaircraftsnapshot.cpp index 0393337b0..f22297115 100644 --- a/src/blackmisc/simulation/airspaceaircraftsnapshot.cpp +++ b/src/blackmisc/simulation/airspaceaircraftsnapshot.cpp @@ -109,15 +109,15 @@ namespace BlackMisc } } - CVariant CAirspaceAircraftSnapshot::propertyByIndex(const CPropertyIndex &index) const + QVariant CAirspaceAircraftSnapshot::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } return CValueObject::propertyByIndex(index); } - void CAirspaceAircraftSnapshot::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAirspaceAircraftSnapshot::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } CValueObject::setPropertyByIndex(index, variant); } diff --git a/src/blackmisc/simulation/airspaceaircraftsnapshot.h b/src/blackmisc/simulation/airspaceaircraftsnapshot.h index 90be9a1e3..3b95758c9 100644 --- a/src/blackmisc/simulation/airspaceaircraftsnapshot.h +++ b/src/blackmisc/simulation/airspaceaircraftsnapshot.h @@ -81,10 +81,10 @@ namespace BlackMisc bool isRenderingEnabled() const { return m_renderingEnabled; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/distributor.cpp b/src/blackmisc/simulation/distributor.cpp index 5ef9da46e..db8251da7 100644 --- a/src/blackmisc/simulation/distributor.cpp +++ b/src/blackmisc/simulation/distributor.cpp @@ -62,27 +62,27 @@ namespace BlackMisc return m_simulator.matchesAny(simulator); } - CVariant CDistributor::propertyByIndex(const CPropertyIndex &index) const + QVariant CDistributor::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { return IDatastoreObjectWithStringKey::propertyByIndex(index); } if (IOrderable::canHandleIndex(index)) { return IOrderable::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAlias1: return CVariant::from(m_alias1); - case IndexAlias2: return CVariant::from(m_alias2); - case IndexDescription: return CVariant::from(m_description); + case IndexAlias1: return QVariant::fromValue(m_alias1); + case IndexAlias2: return QVariant::fromValue(m_alias2); + case IndexDescription: return QVariant::fromValue(m_description); case IndexSimulator: return m_simulator.propertyByIndex(index.copyFrontRemoved()); default: return CValueObject::propertyByIndex(index); } } - void CDistributor::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CDistributor::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { IDatastoreObjectWithStringKey::setPropertyByIndex(index, variant); return; } if (IOrderable::canHandleIndex(index)) { IOrderable::setPropertyByIndex(index, variant); return; } @@ -97,7 +97,7 @@ namespace BlackMisc } } - int CDistributor::comparePropertyByIndex(const CPropertyIndex &index, const CDistributor &compareValue) const + int CDistributor::comparePropertyByIndex(CPropertyIndexRef index, const CDistributor &compareValue) const { if (IDatastoreObjectWithStringKey::canHandleIndex(index)) { return IDatastoreObjectWithStringKey::comparePropertyByIndex(index, compareValue); } if (IOrderable::canHandleIndex(index)) { return IOrderable::comparePropertyByIndex(index, compareValue); } diff --git a/src/blackmisc/simulation/distributor.h b/src/blackmisc/simulation/distributor.h index fafb0273b..15106ae0e 100644 --- a/src/blackmisc/simulation/distributor.h +++ b/src/blackmisc/simulation/distributor.h @@ -102,13 +102,13 @@ namespace BlackMisc bool matchesSimulator(const CSimulatorInfo &simulator) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CDistributor &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CDistributor &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/fscommon/aircraftcfgentries.cpp b/src/blackmisc/simulation/fscommon/aircraftcfgentries.cpp index e4d489cd5..3b08e6d4a 100644 --- a/src/blackmisc/simulation/fscommon/aircraftcfgentries.cpp +++ b/src/blackmisc/simulation/fscommon/aircraftcfgentries.cpp @@ -179,55 +179,55 @@ namespace BlackMisc return {}; } - CVariant CAircraftCfgEntries::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CAircraftCfgEntries::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } ColumnIndex i = index.frontCasted(); switch (i) { - case IndexEntryIndex: return CVariant::from(m_index); - case IndexFileName: return CVariant::from(m_fileName); - case IndexTitle: return CVariant::from(m_title); - case IndexAirline: return CVariant::from(m_atcAirline); - case IndexAtcType: return CVariant::from(m_atcType); - case IndexAtcModel: return CVariant::from(m_atcModel); - case IndexAtcIdColor: return CVariant::from(m_atcIdColor); - case IndexParkingCode: return CVariant::from(m_atcParkingCode); - case IndexDescription: return CVariant::from(m_description); - case IndexUiType: return CVariant::from(m_uiType); - case IndexUiManufacturer: return CVariant::from(m_uiManufacturer); - case IndexUiVariation: return CVariant::from(m_uiVariation); - case IndexTexture: return CVariant::from(m_texture); - case IndexSimulatorName: return CVariant::from(m_simName); - case IndexCreatedBy: return CVariant::from(m_createdBy); - case IndexRotorcraft: return CVariant::from(m_rotorcraft); + case IndexEntryIndex: return QVariant::fromValue(m_index); + case IndexFileName: return QVariant::fromValue(m_fileName); + case IndexTitle: return QVariant::fromValue(m_title); + case IndexAirline: return QVariant::fromValue(m_atcAirline); + case IndexAtcType: return QVariant::fromValue(m_atcType); + case IndexAtcModel: return QVariant::fromValue(m_atcModel); + case IndexAtcIdColor: return QVariant::fromValue(m_atcIdColor); + case IndexParkingCode: return QVariant::fromValue(m_atcParkingCode); + case IndexDescription: return QVariant::fromValue(m_description); + case IndexUiType: return QVariant::fromValue(m_uiType); + case IndexUiManufacturer: return QVariant::fromValue(m_uiManufacturer); + case IndexUiVariation: return QVariant::fromValue(m_uiVariation); + case IndexTexture: return QVariant::fromValue(m_texture); + case IndexSimulatorName: return QVariant::fromValue(m_simName); + case IndexCreatedBy: return QVariant::fromValue(m_createdBy); + case IndexRotorcraft: return QVariant::fromValue(m_rotorcraft); default: return CValueObject::propertyByIndex(index); } } - void CAircraftCfgEntries::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CAircraftCfgEntries::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } ColumnIndex i = index.frontCasted(); switch (i) { case IndexEntryIndex: this->setIndex(variant.toInt()); break; - case IndexFileName: this->setFileName(variant.toQString()); break; - case IndexTitle: this->setTitle(variant.toQString()); break; + case IndexFileName: this->setFileName(variant.toString()); break; + case IndexTitle: this->setTitle(variant.toString()); break; case IndexAirline: this->setTitle(m_atcAirline); break; - case IndexAtcType: this->setAtcType(variant.toQString()); break; - case IndexAtcModel: this->setAtcModel(variant.toQString()); break; - case IndexAtcIdColor: this->setAtcIdColor(variant.toQString()); break; - case IndexParkingCode: this->setAtcParkingCode(variant.toQString()); break; - case IndexDescription: this->setDescription(variant.toQString()); break; - case IndexUiType: this->setUiType(variant.toQString()); break; - case IndexUiVariation: this->setUiVariation(variant.toQString()); break; - case IndexUiManufacturer: this->setUiManufacturer(variant.toQString()); break; - case IndexTexture: this->setTexture(variant.toQString()); break; - case IndexSimulatorName: this->setSimName(variant.toQString()); break; - case IndexCreatedBy: this->setCreatedBy(variant.toQString()); break; + case IndexAtcType: this->setAtcType(variant.toString()); break; + case IndexAtcModel: this->setAtcModel(variant.toString()); break; + case IndexAtcIdColor: this->setAtcIdColor(variant.toString()); break; + case IndexParkingCode: this->setAtcParkingCode(variant.toString()); break; + case IndexDescription: this->setDescription(variant.toString()); break; + case IndexUiType: this->setUiType(variant.toString()); break; + case IndexUiVariation: this->setUiVariation(variant.toString()); break; + case IndexUiManufacturer: this->setUiManufacturer(variant.toString()); break; + case IndexTexture: this->setTexture(variant.toString()); break; + case IndexSimulatorName: this->setSimName(variant.toString()); break; + case IndexCreatedBy: this->setCreatedBy(variant.toString()); break; case IndexRotorcraft: this->setRotorcraft(variant.toBool()); break; default: CValueObject::setPropertyByIndex(index, variant); diff --git a/src/blackmisc/simulation/fscommon/aircraftcfgentries.h b/src/blackmisc/simulation/fscommon/aircraftcfgentries.h index 27dd92628..533f288df 100644 --- a/src/blackmisc/simulation/fscommon/aircraftcfgentries.h +++ b/src/blackmisc/simulation/fscommon/aircraftcfgentries.h @@ -179,10 +179,10 @@ namespace BlackMisc QString getThumbnailFileNameChecked() const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/fscommon/vpilotmodelrule.cpp b/src/blackmisc/simulation/fscommon/vpilotmodelrule.cpp index 1714d6298..ed73769cf 100644 --- a/src/blackmisc/simulation/fscommon/vpilotmodelrule.cpp +++ b/src/blackmisc/simulation/fscommon/vpilotmodelrule.cpp @@ -50,25 +50,25 @@ namespace BlackMisc return "??? - " + f; } - CVariant CVPilotModelRule::propertyByIndex(const CPropertyIndex &index) const + QVariant CVPilotModelRule::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } ColumnIndex i = index.frontCasted(); switch (i) { - case IndexModelName: return CVariant::from(this->m_modelName); - case IndexFolder: return CVariant::from(this->m_folder); - case IndexTypeCode: return CVariant::from(this->m_typeCode); - case IndexCallsignPrefix: return CVariant::from(this->m_callsignPrefix); + case IndexModelName: return QVariant::fromValue(this->m_modelName); + case IndexFolder: return QVariant::fromValue(this->m_folder); + case IndexTypeCode: return QVariant::fromValue(this->m_typeCode); + case IndexCallsignPrefix: return QVariant::fromValue(this->m_callsignPrefix); default: return CValueObject::propertyByIndex(index); } } - void CVPilotModelRule::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CVPilotModelRule::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } ColumnIndex i = index.frontCasted(); switch (i) diff --git a/src/blackmisc/simulation/fscommon/vpilotmodelrule.h b/src/blackmisc/simulation/fscommon/vpilotmodelrule.h index 0c672eced..1648a5f20 100644 --- a/src/blackmisc/simulation/fscommon/vpilotmodelrule.h +++ b/src/blackmisc/simulation/fscommon/vpilotmodelrule.h @@ -79,10 +79,10 @@ namespace BlackMisc void setCallsignPrefix(const QString &callsign) { this->m_callsignPrefix = callsign.trimmed().toUpper(); } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/interpolationrenderingsetup.cpp b/src/blackmisc/simulation/interpolationrenderingsetup.cpp index d78adacfd..ff92791d1 100644 --- a/src/blackmisc/simulation/interpolationrenderingsetup.cpp +++ b/src/blackmisc/simulation/interpolationrenderingsetup.cpp @@ -95,27 +95,27 @@ namespace BlackMisc return this->setEnabledAircraftParts(masked); } - CVariant CInterpolationAndRenderingSetupBase::propertyByIndex(const CPropertyIndex &index) const + QVariant CInterpolationAndRenderingSetupBase::propertyByIndex(CPropertyIndexRef index) const { const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexLogInterpolation: return CVariant::fromValue(m_logInterpolation); - case IndexSimulatorDebugMessages: return CVariant::fromValue(m_simulatorDebugMessages); - case IndexForceFullInterpolation: return CVariant::fromValue(m_forceFullInterpolation); - case IndexEnabledAircraftParts: return CVariant::fromValue(m_enabledAircraftParts); - case IndexSendGndFlagToSimulator: return CVariant::fromValue(m_sendGndToSim); - case IndexInterpolatorMode: return CVariant::fromValue(m_interpolatorMode); - case IndexInterpolatorModeAsString: return CVariant::fromValue(this->getInterpolatorModeAsString()); - case IndexFixSceneryOffset: return CVariant::fromValue(m_fixSceneryOffset); - case IndexPitchOnGround: return CVariant::fromValue(m_pitchOnGround); + case IndexLogInterpolation: return QVariant::fromValue(m_logInterpolation); + case IndexSimulatorDebugMessages: return QVariant::fromValue(m_simulatorDebugMessages); + case IndexForceFullInterpolation: return QVariant::fromValue(m_forceFullInterpolation); + case IndexEnabledAircraftParts: return QVariant::fromValue(m_enabledAircraftParts); + case IndexSendGndFlagToSimulator: return QVariant::fromValue(m_sendGndToSim); + case IndexInterpolatorMode: return QVariant::fromValue(m_interpolatorMode); + case IndexInterpolatorModeAsString: return QVariant::fromValue(this->getInterpolatorModeAsString()); + case IndexFixSceneryOffset: return QVariant::fromValue(m_fixSceneryOffset); + case IndexPitchOnGround: return QVariant::fromValue(m_pitchOnGround); default: break; } BLACK_VERIFY_X(false, Q_FUNC_INFO, "Cannot handle index"); return QStringLiteral("Wrong index for %1").arg(i); } - void CInterpolationAndRenderingSetupBase::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CInterpolationAndRenderingSetupBase::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { const ColumnIndex i = index.frontCasted(); switch (i) @@ -126,7 +126,7 @@ namespace BlackMisc case IndexEnabledAircraftParts: m_enabledAircraftParts = variant.toBool(); return; case IndexSendGndFlagToSimulator: m_sendGndToSim = variant.toBool(); return; case IndexInterpolatorMode: m_interpolatorMode = variant.toInt(); return; - case IndexInterpolatorModeAsString: this->setInterpolatorMode(variant.toQString()); return; + case IndexInterpolatorModeAsString: this->setInterpolatorMode(variant.toString()); return; case IndexFixSceneryOffset: m_fixSceneryOffset = variant.toBool(); return; case IndexPitchOnGround: m_pitchOnGround.setPropertyByIndex(index.copyFrontRemoved(), variant); return; default: break; @@ -283,21 +283,21 @@ namespace BlackMisc QStringLiteral(" max.distance:") % m_maxRenderedDistance.valueRoundedWithUnit(CLengthUnit::NM(), 2); } - CVariant CInterpolationAndRenderingSetupGlobal::propertyByIndex(const CPropertyIndex &index) const + QVariant CInterpolationAndRenderingSetupGlobal::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexMaxRenderedAircraft: return CVariant::fromValue(m_maxRenderedAircraft); - case IndexMaxRenderedDistance: return CVariant::fromValue(m_maxRenderedDistance); + case IndexMaxRenderedAircraft: return QVariant::fromValue(m_maxRenderedAircraft); + case IndexMaxRenderedDistance: return QVariant::fromValue(m_maxRenderedDistance); default: break; } if (CInterpolationAndRenderingSetupBase::canHandleIndex(i)) { return CInterpolationAndRenderingSetupBase::propertyByIndex(index); } return CValueObject::propertyByIndex(index); } - void CInterpolationAndRenderingSetupGlobal::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CInterpolationAndRenderingSetupGlobal::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (index.isMyself()) { @@ -346,9 +346,9 @@ namespace BlackMisc return equal; } - CVariant CInterpolationAndRenderingSetupPerCallsign::propertyByIndex(const CPropertyIndex &index) const + QVariant CInterpolationAndRenderingSetupPerCallsign::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::fromValue(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -358,7 +358,7 @@ namespace BlackMisc return CInterpolationAndRenderingSetupBase::propertyByIndex(index); } - void CInterpolationAndRenderingSetupPerCallsign::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CInterpolationAndRenderingSetupPerCallsign::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (index.isMyself()) { diff --git a/src/blackmisc/simulation/interpolationrenderingsetup.h b/src/blackmisc/simulation/interpolationrenderingsetup.h index 0790ba897..0aa079baa 100644 --- a/src/blackmisc/simulation/interpolationrenderingsetup.h +++ b/src/blackmisc/simulation/interpolationrenderingsetup.h @@ -113,10 +113,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! Interpolator mode as string static const QString &modeToString(InterpolatorMode mode); @@ -200,10 +200,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); private: int m_maxRenderedAircraft = InfiniteAircraft(); //!< max.rendered aircraft @@ -258,10 +258,10 @@ namespace BlackMisc bool isNull() const { return m_callsign.isEmpty(); } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! NULL object static const CInterpolationAndRenderingSetupPerCallsign &null(); diff --git a/src/blackmisc/simulation/matchingstatisticsentry.cpp b/src/blackmisc/simulation/matchingstatisticsentry.cpp index 293a915bf..af9e93258 100644 --- a/src/blackmisc/simulation/matchingstatisticsentry.cpp +++ b/src/blackmisc/simulation/matchingstatisticsentry.cpp @@ -88,31 +88,31 @@ namespace BlackMisc } } - CVariant CMatchingStatisticsEntry::propertyByIndex(const CPropertyIndex &index) const + QVariant CMatchingStatisticsEntry::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexSessionId: return CVariant::from(m_sessionId); - case IndexModelSetId: return CVariant::from(m_modelSetId); - case IndexCount: return CVariant::from(m_count); - case IndexEntryType: return CVariant::from(m_entryType); - case IndexEntryTypeAsString: return CVariant::from(entryTypeToString(this->getEntryType())); - case IndexEntryTypeAsIcon: return CVariant::from(entryTypeToIcon(this->getEntryType())); - case IndexAircraftDesignator: return CVariant::from(m_aircraftDesignator); - case IndexAirlineDesignator: return CVariant::from(m_airlineDesignator); - case IndexDescription: return CVariant::from(m_description); - case IndexHasAircraftAirlineCombination: return CVariant::from(this->hasAircraftAirlineCombination()); + case IndexSessionId: return QVariant::fromValue(m_sessionId); + case IndexModelSetId: return QVariant::fromValue(m_modelSetId); + case IndexCount: return QVariant::fromValue(m_count); + case IndexEntryType: return QVariant::fromValue(m_entryType); + case IndexEntryTypeAsString: return QVariant::fromValue(entryTypeToString(this->getEntryType())); + case IndexEntryTypeAsIcon: return QVariant::fromValue(entryTypeToIcon(this->getEntryType())); + case IndexAircraftDesignator: return QVariant::fromValue(m_aircraftDesignator); + case IndexAirlineDesignator: return QVariant::fromValue(m_airlineDesignator); + case IndexDescription: return QVariant::fromValue(m_description); + case IndexHasAircraftAirlineCombination: return QVariant::fromValue(this->hasAircraftAirlineCombination()); default: return CValueObject::propertyByIndex(index); } } - void CMatchingStatisticsEntry::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CMatchingStatisticsEntry::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); @@ -129,7 +129,7 @@ namespace BlackMisc } } - int CMatchingStatisticsEntry::comparePropertyByIndex(const CPropertyIndex &index, const CMatchingStatisticsEntry &compareValue) const + int CMatchingStatisticsEntry::comparePropertyByIndex(CPropertyIndexRef index, const CMatchingStatisticsEntry &compareValue) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::comparePropertyByIndex(index, compareValue); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/simulation/matchingstatisticsentry.h b/src/blackmisc/simulation/matchingstatisticsentry.h index 3c1c1f70c..fe6c2cc58 100644 --- a/src/blackmisc/simulation/matchingstatisticsentry.h +++ b/src/blackmisc/simulation/matchingstatisticsentry.h @@ -103,13 +103,13 @@ namespace BlackMisc bool matches(EntryType type, const QString &sessionId, const QString &aircraftDesignator, const QString &airlineDesignator) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! Compare by index - int comparePropertyByIndex(const CPropertyIndex &index, const CMatchingStatisticsEntry &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CMatchingStatisticsEntry &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/settings/modelsettings.cpp b/src/blackmisc/simulation/settings/modelsettings.cpp index 7cbc52aa8..427f107da 100644 --- a/src/blackmisc/simulation/settings/modelsettings.cpp +++ b/src/blackmisc/simulation/settings/modelsettings.cpp @@ -24,20 +24,20 @@ namespace BlackMisc return QStringLiteral("Allow exclude: %1").arg(boolToYesNo(this->m_allowExcludeModels)); } - CVariant CModelSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CModelSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexAllowExclude: return CVariant::fromValue(this->m_allowExcludeModels); + case IndexAllowExclude: return QVariant::fromValue(this->m_allowExcludeModels); default: return CValueObject::propertyByIndex(index); } } - void CModelSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CModelSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/simulation/settings/modelsettings.h b/src/blackmisc/simulation/settings/modelsettings.h index dc682f252..bee3fcb7d 100644 --- a/src/blackmisc/simulation/settings/modelsettings.h +++ b/src/blackmisc/simulation/settings/modelsettings.h @@ -45,10 +45,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); private: bool m_allowExcludeModels = false; //!< Allow excluded models in sets diff --git a/src/blackmisc/simulation/settings/simulatorsettings.cpp b/src/blackmisc/simulation/settings/simulatorsettings.cpp index 7148a6ec6..e650dacd6 100644 --- a/src/blackmisc/simulation/settings/simulatorsettings.cpp +++ b/src/blackmisc/simulation/settings/simulatorsettings.cpp @@ -155,31 +155,31 @@ namespace BlackMisc m_excludeDirectoryPatterns.join(','); } - CVariant CSimulatorSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CSimulatorSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexSimulatorDirectory: return CVariant::fromValue(m_simulatorDirectory); - case IndexModelDirectories: return CVariant::fromValue(m_modelDirectories); - case IndexModelExcludeDirectoryPatterns: return CVariant::fromValue(m_excludeDirectoryPatterns); - case IndexComIntegration: return CVariant::fromValue(m_comIntegration); - case IndexRecordOwnAircraftGnd: return CVariant::fromValue(m_recordGnd); - case IndexCGSource: return CVariant::fromValue(m_cgSource); + case IndexSimulatorDirectory: return QVariant::fromValue(m_simulatorDirectory); + case IndexModelDirectories: return QVariant::fromValue(m_modelDirectories); + case IndexModelExcludeDirectoryPatterns: return QVariant::fromValue(m_excludeDirectoryPatterns); + case IndexComIntegration: return QVariant::fromValue(m_comIntegration); + case IndexRecordOwnAircraftGnd: return QVariant::fromValue(m_recordGnd); + case IndexCGSource: return QVariant::fromValue(m_cgSource); case IndexRecordOwnAircraftGndRadius: return m_recordedGndRadius.propertyByIndex(index.copyFrontRemoved()); default: return CValueObject::propertyByIndex(index); } } - void CSimulatorSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CSimulatorSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexSimulatorDirectory: this->setSimulatorDirectory(variant.toQString()); break; - case IndexModelDirectories: this->setSimulatorDirectory(variant.toQString()); break; + case IndexSimulatorDirectory: this->setSimulatorDirectory(variant.toString()); break; + case IndexModelDirectories: this->setSimulatorDirectory(variant.toString()); break; case IndexComIntegration: this->setComIntegrated(variant.toBool()); break; case IndexRecordOwnAircraftGnd: this->setRecordOwnAircraftGnd(variant.toBool()); break; case IndexModelExcludeDirectoryPatterns: m_excludeDirectoryPatterns = variant.value(); break; @@ -524,22 +524,22 @@ namespace BlackMisc return s.arg(boolToOnOff(m_relayGloballyEnabled)).arg(m_messageType).arg(severity); } - CVariant CSimulatorMessagesSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CSimulatorMessagesSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexTechnicalLogSeverity: return CVariant::fromValue(m_technicalLogLevel); - case IndexRelayTextMessage: return CVariant::from(m_messageType); - case IndexRelayGloballyEnabled: return CVariant::from(m_relayGloballyEnabled); + case IndexTechnicalLogSeverity: return QVariant::fromValue(m_technicalLogLevel); + case IndexRelayTextMessage: return QVariant::fromValue(m_messageType); + case IndexRelayGloballyEnabled: return QVariant::fromValue(m_relayGloballyEnabled); default: return CValueObject::propertyByIndex(index); } } - void CSimulatorMessagesSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CSimulatorMessagesSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -746,13 +746,13 @@ namespace BlackMisc u" SB offsets: " % boolToYesNo(m_useSbOffsets); } - CVariant CFsxP3DSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CFsxP3DSettings::propertyByIndex(CPropertyIndexRef index) const { Q_UNUSED(index) return {}; } - void CFsxP3DSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CFsxP3DSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { Q_UNUSED(index) Q_UNUSED(variant) diff --git a/src/blackmisc/simulation/settings/simulatorsettings.h b/src/blackmisc/simulation/settings/simulatorsettings.h index 5498b61d6..4bdb4d0b9 100644 --- a/src/blackmisc/simulation/settings/simulatorsettings.h +++ b/src/blackmisc/simulation/settings/simulatorsettings.h @@ -136,10 +136,10 @@ namespace BlackMisc QString convertToQString(const QString &separator, bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); private: QString m_simulatorDirectory; //!< Simulator directory @@ -191,10 +191,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); private: bool m_useSimulatedObjectAdding = false; //!< COM integration @@ -600,10 +600,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); private: int m_technicalLogLevel = CStatusMessage::SeverityError; //!< log level diff --git a/src/blackmisc/simulation/settings/swiftpluginsettings.cpp b/src/blackmisc/simulation/settings/swiftpluginsettings.cpp index efe999c37..24d538b1e 100644 --- a/src/blackmisc/simulation/settings/swiftpluginsettings.cpp +++ b/src/blackmisc/simulation/settings/swiftpluginsettings.cpp @@ -31,28 +31,28 @@ namespace BlackMisc return ms.arg(this->m_emulatedSimulator.toQString(), m_defaultModel.getModelStringAndDbKey(), boolToYesNo(m_logFunctionCalls)); } - CVariant CSwiftPluginSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CSwiftPluginSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexEmulatedSimulator: return this->m_emulatedSimulator.propertyByIndex(index.copyFrontRemoved()); case IndexOwnModel: - return CVariant::from(m_ownModel); + return QVariant::fromValue(m_ownModel); case IndexDefaultModel: - return CVariant::from(m_defaultModel); + return QVariant::fromValue(m_defaultModel); case IndexLoggingFunctionCalls: - return CVariant::from(m_logFunctionCalls); + return QVariant::fromValue(m_logFunctionCalls); default: return CValueObject::propertyByIndex(index); } } - void CSwiftPluginSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CSwiftPluginSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/simulation/settings/swiftpluginsettings.h b/src/blackmisc/simulation/settings/swiftpluginsettings.h index 15b60a501..0ad0b724e 100644 --- a/src/blackmisc/simulation/settings/swiftpluginsettings.h +++ b/src/blackmisc/simulation/settings/swiftpluginsettings.h @@ -67,10 +67,10 @@ namespace BlackMisc QString convertToQString(bool i18n = false) const; //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - BlackMisc::CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); private: CSimulatorInfo m_emulatedSimulator { CSimulatorInfo::P3D }; // simulator with default value diff --git a/src/blackmisc/simulation/settings/xswiftbussettings.cpp b/src/blackmisc/simulation/settings/xswiftbussettings.cpp index 886813b33..3b8504a20 100644 --- a/src/blackmisc/simulation/settings/xswiftbussettings.cpp +++ b/src/blackmisc/simulation/settings/xswiftbussettings.cpp @@ -22,38 +22,38 @@ namespace BlackMisc this->parseXSwiftBusStringQt(json); } - CVariant CXSwiftBusSettings::propertyByIndex(const CPropertyIndex &index) const + QVariant CXSwiftBusSettings::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexMaxPlanes: return CVariant::fromValue(m_maxPlanes); - case IndexDBusServerAddress: return CVariant::fromValue(QString::fromStdString(m_dBusServerAddress)); - case IndexNightTextureMode: return CVariant::fromValue(QString::fromStdString(m_nightTextureMode)); - case IndexMessageBoxMargins: return CVariant::fromValue(QString::fromStdString(m_msgBox)); - case IndexDrawingLabels: return CVariant::fromValue(m_drawingLabels); - case IndexBundleTaxiLandingLights: return CVariant::fromValue(m_bundleTaxiLandingLights); - case IndexMaxDrawingDistance: return CVariant::fromValue(m_maxDrawDistanceNM); - case IndexFollowAircraftDistance: return CVariant::fromValue(m_followAircraftDistanceM); + case IndexMaxPlanes: return QVariant::fromValue(m_maxPlanes); + case IndexDBusServerAddress: return QVariant::fromValue(QString::fromStdString(m_dBusServerAddress)); + case IndexNightTextureMode: return QVariant::fromValue(QString::fromStdString(m_nightTextureMode)); + case IndexMessageBoxMargins: return QVariant::fromValue(QString::fromStdString(m_msgBox)); + case IndexDrawingLabels: return QVariant::fromValue(m_drawingLabels); + case IndexBundleTaxiLandingLights: return QVariant::fromValue(m_bundleTaxiLandingLights); + case IndexMaxDrawingDistance: return QVariant::fromValue(m_maxDrawDistanceNM); + case IndexFollowAircraftDistance: return QVariant::fromValue(m_followAircraftDistanceM); default: break; } return CValueObject::propertyByIndex(index); } - void CXSwiftBusSettings::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CXSwiftBusSettings::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); } const ColumnIndex i = index.frontCasted(); switch (i) { case IndexMaxPlanes: m_maxPlanes = variant.toInt(); break; - case IndexDBusServerAddress: m_dBusServerAddress = variant.toStdString(); break; - case IndexMessageBoxMargins: m_msgBox = variant.toStdString(); break; - case IndexNightTextureMode: m_nightTextureMode = variant.toStdString(); break; + case IndexDBusServerAddress: m_dBusServerAddress = variant.toString().toStdString(); break; + case IndexMessageBoxMargins: m_msgBox = variant.toString().toStdString(); break; + case IndexNightTextureMode: m_nightTextureMode = variant.toString().toStdString(); break; case IndexDrawingLabels: m_drawingLabels = variant.toBool(); break; case IndexBundleTaxiLandingLights: m_bundleTaxiLandingLights = variant.toBool(); break; case IndexMaxDrawingDistance: m_maxDrawDistanceNM = variant.toDouble(); break; diff --git a/src/blackmisc/simulation/settings/xswiftbussettings.h b/src/blackmisc/simulation/settings/xswiftbussettings.h index 76eaeff87..fced2e242 100644 --- a/src/blackmisc/simulation/settings/xswiftbussettings.h +++ b/src/blackmisc/simulation/settings/xswiftbussettings.h @@ -53,10 +53,10 @@ namespace BlackMisc CXSwiftBusSettings(const QString &json); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/simulatedaircraft.cpp b/src/blackmisc/simulation/simulatedaircraft.cpp index 7212668cc..7be0ffbae 100644 --- a/src/blackmisc/simulation/simulatedaircraft.cpp +++ b/src/blackmisc/simulation/simulatedaircraft.cpp @@ -334,9 +334,9 @@ namespace BlackMisc return model.getAircraftIcaoCode().getDesignator(); } - CVariant CSimulatedAircraft::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CSimulatedAircraft::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -345,11 +345,11 @@ namespace BlackMisc case IndexNetworkModelAircraftIcaoDifference: return this->getNetworkModelAircraftIcaoDifference(); case IndexNetworkModelAirlineIcaoDifference: return this->getNetworkModelAirlineIcaoDifference(); case IndexNetworkModelLiveryDifference: return this->getNetworkModelLiveryDifference(); - case IndexEnabled: return CVariant::fromValue(this->isEnabled()); - case IndexRendered: return CVariant::fromValue(this->isRendered()); - case IndexPartsSynchronized: return CVariant::fromValue(this->isPartsSynchronized()); - case IndexFastPositionUpdates: return CVariant::fromValue(this->fastPositionUpdates()); - case IndexSupportsGndFlag: return CVariant::fromValue(this->isSupportingGndFlag()); + case IndexEnabled: return QVariant::fromValue(this->isEnabled()); + case IndexRendered: return QVariant::fromValue(this->isRendered()); + case IndexPartsSynchronized: return QVariant::fromValue(this->isPartsSynchronized()); + case IndexFastPositionUpdates: return QVariant::fromValue(this->fastPositionUpdates()); + case IndexSupportsGndFlag: return QVariant::fromValue(this->isSupportingGndFlag()); case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved()); case IndexPilot: return m_pilot.propertyByIndex(index.copyFrontRemoved()); case IndexRelativeDistance: return m_relativeDistance.propertyByIndex(index.copyFrontRemoved()); @@ -360,9 +360,9 @@ namespace BlackMisc case IndexAircraftIcaoCode: return this->getAircraftIcaoCode().propertyByIndex(index.copyFrontRemoved()); case IndexLivery: return this->getLivery().propertyByIndex(index.copyFrontRemoved()); case IndexParts: return m_parts.propertyByIndex(index.copyFrontRemoved()); - case IndexIsVtol: return CVariant::fromValue(this->isVtol()); - case IndexCombinedIcaoLiveryString: return CVariant::fromValue(this->getCombinedIcaoLiveryString(false)); - case IndexCombinedIcaoLiveryStringNetworkModel: return CVariant::fromValue(this->getCombinedIcaoLiveryString(true)); + case IndexIsVtol: return QVariant::fromValue(this->isVtol()); + case IndexCombinedIcaoLiveryString: return QVariant::fromValue(this->getCombinedIcaoLiveryString(false)); + case IndexCombinedIcaoLiveryStringNetworkModel: return QVariant::fromValue(this->getCombinedIcaoLiveryString(true)); default: return (ICoordinateWithRelativePosition::canHandleIndex(index)) ? ICoordinateWithRelativePosition::propertyByIndex(index) : @@ -370,9 +370,9 @@ namespace BlackMisc } } - void CSimulatedAircraft::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CSimulatedAircraft::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { @@ -408,7 +408,7 @@ namespace BlackMisc } } - int CSimulatedAircraft::comparePropertyByIndex(const CPropertyIndex &index, const CSimulatedAircraft &compareValue) const + int CSimulatedAircraft::comparePropertyByIndex(CPropertyIndexRef index, const CSimulatedAircraft &compareValue) const { if (index.isMyself()) { return m_callsign.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCallsign()); } const ColumnIndex i = index.frontCasted(); diff --git a/src/blackmisc/simulation/simulatedaircraft.h b/src/blackmisc/simulation/simulatedaircraft.h index bd1218ed8..9e3a7a43f 100644 --- a/src/blackmisc/simulation/simulatedaircraft.h +++ b/src/blackmisc/simulation/simulatedaircraft.h @@ -353,7 +353,7 @@ namespace BlackMisc QString getCombinedIcaoLiveryString(bool networkModel = false) const; //! Compare for index - int comparePropertyByIndex(const CPropertyIndex &index, const CSimulatedAircraft &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CSimulatedAircraft &compareValue) const; //! Get model (model used for mapping) const Simulation::CAircraftModel &getModel() const { return m_models[CurrentModel]; } @@ -450,10 +450,10 @@ namespace BlackMisc void setSupportingGndFlag(bool supports) { m_supportsGndFlag = supports; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/simulatorinfo.cpp b/src/blackmisc/simulation/simulatorinfo.cpp index b11a6a0bd..89d31b4c6 100644 --- a/src/blackmisc/simulation/simulatorinfo.cpp +++ b/src/blackmisc/simulation/simulatorinfo.cpp @@ -155,7 +155,7 @@ namespace BlackMisc return this->matchesAny(otherInfo); } - int CSimulatorInfo::comparePropertyByIndex(const CPropertyIndex &index, const CSimulatorInfo &compareValue) const + int CSimulatorInfo::comparePropertyByIndex(CPropertyIndexRef index, const CSimulatorInfo &compareValue) const { Q_UNUSED(index) return Compare::compare(m_simulator, compareValue.m_simulator); diff --git a/src/blackmisc/simulation/simulatorinfo.h b/src/blackmisc/simulation/simulatorinfo.h index a4577eebb..99712d405 100644 --- a/src/blackmisc/simulation/simulatorinfo.h +++ b/src/blackmisc/simulation/simulatorinfo.h @@ -156,7 +156,7 @@ namespace BlackMisc void setAllSimulators() { setSimulator(All); } //! \copydoc Mixin::String::toQString - int comparePropertyByIndex(const CPropertyIndex &index, const CSimulatorInfo &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CSimulatorInfo &compareValue) const; //! \copydoc Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/simulatorinternals.cpp b/src/blackmisc/simulation/simulatorinternals.cpp index bfef14bf7..48ba3ee48 100644 --- a/src/blackmisc/simulation/simulatorinternals.cpp +++ b/src/blackmisc/simulation/simulatorinternals.cpp @@ -94,24 +94,24 @@ namespace BlackMisc return m_data.toQString(i18n); } - CVariant CSimulatorInternals::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CSimulatorInternals::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexData: return CVariant::from(m_data); + case IndexData: return QVariant::fromValue(m_data); default: return CValueObject::propertyByIndex(index); } } - void CSimulatorInternals::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CSimulatorInternals::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexData: m_data = variant.to(); break; + case IndexData: m_data = variant.value(); break; default: CValueObject::setPropertyByIndex(index, variant); break; } } diff --git a/src/blackmisc/simulation/simulatorinternals.h b/src/blackmisc/simulation/simulatorinternals.h index 6aabad8e5..b9fcd02cc 100644 --- a/src/blackmisc/simulation/simulatorinternals.h +++ b/src/blackmisc/simulation/simulatorinternals.h @@ -89,10 +89,10 @@ namespace BlackMisc void setSimulatorInstallationDirectory(const QString &fullFilePath); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString() QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/simulation/xplane/navdatareference.cpp b/src/blackmisc/simulation/xplane/navdatareference.cpp index a7cb3d375..ff06807a5 100644 --- a/src/blackmisc/simulation/xplane/navdatareference.cpp +++ b/src/blackmisc/simulation/xplane/navdatareference.cpp @@ -30,17 +30,17 @@ namespace BlackMisc m_position(latitudeDegrees, longitudeDegrees, 0) {} - CVariant CNavDataReference::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CNavDataReference::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } return ICoordinateGeodetic::canHandleIndex(index) ? ICoordinateGeodetic::propertyByIndex(index) : CValueObject::propertyByIndex(index); } - void CNavDataReference::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CNavDataReference::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } CValueObject::setPropertyByIndex(index, variant); } diff --git a/src/blackmisc/simulation/xplane/navdatareference.h b/src/blackmisc/simulation/xplane/navdatareference.h index 2dfb3f00f..13107283c 100644 --- a/src/blackmisc/simulation/xplane/navdatareference.h +++ b/src/blackmisc/simulation/xplane/navdatareference.h @@ -61,10 +61,10 @@ namespace BlackMisc virtual std::array normalVectorDouble() const override { return this->m_position.normalVectorDouble(); } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/statusmessage.cpp b/src/blackmisc/statusmessage.cpp index 17346855e..e3ec30657 100644 --- a/src/blackmisc/statusmessage.cpp +++ b/src/blackmisc/statusmessage.cpp @@ -431,29 +431,29 @@ namespace BlackMisc return all; } - CVariant CStatusMessage::propertyByIndex(const CPropertyIndex &index) const + QVariant CStatusMessage::propertyByIndex(CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + 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(); switch (i) { - case IndexMessage: return CVariant::from(this->getMessage()); - case IndexSeverity: return CVariant::from(m_severity); - case IndexSeverityAsString: return CVariant::from(this->getSeverityAsString()); - case IndexSeverityAsIcon: return CVariant::from(this->getSeverityAsIcon()); - case IndexCategoriesAsString: return CVariant::from(m_categories.toQString()); - case IndexCategoriesHumanReadableAsString: return CVariant::from(this->getHumanReadablePattern()); - case IndexCategoryHumanReadableOrTechnicalAsString: return CVariant::from(this->getHumanOrTechnicalCategoriesAsString()); - case IndexMessageAsHtml: return CVariant::from(this->toHtml(false, true)); + case IndexMessage: return QVariant::fromValue(this->getMessage()); + case IndexSeverity: return QVariant::fromValue(m_severity); + case IndexSeverityAsString: return QVariant::fromValue(this->getSeverityAsString()); + case IndexSeverityAsIcon: return QVariant::fromValue(this->getSeverityAsIcon()); + case IndexCategoriesAsString: return QVariant::fromValue(m_categories.toQString()); + case IndexCategoriesHumanReadableAsString: return QVariant::fromValue(this->getHumanReadablePattern()); + case IndexCategoryHumanReadableOrTechnicalAsString: return QVariant::fromValue(this->getHumanOrTechnicalCategoriesAsString()); + case IndexMessageAsHtml: return QVariant::fromValue(this->toHtml(false, true)); default: return CValueObject::propertyByIndex(index); } } - void CStatusMessage::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CStatusMessage::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } if (IOrderable::canHandleIndex(index)) { IOrderable::setPropertyByIndex(index, variant); return; } const ColumnIndex i = index.frontCasted(); @@ -469,7 +469,7 @@ namespace BlackMisc } } - int CStatusMessage::comparePropertyByIndex(const CPropertyIndex &index, const CStatusMessage &compareValue) const + int CStatusMessage::comparePropertyByIndex(CPropertyIndexRef index, const CStatusMessage &compareValue) const { if (index.isMyself()) { return Compare::compare(this->getSeverity(), compareValue.getSeverity()); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::comparePropertyByIndex(index, compareValue); } diff --git a/src/blackmisc/statusmessage.h b/src/blackmisc/statusmessage.h index 564f798a2..1f315f447 100644 --- a/src/blackmisc/statusmessage.h +++ b/src/blackmisc/statusmessage.h @@ -484,13 +484,13 @@ namespace BlackMisc static const QStringList &allSeverityStrings(); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const CStatusMessage &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const CStatusMessage &compareValue) const; //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/statusmessagelist.cpp b/src/blackmisc/statusmessagelist.cpp index 44a2159f9..dc68ff020 100644 --- a/src/blackmisc/statusmessagelist.cpp +++ b/src/blackmisc/statusmessagelist.cpp @@ -9,6 +9,7 @@ //! \cond PRIVATE #include "blackmisc/statusmessagelist.h" +#include "blackmisc/propertyindexlist.h" #include "blackmisc/mixin/mixincompare.h" #include "blackmisc/range.h" @@ -255,7 +256,7 @@ namespace BlackMisc for (const CPropertyIndex &index : usedIndexes) { rowHtml += u"" % - statusMessage.propertyByIndex(index).toQString(true).toHtmlEscaped().replace('\n', "
") % + statusMessage.propertyByIndex(index).toString().toHtmlEscaped().replace('\n', "
") % u""; } diff --git a/src/blackmisc/timestampbased.cpp b/src/blackmisc/timestampbased.cpp index 85f4dbd85..9642a5a73 100644 --- a/src/blackmisc/timestampbased.cpp +++ b/src/blackmisc/timestampbased.cpp @@ -179,38 +179,38 @@ namespace BlackMisc return (index >= static_cast(IndexUtcTimestamp)) && (index <= static_cast(IndexMSecsSinceEpoch)); } - bool ITimestampBased::canHandleIndex(const CPropertyIndex &index) + bool ITimestampBased::canHandleIndex(CPropertyIndexRef index) { if (index.isEmpty()) { return false; } const int i = index.frontCasted(); return isAnyTimestampIndex(i); } - CVariant ITimestampBased::propertyByIndex(const CPropertyIndex &index) const + QVariant ITimestampBased::propertyByIndex(CPropertyIndexRef index) const { if (!index.isEmpty()) { const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexUtcTimestamp: return CVariant::fromValue(this->getUtcTimestamp()); - case IndexMSecsSinceEpoch: return CVariant::fromValue(this->getMSecsSinceEpoch()); - case IndexUtcTimestampFormattedDhms: return CVariant::fromValue(this->getFormattedUtcTimestampDhms()); - case IndexUtcTimestampFormattedHm: return CVariant::fromValue(this->getFormattedUtcTimestampHm()); - case IndexUtcTimestampFormattedHms: return CVariant::fromValue(this->getFormattedUtcTimestampHms()); - case IndexUtcTimestampFormattedYmdhms: return CVariant::fromValue(this->getFormattedUtcTimestampYmdhms()); - case IndexUtcTimestampFormattedYmdhmsz: return CVariant::fromValue(this->getFormattedUtcTimestampYmdhmsz()); - case IndexUtcTimestampFormattedMdhms: return CVariant::fromValue(this->getFormattedUtcTimestampMdhms()); - case IndexUtcTimestampFormattedMdhmsz: return CVariant::fromValue(this->getFormattedUtcTimestampMdhmsz()); + case IndexUtcTimestamp: return QVariant::fromValue(this->getUtcTimestamp()); + case IndexMSecsSinceEpoch: return QVariant::fromValue(this->getMSecsSinceEpoch()); + case IndexUtcTimestampFormattedDhms: return QVariant::fromValue(this->getFormattedUtcTimestampDhms()); + case IndexUtcTimestampFormattedHm: return QVariant::fromValue(this->getFormattedUtcTimestampHm()); + case IndexUtcTimestampFormattedHms: return QVariant::fromValue(this->getFormattedUtcTimestampHms()); + case IndexUtcTimestampFormattedYmdhms: return QVariant::fromValue(this->getFormattedUtcTimestampYmdhms()); + case IndexUtcTimestampFormattedYmdhmsz: return QVariant::fromValue(this->getFormattedUtcTimestampYmdhmsz()); + case IndexUtcTimestampFormattedMdhms: return QVariant::fromValue(this->getFormattedUtcTimestampMdhms()); + case IndexUtcTimestampFormattedMdhmsz: return QVariant::fromValue(this->getFormattedUtcTimestampMdhmsz()); default: break; } } const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString()); BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); - return CVariant::fromValue(m); + return QVariant::fromValue(m); } - void ITimestampBased::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void ITimestampBased::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (!index.isEmpty()) { @@ -218,14 +218,14 @@ namespace BlackMisc switch (i) { case IndexUtcTimestamp: this->setUtcTimestamp(variant.toDateTime()); return; - case IndexMSecsSinceEpoch: this->setMSecsSinceEpoch(variant.toQInt64()); return; + case IndexMSecsSinceEpoch: this->setMSecsSinceEpoch(variant.toLongLong()); return; case IndexUtcTimestampFormattedYmdhms: case IndexUtcTimestampFormattedYmdhmsz: case IndexUtcTimestampFormattedHm: case IndexUtcTimestampFormattedHms: case IndexUtcTimestampFormattedDhms: { - const QDateTime dt = fromStringUtc(variant.toQString()); + const QDateTime dt = fromStringUtc(variant.toString()); m_timestampMSecsSinceEpoch = dt.toMSecsSinceEpoch(); } return; @@ -236,7 +236,7 @@ namespace BlackMisc BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); } - int ITimestampBased::comparePropertyByIndex(const CPropertyIndex &index, const ITimestampBased &compareValue) const + int ITimestampBased::comparePropertyByIndex(CPropertyIndexRef index, const ITimestampBased &compareValue) const { Q_UNUSED(index); return Compare::compare(m_timestampMSecsSinceEpoch, compareValue.m_timestampMSecsSinceEpoch); @@ -286,7 +286,7 @@ namespace BlackMisc return this->getAdjustedMSecsSinceEpoch() < mSecsSinceEpoch; } - bool ITimestampWithOffsetBased::canHandleIndex(const CPropertyIndex &index) + bool ITimestampWithOffsetBased::canHandleIndex(CPropertyIndexRef index) { if (ITimestampBased::canHandleIndex(index)) { return true; } if (index.isEmpty()) { return false; } @@ -309,7 +309,7 @@ namespace BlackMisc return QStringLiteral("%1ms").arg(this->getTimeOffsetMs()); } - CVariant ITimestampWithOffsetBased::propertyByIndex(const CPropertyIndex &index) const + QVariant ITimestampWithOffsetBased::propertyByIndex(CPropertyIndexRef index) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } if (!index.isEmpty()) @@ -325,10 +325,10 @@ namespace BlackMisc } const QString m = QStringLiteral("Cannot handle index %1").arg(index.toQString()); BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); - return CVariant(); + return QVariant(); } - void ITimestampWithOffsetBased::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void ITimestampWithOffsetBased::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; } if (!index.isEmpty()) @@ -346,7 +346,7 @@ namespace BlackMisc BLACK_VERIFY_X(false, Q_FUNC_INFO, qUtf8Printable(m)); } - int ITimestampWithOffsetBased::comparePropertyByIndex(const CPropertyIndex &index, const ITimestampWithOffsetBased &compareValue) const + int ITimestampWithOffsetBased::comparePropertyByIndex(CPropertyIndexRef index, const ITimestampWithOffsetBased &compareValue) const { if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::comparePropertyByIndex(index, compareValue); } if (!index.isEmpty()) diff --git a/src/blackmisc/timestampbased.h b/src/blackmisc/timestampbased.h index c056317b5..296e219c4 100644 --- a/src/blackmisc/timestampbased.h +++ b/src/blackmisc/timestampbased.h @@ -139,7 +139,7 @@ namespace BlackMisc static bool isAnyTimestampIndex(int index); //! Can given index be handled - static bool canHandleIndex(const CPropertyIndex &index); + static bool canHandleIndex(CPropertyIndexRef index); protected: //! Constructor @@ -152,13 +152,13 @@ namespace BlackMisc ITimestampBased(const QDateTime ×tamp); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const CPropertyIndex &index) const; + QVariant propertyByIndex(CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const ITimestampBased &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const ITimestampBased &compareValue) const; //! Update missing parts void updateMissingParts(const ITimestampBased &other); @@ -222,7 +222,7 @@ namespace BlackMisc protected: //! Can given index be handled - static bool canHandleIndex(const CPropertyIndex &index); + static bool canHandleIndex(CPropertyIndexRef index); //! Constructor ITimestampWithOffsetBased() : ITimestampBased() {} @@ -234,13 +234,13 @@ namespace BlackMisc ITimestampWithOffsetBased(const QDateTime ×tamp) : ITimestampBased(timestamp) {} //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex - int comparePropertyByIndex(const CPropertyIndex &index, const ITimestampWithOffsetBased &compareValue) const; + int comparePropertyByIndex(CPropertyIndexRef index, const ITimestampWithOffsetBased &compareValue) const; qint64 m_timeOffsetMs = 0; //!< offset time in ms }; diff --git a/src/blackmisc/typetraits.h b/src/blackmisc/typetraits.h index 1ef431926..a10a11619 100644 --- a/src/blackmisc/typetraits.h +++ b/src/blackmisc/typetraits.h @@ -19,7 +19,7 @@ class QDBusArgument; namespace BlackMisc { - class CPropertyIndex; + class CPropertyIndexRef; //! \cond PRIVATE // Own implementation of C++17 std::void_t, simple variadic alias @@ -133,24 +133,24 @@ namespace BlackMisc /*! * Trait which is true if the expression a.compareByPropertyIndex(b, i) is valid when a and b are instances of T, - * and i is an instance of CPropertyIndex. + * and i is an instance of CPropertyIndexRef. */ template > struct THasComparePropertyByIndex : public std::false_type {}; //! \cond template - struct THasComparePropertyByIndex().comparePropertyByIndex(std::declval(), std::declval()))>> : public std::true_type {}; + struct THasComparePropertyByIndex().comparePropertyByIndex(std::declval(), std::declval()))>> : public std::true_type {}; //! \endcond /*! * Trait which is true if the expression a.propertyByIndex(i) is valid with a is an instance of T and i is an - * instance of CPropertyIndex. + * instance of CPropertyIndexRef. */ template > struct THasPropertyByIndex : public std::false_type {}; //! \cond template - struct THasPropertyByIndex().propertyByIndex(std::declval()))>> : public std::true_type {}; + struct THasPropertyByIndex().propertyByIndex(std::declval()))>> : public std::true_type {}; //! \endcond /*! diff --git a/src/blackmisc/valuecache.h b/src/blackmisc/valuecache.h index 1a208906e..117c4c2d2 100644 --- a/src/blackmisc/valuecache.h +++ b/src/blackmisc/valuecache.h @@ -406,10 +406,10 @@ namespace BlackMisc CStatusMessage save() { return m_page->setValue(*m_element, {}, 0, true, true); } //! Write a property of the value. Must be called from the thread in which the owner lives. - CStatusMessage setProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) { auto v = get(); v.setPropertyByIndex(index, value); return set(v, timestamp); } + CStatusMessage setProperty(CPropertyIndexRef index, const CVariant &value, qint64 timestamp = 0) { auto v = get(); v.setPropertyByIndex(index, value); return set(v, timestamp); } //! Write a property and save in the same step. Must be called from the thread in which the owner lives. - CStatusMessage setAndSaveProperty(const CPropertyIndex &index, const CVariant &value, qint64 timestamp = 0) { auto v = get(); v.setPropertyByIndex(index, value); return setAndSave(v, timestamp); } + CStatusMessage setAndSaveProperty(CPropertyIndexRef index, const CVariant &value, qint64 timestamp = 0) { auto v = get(); v.setPropertyByIndex(index, value); return setAndSave(v, timestamp); } //! Is current thread the owner thread, so CCached::set is safe bool isOwnerThread() const { return QThread::currentThread() == m_page->thread(); } diff --git a/src/blackmisc/variant.cpp b/src/blackmisc/variant.cpp index a00283453..d43f59ee1 100644 --- a/src/blackmisc/variant.cpp +++ b/src/blackmisc/variant.cpp @@ -446,7 +446,7 @@ namespace BlackMisc stream >> m_v; } - void CVariant::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CVariant::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { auto *meta = getValueObjectMetaInfo(); Q_ASSERT(meta); @@ -460,13 +460,13 @@ namespace BlackMisc } } - CVariant CVariant::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CVariant::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { auto *meta = getValueObjectMetaInfo(); Q_ASSERT(meta); try { - CVariant result; + QVariant result; meta->propertyByIndex(data(), result, index); return result; } @@ -477,7 +477,7 @@ namespace BlackMisc } } - bool CVariant::equalsPropertyByIndex(const CVariant &compareValue, const CPropertyIndex &index) const + bool CVariant::equalsPropertyByIndex(const CVariant &compareValue, CPropertyIndexRef index) const { auto *meta = getValueObjectMetaInfo(); Q_ASSERT(meta); diff --git a/src/blackmisc/variant.h b/src/blackmisc/variant.h index eba4b197a..eccd8c56a 100644 --- a/src/blackmisc/variant.h +++ b/src/blackmisc/variant.h @@ -148,6 +148,12 @@ namespace BlackMisc //! Return the internal QVariant. const QVariant &getQVariant() const { return m_v; } + //! Return the internal QVariant. + operator const QVariant &() const { return m_v; } + + //! Return the internal QVariant. + operator QVariant() && { return std::move(m_v); } + //! True if this variant can be converted to the type with the given metatype ID. bool canConvert(int typeId) const; @@ -245,13 +251,13 @@ namespace BlackMisc friend int compare(const CVariant &a, const CVariant &b) { return compareImpl(a, b); } //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc CValueObject::equalsPropertyByIndex - bool equalsPropertyByIndex(const CVariant &compareValue, const CPropertyIndex &index) const; + bool equalsPropertyByIndex(const CVariant &compareValue, CPropertyIndexRef index) const; //! \copydoc CIcon::toPixmap QPixmap toPixmap() const; @@ -297,9 +303,6 @@ namespace BlackMisc { namespace Private { - //! \private Needed so CValueObjectMetaInfoHelper can copy forward-declared CVariant. - inline void assign(CVariant &a, const CVariant &b) { a = b; } - //! \private template void maybeRegisterMetaListConvert(int) diff --git a/src/blackmisc/variantprivate.h b/src/blackmisc/variantprivate.h index 211632c0b..a9e159f0a 100644 --- a/src/blackmisc/variantprivate.h +++ b/src/blackmisc/variantprivate.h @@ -24,7 +24,7 @@ namespace BlackMisc { class CEmpty; class CVariant; - class CPropertyIndex; + class CPropertyIndexRef; class CIcon; template @@ -35,9 +35,6 @@ namespace BlackMisc namespace Private { - //! \private Defined in variant.h - void assign(CVariant &, const CVariant &); - //! \private Abstract base class representing the set of operations supported by a particular value type. struct BLACKMISC_EXPORT IValueObjectMetaInfo { @@ -52,9 +49,9 @@ namespace BlackMisc virtual int getMetaTypeId() const = 0; virtual const void *upCastTo(const void *object, int metaTypeId) const = 0; virtual int compareImpl(const void *lhs, const void *rhs) const = 0; - virtual void setPropertyByIndex(void *object, const CVariant &variant, const CPropertyIndex &index) const = 0; - virtual void propertyByIndex(const void *object, CVariant &o_variant, const BlackMisc::CPropertyIndex &index) const = 0; - virtual bool equalsPropertyByIndex(const void *object, const CVariant &compareValue, const CPropertyIndex &index) const = 0; + virtual void setPropertyByIndex(void *object, const QVariant &variant, CPropertyIndexRef index) const = 0; + virtual void propertyByIndex(const void *object, QVariant &o_variant, BlackMisc::CPropertyIndexRef index) const = 0; + virtual bool equalsPropertyByIndex(const void *object, const QVariant &compareValue, CPropertyIndexRef index) const = 0; virtual bool matches(const void *object, const CVariant &value) const = 0; virtual int toIcon(const void *object) const = 0; }; @@ -115,19 +112,19 @@ namespace BlackMisc static int compareImpl(const T &lhs, const T &, ...) { throw CVariantException(lhs, "compare"); } template - static void setPropertyByIndex(T &object, const CVariant &variant, const CPropertyIndex &index, decltype(static_cast(object.setPropertyByIndex(index, variant)), 0)) { object.setPropertyByIndex(index, variant); } + static void setPropertyByIndex(T &object, const QVariant &variant, CPropertyIndexRef index, decltype(static_cast(object.setPropertyByIndex(index, variant)), 0)) { object.setPropertyByIndex(index, variant); } template - static void setPropertyByIndex(T &object, const CVariant &, const CPropertyIndex &, ...) { throw CVariantException(object, "setPropertyByIndex"); } + static void setPropertyByIndex(T &object, const QVariant &, CPropertyIndexRef, ...) { throw CVariantException(object, "setPropertyByIndex"); } template - static void propertyByIndex(CVariant &o_variant, const T &object, const CPropertyIndex &index, decltype(static_cast(object.propertyByIndex(index)), 0)) { assign(o_variant, object.propertyByIndex(index)); } + static void propertyByIndex(QVariant &o_variant, const T &object, CPropertyIndexRef index, decltype(static_cast(object.propertyByIndex(index)), 0)) { o_variant = object.propertyByIndex(index); } template - static void propertyByIndex(CVariant &, const T &object, const CPropertyIndex &, ...) { throw CVariantException(object, "propertyByIndex"); } + static void propertyByIndex(QVariant &, const T &object, CPropertyIndexRef, ...) { throw CVariantException(object, "propertyByIndex"); } template - static bool equalsPropertyByIndex(const T &object, const CVariant &variant, const CPropertyIndex &index, decltype(static_cast(object.equalsPropertyByIndex(variant, index)), 0)) { return object.equalsPropertyByIndex(variant, index); } + static bool equalsPropertyByIndex(const T &object, const QVariant &variant, CPropertyIndexRef index, decltype(static_cast(object.equalsPropertyByIndex(variant, index)), 0)) { return object.equalsPropertyByIndex(variant, index); } template - static bool equalsPropertyByIndex(const T &object, const CVariant &, const CPropertyIndex &, ...) { throw CVariantException(object, "equalsPropertyByIndex"); } + static bool equalsPropertyByIndex(const T &object, const QVariant &, CPropertyIndexRef, ...) { throw CVariantException(object, "equalsPropertyByIndex"); } template static int toIcon(const T &object, std::enable_if_t < ! std::is_same::value, decltype(static_cast(object.toIcon()), 0) >) { return object.toIcon(); } @@ -185,15 +182,15 @@ namespace BlackMisc { return CValueObjectMetaInfoHelper::compareImpl(cast(lhs), cast(rhs), 0); } - virtual void setPropertyByIndex(void *object, const CVariant &variant, const CPropertyIndex &index) const override + virtual void setPropertyByIndex(void *object, const QVariant &variant, CPropertyIndexRef index) const override { CValueObjectMetaInfoHelper::setPropertyByIndex(cast(object), variant, index, 0); } - virtual void propertyByIndex(const void *object, CVariant &o_variant, const BlackMisc::CPropertyIndex &index) const override + virtual void propertyByIndex(const void *object, QVariant &o_variant, BlackMisc::CPropertyIndexRef index) const override { CValueObjectMetaInfoHelper::propertyByIndex(o_variant, cast(object), index, 0); } - virtual bool equalsPropertyByIndex(const void *object, const CVariant &compareValue, const CPropertyIndex &index) const override + virtual bool equalsPropertyByIndex(const void *object, const QVariant &compareValue, CPropertyIndexRef index) const override { return CValueObjectMetaInfoHelper::equalsPropertyByIndex(cast(object), compareValue, index, 0); } diff --git a/src/blackmisc/weather/cloudlayer.cpp b/src/blackmisc/weather/cloudlayer.cpp index 6127a69bd..bfec69b0b 100644 --- a/src/blackmisc/weather/cloudlayer.cpp +++ b/src/blackmisc/weather/cloudlayer.cpp @@ -53,32 +53,32 @@ namespace BlackMisc return None; } - CVariant CCloudLayer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CCloudLayer::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexBase: - return CVariant::fromValue(m_base); + return QVariant::fromValue(m_base); case IndexTop: - return CVariant::fromValue(m_top); + return QVariant::fromValue(m_top); case IndexPrecipitationRate: - return CVariant::fromValue(m_precipitationRate); + return QVariant::fromValue(m_precipitationRate); case IndexPrecipitation: - return CVariant::fromValue(m_precipitation); + return QVariant::fromValue(m_precipitation); case IndexClouds: - return CVariant::fromValue(m_clouds); + return QVariant::fromValue(m_clouds); case IndexCoveragePercent: - return CVariant::fromValue(m_coveragePercent); + return QVariant::fromValue(m_coveragePercent); default: return CValueObject::propertyByIndex(index); } } - void CCloudLayer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CCloudLayer::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/weather/cloudlayer.h b/src/blackmisc/weather/cloudlayer.h index 27d8fe5c5..03dac4a1e 100644 --- a/src/blackmisc/weather/cloudlayer.h +++ b/src/blackmisc/weather/cloudlayer.h @@ -132,10 +132,10 @@ namespace BlackMisc int getCoveragePercent() const { return m_coveragePercent; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/weather/gridpoint.cpp b/src/blackmisc/weather/gridpoint.cpp index b9e32459f..536e2f54a 100644 --- a/src/blackmisc/weather/gridpoint.cpp +++ b/src/blackmisc/weather/gridpoint.cpp @@ -51,32 +51,32 @@ namespace BlackMisc setPressureAtMsl(other.getPressureAtMsl()); } - CVariant CGridPoint::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CGridPoint::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexIdentifier: - return CVariant::fromValue(m_identifier); + return QVariant::fromValue(m_identifier); case IndexPosition: - return CVariant::fromValue(m_position); + return QVariant::fromValue(m_position); case IndexCloudLayers: - return CVariant::fromValue(m_cloudLayers); + return QVariant::fromValue(m_cloudLayers); case IndexTemperatureLayers: - return CVariant::fromValue(m_temperatureLayers); + return QVariant::fromValue(m_temperatureLayers); case IndexWindLayers: - return CVariant::fromValue(m_windLayers); + return QVariant::fromValue(m_windLayers); case IndexPressureAtMsl: - return CVariant::fromValue(m_pressureAtMsl); + return QVariant::fromValue(m_pressureAtMsl); default: return CValueObject::propertyByIndex(index); } } - void CGridPoint::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CGridPoint::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/weather/gridpoint.h b/src/blackmisc/weather/gridpoint.h index 1f9cf39fc..c3dabd0d5 100644 --- a/src/blackmisc/weather/gridpoint.h +++ b/src/blackmisc/weather/gridpoint.h @@ -111,10 +111,10 @@ namespace BlackMisc const PhysicalQuantities::CPressure &getPressureAtMsl() const { return m_pressureAtMsl; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/weather/presentweather.cpp b/src/blackmisc/weather/presentweather.cpp index 0a5554c93..28ff80ea7 100644 --- a/src/blackmisc/weather/presentweather.cpp +++ b/src/blackmisc/weather/presentweather.cpp @@ -26,26 +26,26 @@ namespace BlackMisc m_intensity(intensity), m_descriptor(descriptor), m_weatherPhenomena(weatherPhenomena) { } - CVariant CPresentWeather::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CPresentWeather::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexIntensity: - return CVariant::fromValue(m_intensity); + return QVariant::fromValue(m_intensity); case IndexDescriptor: - return CVariant::fromValue(m_descriptor); + return QVariant::fromValue(m_descriptor); case IndexWeatherPhenomena: - return CVariant::fromValue(m_weatherPhenomena); + return QVariant::fromValue(m_weatherPhenomena); default: return CValueObject::propertyByIndex(index); } } - void CPresentWeather::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CPresentWeather::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/weather/presentweather.h b/src/blackmisc/weather/presentweather.h index 3791e7a67..d980b37e8 100644 --- a/src/blackmisc/weather/presentweather.h +++ b/src/blackmisc/weather/presentweather.h @@ -121,10 +121,10 @@ namespace BlackMisc int getWeatherPhenomena() const { return m_weatherPhenomena; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/weather/temperaturelayer.cpp b/src/blackmisc/weather/temperaturelayer.cpp index 184fbdae0..0bd5fead6 100644 --- a/src/blackmisc/weather/temperaturelayer.cpp +++ b/src/blackmisc/weather/temperaturelayer.cpp @@ -25,28 +25,28 @@ namespace BlackMisc m_level(level), m_temperature(value), m_dewPoint(dewPoint), m_relativeHumidity(relativeHumidity) { } - CVariant CTemperatureLayer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CTemperatureLayer::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexLevel: - return CVariant::fromValue(m_level); + return QVariant::fromValue(m_level); case IndexTemperature: - return CVariant::fromValue(m_temperature); + return QVariant::fromValue(m_temperature); case IndexDewPoint: - return CVariant::fromValue(m_dewPoint); + return QVariant::fromValue(m_dewPoint); case IndexRelativeHumidity: - return CVariant::fromValue(m_relativeHumidity); + return QVariant::fromValue(m_relativeHumidity); default: return CValueObject::propertyByIndex(index); } } - void CTemperatureLayer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CTemperatureLayer::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/weather/temperaturelayer.h b/src/blackmisc/weather/temperaturelayer.h index 9bf7398df..fb40e5bbd 100644 --- a/src/blackmisc/weather/temperaturelayer.h +++ b/src/blackmisc/weather/temperaturelayer.h @@ -77,10 +77,10 @@ namespace BlackMisc double getRelativeHumidity() const { return m_relativeHumidity; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/weather/visibilitylayer.cpp b/src/blackmisc/weather/visibilitylayer.cpp index b89de8fa3..55dd195be 100644 --- a/src/blackmisc/weather/visibilitylayer.cpp +++ b/src/blackmisc/weather/visibilitylayer.cpp @@ -24,26 +24,26 @@ namespace BlackMisc m_base(base), m_top(top), m_visibility(visibility) { } - CVariant CVisibilityLayer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CVisibilityLayer::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexBase: - return CVariant::fromValue(m_base); + return QVariant::fromValue(m_base); case IndexTop: - return CVariant::fromValue(m_top); + return QVariant::fromValue(m_top); case IndexVisibility: - return CVariant::fromValue(m_visibility); + return QVariant::fromValue(m_visibility); default: return CValueObject::propertyByIndex(index); } } - void CVisibilityLayer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CVisibilityLayer::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/weather/visibilitylayer.h b/src/blackmisc/weather/visibilitylayer.h index 5aa04bfb7..cb6585a06 100644 --- a/src/blackmisc/weather/visibilitylayer.h +++ b/src/blackmisc/weather/visibilitylayer.h @@ -68,10 +68,10 @@ namespace BlackMisc PhysicalQuantities::CLength getVisibility() const { return m_visibility; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/weather/weatherscenario.cpp b/src/blackmisc/weather/weatherscenario.cpp index 3d0cbb5c3..3de77b9f4 100644 --- a/src/blackmisc/weather/weatherscenario.cpp +++ b/src/blackmisc/weather/weatherscenario.cpp @@ -28,23 +28,23 @@ namespace BlackMisc m_scenarioDescription(description) { } - CVariant CWeatherScenario::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CWeatherScenario::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexScenarioIndex: return CVariant::fromValue(m_scenarioIndex); - case IndexScenarioName: return CVariant::fromValue(m_scenarioName); - case IndexScenarioDescription: return CVariant::fromValue(m_scenarioDescription); + case IndexScenarioIndex: return QVariant::fromValue(m_scenarioIndex); + case IndexScenarioName: return QVariant::fromValue(m_scenarioName); + case IndexScenarioDescription: return QVariant::fromValue(m_scenarioDescription); default: return CValueObject::propertyByIndex(index); } } - void CWeatherScenario::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CWeatherScenario::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } const ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/weather/weatherscenario.h b/src/blackmisc/weather/weatherscenario.h index f1e236ce5..7ea63c848 100644 --- a/src/blackmisc/weather/weatherscenario.h +++ b/src/blackmisc/weather/weatherscenario.h @@ -74,10 +74,10 @@ namespace BlackMisc QString getDescription() const { return m_scenarioDescription; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const; diff --git a/src/blackmisc/weather/windlayer.cpp b/src/blackmisc/weather/windlayer.cpp index 406a7520d..165baa5f2 100644 --- a/src/blackmisc/weather/windlayer.cpp +++ b/src/blackmisc/weather/windlayer.cpp @@ -23,30 +23,30 @@ namespace BlackMisc m_level(level), m_directionMain(direction), m_speed(speed), m_gustSpeed(gustSpeed) { } - CVariant CWindLayer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + QVariant CWindLayer::propertyByIndex(BlackMisc::CPropertyIndexRef index) const { - if (index.isMyself()) { return CVariant::from(*this); } + if (index.isMyself()) { return QVariant::fromValue(*this); } ColumnIndex i = index.frontCasted(); switch (i) { case IndexLevel: - return CVariant::fromValue(m_level); + return QVariant::fromValue(m_level); case IndexDirection: - return CVariant::fromValue(m_directionMain); + return QVariant::fromValue(m_directionMain); case IndexDirectionVariable: - return CVariant::fromValue(m_directionVariable); + return QVariant::fromValue(m_directionVariable); case IndexSpeed: - return CVariant::fromValue(m_speed); + return QVariant::fromValue(m_speed); case IndexGustSpeed: - return CVariant::fromValue(m_gustSpeed); + return QVariant::fromValue(m_gustSpeed); default: return CValueObject::propertyByIndex(index); } } - void CWindLayer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) + void CWindLayer::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant) { - if (index.isMyself()) { (*this) = variant.to(); return; } + if (index.isMyself()) { (*this) = variant.value(); return; } ColumnIndex i = index.frontCasted(); switch (i) { diff --git a/src/blackmisc/weather/windlayer.h b/src/blackmisc/weather/windlayer.h index c994cbafc..a633d87ae 100644 --- a/src/blackmisc/weather/windlayer.h +++ b/src/blackmisc/weather/windlayer.h @@ -103,10 +103,10 @@ namespace BlackMisc PhysicalQuantities::CSpeed getGustSpeed() const { return m_gustSpeed; } //! \copydoc BlackMisc::Mixin::Index::propertyByIndex - CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const; + QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const; //! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex - void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant); + void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant); //! \copydoc BlackMisc::Mixin::String::toQString QString convertToQString(bool i18n = false) const;