Ref T730, ATC station properties for cross coupled ATC stations

This commit is contained in:
Klaus Basan
2019-09-26 15:35:18 +02:00
committed by Mat Sutcliffe
parent 840633749e
commit afd7881a90
2 changed files with 29 additions and 1 deletions

View File

@@ -64,6 +64,12 @@ namespace BlackMisc
return m_metar.hasMessage();
}
QString CAtcStation::getCallsignAsStringCrossCoupled() const
{
if (!this->isAfvCrossCoupled()) { return this->getCallsignAsString(); }
return QStringLiteral("*") % this->getCallsignAsString();
}
QString CAtcStation::getCallsignSuffix() const
{
return m_callsign.getSuffix();
@@ -370,6 +376,8 @@ namespace BlackMisc
case IndexBookedFrom: return CVariant::from(m_bookedFromUtc);
case IndexBookedUntil: return CVariant::from(m_bookedUntilUtc);
case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved());
case IndexCallsignString: return this->getCallsignAsString();
case IndexCallsignStringCrossCopuled: return this->getCallsignAsStringCrossCoupled();
case IndexController: return m_controller.propertyByIndex(index.copyFrontRemoved());
case IndexFrequency: return m_frequency.propertyByIndex(index.copyFrontRemoved());
case IndexIsOnline: return CVariant::from(m_isOnline);
@@ -407,6 +415,14 @@ namespace BlackMisc
case IndexMetar: m_metar.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexVoiceRoom: m_voiceRoom.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
case IndexIsAfvCrossCoupled: this->setAfvCrossCoupled(variant.value<bool>()); break;
case IndexCallsignString:
case IndexCallsignStringCrossCopuled:
{
const QString cs = variant.toQString();
*this = CAtcStation();
this->setAfvCrossCoupled(cs.startsWith('*'));
}
break;
default:
if (ICoordinateWithRelativePosition::canHandleIndex(index))
{
@@ -428,6 +444,9 @@ namespace BlackMisc
{
case IndexBookedFrom: return Compare::compare(this->getBookedFromUtc(), compareValue.getBookedFromUtc());
case IndexBookedUntil: return Compare::compare(this->getBookedUntilUtc(), compareValue.getBookedUntilUtc());
case IndexCallsignString:
case IndexCallsignStringCrossCopuled:
return m_callsign.comparePropertyByIndex(CPropertyIndex::empty(), compareValue.getCallsign());
case IndexCallsign: return m_callsign.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCallsign());
case IndexController: return m_controller.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getController());
case IndexFrequency: return m_frequency.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getFrequency());

View File

@@ -48,6 +48,8 @@ namespace BlackMisc
enum ColumnIndex
{
IndexCallsign = CPropertyIndex::GlobalIndexCAtcStation,
IndexCallsignString,
IndexCallsignStringCrossCopuled,
IndexController,
IndexFrequency,
IndexPosition,
@@ -61,7 +63,7 @@ namespace BlackMisc
IndexLongitude,
IndexAtis,
IndexMetar,
IndexVoiceRoom,
IndexVoiceRoom, //!< @deprecated
};
//! Default constructor.
@@ -95,6 +97,9 @@ namespace BlackMisc
//! Get callsign as string.
QString getCallsignAsString() const { return m_callsign.asString(); }
//! Get callsign
QString getCallsignAsStringCrossCoupled() const;
//! Callsign suffix (e.g. TWR)
QString getCallsignSuffix() const;
@@ -177,15 +182,19 @@ namespace BlackMisc
void setAfvCrossCoupled(bool coupled) { m_isAfvCrossCoupled = coupled; }
//! Get voice room
//! \deprecated
const Audio::CVoiceRoom &getVoiceRoom() const { return m_voiceRoom; }
//! Set voice room
//! \deprecated
void setVoiceRoom(const Audio::CVoiceRoom &voiceRoom) { m_voiceRoom = voiceRoom; }
//! Set voice room URL
//! \deprecated
void setVoiceRoomUrl(const QString &url) { m_voiceRoom.setVoiceRoomUrl(url); }
//! Valid voice room?
//! \deprecated
bool hasValidVoiceRoom() const { return m_voiceRoom.isValid(); }
//! Booked date/time if any.