mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 14:15:35 +08:00
Formatting, help text beautifyHelpMessage, improved convertToQString
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a34be02e07
commit
c1482dca36
@@ -29,7 +29,6 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
//! Value object for ICAO classification
|
||||
class BLACKMISC_EXPORT CAircraftIcaoCode :
|
||||
public CValueObject<CAircraftIcaoCode>,
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackMisc
|
||||
QLatin1Literal(" gs: ") % (this->m_groundSpeed.toQString(i18n)) %
|
||||
QLatin1Literal(" elevation: ") % (this->m_groundElevation.toQString(i18n)) %
|
||||
QLatin1Literal(" heading: ") % (this->m_heading.toQString(i18n)) %
|
||||
QLatin1Literal(" timestamp: ") % (this->getFormattedUtcTimestampDhms());
|
||||
QLatin1Literal(" timestamp: ") % (this->hasValidTimestamp() ? this->getFormattedUtcTimestampDhms() : QStringLiteral("-"));
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace BlackMisc
|
||||
{ }
|
||||
|
||||
CAirport::CAirport(const CAirportIcaoCode &icao, const BlackMisc::Geo::CCoordinateGeodetic &position, const QString &descriptiveName) :
|
||||
m_icao(icao), m_descriptiveName(descriptiveName), m_position(position)
|
||||
m_descriptiveName(descriptiveName), m_icao(icao), m_position(position)
|
||||
{ }
|
||||
|
||||
void CAirport::updateMissingParts(const CAirport &airport)
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace BlackMisc
|
||||
//! Value object encapsulating information about an airpot.
|
||||
class BLACKMISC_EXPORT CAirport :
|
||||
public CValueObject<CAirport>,
|
||||
public BlackMisc::Db::IDatastoreObjectWithIntegerKey,
|
||||
public Geo::ICoordinateWithRelativePosition
|
||||
public Geo::ICoordinateWithRelativePosition,
|
||||
public BlackMisc::Db::IDatastoreObjectWithIntegerKey
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
@@ -148,23 +148,25 @@ namespace BlackMisc
|
||||
static CAirport fromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||
|
||||
private:
|
||||
CAirportIcaoCode m_icao;
|
||||
QString m_descriptiveName;
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_position;
|
||||
CCountry m_country;
|
||||
bool m_operating;
|
||||
CAirportIcaoCode m_icao;
|
||||
BlackMisc::CCountry m_country;
|
||||
BlackMisc::Geo::CCoordinateGeodetic m_position;
|
||||
|
||||
BLACK_METACLASS(
|
||||
CAirport,
|
||||
BLACK_METAMEMBER(dbKey),
|
||||
BLACK_METAMEMBER(timestampMSecsSinceEpoch),
|
||||
BLACK_METAMEMBER(icao),
|
||||
BLACK_METAMEMBER(descriptiveName),
|
||||
BLACK_METAMEMBER(position),
|
||||
BLACK_METAMEMBER(country),
|
||||
BLACK_METAMEMBER(operating),
|
||||
// ICoordinateWithRelativePosition
|
||||
BLACK_METAMEMBER(relativeDistance),
|
||||
BLACK_METAMEMBER(relativeBearing)
|
||||
BLACK_METAMEMBER(relativeBearing),
|
||||
// IDatastoreObjectWithIntegerKey
|
||||
BLACK_METAMEMBER(dbKey),
|
||||
BLACK_METAMEMBER(timestampMSecsSinceEpoch)
|
||||
);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
@@ -84,93 +85,49 @@ namespace BlackMisc
|
||||
|
||||
QString CAtcStation::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s = i18n ?
|
||||
QCoreApplication::translate("Aviation", "ATC station") :
|
||||
"ATC station";
|
||||
s.append(' ').append(this->m_callsign.toQString(i18n));
|
||||
static const QString atcI18n(QCoreApplication::translate("Aviation", "ATC station"));
|
||||
static const QString rangeI18n(QCoreApplication::translate("Aviation", "range"));
|
||||
static const QString fromUtcI18n(QCoreApplication::translate("Aviation", "from(UTC)"));
|
||||
static const QString untilUtcI18n(QCoreApplication::translate("Aviation", "until(UTC)"));
|
||||
|
||||
// position
|
||||
s.append(' ').append(this->m_position.toQString(i18n));
|
||||
const QString s = (i18n ? atcI18n : QLatin1Literal("ATC station")) %
|
||||
QLatin1Char(' ') % this->m_callsign.toQString(i18n) %
|
||||
QLatin1Char(' ') % this->m_position.toQString(i18n) %
|
||||
QLatin1String(" online: ") % boolToYesNo(m_isOnline) %
|
||||
|
||||
// Online?
|
||||
s.append(' ');
|
||||
if (this->m_isOnline)
|
||||
{
|
||||
i18n ? s.append(QCoreApplication::translate("Aviation", "online")) : s.append("online");
|
||||
}
|
||||
else
|
||||
{
|
||||
i18n ? s.append(QCoreApplication::translate("Aviation", "offline")) : s.append("offline");
|
||||
}
|
||||
// controller
|
||||
(!this->m_controller.isValid() ? QStringLiteral("") :
|
||||
QStringLiteral(" ") % this->m_controller.toQString(i18n)) %
|
||||
|
||||
// controller name
|
||||
if (this->m_controller.isValid())
|
||||
{
|
||||
s.append(' ');
|
||||
s.append(this->m_controller.toQString(i18n));
|
||||
}
|
||||
// frequency
|
||||
QLatin1Char(' ') % this->m_frequency.valueRoundedWithUnit(3, i18n) %
|
||||
|
||||
// frequency
|
||||
s.append(' ');
|
||||
s.append(this->m_frequency.valueRoundedWithUnit(3, i18n));
|
||||
// ATIS
|
||||
(!this->hasAtis() ? QStringLiteral("") :
|
||||
QStringLiteral(" ") % this->m_atis.toQString(i18n)) %
|
||||
|
||||
// ATIS
|
||||
if (this->hasAtis())
|
||||
{
|
||||
s.append(' ');
|
||||
s.append(this->m_atis.toQString(i18n));
|
||||
}
|
||||
// METAR
|
||||
(!this->hasMetar() ? QStringLiteral("") :
|
||||
QStringLiteral(" ") % this->m_metar.toQString(i18n)) %
|
||||
|
||||
// METAR
|
||||
if (this->hasMetar())
|
||||
{
|
||||
s.append(' ');
|
||||
s.append(this->m_metar.toQString(i18n));
|
||||
}
|
||||
// range
|
||||
QLatin1Char(' ') % (i18n ? rangeI18n : QLatin1Literal("range")) %
|
||||
QLatin1Char(' ') % this->m_range.toQString(i18n) %
|
||||
|
||||
// range
|
||||
s.append(' ');
|
||||
i18n ? s.append(s.append(QCoreApplication::translate("Aviation", "range"))) : s.append("range");
|
||||
s.append(": ");
|
||||
s.append(this->m_range.toQString(i18n));
|
||||
// distance / bearing
|
||||
QLatin1Char(' ') % ICoordinateWithRelativePosition::convertToQString(i18n) %
|
||||
|
||||
// distance to plane
|
||||
if (this->m_relativeDistance.isPositiveWithEpsilonConsidered())
|
||||
{
|
||||
s.append(' ');
|
||||
i18n ? s.append(QCoreApplication::translate("Aviation", "distance")) : s.append("distance");
|
||||
s.append(' ');
|
||||
s.append(this->m_relativeDistance.toQString(i18n));
|
||||
}
|
||||
// booking from/until
|
||||
QLatin1Char(' ') %
|
||||
(i18n ? fromUtcI18n : QLatin1Literal("from(UTC)")) %
|
||||
QLatin1Char(' ') %
|
||||
(this->m_bookedFromUtc.isNull() ? QLatin1String("-") : this->m_bookedFromUtc.toString("yy-MM-dd HH:mm")) %
|
||||
|
||||
// from / to
|
||||
if (!this->hasBookingTimes()) return s;
|
||||
QLatin1Char(' ') %
|
||||
(i18n ? untilUtcI18n : QLatin1Literal("until(UTC)")) %
|
||||
QLatin1Char(' ') %
|
||||
(this->m_bookedUntilUtc.isNull() ? QLatin1String("-") : this->m_bookedUntilUtc.toString("yy-MM-dd HH:mm"));
|
||||
|
||||
// append from
|
||||
s.append(' ');
|
||||
i18n ? s.append(s.append(QCoreApplication::translate("Aviation", "from(UTC)"))) : s.append("from(UTC)");
|
||||
s.append(": ");
|
||||
if (this->m_bookedFromUtc.isNull())
|
||||
{
|
||||
s.append('-');
|
||||
}
|
||||
else
|
||||
{
|
||||
s.append(this->m_bookedFromUtc.toString("yy-MM-dd HH:mm"));
|
||||
}
|
||||
|
||||
// append to
|
||||
s.append(' ');
|
||||
i18n ? s.append(s.append(QCoreApplication::translate("Aviation", "until(UTC)"))) : s.append("to(UTC)");
|
||||
s.append(": ");
|
||||
if (this->m_bookedFromUtc.isNull())
|
||||
{
|
||||
s.append('-');
|
||||
}
|
||||
else
|
||||
{
|
||||
s.append(this->m_bookedUntilUtc.toString("yy-MM-dd HH:mm"));
|
||||
}
|
||||
return s;
|
||||
|
||||
// force strings for translation in resource files
|
||||
|
||||
@@ -77,17 +77,11 @@ namespace BlackMisc
|
||||
bool isOnline = false, const QDateTime &bookedFromUtc = QDateTime(), const QDateTime &bookedUntilUtc = QDateTime(),
|
||||
const CInformationMessage &atis = CInformationMessage(CInformationMessage::ATIS), const CInformationMessage &metar = CInformationMessage(CInformationMessage::METAR));
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
BlackMisc::CIcon toIcon() const { return this->m_callsign.toIcon(); }
|
||||
|
||||
//! Has booking times?
|
||||
bool hasBookingTimes() const;
|
||||
|
||||
//! Has ATIS?
|
||||
bool hasAtis() const
|
||||
{
|
||||
return this->m_atis.hasMessage();
|
||||
}
|
||||
bool hasAtis() const { return this->m_atis.hasMessage(); }
|
||||
|
||||
//! Has METAR?
|
||||
bool hasMetar() const;
|
||||
@@ -256,6 +250,9 @@ namespace BlackMisc
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon()
|
||||
BlackMisc::CIcon toIcon() const { return this->m_callsign.toIcon(); }
|
||||
|
||||
private:
|
||||
CCallsign m_callsign;
|
||||
BlackMisc::Network::CUser m_controller;
|
||||
@@ -277,9 +274,9 @@ namespace BlackMisc
|
||||
BLACK_METAMEMBER(position),
|
||||
BLACK_METAMEMBER(range),
|
||||
BLACK_METAMEMBER(isOnline),
|
||||
BLACK_METAMEMBER(atis),
|
||||
BLACK_METAMEMBER(bookedFromUtc),
|
||||
BLACK_METAMEMBER(bookedUntilUtc),
|
||||
BLACK_METAMEMBER(atis),
|
||||
BLACK_METAMEMBER(metar),
|
||||
BLACK_METAMEMBER(voiceRoom),
|
||||
BLACK_METAMEMBER(relativeDistance),
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
|
||||
QString CCallsign::unifyCallsign(const QString &callsign)
|
||||
{
|
||||
return removeChars(callsign.toUpper(), [](QChar c) { return !c.isLetterOrNumber() && c != '_'; });
|
||||
return removeChars(callsign.toUpper().trimmed(), [](QChar c) { return !c.isLetterOrNumber() && c != '_'; });
|
||||
}
|
||||
|
||||
const CIcon &CCallsign::convertToIcon(const CCallsign &callsign)
|
||||
|
||||
@@ -56,12 +56,12 @@ namespace BlackMisc
|
||||
|
||||
//! Constructor
|
||||
CCallsign(const QString &callsign, TypeHint hint = NoHint)
|
||||
: m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign.trimmed())), m_typeHint(hint)
|
||||
: m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign)), m_typeHint(hint)
|
||||
{}
|
||||
|
||||
//! Constructor
|
||||
CCallsign(const QString &callsign, const QString &telephonyDesignator, TypeHint hint = NoHint)
|
||||
: m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign.trimmed())), m_telephonyDesignator(telephonyDesignator.trimmed()), m_typeHint(hint)
|
||||
: m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign)), m_telephonyDesignator(telephonyDesignator.trimmed()), m_typeHint(hint)
|
||||
{}
|
||||
|
||||
//! Constructor, needed to disambiguate implicit conversion from string literal.
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
QString CInformationMessage::convertToQString(bool /** i18n **/) const
|
||||
QString CInformationMessage::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return this->m_message;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,5 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -29,9 +29,7 @@ namespace BlackMisc
|
||||
class BLACKMISC_EXPORT CInformationMessage : public CValueObject<CInformationMessage>
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* Type
|
||||
*/
|
||||
//! Type
|
||||
enum InformationType
|
||||
{
|
||||
Unspecified,
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
#include <tuple>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Db;
|
||||
@@ -69,9 +70,7 @@ namespace BlackMisc
|
||||
QString s(getCombinedCode());
|
||||
if (!this->getDescription().isEmpty())
|
||||
{
|
||||
s += " (";
|
||||
s += this->getDescription();
|
||||
s += ")";
|
||||
s += QLatin1Literal(" (") % this->getDescription() % QLatin1Literal(")");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@@ -117,20 +116,16 @@ namespace BlackMisc
|
||||
|
||||
QString CLivery::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s(i18n ? QCoreApplication::translate("Aviation", "Livery") : "Livery");
|
||||
if (this->hasCombinedCode())
|
||||
{
|
||||
s.append(' ');
|
||||
s.append(m_combinedCode);
|
||||
}
|
||||
s.append(' ');
|
||||
s.append(this->m_airline.toQString(i18n));
|
||||
s.append(' ');
|
||||
if (!this->m_description.isEmpty()) { s.append(' ').append(this->m_description); }
|
||||
if (this->m_colorFuselage.isValid()) { s.append(" F: ").append(this->m_colorFuselage.hex()); }
|
||||
if (this->m_colorTail.isValid()) { s.append(" T: ").append(this->m_colorTail.hex()); }
|
||||
s.append(" Mil: ").append(boolToYesNo(this->isMilitary()));
|
||||
return s;
|
||||
static const QString livery("Livery");
|
||||
static const QString liveryI18n(QCoreApplication::translate("Aviation", "Livery"));
|
||||
|
||||
return (i18n ? liveryI18n : livery) %
|
||||
QLatin1Literal(" cc: '") % m_combinedCode %
|
||||
QLatin1Literal("' airline: '") % m_airline.toQString(i18n) %
|
||||
QLatin1Literal("' desc.: '") % m_description %
|
||||
QLatin1Literal("' F: '") % m_colorFuselage.hex() %
|
||||
QLatin1Literal("' T: '") % m_colorTail.hex() %
|
||||
QLatin1Literal("' Mil: ") % boolToYesNo(this->isMilitary());
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("Aviation", "Livery");
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace BlackMisc
|
||||
CAircraftSituationList::registerMetadata();
|
||||
CAirlineIcaoCode::registerMetadata();
|
||||
CAirlineIcaoCodeList::registerMetadata();
|
||||
CAirport::registerMetadata();
|
||||
CAirportIcaoCode::registerMetadata();
|
||||
CAirport::registerMetadata();
|
||||
CAirportList::registerMetadata();
|
||||
CAltitude::registerMetadata();
|
||||
CAtcStation::registerMetadata();
|
||||
|
||||
@@ -25,6 +25,33 @@ namespace BlackMisc
|
||||
qRegisterMetaType<TransponderMode>();
|
||||
}
|
||||
|
||||
CTransponder::CTransponder(int transponderCode, CTransponder::TransponderMode transponderMode) :
|
||||
m_transponderCode(transponderCode), m_transponderMode(transponderMode)
|
||||
{ }
|
||||
|
||||
CTransponder::CTransponder(int transponderCode, QString transponderMode) :
|
||||
m_transponderCode(transponderCode), m_transponderMode(StateStandby)
|
||||
{
|
||||
this->setModeAsString(transponderMode);
|
||||
}
|
||||
|
||||
CTransponder::CTransponder(QString transponderCode, CTransponder::TransponderMode transponderMode) :
|
||||
m_transponderCode(0), m_transponderMode(transponderMode)
|
||||
{
|
||||
bool ok = false;
|
||||
this->m_transponderCode = transponderCode.toInt(&ok);
|
||||
if (!ok) this->m_transponderCode = -1; // will cause assert / exception
|
||||
}
|
||||
|
||||
CTransponder::CTransponder(QString transponderCode, QString transponderMode) :
|
||||
m_transponderCode(0), m_transponderMode(StateStandby)
|
||||
{
|
||||
bool ok = false;
|
||||
this->m_transponderCode = transponderCode.toInt(&ok);
|
||||
if (!ok) this->m_transponderCode = -1; // will cause assert / exception
|
||||
this->setModeAsString(transponderMode);
|
||||
}
|
||||
|
||||
bool CTransponder::validValues() const
|
||||
{
|
||||
if (this->isDefaultValue()) return true; // special case
|
||||
@@ -62,11 +89,11 @@ namespace BlackMisc
|
||||
if (modeString.startsWith("Mode C", Qt::CaseInsensitive)) return ModeC;
|
||||
if (modeString.startsWith("C", Qt::CaseInsensitive)) return ModeC;
|
||||
if (modeString.startsWith("Mode S", Qt::CaseInsensitive)) return ModeS;
|
||||
if (modeString.contains("Mode 1", Qt::CaseInsensitive)) return ModeMil1;
|
||||
if (modeString.contains("Mode 2", Qt::CaseInsensitive)) return ModeMil2;
|
||||
if (modeString.contains("Mode 3", Qt::CaseInsensitive)) return ModeMil3;
|
||||
if (modeString.contains("Mode 4", Qt::CaseInsensitive)) return ModeMil4;
|
||||
if (modeString.contains("Mode 5", Qt::CaseInsensitive)) return ModeMil5;
|
||||
if (modeString.contains("1", Qt::CaseInsensitive)) return ModeMil1;
|
||||
if (modeString.contains("2", Qt::CaseInsensitive)) return ModeMil2;
|
||||
if (modeString.contains("3", Qt::CaseInsensitive)) return ModeMil3;
|
||||
if (modeString.contains("4", Qt::CaseInsensitive)) return ModeMil4;
|
||||
if (modeString.contains("5", Qt::CaseInsensitive)) return ModeMil5;
|
||||
return StateStandby;
|
||||
}
|
||||
|
||||
@@ -114,6 +141,11 @@ namespace BlackMisc
|
||||
return CTransponder::isValidTransponderCode(QString::number(transponderCode));
|
||||
}
|
||||
|
||||
CTransponder CTransponder::getStandardTransponder(qint32 transponderCode, CTransponder::TransponderMode mode)
|
||||
{
|
||||
return CTransponder(transponderCode, mode);
|
||||
}
|
||||
|
||||
const QString &CTransponder::modeAsString(CTransponder::TransponderMode mode)
|
||||
{
|
||||
static QString m;
|
||||
@@ -206,6 +238,5 @@ namespace BlackMisc
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
namespace Aviation
|
||||
{
|
||||
//! Transponder
|
||||
@@ -37,9 +36,9 @@ namespace BlackMisc
|
||||
//! Transponder codes
|
||||
enum TransponderMode
|
||||
{
|
||||
StateStandby = 0, // not a real mode, more a state
|
||||
StateStandby = 0, //!< not a real mode, more a state
|
||||
ModeMil1 = 1, ModeMil2 = 2, ModeMil3 = 3, ModeMil4 = 4, ModeMil5 = 5,
|
||||
StateIdent = 10, // not a real mode, more a state
|
||||
StateIdent = 10, //!< not a real mode, more a state
|
||||
ModeA = 11,
|
||||
ModeC = 12,
|
||||
ModeS = 20
|
||||
@@ -62,44 +61,22 @@ namespace BlackMisc
|
||||
CTransponder() : m_transponderCode(0), m_transponderMode(StateStandby) {}
|
||||
|
||||
//! Constructor
|
||||
CTransponder(int transponderCode, TransponderMode transponderMode) :
|
||||
m_transponderCode(transponderCode), m_transponderMode(transponderMode)
|
||||
{ }
|
||||
CTransponder(int transponderCode, TransponderMode transponderMode);
|
||||
|
||||
//! Constructor with transponder mode as string
|
||||
CTransponder(int transponderCode, QString transponderMode) :
|
||||
m_transponderCode(transponderCode), m_transponderMode(StateStandby)
|
||||
{
|
||||
this->setModeAsString(transponderMode);
|
||||
}
|
||||
CTransponder(int transponderCode, QString transponderMode);
|
||||
|
||||
//! Constructor, code as string
|
||||
CTransponder(QString transponderCode, TransponderMode transponderMode) :
|
||||
m_transponderCode(0), m_transponderMode(transponderMode)
|
||||
{
|
||||
bool ok = false;
|
||||
this->m_transponderCode = transponderCode.toInt(&ok);
|
||||
if (!ok) this->m_transponderCode = -1; // will cause assert / exception
|
||||
}
|
||||
CTransponder(QString transponderCode, TransponderMode transponderMode);
|
||||
|
||||
//! Constructor
|
||||
CTransponder(QString transponderCode, QString transponderMode) :
|
||||
m_transponderCode(0), m_transponderMode(StateStandby)
|
||||
{
|
||||
bool ok = false;
|
||||
this->m_transponderCode = transponderCode.toInt(&ok);
|
||||
if (!ok) this->m_transponderCode = -1; // will cause assert / exception
|
||||
this->setModeAsString(transponderMode);
|
||||
}
|
||||
CTransponder(QString transponderCode, QString transponderMode);
|
||||
|
||||
//! Are set values valid?
|
||||
bool validValues() const;
|
||||
|
||||
//! Transponder mode as string
|
||||
QString getModeAsString() const
|
||||
{
|
||||
return modeAsString(this->getTransponderMode());
|
||||
}
|
||||
QString getModeAsString() const { return modeAsString(this->getTransponderMode()); }
|
||||
|
||||
//! In any sending mode such as MIL1 oder ModeS
|
||||
bool isInNormalSendingMode() const;
|
||||
@@ -111,25 +88,16 @@ namespace BlackMisc
|
||||
bool isIdentifying() const { return StateIdent == m_transponderMode; }
|
||||
|
||||
//! Transponder mode as string
|
||||
void setModeAsString(const QString &mode)
|
||||
{
|
||||
this->setTransponderMode(CTransponder::modeFromString(mode));
|
||||
}
|
||||
void setModeAsString(const QString &mode) { this->setTransponderMode(CTransponder::modeFromString(mode)); }
|
||||
|
||||
//! Transponder mode
|
||||
TransponderMode getTransponderMode() const
|
||||
{
|
||||
return this->m_transponderMode;
|
||||
}
|
||||
TransponderMode getTransponderMode() const { return this->m_transponderMode; }
|
||||
|
||||
//! Transponder mode as string
|
||||
static const QString &modeAsString(TransponderMode mode);
|
||||
|
||||
//! Transponder code
|
||||
int getTransponderCode() const
|
||||
{
|
||||
return this->m_transponderCode;
|
||||
}
|
||||
int getTransponderCode() const { return this->m_transponderCode; }
|
||||
|
||||
//! Transponder code
|
||||
QString getTransponderCodeFormatted() const;
|
||||
@@ -158,26 +126,23 @@ namespace BlackMisc
|
||||
//! Set IFR
|
||||
void setIFR() { this->m_transponderCode = 2000; }
|
||||
|
||||
//! Transponder unit
|
||||
static CTransponder getStandardTransponder(qint32 transponderCode, TransponderMode mode)
|
||||
{
|
||||
return CTransponder(transponderCode, mode);
|
||||
}
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! Is valid transponder code?
|
||||
static bool isValidTransponderCode(const QString &transponderCode);
|
||||
|
||||
//! Is valid transponder code?
|
||||
static bool isValidTransponderCode(qint32 transponderMode);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
//! Transponder unit
|
||||
static CTransponder getStandardTransponder(qint32 transponderCode, TransponderMode mode);
|
||||
|
||||
private:
|
||||
//! Default value?
|
||||
@@ -192,7 +157,6 @@ namespace BlackMisc
|
||||
BLACK_METAMEMBER(transponderMode)
|
||||
);
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
|
||||
Reference in New Issue
Block a user