mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:38:15 +08:00
Issue #77 All classes propertyindex methods use CPropertyIndexRef and QVariant
This commit is contained in:
@@ -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<ColumnIndex>();
|
||||
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<CGlobalSetup>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CGlobalSetup>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index))
|
||||
{
|
||||
ITimestampBased::setPropertyByIndex(index, variant);
|
||||
@@ -437,7 +437,7 @@ namespace BlackCore
|
||||
case IndexCrashReportServerUrl: m_crashReportServerUrl = variant.value<CUrl>(); 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<CServerList>(); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CLauncherSetup>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CLauncherSetup>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CVatsimSetup>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CVatsimSetup>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index))
|
||||
{
|
||||
ITimestampBased::setPropertyByIndex(index, variant);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CReaderSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CReaderSettings>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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<ColumnIndex>();
|
||||
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<CRawFsdMessageSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CRawFsdMessageSettings>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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<FileWriteMode>(); break;
|
||||
case IndexFileDir: this->m_FileDir = variant.toString(); break;
|
||||
case IndexFileWriteMode: this->m_fileWriteMode = variant.value<FileWriteMode>(); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user