mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
X-Plane menu improvements
* Remove start items with DBus details and replace them with a single start * Add an item to toggle the message box
This commit is contained in:
committed by
Klaus Basan
parent
ff37704a59
commit
7f6dd61bb3
@@ -97,10 +97,13 @@ namespace XSwiftBus
|
|||||||
//! \copydoc XSwiftBus::CMessageBox::maxLineLength
|
//! \copydoc XSwiftBus::CMessageBox::maxLineLength
|
||||||
int maxLineLength() const { return m_messageBox.maxLineLength(); }
|
int maxLineLength() const { return m_messageBox.maxLineLength(); }
|
||||||
|
|
||||||
|
//! Toggles the visibility of the message box
|
||||||
|
void toggle() { if (m_visible) { hide(); } else { show(); } }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void show() { m_messageBox.show(); m_visible = true; }
|
void show() { m_messageBox.show(); m_visible = true; }
|
||||||
void hide() { m_messageBox.hide(); m_visible = false; }
|
void hide() { m_messageBox.hide(); m_visible = false; }
|
||||||
void toggle() { if (m_visible) { hide(); } else { show(); } }
|
|
||||||
void scrollUp();
|
void scrollUp();
|
||||||
void scrollDown();
|
void scrollDown();
|
||||||
void scrollToTop();
|
void scrollToTop();
|
||||||
|
|||||||
@@ -29,14 +29,16 @@ namespace XSwiftBus
|
|||||||
CPlugin::CPlugin()
|
CPlugin::CPlugin()
|
||||||
: m_menu(CMenu::mainMenu().subMenu("XSwiftBus"))
|
: m_menu(CMenu::mainMenu().subMenu("XSwiftBus"))
|
||||||
{
|
{
|
||||||
m_startServerMenuItems.push_back(m_menu.item("Start server on session bus", [this]{ startServer(BlackMisc::CDBusServer::sessionBusAddress()); }));
|
m_startServerMenuItem = m_menu.item("Start XSwiftBus", [this]{ startServer(BlackMisc::CDBusServer::sessionBusAddress()); });
|
||||||
m_startServerMenuItems.push_back(m_menu.item("Start server on system bus", [this]{ startServer(BlackMisc::CDBusServer::systemBusAddress()); }));
|
m_toggleMessageWindowMenuItem = m_menu.item("Toggle Message Window", [this] { if(m_service) { m_service->toggleMessageBoxVisibility(); } });
|
||||||
m_startServerMenuItems.push_back(m_menu.item("Start server on localhost P2P", [this]{ startServer(BlackMisc::CDBusServer::p2pAddress("localhost")); }));
|
// m_startServerMenuItems.push_back(m_menu.item("Start server on system bus", [this]{ startServer(BlackMisc::CDBusServer::systemBusAddress()); }));
|
||||||
|
// m_startServerMenuItems.push_back(m_menu.item("Start server on localhost P2P", [this]{ startServer(BlackMisc::CDBusServer::p2pAddress("localhost")); }));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugin::startServer(const QString &address)
|
void CPlugin::startServer(const QString &address)
|
||||||
{
|
{
|
||||||
for (auto &item : m_startServerMenuItems) { item.setEnabled(false); }
|
// for (auto &item : m_startServerMenuItems) { item.setEnabled(false); }
|
||||||
|
m_startServerMenuItem.setEnabled(false);
|
||||||
|
|
||||||
m_service = new CService(this);
|
m_service = new CService(this);
|
||||||
m_traffic = new CTraffic(this);
|
m_traffic = new CTraffic(this);
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ namespace XSwiftBus
|
|||||||
CTraffic *m_traffic = nullptr;
|
CTraffic *m_traffic = nullptr;
|
||||||
CWeather *m_weather = nullptr;
|
CWeather *m_weather = nullptr;
|
||||||
CMenu m_menu;
|
CMenu m_menu;
|
||||||
QVector<CMenuItem> m_startServerMenuItems;
|
CMenuItem m_startServerMenuItem;
|
||||||
|
CMenuItem m_toggleMessageWindowMenuItem;
|
||||||
|
|
||||||
void startServer(const QString &address);
|
void startServer(const QString &address);
|
||||||
void tryStartServer(const QString &address);
|
void tryStartServer(const QString &address);
|
||||||
|
|||||||
@@ -238,6 +238,9 @@ namespace XSwiftBus
|
|||||||
//! Get the ratio how much the speedbrakes surfaces are extended (0.0 is fully retracted, and 1.0 is fully extended)
|
//! Get the ratio how much the speedbrakes surfaces are extended (0.0 is fully retracted, and 1.0 is fully extended)
|
||||||
double getSpeedBrakeRatio() const { return m_speedBrakeRatio.get(); }
|
double getSpeedBrakeRatio() const { return m_speedBrakeRatio.get(); }
|
||||||
|
|
||||||
|
//! \copydoc XSwiftBus::CMessageBoxControl::toggle
|
||||||
|
void toggleMessageBoxVisibility() { m_messages.toggle(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CMessageBoxControl m_messages { 128, 128, 16 };
|
CMessageBoxControl m_messages { 128, 128, 16 };
|
||||||
BlackMisc::Simulation::XPlane::CNavDataReferenceList m_airports;
|
BlackMisc::Simulation::XPlane::CNavDataReferenceList m_airports;
|
||||||
|
|||||||
Reference in New Issue
Block a user