From 2e4d3888a1b5d4f696e456d229c54f33b8639841 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 19 Feb 2016 11:16:33 -0800 Subject: [PATCH] Get rid of View menu --- src/ui/MainWindow.cc | 30 ------------------------ src/ui/MainWindow.h | 10 -------- src/ui/MainWindow.ui | 56 ++------------------------------------------ 3 files changed, 2 insertions(+), 94 deletions(-) diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 49131307e..fe17f8ef0 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -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(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))) { diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index d92ab7f68..794a5b156 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -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 */ diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index 4c58ab268..97f563750 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -51,7 +51,7 @@ 0 0 1024 - 21 + 22 @@ -60,6 +60,7 @@ + @@ -72,24 +73,12 @@ - - - View - - - - - - - - Widgets - @@ -122,22 +111,6 @@ Developer Credits - - - true - - - Plan - - - - - true - - - Fly - - true @@ -157,20 +130,6 @@ QAction::PreferencesRole - - - true - - - Setup - - - Setup of the vehicle - - - QAction::NoRole - - true @@ -187,17 +146,6 @@ Show Status Bar - - - true - - - New Mission Editor - - - Mission Editor - - -- 2.22.0