mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
refs #247 Style.
This commit is contained in:
@@ -305,10 +305,8 @@ namespace BlackGui
|
||||
{
|
||||
QVariant aQv = a.propertyByIndex(propertyIndex);
|
||||
QVariant bQv = b.propertyByIndex(propertyIndex);
|
||||
int compare = (order == Qt::AscendingOrder) ?
|
||||
BlackMisc::compareQVariants(aQv, bQv) :
|
||||
BlackMisc::compareQVariants(bQv, aQv);
|
||||
return compare < 0;
|
||||
int compare = BlackMisc::compareQVariants(aQv, bQv);
|
||||
return (order == Qt::AscendingOrder) ? (compare < 0) : (compare > 0);
|
||||
};
|
||||
|
||||
// KWB: qDebug() will be removed soon
|
||||
|
||||
@@ -223,10 +223,10 @@ namespace BlackMisc
|
||||
//! Meaningful default settings for Transponder
|
||||
void initTransponder();
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex()
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant, index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant, index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
//! Valid designator?
|
||||
|
||||
@@ -56,10 +56,10 @@ namespace BlackMisc
|
||||
: m_position(position), m_altitude(altitude), m_heading(heading), m_pitch(pitch),
|
||||
m_bank(bank), m_groundspeed(gs), m_timestamp(QDateTime::currentDateTimeUtc()) {}
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex(index)
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant,index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
//! Get position
|
||||
|
||||
@@ -109,10 +109,10 @@ namespace BlackMisc
|
||||
return this->getPosition().longitude();
|
||||
}
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex()
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant, index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -254,10 +254,10 @@ namespace BlackMisc
|
||||
return this->getPosition().longitude();
|
||||
}
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex()
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant, index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const CPropertyIndex &index) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant, index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
//! Valid callsign?
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant, index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant, index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
//! Is valid transponder code?
|
||||
|
||||
@@ -57,10 +57,10 @@ namespace BlackMisc
|
||||
//! Has icon
|
||||
bool hasIcon() const;
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex()
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(variant, index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -38,10 +38,10 @@ namespace BlackMisc
|
||||
//! Constructor.
|
||||
CAircraftModel(const QString &model, bool isQueriedString) : m_modelString(model), m_queriedModelStringFlag(isQueriedString) {}
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex(int)
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(const QVariant, int)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
//! Queried model string
|
||||
|
||||
@@ -111,10 +111,10 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::toIcon()
|
||||
virtual CIcon toIcon() const override { return this->m_user.toIcon(); }
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex(int)
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(const QVariant, int)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -86,10 +86,10 @@ namespace BlackMisc
|
||||
//! Validate, provide details about issues
|
||||
BlackMisc::CStatusMessageList validate() const;
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex(int)
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(const QVariant &, int index)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -117,10 +117,10 @@ namespace BlackMisc
|
||||
//! \copydoc CValueObject::toIcon()
|
||||
virtual BlackMisc::CIcon toIcon() const override { return this->getCallsign().toIcon(); }
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex(int)
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(const QVariant, int)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
/*!
|
||||
|
||||
@@ -235,10 +235,10 @@ namespace BlackMisc
|
||||
*this = CPqString::parse<PQ>(value, CPqString::SeparatorsCLocale);
|
||||
}
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex(int)
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::setPropertyByIndex(const QVariant, int)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -120,10 +120,10 @@ namespace BlackMisc
|
||||
//! Severities as strings
|
||||
static const QStringList &allSeverityStrings();
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex(int)
|
||||
//! \copydoc CValueObject::propertyByIndex
|
||||
virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
|
||||
|
||||
//! \copydoc CValueObject::propertyByIndex(const QVariant, int)
|
||||
//! \copydoc CValueObject::setPropertyByIndex
|
||||
virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override;
|
||||
|
||||
//! To HTML
|
||||
|
||||
@@ -65,81 +65,35 @@ namespace BlackMisc
|
||||
|
||||
uint CVariant::getValueHash() const
|
||||
{
|
||||
uint h = 0;
|
||||
QVariant qv = this->toQVariant();
|
||||
switch (qv.type())
|
||||
switch (m_v.type())
|
||||
{
|
||||
case QVariant::Int:
|
||||
h = ::qHash(qv.toInt());
|
||||
break;
|
||||
case QVariant::UInt:
|
||||
h = ::qHash(qv.toUInt());
|
||||
break;
|
||||
case QVariant::Bool:
|
||||
h = ::qHash(qv.toUInt());
|
||||
break;
|
||||
case QVariant::Double:
|
||||
h = ::qHash(qv.toUInt());
|
||||
break;
|
||||
case QVariant::LongLong:
|
||||
h = ::qHash(qv.toLongLong());
|
||||
break;
|
||||
case QVariant::ULongLong:
|
||||
h = ::qHash(qv.toULongLong());
|
||||
break;
|
||||
case QVariant::String:
|
||||
h = ::qHash(qv.toString());
|
||||
break;
|
||||
case QVariant::Char:
|
||||
h = ::qHash(qv.toChar());
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
h = ::qHash(qv.toString());
|
||||
break;
|
||||
case QVariant::ByteArray:
|
||||
h = ::qHash(qv.toByteArray());
|
||||
break;
|
||||
case QVariant::Date:
|
||||
case QVariant::Time:
|
||||
case QVariant::DateTime:
|
||||
case QVariant::Url:
|
||||
case QVariant::Locale:
|
||||
case QVariant::RegExp:
|
||||
h = ::qHash(qv.toString());
|
||||
break;
|
||||
case QVariant::Map:
|
||||
case QVariant::List:
|
||||
case QVariant::BitArray:
|
||||
case QVariant::Size:
|
||||
case QVariant::SizeF:
|
||||
case QVariant::Rect:
|
||||
case QVariant::LineF:
|
||||
case QVariant::Line:
|
||||
case QVariant::RectF:
|
||||
case QVariant::Point:
|
||||
case QVariant::PointF:
|
||||
case QVariant::UserType:
|
||||
case QVariant::Invalid:
|
||||
h = 2; // known, but not supported
|
||||
break;
|
||||
case QVariant::Int: return qHash(m_v.toInt());
|
||||
case QVariant::UInt: return qHash(m_v.toUInt());
|
||||
case QVariant::Bool: return qHash(m_v.toUInt());
|
||||
case QVariant::Double: return qHash(m_v.toUInt());
|
||||
case QVariant::LongLong: return qHash(m_v.toLongLong());
|
||||
case QVariant::ULongLong: return qHash(m_v.toULongLong());
|
||||
case QVariant::String: return qHash(m_v.toString());
|
||||
case QVariant::Char: return qHash(m_v.toChar());
|
||||
case QVariant::ByteArray: return qHash(m_v.toByteArray());
|
||||
default:
|
||||
{
|
||||
// value object?
|
||||
const QVariant qv = this->toQVariant();
|
||||
const CValueObject *cv = CValueObject::fromQVariant(qv);
|
||||
const CValueObject *cv = CValueObject::fromQVariant(m_v);
|
||||
if (cv)
|
||||
{
|
||||
h = cv->getValueHash();
|
||||
return cv->getValueHash();
|
||||
}
|
||||
else if (m_v.canConvert<QString>())
|
||||
{
|
||||
return qHash(m_v.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
// no value object
|
||||
Q_ASSERT(false);
|
||||
qWarning() << "Unsupported CVariant type for getValueHash";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
QDBusArgument &operator <<(QDBusArgument &arg, const CVariant &var)
|
||||
|
||||
Reference in New Issue
Block a user