mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Issue #77 All classes propertyindex methods use CPropertyIndexRef and QVariant
This commit is contained in:
@@ -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<ColumnIndex>();
|
||||
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<CModelSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CModelSettings>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CSimulatorSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CSimulatorSettings>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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<QStringList>(); 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<ColumnIndex>();
|
||||
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<CSimulatorMessagesSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CSimulatorMessagesSettings>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CSwiftPluginSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CSwiftPluginSettings>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CXSwiftBusSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CXSwiftBusSettings>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); }
|
||||
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user