From 0a6d9e6081adb0bf1238d507e447946b35b34d2d Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Wed, 27 May 2020 15:31:45 +0100 Subject: [PATCH] Issue #17 Remove aircraft labels (not supported in xpmp2) --- .../simulator/xplane/xswiftbustrafficproxy.h | 4 +- src/xswiftbus/plugin.cpp | 4 -- src/xswiftbus/traffic.cpp | 48 +------------------ src/xswiftbus/traffic.h | 6 --- 4 files changed, 4 insertions(+), 58 deletions(-) diff --git a/src/plugins/simulator/xplane/xswiftbustrafficproxy.h b/src/plugins/simulator/xplane/xswiftbustrafficproxy.h index 39d07a02d..fbd351aa8 100644 --- a/src/plugins/simulator/xplane/xswiftbustrafficproxy.h +++ b/src/plugins/simulator/xplane/xswiftbustrafficproxy.h @@ -213,10 +213,10 @@ namespace BlackSimPlugin //! \copydoc XSwiftBus::CTraffic::setDefaultIcao void setDefaultIcao(const QString &defaultIcao); - //! \copydoc XSwiftBus::CTraffic::setDrawingLabels + //! deprecated void setDrawingLabels(bool drawing); - //! \copydoc XSwiftBus::CTraffic::isDrawingLabels + //! deprecated bool isDrawingLabels() const; //! \copydoc XSwiftBus::CTraffic::setMaxPlanes diff --git a/src/xswiftbus/plugin.cpp b/src/xswiftbus/plugin.cpp index 13f027da1..70a552d1d 100644 --- a/src/xswiftbus/plugin.cpp +++ b/src/xswiftbus/plugin.cpp @@ -31,10 +31,6 @@ namespace XSwiftBus { // m_startServerMenuItem = m_menu.item("Start XSwiftBus", [this]{ startServer(CDBusConnection::SessionBus); }); - m_showHideLabelsMenuItem = m_menu.item("Show/Hide Aircraft Labels", [this] - { - m_traffic->setDrawingLabels(!m_traffic->isDrawingLabels()); - }); m_messageWindowSubMenu = m_menu.subMenu("Message Window"); m_toggleMessageWindowMenuItem = m_messageWindowSubMenu.item("Show/Hide", [this] { diff --git a/src/xswiftbus/traffic.cpp b/src/xswiftbus/traffic.cpp index 7f4139b80..bad119aed 100644 --- a/src/xswiftbus/traffic.cpp +++ b/src/xswiftbus/traffic.cpp @@ -61,9 +61,6 @@ namespace XSwiftBus s_instance = this; XPLMRegisterDrawCallback(drawCallback, xplm_Phase_Airplanes, 1, this); XPLMRegisterKeySniffer(followAircraftKeySniffer, 1, this); - - // init labels - this->setDrawingLabels(this->getSettings().isDrawingLabels()); } // *INDENT-ON* @@ -290,30 +287,6 @@ namespace XSwiftBus XPMPSetDefaultPlaneICAO(defaultIcao.c_str()); } - void CTraffic::setDrawingLabels(bool drawing) - { - CSettings s = this->getSettings(); - if (s.isDrawingLabels() != drawing) - { - s.setDrawingLabels(drawing); - this->setSettings(s); - } - - if (drawing) - { - XPMPEnableAircraftLabels(); - } - else - { - XPMPDisableAircraftLabels(); - } - } - - bool CTraffic::isDrawingLabels() const - { - return XPMPDrawingAircraftLabels(); - } - void CTraffic::setMaxPlanes(int planes) { CSettings s = this->getSettings(); @@ -628,19 +601,13 @@ namespace XSwiftBus else if (message.getMethodName() == "setDrawingLabels") { maybeSendEmptyDBusReply(wantsReply, sender, serial); - bool drawing = true; - message.beginArgumentRead(); - message.getArgument(drawing); - queueDBusCall([ = ]() - { - setDrawingLabels(drawing); - }); + // removed in xpmp2 } else if (message.getMethodName() == "isDrawingLabels") { queueDBusCall([ = ]() { - sendDBusReply(sender, serial, isDrawingLabels()); + sendDBusReply(sender, serial, false); // always false in xpmp2 }); } else if (message.getMethodName() == "setMaxPlanes") @@ -1129,17 +1096,6 @@ namespace XSwiftBus traffic->m_countFrame++; - // slow updates by modulo - if (traffic->m_countFrame % 250 == 0) - { - // update labels - const CSettings s = traffic->getSettings(); - if (traffic->isDrawingLabels() != s.isDrawingLabels()) - { - traffic->setDrawingLabels(s.isDrawingLabels()); - } - } - return 1; } diff --git a/src/xswiftbus/traffic.h b/src/xswiftbus/traffic.h index 0189bbddc..e4cb73822 100644 --- a/src/xswiftbus/traffic.h +++ b/src/xswiftbus/traffic.h @@ -77,12 +77,6 @@ namespace XSwiftBus //! Set the ICAO code to use for aircraft without a model match void setDefaultIcao(const std::string &defaultIcao); - //! Set whether the plugin draws type and callsign labels above aircraft - void setDrawingLabels(bool drawing); - - //! Get whether the plugin draws type and callsign labels above aircraft - bool isDrawingLabels() const; - //! Set the maximum number of aircraft. void setMaxPlanes(int planes);