From afd7881a9016c9b0ea4c31559821f3056d8f17e0 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 26 Sep 2019 15:35:18 +0200 Subject: [PATCH] Ref T730, ATC station properties for cross coupled ATC stations --- src/blackmisc/aviation/atcstation.cpp | 19 +++++++++++++++++++ src/blackmisc/aviation/atcstation.h | 11 ++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/blackmisc/aviation/atcstation.cpp b/src/blackmisc/aviation/atcstation.cpp index d04aa498d..a4c456276 100644 --- a/src/blackmisc/aviation/atcstation.cpp +++ b/src/blackmisc/aviation/atcstation.cpp @@ -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()); 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()); diff --git a/src/blackmisc/aviation/atcstation.h b/src/blackmisc/aviation/atcstation.h index 313bf6eec..658abdf99 100644 --- a/src/blackmisc/aviation/atcstation.h +++ b/src/blackmisc/aviation/atcstation.h @@ -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.