mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-02 15:15:39 +08:00
Ref T385, added propertyBy functions for airport ICAO + style
This commit is contained in:
@@ -12,13 +12,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QString CAirportIcaoCode::convertToQString(bool /** i18n **/) const
|
QString CAirportIcaoCode::convertToQString(bool /** i18n **/) const
|
||||||
{
|
{
|
||||||
return this->m_icaoCode;
|
return m_icaoCode;
|
||||||
}
|
|
||||||
|
|
||||||
int CAirportIcaoCode::comparePropertyByIndex(const CPropertyIndex &index, const CAirportIcaoCode &compareValue) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(index);
|
|
||||||
return this->m_icaoCode.compare(compareValue.getIcaoCode(), Qt::CaseInsensitive);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAirportIcaoCode::hasValidIcaoCode() const
|
bool CAirportIcaoCode::hasValidIcaoCode() const
|
||||||
@@ -50,5 +44,24 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
return (containsChar(icaoCode, [](QChar c) { return c.isDigit(); }));
|
return (containsChar(icaoCode, [](QChar c) { return c.isDigit(); }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CVariant CAirportIcaoCode::propertyByIndex(const CPropertyIndex &index) const
|
||||||
|
{
|
||||||
|
if (index.isMyself()) { return CVariant::from(*this); }
|
||||||
|
return CValueObject::propertyByIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAirportIcaoCode::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||||
|
{
|
||||||
|
if (index.isMyself()) { (*this) = variant.to<CAirportIcaoCode>(); return; }
|
||||||
|
CValueObject::setPropertyByIndex(index, variant);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CAirportIcaoCode::comparePropertyByIndex(const CPropertyIndex &index, const CAirportIcaoCode &compareValue) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(index);
|
||||||
|
return m_icaoCode.compare(compareValue.getIcaoCode(), Qt::CaseInsensitive);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -65,7 +65,13 @@ namespace BlackMisc
|
|||||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
//! Compare for index
|
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||||
|
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||||
|
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
|
||||||
int comparePropertyByIndex(const CPropertyIndex &index, const CAirportIcaoCode &compareValue) const;
|
int comparePropertyByIndex(const CPropertyIndex &index, const CAirportIcaoCode &compareValue) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ namespace BlackMisc
|
|||||||
return newRealName;
|
return newRealName;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVariant CUser::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
CVariant CUser::propertyByIndex(const CPropertyIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return CVariant::from(*this); }
|
if (index.isMyself()) { return CVariant::from(*this); }
|
||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ namespace BlackMisc
|
|||||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||||
|
|
||||||
//! Compare by index
|
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
|
||||||
int comparePropertyByIndex(const CPropertyIndex &index, const CUser &compareValue) const;
|
int comparePropertyByIndex(const CPropertyIndex &index, const CUser &compareValue) const;
|
||||||
|
|
||||||
//! This and another user exchange missing data, This user has priority and overrides first.
|
//! This and another user exchange missing data, This user has priority and overrides first.
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ namespace BlackMisc
|
|||||||
CVariant Index<Derived>::propertyByIndex(const CPropertyIndex &index) const
|
CVariant Index<Derived>::propertyByIndex(const CPropertyIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return myself<Derived>(); }
|
if (index.isMyself()) { return myself<Derived>(); }
|
||||||
const auto i = index.frontCasted<ColumnIndex>();
|
const auto i = index.frontCasted<ColumnIndex>(); // keep that "auto", otherwise I won's compile
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexIcon: return CVariant::from(derived()->toIcon());
|
case IndexIcon: return CVariant::from(derived()->toIcon());
|
||||||
|
|||||||
Reference in New Issue
Block a user