mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Set "ft" as default unit for altitude formatter
See https://discordapp.com/channels/539048679160676382/539486489977946112/692158405145788437
This commit is contained in:
committed by
Mat Sutcliffe
parent
605ccdbaa8
commit
82f7771882
@@ -372,7 +372,7 @@ namespace BlackGui
|
||||
|
||||
CVariant CBoolIconFormatter::displayRole(const CVariant &dataCVariant) const
|
||||
{
|
||||
Q_UNUSED(dataCVariant);
|
||||
Q_UNUSED(dataCVariant)
|
||||
Q_ASSERT_X(false, "CBoolIconFormatter", "this role should be disabled with icon boolean");
|
||||
return CVariant();
|
||||
}
|
||||
@@ -396,7 +396,14 @@ namespace BlackGui
|
||||
CVariant CAltitudeFormatter::displayRole(const CVariant &altitude) const
|
||||
{
|
||||
CAltitude alt(altitude.to<CAltitude>());
|
||||
if (m_flightLevel) { alt.toFlightLevel(); }
|
||||
if (m_flightLevel)
|
||||
{
|
||||
alt.toFlightLevel();
|
||||
}
|
||||
else
|
||||
{
|
||||
alt.switchUnit(m_unit);
|
||||
}
|
||||
return alt.toQString(m_useI18n);
|
||||
}
|
||||
|
||||
@@ -405,7 +412,7 @@ namespace BlackGui
|
||||
|
||||
CVariant CColorFormatter::displayRole(const CVariant &dataCVariant) const
|
||||
{
|
||||
Q_UNUSED(dataCVariant);
|
||||
Q_UNUSED(dataCVariant)
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "this role should be disabled with RGB color");
|
||||
return CVariant();
|
||||
}
|
||||
|
||||
@@ -350,10 +350,17 @@ namespace BlackGui
|
||||
//! Constructor
|
||||
CAltitudeFormatter(bool flightlevel = false, int alignment = alignRightVCenter(), bool i18n = true) : CDefaultFormatter(alignment, i18n), m_flightLevel(flightlevel) {}
|
||||
|
||||
//! Constructor
|
||||
CAltitudeFormatter(const BlackMisc::PhysicalQuantities::CLengthUnit &unit, bool flightlevel = false, int alignment = alignRightVCenter(), bool i18n = true) : CDefaultFormatter(alignment, i18n), m_unit(unit), m_flightLevel(flightlevel) {}
|
||||
|
||||
//! Set the unit, normally ft/m
|
||||
void setUnit(const BlackMisc::PhysicalQuantities::CLengthUnit &unit);
|
||||
|
||||
//! \copydoc CDefaultFormatter::displayRole
|
||||
virtual BlackMisc::CVariant displayRole(const BlackMisc::CVariant &altitude) const override;
|
||||
|
||||
private:
|
||||
BlackMisc::PhysicalQuantities::CLengthUnit m_unit = BlackMisc::PhysicalQuantities::CLengthUnit::ft();
|
||||
const bool m_flightLevel = false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user