Issue #17 Remove aircraft labels (not supported in xpmp2)

This commit is contained in:
Mat Sutcliffe
2020-05-27 15:31:45 +01:00
parent bfa82affb9
commit 0a6d9e6081
4 changed files with 4 additions and 58 deletions

View File

@@ -213,10 +213,10 @@ namespace BlackSimPlugin
//! \copydoc XSwiftBus::CTraffic::setDefaultIcao //! \copydoc XSwiftBus::CTraffic::setDefaultIcao
void setDefaultIcao(const QString &defaultIcao); void setDefaultIcao(const QString &defaultIcao);
//! \copydoc XSwiftBus::CTraffic::setDrawingLabels //! deprecated
void setDrawingLabels(bool drawing); void setDrawingLabels(bool drawing);
//! \copydoc XSwiftBus::CTraffic::isDrawingLabels //! deprecated
bool isDrawingLabels() const; bool isDrawingLabels() const;
//! \copydoc XSwiftBus::CTraffic::setMaxPlanes //! \copydoc XSwiftBus::CTraffic::setMaxPlanes

View File

@@ -31,10 +31,6 @@ namespace XSwiftBus
{ {
// m_startServerMenuItem = m_menu.item("Start XSwiftBus", [this]{ startServer(CDBusConnection::SessionBus); }); // 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_messageWindowSubMenu = m_menu.subMenu("Message Window");
m_toggleMessageWindowMenuItem = m_messageWindowSubMenu.item("Show/Hide", [this] m_toggleMessageWindowMenuItem = m_messageWindowSubMenu.item("Show/Hide", [this]
{ {

View File

@@ -61,9 +61,6 @@ namespace XSwiftBus
s_instance = this; s_instance = this;
XPLMRegisterDrawCallback(drawCallback, xplm_Phase_Airplanes, 1, this); XPLMRegisterDrawCallback(drawCallback, xplm_Phase_Airplanes, 1, this);
XPLMRegisterKeySniffer(followAircraftKeySniffer, 1, this); XPLMRegisterKeySniffer(followAircraftKeySniffer, 1, this);
// init labels
this->setDrawingLabels(this->getSettings().isDrawingLabels());
} }
// *INDENT-ON* // *INDENT-ON*
@@ -290,30 +287,6 @@ namespace XSwiftBus
XPMPSetDefaultPlaneICAO(defaultIcao.c_str()); 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) void CTraffic::setMaxPlanes(int planes)
{ {
CSettings s = this->getSettings(); CSettings s = this->getSettings();
@@ -628,19 +601,13 @@ namespace XSwiftBus
else if (message.getMethodName() == "setDrawingLabels") else if (message.getMethodName() == "setDrawingLabels")
{ {
maybeSendEmptyDBusReply(wantsReply, sender, serial); maybeSendEmptyDBusReply(wantsReply, sender, serial);
bool drawing = true; // removed in xpmp2
message.beginArgumentRead();
message.getArgument(drawing);
queueDBusCall([ = ]()
{
setDrawingLabels(drawing);
});
} }
else if (message.getMethodName() == "isDrawingLabels") else if (message.getMethodName() == "isDrawingLabels")
{ {
queueDBusCall([ = ]() queueDBusCall([ = ]()
{ {
sendDBusReply(sender, serial, isDrawingLabels()); sendDBusReply(sender, serial, false); // always false in xpmp2
}); });
} }
else if (message.getMethodName() == "setMaxPlanes") else if (message.getMethodName() == "setMaxPlanes")
@@ -1129,17 +1096,6 @@ namespace XSwiftBus
traffic->m_countFrame++; 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; return 1;
} }

View File

@@ -77,12 +77,6 @@ namespace XSwiftBus
//! Set the ICAO code to use for aircraft without a model match //! Set the ICAO code to use for aircraft without a model match
void setDefaultIcao(const std::string &defaultIcao); 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. //! Set the maximum number of aircraft.
void setMaxPlanes(int planes); void setMaxPlanes(int planes);