From fa83a81755b7f121e19456dbbdc075668ce8f1ea Mon Sep 17 00:00:00 2001 From: pixhawk Date: Sun, 5 Dec 2010 20:43:21 +0100 Subject: [PATCH] Removed all sorts of menu entries and widgets not available on the various platforms --- src/ui/MainWindow.cc | 327 +++++++++++++++++++++---------------------- 1 file changed, 163 insertions(+), 164 deletions(-) diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 4af4fcf50..b053b35c4 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -1,24 +1,4 @@ -/*===================================================================== - -QGroundControl Open Source Ground Control Station - -(c) 2009, 2010 QGROUNDCONTROL PROJECT - -This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - +/*=================================================================== ======================================================================*/ /** @@ -135,14 +115,16 @@ void MainWindow::buildWidgets() mapWidget = new MapWidget(this); protocolWidget = new XMLCommProtocolWidget(this); dataplotWidget = new QGCDataPlot2D(this); - #ifdef QGC_OSG_ENABLED +#ifdef QGC_OSG_ENABLED _3DWidget = Q3DWidgetFactory::get("PIXHAWK"); - #endif +#endif #ifdef QGC_OSGEARTH_ENABLED _3DMapWidget = Q3DWidgetFactory::get("MAP3D"); #endif +#if (defined Q_OS_WIN) | (defined Q_OS_MAC) gEarthWidget = new QGCGoogleEarthView(this); +#endif // Dock widgets controlDockWidget = new QDockWidget(tr("Control"), this); @@ -234,13 +216,15 @@ void MainWindow::arrangeCenterStack() if (linechartWidget) centerStack->addWidget(linechartWidget); if (protocolWidget) centerStack->addWidget(protocolWidget); if (mapWidget) centerStack->addWidget(mapWidget); - #ifdef QGC_OSG_ENABLED +#ifdef QGC_OSG_ENABLED if (_3DWidget) centerStack->addWidget(_3DWidget); #endif - #ifdef QGC_OSGEARTH_ENABLED +#ifdef QGC_OSGEARTH_ENABLED if (_3DMapWidget) centerStack->addWidget(_3DMapWidget); - #endif +#endif +#if (defined Q_OS_WIN) | (defined Q_OS_MAC) if (gEarthWidget) centerStack->addWidget(gEarthWidget); +#endif if (hudWidget) centerStack->addWidget(hudWidget); if (dataplotWidget) centerStack->addWidget(dataplotWidget); @@ -380,8 +364,17 @@ void MainWindow::connectActions() connect(ui.actionPilotView, SIGNAL(triggered()), this, SLOT(loadPilotView())); connect(ui.actionEngineerView, SIGNAL(triggered()), this, SLOT(loadEngineerView())); connect(ui.actionOperatorView, SIGNAL(triggered()), this, SLOT(loadOperatorView())); +#ifdef QGC_OSG_ENABLED connect(ui.action3DView, SIGNAL(triggered()), this, SLOT(load3DView())); +#else + ui.menuWindow->removeAction(ui.action3DView); +#endif + +#ifdef QGC_OSGEARTH_ENABLED connect(ui.action3DMapView, SIGNAL(triggered()), this, SLOT(load3DMapView())); +#else + ui.menuWindow->removeAction(ui.action3DMapView); +#endif connect(ui.actionShow_full_view, SIGNAL(triggered()), this, SLOT(loadAllView())); connect(ui.actionShow_MAVLink_view, SIGNAL(triggered()), this, SLOT(loadMAVLinkView())); connect(ui.actionShow_data_analysis_view, SIGNAL(triggered()), this, SLOT(loadDataView())); @@ -390,7 +383,11 @@ void MainWindow::connectActions() connect(ui.actionOnline_documentation, SIGNAL(triggered()), this, SLOT(showHelp())); connect(ui.actionCredits_Developers, SIGNAL(triggered()), this, SLOT(showCredits())); connect(ui.actionProject_Roadmap, SIGNAL(triggered()), this, SLOT(showRoadMap())); +#if (defined Q_OS_WIN) | (defined Q_OS_MAC) connect(ui.actionGoogleEarthView, SIGNAL(triggered()), this, SLOT(loadGoogleEarthView())); +#else + ui.menuWindow->removeAction(ui.actionGoogleEarthView); +#endif // Joystick configuration connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure())); @@ -935,17 +932,17 @@ void MainWindow::loadGlobalOperatorView() waypointsDockWidget->show(); } -// // HORIZONTAL SITUATION INDICATOR -// if (hsiDockWidget) -// { -// HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); -// if (hsi) -// { -// addDockWidget(Qt::BottomDockWidgetArea, hsiDockWidget); -// hsiDockWidget->show(); -// hsi->start(); -// } -// } + // // HORIZONTAL SITUATION INDICATOR + // if (hsiDockWidget) + // { + // HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); + // if (hsi) + // { + // addDockWidget(Qt::BottomDockWidgetArea, hsiDockWidget); + // hsiDockWidget->show(); + // hsi->start(); + // } + // } // PROCESS CONTROL if (watchdogControlDockWidget) @@ -972,159 +969,161 @@ void MainWindow::loadGlobalOperatorView() void MainWindow::load3DMapView() { - #ifdef QGC_OSGEARTH_ENABLED - clearView(); +#ifdef QGC_OSGEARTH_ENABLED + clearView(); - // 3D map - if (_3DMapWidget) - { - QStackedWidget *centerStack = dynamic_cast(centralWidget()); - if (centerStack) - { - //map3DWidget->setActive(true); - centerStack->setCurrentWidget(_3DMapWidget); - } - } + // 3D map + if (_3DMapWidget) + { + QStackedWidget *centerStack = dynamic_cast(centralWidget()); + if (centerStack) + { + //map3DWidget->setActive(true); + centerStack->setCurrentWidget(_3DMapWidget); + } + } - // UAS CONTROL - if (controlDockWidget) - { - addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget); - controlDockWidget->show(); - } + // UAS CONTROL + if (controlDockWidget) + { + addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget); + controlDockWidget->show(); + } - // UAS LIST - if (listDockWidget) - { - addDockWidget(Qt::BottomDockWidgetArea, listDockWidget); - listDockWidget->show(); - } + // UAS LIST + if (listDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, listDockWidget); + listDockWidget->show(); + } - // WAYPOINT LIST - if (waypointsDockWidget) - { - addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget); - waypointsDockWidget->show(); - } + // WAYPOINT LIST + if (waypointsDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget); + waypointsDockWidget->show(); + } - // HORIZONTAL SITUATION INDICATOR - if (hsiDockWidget) - { - HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); - if (hsi) - { - hsi->start(); - addDockWidget(Qt::LeftDockWidgetArea, hsiDockWidget); - hsiDockWidget->show(); - } - } -#endif - this->show(); + // HORIZONTAL SITUATION INDICATOR + if (hsiDockWidget) + { + HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); + if (hsi) + { + hsi->start(); + addDockWidget(Qt::LeftDockWidgetArea, hsiDockWidget); + hsiDockWidget->show(); } + } +#endif + this->show(); +} void MainWindow::loadGoogleEarthView() { - clearView(); - - // 3D map - if (gEarthWidget) - { - QStackedWidget *centerStack = dynamic_cast(centralWidget()); - if (centerStack) - { - centerStack->setCurrentWidget(gEarthWidget); - } - } + #if (defined Q_OS_WIN) | (defined Q_OS_MAC) + clearView(); - // UAS CONTROL - if (controlDockWidget) - { - addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget); - controlDockWidget->show(); - } + // 3D map + if (gEarthWidget) + { + QStackedWidget *centerStack = dynamic_cast(centralWidget()); + if (centerStack) + { + centerStack->setCurrentWidget(gEarthWidget); + } + } - // UAS LIST - if (listDockWidget) - { - addDockWidget(Qt::BottomDockWidgetArea, listDockWidget); - listDockWidget->show(); - } + // UAS CONTROL + if (controlDockWidget) + { + addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget); + controlDockWidget->show(); + } - // WAYPOINT LIST - if (waypointsDockWidget) - { - addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget); - waypointsDockWidget->show(); - } + // UAS LIST + if (listDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, listDockWidget); + listDockWidget->show(); + } - // HORIZONTAL SITUATION INDICATOR - if (hsiDockWidget) - { - HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); - if (hsi) - { - hsi->start(); - addDockWidget(Qt::LeftDockWidgetArea, hsiDockWidget); - hsiDockWidget->show(); - } - } - this->show(); + // WAYPOINT LIST + if (waypointsDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget); + waypointsDockWidget->show(); + } + // HORIZONTAL SITUATION INDICATOR + if (hsiDockWidget) + { + HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); + if (hsi) + { + hsi->start(); + addDockWidget(Qt::LeftDockWidgetArea, hsiDockWidget); + hsiDockWidget->show(); } + } + this->show(); +#endif + +} void MainWindow::load3DView() { - #ifdef QGC_OSG_ENABLED - clearView(); +#ifdef QGC_OSG_ENABLED + clearView(); - // 3D map - if (_3DWidget) - { - QStackedWidget *centerStack = dynamic_cast(centralWidget()); - if (centerStack) - { - //map3DWidget->setActive(true); - centerStack->setCurrentWidget(_3DWidget); - } - } + // 3D map + if (_3DWidget) + { + QStackedWidget *centerStack = dynamic_cast(centralWidget()); + if (centerStack) + { + //map3DWidget->setActive(true); + centerStack->setCurrentWidget(_3DWidget); + } + } - // UAS CONTROL - if (controlDockWidget) - { - addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget); - controlDockWidget->show(); - } + // UAS CONTROL + if (controlDockWidget) + { + addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget); + controlDockWidget->show(); + } - // UAS LIST - if (listDockWidget) - { - addDockWidget(Qt::BottomDockWidgetArea, listDockWidget); - listDockWidget->show(); - } + // UAS LIST + if (listDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, listDockWidget); + listDockWidget->show(); + } - // WAYPOINT LIST - if (waypointsDockWidget) - { - addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget); - waypointsDockWidget->show(); - } + // WAYPOINT LIST + if (waypointsDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget); + waypointsDockWidget->show(); + } - // HORIZONTAL SITUATION INDICATOR - if (hsiDockWidget) - { - HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); - if (hsi) - { - hsi->start(); - addDockWidget(Qt::LeftDockWidgetArea, hsiDockWidget); - hsiDockWidget->show(); - } - } + // HORIZONTAL SITUATION INDICATOR + if (hsiDockWidget) + { + HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); + if (hsi) + { + hsi->start(); + addDockWidget(Qt::LeftDockWidgetArea, hsiDockWidget); + hsiDockWidget->show(); + } + } #endif - this->show(); + this->show(); - } +} void MainWindow::loadEngineerView() { -- 2.22.0