5 #include <QDesktopServices>
9 #include <QScopedPointer>
10 #include <QStackedWidget>
14 #include "ui_swiftguistd.h"
26 using namespace swift::config;
31 using namespace swift::misc::physical_quantities;
32 using namespace swift::misc::aviation;
33 using namespace swift::misc::network;
34 using namespace swift::misc::simulation;
36 void SwiftGuiStd::onMenuClicked()
38 using namespace std::chrono_literals;
39 QObject *sender = QObject::sender();
40 if (sender == ui->menu_TestLocationsEDRY)
42 this->setTestPosition(
"N 049° 18' 17",
"E 008° 27' 05",
43 CAltitude(312, CAltitude::MeanSeaLevel, CLengthUnit::ft()),
44 CAltitude(312, CAltitude::MeanSeaLevel, CAltitude::PressureAltitude, CLengthUnit::ft()));
46 else if (sender == ui->menu_TestLocationsEDNX)
48 this->setTestPosition(
"N 048° 14′ 22",
"E 011° 33′ 41",
49 CAltitude(486, CAltitude::MeanSeaLevel, CLengthUnit::m()),
50 CAltitude(486, CAltitude::MeanSeaLevel, CAltitude::PressureAltitude, CLengthUnit::m()));
52 else if (sender == ui->menu_TestLocationsEDDM)
54 this->setTestPosition(
"N 048° 21′ 14",
"E 011° 47′ 10",
55 CAltitude(448, CAltitude::MeanSeaLevel, CLengthUnit::m()),
56 CAltitude(448, CAltitude::MeanSeaLevel, CAltitude::PressureAltitude, CLengthUnit::m()));
58 else if (sender == ui->menu_TestLocationsEDDF)
60 this->setTestPosition(
"N 50° 2′ 0",
"E 8° 34′ 14",
CAltitude(100, CAltitude::MeanSeaLevel, CLengthUnit::m()),
61 CAltitude(100, CAltitude::MeanSeaLevel, CAltitude::PressureAltitude, CLengthUnit::m()));
63 else if (sender == ui->menu_TestLocationsLOWW)
65 this->setTestPosition(
"N 48° 7′ 6.3588",
"E 16° 33′ 39.924",
66 CAltitude(100, CAltitude::MeanSeaLevel, CLengthUnit::m()),
67 CAltitude(100, CAltitude::MeanSeaLevel, CAltitude::PressureAltitude, CLengthUnit::m()));
69 else if (sender == ui->menu_WindowFont)
71 this->setMainPageToInfoArea();
72 ui->comp_MainInfoArea->selectSettingsTab(swift::gui::components::CSettingsComponent::SettingTabGui);
74 else if (sender == ui->menu_InternalsPage) { ui->sw_MainMiddle->setCurrentIndex(MainPageInternals); }
75 else if (sender == ui->menu_AutoPublish) { this->autoPublishDialog(); }
76 else if (sender == ui->menu_ToggleIncognito)
87 void SwiftGuiStd::initMenus()
89 Q_ASSERT_X(ui->menu_InfoAreas, Q_FUNC_INFO,
"No menu");
90 Q_ASSERT_X(ui->menu_Window, Q_FUNC_INFO,
"No menu");
91 Q_ASSERT_X(ui->comp_MainInfoArea, Q_FUNC_INFO,
"no main area");
97 ui->menu_InfoAreas->addActions(ui->comp_MainInfoArea->getInfoAreaSelectActions(
true, ui->menu_InfoAreas));
100 const QString swift(CGuiActionBindHandler::pathSwiftPilotClient());
101 static const CActionBind swiftRoot(swift, CIcons::Swift16);
103 m_menuHotkeyHandlers.append(CGuiActionBindHandler::bindMenu(ui->menu_InfoAreas, swift +
"Info areas"));
104 m_menuHotkeyHandlers.append(CGuiActionBindHandler::bindMenu(ui->menu_File, swift +
"File"));
105 m_menuHotkeyHandlers.append(CGuiActionBindHandler::bindMenu(ui->menu_Window, swift +
"Window"));
108 int SwiftGuiStd::autoPublishDialog()
110 if (!m_autoPublishDialog) { m_autoPublishDialog.reset(
new CAutoPublishDialog(
this)); }
111 m_lastAutoPublish.set(QDateTime::currentMSecsSinceEpoch());
112 return m_autoPublishDialog->readAndShow();
CActionBind binds a member function to an action.
bool isIncognito() const
Is incognito mode?
void toggleIncognito()
Toggle incognito mode.
void addMenuHelp(QMenu &menu)
Help operations.
void addMenuFile(QMenu &menu)
File menu.
void addMenuInternals(QMenu &menu)
Internals menu.
void addMenuWindow(QMenu &menu)
Window operations.
CAutoPublishComponent as dialog.
Altitude as used in aviation, can be AGL or MSL altitude.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Backend services of the swift project, like dealing with the network or the simulators.
High level reusable GUI components.
Free functions in swift::misc.
SWIFT_MISC_EXPORT const QString & boolToOnOff(bool v)
Bool to on/off.