Commit 7fa87116 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #635 from mavlink/keyboardshortcuts

make keyboard shortcuts OS dependent
parents 2b2c826b b15acd6e
......@@ -187,7 +187,7 @@ void MainWindow::init()
ui.setupUi(this);
hide();
menuActionHelper->setMenu(ui.menuTools);
// Qt 4 on Ubuntu does place the native menubar correctly so on Linux we revert back to in-window menu bar.
#ifdef Q_OS_LINUX
menuBar()->setNativeMenuBar(false);
......@@ -223,6 +223,7 @@ void MainWindow::init()
actions << ui.actionFlightView;
actions << ui.actionMissionView;
actions << ui.actionHardwareConfig;
toolBar->setPerspectiveChangeActions(actions);
// Add actions for advanced users (displayed in dropdown under "advanced")
......@@ -346,6 +347,27 @@ void MainWindow::init()
}
// Set OS dependent keyboard shortcuts for the main window, non OS dependent shortcuts are set in MainWindow.ui
#ifdef Q_OS_MACX
ui.actionFlightView->setShortcut(QApplication::translate("MainWindow", "Meta+1", 0, QApplication::UnicodeUTF8));
ui.actionMissionView->setShortcut(QApplication::translate("MainWindow", "Meta+2", 0, QApplication::UnicodeUTF8));
ui.actionHardwareConfig->setShortcut(QApplication::translate("MainWindow", "Meta+3", 0, QApplication::UnicodeUTF8));
ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Meta+4", 0, QApplication::UnicodeUTF8));
ui.actionEngineersView->setShortcut(QApplication::translate("MainWindow", "Meta+5", 0, QApplication::UnicodeUTF8));
ui.actionMavlinkView->setShortcut(QApplication::translate("MainWindow", "Meta+M", 0, QApplication::UnicodeUTF8));
ui.actionUnconnectedView->setShortcut(QApplication::translate("MainWindow", "Meta+U", 0, QApplication::UnicodeUTF8));
ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Meta+Return", 0, QApplication::UnicodeUTF8));
#else
ui.actionFlightView->setShortcut(QApplication::translate("MainWindow", "Ctrl+1", 0, QApplication::UnicodeUTF8));
ui.actionMissionView->setShortcut(QApplication::translate("MainWindow", "Ctrl+2", 0, QApplication::UnicodeUTF8));
ui.actionHardwareConfig->setShortcut(QApplication::translate("MainWindow", "Ctrl+3", 0, QApplication::UnicodeUTF8));
ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Ctrl+4", 0, QApplication::UnicodeUTF8));
ui.actionEngineersView->setShortcut(QApplication::translate("MainWindow", "Ctrl+5", 0, QApplication::UnicodeUTF8));
ui.actionMavlinkView->setShortcut(QApplication::translate("MainWindow", "Ctrl+M", 0, QApplication::UnicodeUTF8));
ui.actionUnconnectedView->setShortcut(QApplication::translate("MainWindow", "Ctrl+U", 0, QApplication::UnicodeUTF8));
ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Ctrl+Return", 0, QApplication::UnicodeUTF8));
#endif
connect(&windowNameUpdateTimer, SIGNAL(timeout()), this, SLOT(configureWindowName()));
windowNameUpdateTimer.start(15000);
emit initStatusChanged(tr("Done"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
......@@ -1342,6 +1364,8 @@ void MainWindow::connectCommonActions()
connect(ui.actionHardwareConfig,SIGNAL(triggered()),this,SLOT(loadHardwareConfigView()));
connect(ui.actionGoogleEarthView, SIGNAL(triggered()), this, SLOT(loadGoogleEarthView()));
connect(ui.actionLocal3DView, SIGNAL(triggered()), this, SLOT(loadLocal3DView()));
connect(ui.actionSimulationView, SIGNAL(triggered()), this, SLOT(loadSimulationView()));
connect(ui.actionHardwareConfig, SIGNAL(triggered()), this, SLOT(loadHardwareConfigView()));
if (getCustomMode() == CUSTOM_MODE_APM) {
connect(ui.actionSoftwareConfig,SIGNAL(triggered()),this,SLOT(loadSoftwareConfigView()));
......
......@@ -162,7 +162,7 @@
<string>Emergency Land</string>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
<string>Ctrl+L</string>
</property>
</action>
<action name="actionEmergency_Kill">
......@@ -284,9 +284,6 @@
<property name="text">
<string>Mission</string>
</property>
<property name="shortcut">
<string>Meta+O</string>
</property>
</action>
<action name="actionEngineersView">
<property name="checkable">
......@@ -299,9 +296,6 @@
<property name="text">
<string>Plot</string>
</property>
<property name="shortcut">
<string>Meta+E</string>
</property>
</action>
<action name="actionMavlinkView">
<property name="checkable">
......@@ -314,9 +308,6 @@
<property name="text">
<string>Mavlink</string>
</property>
<property name="shortcut">
<string>Meta+M</string>
</property>
</action>
<action name="actionFlightView">
<property name="checkable">
......@@ -329,9 +320,6 @@
<property name="text">
<string>Flight</string>
</property>
<property name="shortcut">
<string>Meta+P</string>
</property>
</action>
<action name="actionNewCustomWidget">
<property name="icon">
......@@ -369,9 +357,6 @@
<property name="text">
<string>Unconnected</string>
</property>
<property name="shortcut">
<string>Meta+U</string>
</property>
</action>
<action name="actionShutdownMAV">
<property name="icon">
......@@ -397,9 +382,6 @@
<property name="text">
<string>Fullscreen</string>
</property>
<property name="shortcut">
<string>Meta+Return</string>
</property>
</action>
<action name="actionNormal">
<property name="text">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment