mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Replace occurrences of CVariant::toCVariant() with CVariant::from()
This commit is contained in:
@@ -71,7 +71,7 @@ namespace BlackMiscTest
|
||||
atcList.push_back(station1);
|
||||
CAtcStation station1Cpy(station1);
|
||||
CFrequency changedFrequency(118.25, CFrequencyUnit::MHz());
|
||||
CPropertyIndexVariantMap vm(CAtcStation::IndexFrequency, changedFrequency.toCVariant());
|
||||
CPropertyIndexVariantMap vm(CAtcStation::IndexFrequency, CVariant::from(changedFrequency));
|
||||
|
||||
|
||||
// demonstration apply
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace BlackCore
|
||||
{
|
||||
Q_UNUSED(originator);
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
CPropertyIndexVariantMap vm(CSimulatedAircraft::IndexModel, model.toCVariant());
|
||||
CPropertyIndexVariantMap vm(CSimulatedAircraft::IndexModel, CVariant::from(model));
|
||||
int c = m_aircraftInRange.applyIfCallsign(callsign, vm);
|
||||
return c > 0;
|
||||
}
|
||||
@@ -471,7 +471,7 @@ namespace BlackCore
|
||||
capabilities.addValue(CClient::FsdWithModelDescription, (flags & INetwork::SupportsModelDescriptions));
|
||||
capabilities.addValue(CClient::FsdWithAircraftConfig, (flags & INetwork::SupportsAircraftConfigs));
|
||||
|
||||
CPropertyIndexVariantMap vm(CClient::IndexCapabilities, capabilities.toCVariant());
|
||||
CPropertyIndexVariantMap vm(CClient::IndexCapabilities, CVariant::from(capabilities));
|
||||
CVoiceCapabilities caps = m_vatsimDataFileReader->getVoiceCapabilityForCallsign(callsign);
|
||||
vm.addValue({CClient::IndexVoiceCapabilities}, caps);
|
||||
if (!this->m_otherClients.containsCallsign(callsign)) { this->m_otherClients.push_back(CClient(callsign)); }
|
||||
@@ -550,7 +550,7 @@ namespace BlackCore
|
||||
CInformationMessage metar(CInformationMessage::METAR, metarMessage);
|
||||
|
||||
// add METAR to existing stations
|
||||
CPropertyIndexVariantMap vm(CAtcStation::IndexMetar, metar.toCVariant());
|
||||
CPropertyIndexVariantMap vm(CAtcStation::IndexMetar, CVariant::from(metar));
|
||||
this->m_atcStationsOnline.applyIf(&CAtcStation::getCallsign, callsignTower, vm);
|
||||
this->m_atcStationsBooked.applyIf(&CAtcStation::getCallsign, callsignTower, vm);
|
||||
this->m_metarCache.insert(icaoCode, metar);
|
||||
@@ -746,7 +746,7 @@ namespace BlackCore
|
||||
{
|
||||
Q_ASSERT(BlackCore::isCurrentThreadObjectThread(this));
|
||||
if (!this->m_connected || callsign.isEmpty()) return;
|
||||
CPropertyIndexVariantMap vm(CAtcStation::IndexAtis, atisMessage.toCVariant());
|
||||
CPropertyIndexVariantMap vm(CAtcStation::IndexAtis, CVariant::from(atisMessage));
|
||||
int changedOnline = this->m_atcStationsOnline.applyIf(&CAtcStation::getCallsign, callsign, vm);
|
||||
|
||||
// receiving an ATIS means station is online, update in bookings
|
||||
@@ -779,7 +779,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
// receiving voice room means ATC has voice
|
||||
vm = CPropertyIndexVariantMap(CClient::IndexVoiceCapabilities, CVoiceCapabilities::fromVoiceCapabilities(CVoiceCapabilities::Voice).toCVariant());
|
||||
vm = CPropertyIndexVariantMap(CClient::IndexVoiceCapabilities, CVariant::from(CVoiceCapabilities::fromVoiceCapabilities(CVoiceCapabilities::Voice)));
|
||||
this->m_otherClients.applyIf(&CClient::getCallsign, callsign, vm, false);
|
||||
}
|
||||
|
||||
@@ -814,14 +814,14 @@ namespace BlackCore
|
||||
if (!this->m_connected) { return; }
|
||||
|
||||
// update
|
||||
CPropertyIndexVariantMap vm(CAircraft::IndexIcao, icaoData.toCVariant());
|
||||
CPropertyIndexVariantMap vm(CAircraft::IndexIcao, CVariant::from(icaoData));
|
||||
if (!icaoData.hasAircraftDesignator())
|
||||
{
|
||||
// empty so far, try to fetch from data file
|
||||
CLogMessage(this).warning("Empty ICAO info for %1 %2") << callsign.toQString() << icaoData.toQString();
|
||||
CAircraftIcaoData icaoDataFromDataFile = this->m_vatsimDataFileReader->getIcaoInfo(callsign);
|
||||
if (!icaoDataFromDataFile.hasAircraftDesignator()) { return; } // give up!
|
||||
vm = CPropertyIndexVariantMap(CAircraft::IndexIcao, icaoDataFromDataFile.toCVariant());
|
||||
vm = CPropertyIndexVariantMap(CAircraft::IndexIcao, CVariant::from(icaoDataFromDataFile));
|
||||
}
|
||||
// ICAO code received when aircraft is already removed or not yet ready
|
||||
// We add it to cache and use it when aircraft is created
|
||||
@@ -1004,7 +1004,7 @@ namespace BlackCore
|
||||
|
||||
// update
|
||||
int changed;
|
||||
CPropertyIndexVariantMap vm({CAircraft::IndexCom1System, CComSystem::IndexActiveFrequency}, frequency.toCVariant());
|
||||
CPropertyIndexVariantMap vm({CAircraft::IndexCom1System, CComSystem::IndexActiveFrequency}, CVariant::from(frequency));
|
||||
{
|
||||
QWriteLocker l(&m_lockAircraft);
|
||||
changed = this->m_aircraftInRange.applyIf(&CAircraft::getCallsign, callsign, vm, true);
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
#include "ui_settingshotkeycomponent.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackmisc/settingutilities.h"
|
||||
#include "blackmisc/variant.h"
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Settings;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -56,7 +58,7 @@ namespace BlackGui
|
||||
void CSettingsHotkeyComponent::ps_saveHotkeys()
|
||||
{
|
||||
const QString path = CSettingUtilities::appendPaths(IContextSettings::PathRoot(), IContextSettings::PathHotkeys());
|
||||
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), this->ui->tvp_SettingsMiscHotkeys->derivedModel()->getContainer().toCVariant());
|
||||
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), CVariant::from(this->ui->tvp_SettingsMiscHotkeys->derivedModel()->getContainer()));
|
||||
}
|
||||
|
||||
void CSettingsHotkeyComponent::ps_clearHotkey()
|
||||
|
||||
@@ -79,11 +79,11 @@ namespace BlackGui
|
||||
QObject *sender = QObject::sender();
|
||||
if (sender == this->ui->pb_SettingsTnServersRemoveServer)
|
||||
{
|
||||
this->getIContextSettings()->value(path, CSettingUtilities::CmdRemove(), server.toCVariant());
|
||||
this->getIContextSettings()->value(path, CSettingUtilities::CmdRemove(), CVariant::from(server));
|
||||
}
|
||||
else if (sender == this->ui->pb_SettingsTnServersSaveServer)
|
||||
{
|
||||
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), server.toCVariant());
|
||||
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), CVariant::from(server));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace BlackGui
|
||||
// update
|
||||
CSimulatorPluginInfo currentDriver = simDrivers[index];
|
||||
const QString path = CSettingUtilities::appendPaths(IContextSettings::PathSimulatorSettings(), CSettingsSimulator::ValueSelectedDriver());
|
||||
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), currentDriver.toCVariant());
|
||||
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), CVariant::from(currentDriver));
|
||||
}
|
||||
|
||||
void CSettingsSimulatorComponent::ps_settingsHaveChanged(uint settingsType)
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace BlackGui
|
||||
// if the channel is selected, do nothing
|
||||
if (!this->isCorrespondingTextMessageTabSelected(message))
|
||||
{
|
||||
emit this->displayInInfoWindow(message.toCVariant(), 5 * 1000);
|
||||
emit this->displayInInfoWindow(CVariant::from(message), 5 * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace BlackGui
|
||||
{
|
||||
ContainerType sortedContainer = this->sortContainerByColumn(container, sortColumn, sortOrder);
|
||||
QMetaObject::invokeMethod(this, "ps_updateContainer",
|
||||
Q_ARG(BlackMisc::CVariant, sortedContainer.toCVariant()), Q_ARG(bool, false));
|
||||
Q_ARG(BlackMisc::CVariant, CVariant::from(sortedContainer)), Q_ARG(bool, false));
|
||||
});
|
||||
worker->then(this, &CListModelBase::asyncUpdateFinished);
|
||||
return worker;
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace BlackGui
|
||||
if (rowIndex < 0) { return false; }
|
||||
QModelIndex i = this->index(rowIndex, 0);
|
||||
const CNameVariantPair cv = this->at(i);
|
||||
return value == cv.toCVariant();
|
||||
return value == CVariant::from(cv);
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace BlackGui
|
||||
{
|
||||
ContainerType sortedContainer = model->sortContainerByColumn(container, sortColumn, sortOrder);
|
||||
QMetaObject::invokeMethod(this, "ps_updateContainer",
|
||||
Q_ARG(BlackMisc::CVariant, sortedContainer.toCVariant()), Q_ARG(bool, false), Q_ARG(bool, resize));
|
||||
Q_ARG(BlackMisc::CVariant, CVariant::from(sortedContainer)), Q_ARG(bool, false), Q_ARG(bool, resize));
|
||||
});
|
||||
worker->then(this, &CViewBase::asyncUpdateFinished);
|
||||
return worker;
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CVoiceRoom::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAircraft::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAircraftIcaoCode::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAircraftIcaoData::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAircraftLights::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAircraftParts::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (ITimestampBased::canHandleIndex(index))
|
||||
{
|
||||
return ITimestampBased::propertyByIndex(index);
|
||||
@@ -45,7 +45,7 @@ namespace BlackMisc
|
||||
case IndexCallsign:
|
||||
return m_correspondingCallsign.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexEngines:
|
||||
return this->m_engines.toCVariant();
|
||||
return CVariant::fromValue(this->m_engines);
|
||||
case IndexFlapsPercentage:
|
||||
return CVariant::fromValue(this->m_flapsPercentage);
|
||||
case IndexGearDown:
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAircraftSituation::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (ITimestampBased::canHandleIndex(index))
|
||||
{
|
||||
return ITimestampBased::propertyByIndex(index);
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAirlineIcaoCode::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAirport::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAtcStation::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CCallsign::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace BlackMisc
|
||||
template <class AVIO>
|
||||
CVariant CModulator<AVIO>::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*derived()); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CTransponder::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CCoordinateGeodetic::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (ICoordinateGeodetic::canHandleIndex(index))
|
||||
{
|
||||
return ICoordinateGeodetic::propertyByIndex(index);
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CJoystickButton::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CKeyboardKey::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CNameVariantPair::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAircraftMapping::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -70,12 +70,12 @@ namespace BlackMisc
|
||||
|
||||
CVariant CClient::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexCapabilities:
|
||||
return this->m_capabilities.toCVariant();
|
||||
return CVariant::fromValue(this->m_capabilities);
|
||||
case IndexCapabilitiesString:
|
||||
return CVariant(this->getCapabilitiesAsString());
|
||||
case IndexCallsign:
|
||||
@@ -91,7 +91,7 @@ namespace BlackMisc
|
||||
case IndexVoiceCapabilitiesPixmap:
|
||||
return CVariant::from(this->m_voiceCapabilities.toPixmap());
|
||||
case IndexVoiceCapabilitiesIcon:
|
||||
return this->m_voiceCapabilities.toIcon().toCVariant();
|
||||
return CVariant::fromValue(this->m_voiceCapabilities.toIcon());
|
||||
case IndexVoiceCapabilitiesString:
|
||||
return CVariant(this->m_voiceCapabilities.toQString(true));
|
||||
default:
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CServer::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CTextMessage::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CUser::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant COriginator::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
|
||||
|
||||
@@ -345,14 +345,14 @@ namespace BlackMisc
|
||||
template <class MU, class PQ>
|
||||
CVariant CPhysicalQuantity<MU, PQ>::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*derived()); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexValue:
|
||||
return CVariant::from(this->m_value);
|
||||
case IndexUnit:
|
||||
return this->m_unit.toCVariant();
|
||||
return CVariant::from(this->m_unit);
|
||||
case IndexValueRounded0DigitsWithUnit:
|
||||
return CVariant::from(this->valueRoundedWithUnit(0));
|
||||
case IndexValueRounded1DigitsWithUnit:
|
||||
|
||||
@@ -49,55 +49,55 @@ namespace BlackMisc
|
||||
if (CMeasurementUnit::isValidUnitSymbol<CAccelerationUnit>(unit))
|
||||
{
|
||||
CAcceleration pq(numberD, CMeasurementUnit::unitFromSymbol<CAccelerationUnit>(unit, false));
|
||||
return pq.toCVariant();
|
||||
return CVariant::from(pq);
|
||||
}
|
||||
|
||||
if (CMeasurementUnit::isValidUnitSymbol<CAngleUnit>(unit))
|
||||
{
|
||||
CAngle pq(numberD, CMeasurementUnit::unitFromSymbol<CAngleUnit>(unit, false));
|
||||
return pq.toCVariant();
|
||||
return CVariant::from(pq);
|
||||
}
|
||||
|
||||
if (CMeasurementUnit::isValidUnitSymbol<CFrequencyUnit>(unit))
|
||||
{
|
||||
CFrequency pq(numberD, CMeasurementUnit::unitFromSymbol<CFrequencyUnit>(unit, false));
|
||||
return pq.toCVariant();
|
||||
return CVariant::from(pq);
|
||||
}
|
||||
|
||||
if (CMeasurementUnit::isValidUnitSymbol<CLengthUnit>(unit))
|
||||
{
|
||||
CLength pq(numberD, CMeasurementUnit::unitFromSymbol<CLengthUnit>(unit, false));
|
||||
return pq.toCVariant();
|
||||
return CVariant::from(pq);
|
||||
}
|
||||
|
||||
if (CMeasurementUnit::isValidUnitSymbol<CMassUnit>(unit))
|
||||
{
|
||||
CMass pq(numberD, CMeasurementUnit::unitFromSymbol<CMassUnit>(unit, false));
|
||||
return pq.toCVariant();
|
||||
return CVariant::from(pq);
|
||||
}
|
||||
|
||||
if (CMeasurementUnit::isValidUnitSymbol<CPressureUnit>(unit))
|
||||
{
|
||||
CPressure pq(numberD, CMeasurementUnit::unitFromSymbol<CPressureUnit>(unit, false));
|
||||
return pq.toCVariant();
|
||||
return CVariant::from(pq);
|
||||
}
|
||||
|
||||
if (CMeasurementUnit::isValidUnitSymbol<CSpeedUnit>(unit))
|
||||
{
|
||||
CSpeed pq(numberD, CMeasurementUnit::unitFromSymbol<CSpeedUnit>(unit, false));
|
||||
return pq.toCVariant();
|
||||
return CVariant::from(pq);
|
||||
}
|
||||
|
||||
if (CMeasurementUnit::isValidUnitSymbol<CTimeUnit>(unit))
|
||||
{
|
||||
CTime pq(numberD, CMeasurementUnit::unitFromSymbol<CTimeUnit>(unit, false));
|
||||
return pq.toCVariant();
|
||||
return CVariant::from(pq);
|
||||
}
|
||||
|
||||
if (CMeasurementUnit::isValidUnitSymbol<CTemperatureUnit>(unit))
|
||||
{
|
||||
CTemperature pq(numberD, CMeasurementUnit::unitFromSymbol<CTemperatureUnit>(unit, false));
|
||||
return pq.toCVariant();
|
||||
return CVariant::from(pq);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BlackMisc
|
||||
{
|
||||
// QVariant cannot be compared directly
|
||||
CVariant p = variant.propertyByIndex(it.key()); // from value object
|
||||
CVariant v = it.value().toCVariant(); // from map
|
||||
CVariant v = it.value(); // from map
|
||||
if (p != v) return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace BlackMisc
|
||||
bool isEmpty() const { return this->m_values.isEmpty(); }
|
||||
|
||||
//! Value
|
||||
CVariant value(const CPropertyIndex &index) const { return this->m_values.value(index).toCVariant(); }
|
||||
CVariant value(const CPropertyIndex &index) const { return CVariant::from(this->m_values.value(index)); }
|
||||
|
||||
//! Set value
|
||||
void value(const CPropertyIndex &index, const CVariant &value) { this->m_values.value(index, value); }
|
||||
@@ -252,7 +252,7 @@ namespace BlackMisc
|
||||
const auto &map = indexMap.map();
|
||||
for (auto it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
const CVariant value = it.value().toCVariant();
|
||||
const CVariant value = it.value();
|
||||
const CPropertyIndex index = it.key();
|
||||
if (skipEqualValues)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CSettingKeyboardHotkey::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAircraftModel::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAirspaceAircraftSnapshot::propertyByIndex(const CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CAircraftCfgEntries::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace BlackMisc
|
||||
bool CRemoteAircraftProviderDummy::updateAircraftModel(const CCallsign &callsign, const CAircraftModel &model, const COriginator &originator)
|
||||
{
|
||||
Q_UNUSED(originator);
|
||||
CPropertyIndexVariantMap vm(CSimulatedAircraft::IndexModel, model.toCVariant());
|
||||
CPropertyIndexVariantMap vm(CSimulatedAircraft::IndexModel, CVariant::from(model));
|
||||
int n = this->m_aircraft.applyIfCallsign(callsign, vm);
|
||||
return n > 0;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace BlackMisc
|
||||
|
||||
CVariant CSimulatedAircraft::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -57,12 +57,12 @@ namespace BlackMisc
|
||||
|
||||
CVariant CSimulatorSetup::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexData:
|
||||
return m_data.toCVariant();
|
||||
return CVariant::from(m_data);
|
||||
default:
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace BlackMisc
|
||||
*/
|
||||
CVariant CStatusMessage::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
|
||||
@@ -47,15 +47,15 @@ namespace BlackMisc
|
||||
CAtcStation station;
|
||||
if (byPropertyIndex)
|
||||
{
|
||||
station.setPropertyByIndex(CCallsign(cs).toCVariant(), CAtcStation::IndexCallsign);
|
||||
station.setPropertyByIndex(user.toCVariant(), CAtcStation::IndexController);
|
||||
station.setPropertyByIndex(CFrequency(f, CFrequencyUnit::MHz()).toCVariant(), CAtcStation::IndexFrequency);
|
||||
station.setPropertyByIndex(CLength(50, CLengthUnit::km()).toCVariant(), CAtcStation::IndexRange);
|
||||
station.setPropertyByIndex(geoPos.toCVariant(), CAtcStation::IndexPosition);
|
||||
station.setPropertyByIndex(CVariant::from(CCallsign(cs)), CAtcStation::IndexCallsign);
|
||||
station.setPropertyByIndex(CVariant::from(user), CAtcStation::IndexController);
|
||||
station.setPropertyByIndex(CVariant::from(CFrequency(f, CFrequencyUnit::MHz())), CAtcStation::IndexFrequency);
|
||||
station.setPropertyByIndex(CVariant::from(CLength(50, CLengthUnit::km())), CAtcStation::IndexRange);
|
||||
station.setPropertyByIndex(CVariant::from(geoPos), CAtcStation::IndexPosition);
|
||||
station.setPropertyByIndex(CVariant::from(false), CAtcStation::IndexIsOnline);
|
||||
station.setPropertyByIndex(CVariant::from(dtFrom), CAtcStation::IndexBookedFrom);
|
||||
station.setPropertyByIndex(CVariant::from(dtUntil), CAtcStation::IndexBookedUntil);
|
||||
station.setPropertyByIndex(CLength(index + 1, CLengthUnit::NM()).toCVariant(), CAtcStation::IndexDistanceToOwnAircraft);
|
||||
station.setPropertyByIndex(CVariant::from(CLength(index + 1, CLengthUnit::NM())), CAtcStation::IndexDistanceToOwnAircraft);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace BlackMisc
|
||||
using Mixin::Index<Derived>::apply;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::MetaType::toCVariant
|
||||
using Mixin::MetaType<Derived>::toCVariant;
|
||||
// using Mixin::MetaType<Derived>::toCVariant;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::MetaType::convertFromCVariant
|
||||
using Mixin::MetaType<Derived>::convertFromCVariant;
|
||||
|
||||
@@ -65,12 +65,8 @@ namespace BlackMisc
|
||||
return baseIsA(static_cast<const MetaBaseOfT<Derived> *>(derived()), metaTypeId);
|
||||
}
|
||||
|
||||
//! Method to return CVariant
|
||||
//! \deprecated Use CVariant::to() instead.
|
||||
CVariant toCVariant() const;
|
||||
|
||||
//! Set from CVariant
|
||||
//! \deprecated Use CVariant::from() instead.
|
||||
//! \deprecated Use CVariant::to() instead.
|
||||
void convertFromCVariant(const CVariant &variant);
|
||||
|
||||
//! Return QVariant, used with DBus QVariant lists
|
||||
@@ -112,7 +108,6 @@ namespace BlackMisc
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::registerMetadata; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::getMetaTypeId; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::isA; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::toCVariant; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::toQVariant; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::convertFromCVariant; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::convertFromQVariant;
|
||||
@@ -125,7 +120,6 @@ namespace BlackMisc
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::registerMetadata; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::getMetaTypeId; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::isA; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::toCVariant; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::toQVariant; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::convertFromCVariant; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::convertFromQVariant;
|
||||
@@ -375,11 +369,6 @@ namespace BlackMisc
|
||||
|
||||
namespace Mixin
|
||||
{
|
||||
template <class Derived, class... AdditionalTypes>
|
||||
CVariant MetaType<Derived, AdditionalTypes...>::toCVariant() const
|
||||
{
|
||||
return CVariant(derived()->toQVariant());
|
||||
}
|
||||
template <class Derived, class... AdditionalTypes>
|
||||
void MetaType<Derived, AdditionalTypes...>::convertFromCVariant(const CVariant &variant)
|
||||
{
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace BlackSimPlugin
|
||||
|
||||
void CSimulatorFsCommon::ps_aircraftCfgParsingFinished()
|
||||
{
|
||||
setPluginData(this, "aircraft_cfg", m_aircraftCfgParser.getAircraftCfgEntriesList().toCVariant());
|
||||
setPluginData(this, "aircraft_cfg", CVariant::from(m_aircraftCfgParser.getAircraftCfgEntriesList()));
|
||||
m_modelMatcher.setInstalledModels(m_aircraftCfgParser.getAircraftCfgEntriesList().toAircraftModelList());
|
||||
|
||||
// Now the matcher has all required information to be initialized
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace BlackMisc
|
||||
*/
|
||||
CVariant CTestValueObject::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
{
|
||||
if (index.isMyself()) { return this->toCVariant(); }
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user