Ref T573, short XPDR string

This commit is contained in:
Klaus Basan
2019-03-19 05:30:47 +01:00
committed by Mat Sutcliffe
parent 0a013fc906
commit 57ae224c41
2 changed files with 37 additions and 3 deletions

View File

@@ -192,6 +192,34 @@ namespace BlackMisc
return i; return i;
} }
const QString &CTransponder::modeAsShortString(CTransponder::TransponderMode mode)
{
static const QString i("I");
static const QString s("S");
static const QString mc("C");
static const QString ms("S");
static const QString m1("1");
static const QString m2("2");
static const QString m3("3");
static const QString m4("4");
static const QString m5("5");
switch (mode)
{
case StateIdent: return i;
case StateStandby: return s;
case ModeC: return mc;
case ModeS: return ms;
case ModeMil1: return m1;
case ModeMil2: return m2;
case ModeMil3: return m3;
case ModeMil4: return m4;
case ModeMil5: return m5;
default: qFatal("Illegal Transponder Mode");
}
return i;
}
CVariant CTransponder::propertyByIndex(const CPropertyIndex &index) const CVariant CTransponder::propertyByIndex(const CPropertyIndex &index) const
{ {
if (index.isMyself()) { return CVariant::from(*this); } if (index.isMyself()) { return CVariant::from(*this); }

View File

@@ -77,6 +77,9 @@ namespace BlackMisc
//! Transponder mode as string //! Transponder mode as string
QString getModeAsString() const { return modeAsString(this->getTransponderMode()); } QString getModeAsString() const { return modeAsString(this->getTransponderMode()); }
//! Transponder mode as short string
QString getModeAsShortString() const { return modeAsShortString(this->getTransponderMode()); }
//! In any sending mode such as MIL1 oder ModeS //! In any sending mode such as MIL1 oder ModeS
bool isInNormalSendingMode() const; bool isInNormalSendingMode() const;
@@ -98,6 +101,9 @@ namespace BlackMisc
//! Transponder mode as string //! Transponder mode as string
static const QString &modeAsString(TransponderMode mode); static const QString &modeAsString(TransponderMode mode);
//! Transponder mode as short string
static const QString &modeAsShortString(CTransponder::TransponderMode mode);
//! Transponder code //! Transponder code
int getTransponderCode() const { return m_transponderCode; } int getTransponderCode() const { return m_transponderCode; }