Commit 533279a9 authored by Don Gagne's avatar Don Gagne

Remove Local 3d View, Custom tool widget

parent 25187e60
......@@ -49,7 +49,6 @@ This file is part of the QGROUNDCONTROL project
#include "JoystickWidget.h"
#endif
#include "GAudioOutput.h"
#include "QGCToolWidget.h"
#include "QGCMAVLinkLogPlayer.h"
#include "SettingsDialog.h"
#include "QGCMapTool.h"
......@@ -297,18 +296,16 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
_ui.actionPlan->setShortcut(QApplication::translate("MainWindow", "Meta+2", 0));
_ui.actionFlight->setShortcut(QApplication::translate("MainWindow", "Meta+3", 0));
_ui.actionAnalyze->setShortcut(QApplication::translate("MainWindow", "Meta+4", 0));
_ui.actionLocal3DView->setShortcut(QApplication::translate("MainWindow", "Meta+5", 0));
_ui.actionTerminalView->setShortcut(QApplication::translate("MainWindow", "Meta+6", 0));
_ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Meta+7", 0));
_ui.actionTerminalView->setShortcut(QApplication::translate("MainWindow", "Meta+5", 0));
_ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Meta+6", 0));
_ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Meta+Return", 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));
_ui.actionAnalyze->setShortcut(QApplication::translate("MainWindow", "Ctrl+4", 0));
_ui.actionLocal3DView->setShortcut(QApplication::translate("MainWindow", "Ctrl+5", 0));
_ui.actionTerminalView->setShortcut(QApplication::translate("MainWindow", "Ctrl+6", 0));
_ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Ctrl+7", 0));
_ui.actionTerminalView->setShortcut(QApplication::translate("MainWindow", "Ctrl+5", 0));
_ui.actionSimulationView->setShortcut(QApplication::translate("MainWindow", "Ctrl+6", 0));
_ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Ctrl+Return", 0));
#endif
......@@ -380,24 +377,6 @@ QString MainWindow::_getWindowGeometryKey()
return "_geometry";
}
void MainWindow::_buildCustomWidgets(void)
{
Q_ASSERT(_customWidgets.count() == 0);
// Create custom widgets
_customWidgets = QGCToolWidget::createWidgetsFromSettings(this);
if (_customWidgets.size() > 0)
{
_ui.menuTools->addSeparator();
}
foreach(QGCToolWidget* tool, _customWidgets) {
// Check if this widget already has a parent, do not create it in this case
QDockWidget* dock = dynamic_cast<QDockWidget*>(tool->parentWidget());
if (!dock) {
_createDockWidget(tool->getTitle(), tool->objectName(), Qt::BottomDockWidgetArea, tool);
}
}
}
void MainWindow::_createDockWidget(const QString& title, const QString& name, Qt::DockWidgetArea area, QWidget* innerWidget)
{
Q_ASSERT(!_mapName2DockWidget.contains(name));
......@@ -472,8 +451,6 @@ void MainWindow::_buildCommonWidgets(void)
const struct DockWidgetInfo* pDockInfo = &rgDockWidgetInfo[i];
_createDockWidget(pDockInfo->title, pDockInfo->name, pDockInfo->area, NULL /* no inner widget yet */);
}
_buildCustomWidgets();
}
void MainWindow::_buildPlanView(void)
......@@ -532,16 +509,6 @@ void MainWindow::_buildTerminalView(void)
}
}
void MainWindow::_buildLocal3DView(void)
{
#ifdef QGC_OSG_ENABLED
if (!_local3DView) {
_local3DView = Q3DWidgetFactory::get("PIXHAWK", this);
_local3DView->setVisible(false);
}
#endif
}
/// Shows or hides the specified dock widget, creating if necessary
void MainWindow::_showDockWidget(const QString& name, bool show)
{
......@@ -716,45 +683,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
event->accept();
}
void MainWindow::_createNewCustomWidget(void)
{
if (QGCToolWidget::instances()->isEmpty())
{
// This is the first widget
_ui.menuTools->addSeparator();
}
QString objectName;
int customToolIndex = 0;
//Find the next unique object name that we can use
do {
++customToolIndex;
objectName = QString("CUSTOM_TOOL_%1").arg(customToolIndex) + "DOCK";
} while(QGCToolWidget::instances()->contains(objectName));
QString title = tr("Custom Tool %1").arg(customToolIndex );
QGCToolWidget* tool = new QGCToolWidget(objectName, title);
tool->resize(100, 100);
_createDockWidget(title, objectName, Qt::BottomDockWidgetArea, tool);
_mapName2DockWidget[objectName]->setVisible(true);
}
void MainWindow::_loadCustomWidgetFromFile(void)
{
QString fileName = QGCFileDialog::getOpenFileName(
this, tr("Load Widget File"),
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
tr("QGroundControl Widgets (*.qgw);;All Files (*)"));
if (!fileName.isEmpty()) {
QGCToolWidget* tool = new QGCToolWidget("", "", this);
if (tool->loadSettings(fileName, true)) {
QString objectName = tool->objectName() + "DOCK";
_createDockWidget(tool->getTitle(), objectName, Qt::LeftDockWidgetArea, tool);
_mapName2DockWidget[objectName]->widget()->setVisible(true);
}
}
// TODO Add error dialog if widget could not be loaded
}
void MainWindow::loadSettings()
{
// Why the screaming?
......@@ -776,9 +704,6 @@ void MainWindow::loadSettings()
case VIEW_SIMULATION:
case VIEW_SETUP:
case VIEW_TERMINAL:
#ifdef QGC_OSG_ENABLED
case VIEW_LOCAL3D:
#endif
_currentView = currentViewCandidate;
break;
default:
......@@ -804,9 +729,6 @@ void MainWindow::storeSettings()
// Save the last current view in any case
settings.setValue("CURRENT_VIEW", _currentView);
settings.setValue(_getWindowStateKey(), saveState());
// And save any custom weidgets
QGCToolWidget::storeWidgetsToSettings(settings);
}
void MainWindow::configureWindowName()
......@@ -848,15 +770,9 @@ void MainWindow::connectCommonActions()
perspectives->addAction(_ui.actionPlan);
perspectives->addAction(_ui.actionSetup);
perspectives->addAction(_ui.actionTerminalView);
perspectives->addAction(_ui.actionLocal3DView);
perspectives->addAction(_ui.actionExperimentalPlanView);
perspectives->setExclusive(true);
/* Hide the actions that are not relevant */
#ifndef QGC_OSG_ENABLED
_ui.actionLocal3DView->setVisible(false);
#endif
// Mark the right one as selected
if (_currentView == VIEW_ANALYZE)
{
......@@ -893,11 +809,6 @@ void MainWindow::connectCommonActions()
_ui.actionTerminalView->setChecked(true);
_ui.actionTerminalView->activate(QAction::Trigger);
}
if (_currentView == VIEW_LOCAL3D)
{
_ui.actionLocal3DView->setChecked(true);
_ui.actionLocal3DView->activate(QAction::Trigger);
}
// The UAS actions are not enabled without connection to system
_ui.actionLiftoff->setEnabled(false);
......@@ -925,7 +836,6 @@ void MainWindow::connectCommonActions()
connect(_ui.actionAnalyze, SIGNAL(triggered()), this, SLOT(loadAnalyzeView()));
connect(_ui.actionPlan, SIGNAL(triggered()), this, SLOT(loadPlanView()));
connect(_ui.actionExperimentalPlanView, SIGNAL(triggered()), this, SLOT(loadOldPlanView()));
connect(_ui.actionLocal3DView, SIGNAL(triggered()), this, SLOT(loadLocal3DView()));
connect(_ui.actionTerminalView,SIGNAL(triggered()),this,SLOT(loadTerminalView()));
// Help Actions
......@@ -933,10 +843,6 @@ void MainWindow::connectCommonActions()
connect(_ui.actionDeveloper_Credits, SIGNAL(triggered()), this, SLOT(showCredits()));
connect(_ui.actionProject_Roadmap, SIGNAL(triggered()), this, SLOT(showRoadMap()));
// Custom widget actions
connect(_ui.actionNewCustomWidget, SIGNAL(triggered()), this, SLOT(_createNewCustomWidget()));
connect(_ui.actionLoadCustomWidgetFile, SIGNAL(triggered()), this, SLOT(_loadCustomWidgetFromFile()));
// Audio output
_ui.actionMuteAudioOutput->setChecked(GAudioOutput::instance()->isMuted());
connect(GAudioOutput::instance(), SIGNAL(mutedChanged(bool)), _ui.actionMuteAudioOutput, SLOT(setChecked(bool)));
......@@ -1112,10 +1018,9 @@ void MainWindow::_loadCurrentViewState(void)
_buildTerminalView();
centerView = _terminalView;
break;
case VIEW_LOCAL3D:
_buildLocal3DView();
centerView = _local3DView;
default:
Q_ASSERT(false);
break;
}
......@@ -1267,17 +1172,6 @@ void MainWindow::loadTerminalView()
}
}
void MainWindow::loadLocal3DView()
{
if (_currentView != VIEW_LOCAL3D)
{
_storeCurrentViewState();
_currentView = VIEW_LOCAL3D;
_ui.actionLocal3DView->setChecked(true);
_loadCurrentViewState();
}
}
void MainWindow::loadFlightView()
{
if (_currentView != VIEW_FLIGHT)
......
......@@ -67,7 +67,6 @@ This file is part of the QGROUNDCONTROL project
#include "MAVLinkDecoder.h"
#include "QGCUASFileViewMulti.h"
#include "QGCFlightGearLink.h"
#include "QGCToolWidget.h"
class QGCMapTool;
class QGCMAVLinkMessageSender;
......@@ -162,8 +161,6 @@ public slots:
void loadOldPlanView();
/** @brief Load Terminal Console views */
void loadTerminalView();
/** @brief Load local 3D view */
void loadLocal3DView();
/** @brief Manage Links */
void manageLinks();
......@@ -231,14 +228,14 @@ protected:
typedef enum _VIEW_SECTIONS
{
VIEW_ANALYZE, // Engineering/Analyze view mode. Used for analyzing data and modifying onboard parameters
VIEW_PLAN, // New (QtQuick) Mission/Map/Plan view mode. Used for setting mission waypoints and high-level system commands.
VIEW_FLIGHT, // Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle.
VIEW_SIMULATION, // HIL Simulation view. Useful overview of the entire system when doing hardware-in-the-loop simulations.
VIEW_SETUP, // Setup view. Used for initializing the system for operation. Includes UI for calibration, firmware updating/checking, and parameter modifcation.
VIEW_TERMINAL, // Terminal interface. Used for communicating with the remote system, usually in a special configuration input mode.
VIEW_LOCAL3D, // A local 3D view. Provides a local 3D view that makes visualizing 3D attitude/orientation/pose easy while in operation.
VIEW_EXPERIMENTAL_PLAN, // Original (Qt Widget) Mission/Map/Plan view mode. Used for setting mission waypoints and high-level system commands.
VIEW_ANALYZE, // Engineering/Analyze view mode. Used for analyzing data and modifying onboard parameters
VIEW_PLAN, // New (QtQuick) Mission/Map/Plan view mode. Used for setting mission waypoints and high-level system commands.
VIEW_FLIGHT, // Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle.
VIEW_SIMULATION, // HIL Simulation view. Useful overview of the entire system when doing hardware-in-the-loop simulations.
VIEW_SETUP, // Setup view. Used for initializing the system for operation. Includes UI for calibration, firmware updating/checking, and parameter modifcation.
VIEW_TERMINAL, // Terminal interface. Used for communicating with the remote system, usually in a special configuration input mode.
VIEW_LOCAL3D, // Unused
VIEW_EXPERIMENTAL_PLAN, // Original (Qt Widget) Mission/Map/Plan view mode. Used for setting mission waypoints and high-level system commands.
} VIEW_SECTIONS;
/** @brief Catch window resize events */
......@@ -300,8 +297,6 @@ protected:
private slots:
void _showDockWidgetAction(bool show);
void _loadCustomWidgetFromFile(void);
void _createNewCustomWidget(void);
void _linkStateChange(LinkInterface*);
#ifdef UNITTEST_BUILD
void _showQmlTestWidget(void);
......@@ -321,7 +316,6 @@ private:
QPointer<QWidget> _analyzeView;
QPointer<QWidget> _simView;
QPointer<QWidget> _terminalView;
QPointer<QWidget> _local3DView;
// Dock widget names
static const char* _uasControlDockWidgetName;
......@@ -351,14 +345,12 @@ private:
void _buildAnalyzeView(void);
void _buildSimView(void);
void _buildTerminalView(void);
void _buildLocal3DView(void);
void _storeCurrentViewState(void);
void _loadCurrentViewState(void);
void _createDockWidget(const QString& title, const QString& name, Qt::DockWidgetArea area, QWidget* innerWidget);
void _createInnerDockWidget(const QString& widgetName);
void _buildCustomWidgets(void);
void _buildCommonWidgets(void);
void _hideAllHilDockWidgets(void);
void _hideAllDockWidgets(void);
......@@ -370,7 +362,6 @@ private:
bool _showStatusBar;
QActionGroup* _centerStackActionGroup;
MAVLinkSimulationLink* _simulationLink;
QList<QGCToolWidget*> _customWidgets;
QVBoxLayout* _centralLayout;
QList<QObject*> _commsWidgetList;
QWidget* _currentViewWidget; ///< Currently displayed view widget
......
......@@ -95,12 +95,9 @@
<property name="title">
<string>Tool Widgets</string>
</property>
<addaction name="actionNewCustomWidget"/>
<addaction name="actionLoadCustomWidgetFile"/>
<addaction name="separator"/>
</widget>
<addaction name="actionExperimentalPlanView"/>
<addaction name="actionLocal3DView"/>
<addaction name="actionTerminalView"/>
<addaction name="actionSimulationView"/>
<addaction name="separator"/>
......@@ -223,11 +220,6 @@
<string>Fly</string>
</property>
</action>
<action name="actionNewCustomWidget">
<property name="text">
<string>New Custom Widget</string>
</property>
</action>
<action name="actionMuteAudioOutput">
<property name="checkable">
<bool>true</bool>
......@@ -287,11 +279,6 @@
<string>Esc</string>
</property>
</action>
<action name="actionLoadCustomWidgetFile">
<property name="text">
<string>Load Custom Widget File</string>
</property>
</action>
<action name="actionSetup">
<property name="checkable">
<bool>true</bool>
......@@ -330,14 +317,6 @@
<string>Terminal</string>
</property>
</action>
<action name="actionLocal3DView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Local 3D View</string>
</property>
</action>
<action name="actionStatusBar">
<property name="checkable">
<bool>true</bool>
......
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