mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
refs #655, Change signature (order) of setProperty/compareProperty
This commit is contained in:
committed by
Roland Winklmeier
parent
49094115b1
commit
0f5d2a29a8
@@ -119,10 +119,10 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CAuthenticatedUser::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
void CAuthenticatedUser::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CAuthenticatedUser>(); return; }
|
||||
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(variant, index); return; }
|
||||
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
@@ -139,7 +139,7 @@ namespace BlackMisc
|
||||
this->setRealName(variant.value<QString>());
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(variant, index);
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace BlackMisc
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
void CClient::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CClient>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
@@ -109,22 +109,22 @@ namespace BlackMisc
|
||||
this->m_capabilities = variant.value<CPropertyIndexVariantMap>();
|
||||
break;
|
||||
case IndexModel:
|
||||
this->m_model.setPropertyByIndex(variant, index.copyFrontRemoved());;
|
||||
this->m_model.setPropertyByIndex(index.copyFrontRemoved(), variant);;
|
||||
break;
|
||||
case IndexServer:
|
||||
this->m_server = variant.toQString();
|
||||
break;
|
||||
case IndexUser:
|
||||
this->m_user.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
this->m_user.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
break;
|
||||
case IndexCallsign:
|
||||
this->m_user.setCallsign(variant.value<BlackMisc::Aviation::CCallsign>());
|
||||
break;
|
||||
case IndexVoiceCapabilities:
|
||||
this->m_voiceCapabilities.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
this->m_voiceCapabilities.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(variant, index);
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace BlackMisc
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -41,10 +41,10 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CRole::setPropertyByIndex(const CVariant &variant, const CPropertyIndex &index)
|
||||
void CRole::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CRole>(); return; }
|
||||
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(variant, index); return; }
|
||||
if (IDatastoreObjectWithIntegerKey::canHandleIndex(index)) { IDatastoreObjectWithIntegerKey::setPropertyByIndex(index, variant); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ namespace BlackMisc
|
||||
case IndexDescription:
|
||||
this->setDescription(variant.value<QString>());
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(variant, index);
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace BlackMisc
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! Role from DB JSON
|
||||
static CRole fromDatabaseJson(const QJsonObject &json);
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CServer::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
void CServer::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CServer>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
@@ -110,13 +110,13 @@ namespace BlackMisc
|
||||
this->setName(variant.value<QString>());
|
||||
break;
|
||||
case IndexUser:
|
||||
this->m_user.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
this->m_user.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
break;
|
||||
case IndexIsAcceptingConnections:
|
||||
this->setIsAcceptingConnections(variant.value<bool>());
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(variant, index);
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace BlackMisc
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -204,25 +204,25 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CTextMessage::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
void CTextMessage::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CTextMessage>(); return; }
|
||||
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(variant, index); return; }
|
||||
if (ITimestampBased::canHandleIndex(index)) { ITimestampBased::setPropertyByIndex(index, variant); return; }
|
||||
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexSenderCallsign:
|
||||
this->m_senderCallsign.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
this->m_senderCallsign.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
break;
|
||||
case IndexRecipientCallsign:
|
||||
this->m_recipientCallsign.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
this->m_recipientCallsign.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
break;
|
||||
case IndexMessage:
|
||||
this->m_message = variant.value<QString>();
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(variant, index);
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace BlackMisc
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CUrl::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
void CUrl::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CUrl>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
@@ -257,7 +257,7 @@ namespace BlackMisc
|
||||
this->setScheme(variant.value<QString>());
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(variant, index);
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace BlackMisc
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CUser::setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index)
|
||||
void CUser::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CUser>(); return; }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
@@ -207,18 +207,18 @@ namespace BlackMisc
|
||||
this->setRealName(variant.value<QString>());
|
||||
break;
|
||||
case IndexHomebase:
|
||||
this->m_homebase.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
this->m_homebase.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
break;
|
||||
case IndexCallsign:
|
||||
this->m_callsign.setPropertyByIndex(variant, index.copyFrontRemoved());
|
||||
this->m_callsign.setPropertyByIndex(index.copyFrontRemoved(), variant);
|
||||
break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(variant, index);
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int CUser::comparePropertyByIndex(const CUser &compareValue, const CPropertyIndex &index) const
|
||||
int CUser::comparePropertyByIndex(const CPropertyIndex &index, const CUser &compareValue) const
|
||||
{
|
||||
if (index.isMyself()) { return this->getRealName().compare(compareValue.getRealName(), Qt::CaseInsensitive); }
|
||||
ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
@@ -233,9 +233,9 @@ namespace BlackMisc
|
||||
case IndexRealName:
|
||||
return this->m_realname.compare(compareValue.getRealName(), Qt::CaseInsensitive);
|
||||
case IndexHomebase:
|
||||
return this->m_homebase.comparePropertyByIndex(compareValue.getHomebase(), index.copyFrontRemoved());
|
||||
return this->m_homebase.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getHomebase());
|
||||
case IndexCallsign:
|
||||
return this->m_callsign.comparePropertyByIndex(compareValue.getCallsign(), index.copyFrontRemoved());
|
||||
return this->m_callsign.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCallsign());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -120,10 +120,10 @@ namespace BlackMisc
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CVariant &variant, const BlackMisc::CPropertyIndex &index);
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! Compare by index
|
||||
int comparePropertyByIndex(const CUser &compareValue, const CPropertyIndex &index) const;
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const CUser &compareValue) const;
|
||||
|
||||
//! This and another user exchange missing data, This user has priority and overrides first.
|
||||
void syncronizeData(CUser &otherUser);
|
||||
|
||||
Reference in New Issue
Block a user