Commit 2dbc6302 authored by Don Gagne's avatar Don Gagne

Merge pull request #2855 from DonLakeFlyer/NoViewMenu

Get rid of View menu
parents e29dce3d 2e4d3888
......@@ -245,19 +245,6 @@ MainWindow::MainWindow()
connect(_ui.actionStatusBar, &QAction::triggered, this, &MainWindow::showStatusBarCallback);
// Set OS dependent keyboard shortcuts for the main window, non OS dependent shortcuts are set in MainWindow.ui
#ifdef __macos__
_ui.actionSetup->setShortcut(QApplication::translate("MainWindow", "Meta+1", 0));
_ui.actionPlan->setShortcut(QApplication::translate("MainWindow", "Meta+2", 0));
_ui.actionFlight->setShortcut(QApplication::translate("MainWindow", "Meta+3", 0));
#else
_ui.actionSetup->setShortcut(QApplication::translate("MainWindow", "Ctrl+1", 0));
_ui.actionPlan->setShortcut(QApplication::translate("MainWindow", "Ctrl+2", 0));
_ui.actionFlight->setShortcut(QApplication::translate("MainWindow", "Ctrl+3", 0));
#endif
_ui.actionFlight->setChecked(true);
connect(&windowNameUpdateTimer, &QTimer::timeout, this, &MainWindow::configureWindowName);
windowNameUpdateTimer.start(15000);
emit initStatusChanged(tr("Done"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
......@@ -503,27 +490,10 @@ void MainWindow::connectCommonActions()
// Application Settings
connect(_ui.actionSettings, &QAction::triggered, this, &MainWindow::showSettings);
// Views actions
connect(_ui.actionFlight, &QAction::triggered, qgcApp(), &QGCApplication::showFlyView);
connect(_ui.actionPlan, &QAction::triggered, qgcApp(), &QGCApplication::showPlanView);
connect(_ui.actionSetup, &QAction::triggered, qgcApp(), &QGCApplication::showSetupView);
connect(_ui.actionFlight, &QAction::triggered, this, &MainWindow::handleActiveViewActionState);
connect(_ui.actionPlan, &QAction::triggered, this, &MainWindow::handleActiveViewActionState);
connect(_ui.actionSetup, &QAction::triggered, this, &MainWindow::handleActiveViewActionState);
// Connect internal actions
connect(qgcApp()->toolbox()->multiVehicleManager(), &MultiVehicleManager::vehicleAdded, this, &MainWindow::_vehicleAdded);
}
void MainWindow::handleActiveViewActionState(bool triggered)
{
Q_UNUSED(triggered);
QAction *triggeredAction = qobject_cast<QAction*>(sender());
_ui.actionFlight->setChecked(triggeredAction == _ui.actionFlight);
_ui.actionPlan->setChecked(triggeredAction == _ui.actionPlan);
_ui.actionSetup->setChecked(triggeredAction == _ui.actionSetup);
}
void MainWindow::_openUrl(const QString& url, const QString& errorMessage)
{
if(!QDesktopServices::openUrl(QUrl(url))) {
......
......@@ -120,16 +120,6 @@ protected slots:
*/
void showStatusBarCallback(bool checked);
/**
* @brief Disable the other QActions that trigger view mode changes
*
* When a user hits Ctrl+1, Ctrl+2, Ctrl+3 - only one view is set to active
* (and in the QML file for the MainWindow the others are set to have
* visibility = false), but on the Menu all of them would be selected making
* this incoherent.
*/
void handleActiveViewActionState(bool triggered);
signals:
void initStatusChanged(const QString& message, int alignment, const QColor &color);
/** Emitted when any value changes from any source */
......
......@@ -51,7 +51,7 @@
<x>0</x>
<y>0</y>
<width>1024</width>
<height>21</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuMGround">
......@@ -60,6 +60,7 @@
</property>
<addaction name="separator"/>
<addaction name="actionMuteAudioOutput"/>
<addaction name="actionStatusBar"/>
<addaction name="actionSettings"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
......@@ -72,24 +73,12 @@
<addaction name="actionProject_Roadmap"/>
<addaction name="actionDeveloper_Credits"/>
</widget>
<widget class="QMenu" name="menuPerspectives">
<property name="title">
<string>View</string>
</property>
<addaction name="actionSetup"/>
<addaction name="actionPlan"/>
<addaction name="actionFlight"/>
<addaction name="separator"/>
<addaction name="separator"/>
<addaction name="actionStatusBar"/>
</widget>
<widget class="QMenu" name="menuWidgets">
<property name="title">
<string>Widgets</string>
</property>
</widget>
<addaction name="menuMGround"/>
<addaction name="menuPerspectives"/>
<addaction name="menuWidgets"/>
<addaction name="menuHelp"/>
</widget>
......@@ -122,22 +111,6 @@
<string>Developer Credits</string>
</property>
</action>
<action name="actionPlan">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Plan</string>
</property>
</action>
<action name="actionFlight">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Fly</string>
</property>
</action>
<action name="actionMuteAudioOutput">
<property name="checkable">
<bool>true</bool>
......@@ -157,20 +130,6 @@
<enum>QAction::PreferencesRole</enum>
</property>
</action>
<action name="actionSetup">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Setup</string>
</property>
<property name="toolTip">
<string>Setup of the vehicle</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionAdvanced_Mode">
<property name="checkable">
<bool>true</bool>
......@@ -187,17 +146,6 @@
<string>Show Status Bar</string>
</property>
</action>
<action name="actionMissionEditor">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>New Mission Editor</string>
</property>
<property name="toolTip">
<string>Mission Editor</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
......
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