mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
Issue #77 All classes propertyindex methods use CPropertyIndexRef and QVariant
This commit is contained in:
@@ -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<ColumnIndex>();
|
||||
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<CAuthenticatedUser>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CAuthenticatedUser>(); return; }
|
||||
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CClient>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CClient>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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<BlackMisc::Aviation::CCallsign>()); break;
|
||||
case IndexVoiceCapabilities: m_voiceCapabilities.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CEcosystem>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CEcosystem>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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<ColumnIndex>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CFsdSetup>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CFsdSetup>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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<ColumnIndex>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CRawFsdMessage>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CRawFsdMessage>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; }
|
||||
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CRemoteFile>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CRemoteFile>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CRole>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CRole>(); return; }
|
||||
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CServer>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CServer>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; }
|
||||
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
@@ -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);}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
// 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<CNetworkSettings>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CNetworkSettings>(); 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
|
||||
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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
@@ -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<CTextMessage>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CTextMessage>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; }
|
||||
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
@@ -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<ColumnIndex>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CUrl>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CUrl>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CUrlLog>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CUrlLog>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; }
|
||||
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ColumnIndex>();
|
||||
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<CUser>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CUser>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
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<ColumnIndex>();
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user