Commit 691fc57b authored by Don Gagne's avatar Don Gagne

Merge pull request #1993 from DonLakeFlyer/AnalyzeWidget

Move Analyze view to widget
parents aa9f5591 02b946ef
...@@ -162,12 +162,10 @@ INCLUDEPATH += \ ...@@ -162,12 +162,10 @@ INCLUDEPATH += \
FORMS += \ FORMS += \
src/QGCQmlWidgetHolder.ui \ src/QGCQmlWidgetHolder.ui \
src/ui/Linechart.ui \
src/ui/LogReplayLinkConfigurationWidget.ui \ src/ui/LogReplayLinkConfigurationWidget.ui \
src/ui/MainWindow.ui \ src/ui/MainWindow.ui \
src/ui/MAVLinkSettingsWidget.ui \ src/ui/MAVLinkSettingsWidget.ui \
src/ui/QGCCommConfiguration.ui \ src/ui/QGCCommConfiguration.ui \
src/ui/QGCDataPlot2D.ui \
src/ui/QGCLinkConfiguration.ui \ src/ui/QGCLinkConfiguration.ui \
src/ui/QGCMapRCToParamDialog.ui \ src/ui/QGCMapRCToParamDialog.ui \
src/ui/QGCMAVLinkLogPlayer.ui \ src/ui/QGCMAVLinkLogPlayer.ui \
...@@ -185,7 +183,9 @@ FORMS += \ ...@@ -185,7 +183,9 @@ FORMS += \
!MobileBuild { !MobileBuild {
FORMS += \ FORMS += \
src/ui/Linechart.ui \
src/ui/MultiVehicleDockWidget.ui \ src/ui/MultiVehicleDockWidget.ui \
src/ui/QGCDataPlot2D.ui \
src/ui/QGCHilConfiguration.ui \ src/ui/QGCHilConfiguration.ui \
src/ui/QGCHilFlightGearConfiguration.ui \ src/ui/QGCHilFlightGearConfiguration.ui \
src/ui/QGCHilJSBSimConfiguration.ui \ src/ui/QGCHilJSBSimConfiguration.ui \
...@@ -252,19 +252,11 @@ HEADERS += \ ...@@ -252,19 +252,11 @@ HEADERS += \
src/uas/UAS.h \ src/uas/UAS.h \
src/uas/UASInterface.h \ src/uas/UASInterface.h \
src/uas/UASMessageHandler.h \ src/uas/UASMessageHandler.h \
src/ui/linechart/ChartPlot.h \
src/ui/linechart/IncrementalPlot.h \
src/ui/linechart/LinechartPlot.h \
src/ui/linechart/Linecharts.h \
src/ui/linechart/LinechartWidget.h \
src/ui/linechart/Scrollbar.h \
src/ui/linechart/ScrollZoomer.h \
src/ui/LogReplayLinkConfigurationWidget.h \ src/ui/LogReplayLinkConfigurationWidget.h \
src/ui/MainWindow.h \ src/ui/MainWindow.h \
src/ui/MAVLinkDecoder.h \ src/ui/MAVLinkDecoder.h \
src/ui/MAVLinkSettingsWidget.h \ src/ui/MAVLinkSettingsWidget.h \
src/ui/QGCCommConfiguration.h \ src/ui/QGCCommConfiguration.h \
src/ui/QGCDataPlot2D.h \
src/ui/QGCLinkConfiguration.h \ src/ui/QGCLinkConfiguration.h \
src/ui/QGCMapRCToParamDialog.h \ src/ui/QGCMapRCToParamDialog.h \
src/ui/QGCMAVLinkLogPlayer.h \ src/ui/QGCMAVLinkLogPlayer.h \
...@@ -292,7 +284,15 @@ HEADERS += \ ...@@ -292,7 +284,15 @@ HEADERS += \
src/comm/QGCXPlaneLink.h \ src/comm/QGCXPlaneLink.h \
src/ui/CameraView.h \ src/ui/CameraView.h \
src/ui/HILDockWidget.h \ src/ui/HILDockWidget.h \
src/ui/linechart/ChartPlot.h \
src/ui/linechart/IncrementalPlot.h \
src/ui/linechart/LinechartPlot.h \
src/ui/linechart/Linecharts.h \
src/ui/linechart/LinechartWidget.h \
src/ui/linechart/Scrollbar.h \
src/ui/linechart/ScrollZoomer.h \
src/ui/MultiVehicleDockWidget.h \ src/ui/MultiVehicleDockWidget.h \
src/ui/QGCDataPlot2D.h \
src/ui/QGCHilConfiguration.h \ src/ui/QGCHilConfiguration.h \
src/ui/QGCHilFlightGearConfiguration.h \ src/ui/QGCHilFlightGearConfiguration.h \
src/ui/QGCHilJSBSimConfiguration.h \ src/ui/QGCHilJSBSimConfiguration.h \
...@@ -357,19 +357,11 @@ SOURCES += \ ...@@ -357,19 +357,11 @@ SOURCES += \
src/uas/FileManager.cc \ src/uas/FileManager.cc \
src/uas/UAS.cc \ src/uas/UAS.cc \
src/uas/UASMessageHandler.cc \ src/uas/UASMessageHandler.cc \
src/ui/linechart/ChartPlot.cc \
src/ui/linechart/IncrementalPlot.cc \
src/ui/linechart/LinechartPlot.cc \
src/ui/linechart/Linecharts.cc \
src/ui/linechart/LinechartWidget.cc \
src/ui/linechart/Scrollbar.cc \
src/ui/linechart/ScrollZoomer.cc \
src/ui/LogReplayLinkConfigurationWidget.cc \ src/ui/LogReplayLinkConfigurationWidget.cc \
src/ui/MainWindow.cc \ src/ui/MainWindow.cc \
src/ui/MAVLinkDecoder.cc \ src/ui/MAVLinkDecoder.cc \
src/ui/MAVLinkSettingsWidget.cc \ src/ui/MAVLinkSettingsWidget.cc \
src/ui/QGCCommConfiguration.cc \ src/ui/QGCCommConfiguration.cc \
src/ui/QGCDataPlot2D.cc \
src/ui/QGCLinkConfiguration.cc \ src/ui/QGCLinkConfiguration.cc \
src/ui/QGCMapRCToParamDialog.cpp \ src/ui/QGCMapRCToParamDialog.cpp \
src/ui/QGCMAVLinkLogPlayer.cc \ src/ui/QGCMAVLinkLogPlayer.cc \
...@@ -396,7 +388,15 @@ SOURCES += \ ...@@ -396,7 +388,15 @@ SOURCES += \
src/comm/QGCXPlaneLink.cc \ src/comm/QGCXPlaneLink.cc \
src/ui/CameraView.cc \ src/ui/CameraView.cc \
src/ui/HILDockWidget.cc \ src/ui/HILDockWidget.cc \
src/ui/linechart/ChartPlot.cc \
src/ui/linechart/IncrementalPlot.cc \
src/ui/linechart/LinechartPlot.cc \
src/ui/linechart/Linecharts.cc \
src/ui/linechart/LinechartWidget.cc \
src/ui/linechart/Scrollbar.cc \
src/ui/linechart/ScrollZoomer.cc \
src/ui/MultiVehicleDockWidget.cc \ src/ui/MultiVehicleDockWidget.cc \
src/ui/QGCDataPlot2D.cc \
src/ui/QGCHilConfiguration.cc \ src/ui/QGCHilConfiguration.cc \
src/ui/QGCHilFlightGearConfiguration.cc \ src/ui/QGCHilFlightGearConfiguration.cc \
src/ui/QGCHilJSBSimConfiguration.cc \ src/ui/QGCHilJSBSimConfiguration.cc \
......
[Desktop Entry]
Type=Application
Name=qgroundcontrol
GenericName=Ground Control Station
Comment=UAS ground control station
Icon=qgroundcontrol
Exec=qgroundcontrol
Terminal=false
Categories=Utility;
Keywords=computer;
...@@ -84,8 +84,6 @@ void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot) ...@@ -84,8 +84,6 @@ void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot)
QTest::qWait(200); QTest::qWait(200);
_mainToolBar->onFlyView(); _mainToolBar->onFlyView();
QTest::qWait(200); QTest::qWait(200);
_mainToolBar->onAnalyzeView();
QTest::qWait(200);
// On MainWindow close we should get a message box telling the user to disconnect first. Cancel should do nothing. // On MainWindow close we should get a message box telling the user to disconnect first. Cancel should do nothing.
setExpectedMessageBox(QGCMessageBox::Cancel); setExpectedMessageBox(QGCMessageBox::Cancel);
......
...@@ -46,8 +46,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -46,8 +46,6 @@ This file is part of the QGROUNDCONTROL project
#include "QGCMAVLinkLogPlayer.h" #include "QGCMAVLinkLogPlayer.h"
#include "SettingsDialog.h" #include "SettingsDialog.h"
#include "MAVLinkDecoder.h" #include "MAVLinkDecoder.h"
#include "QGCDataPlot2D.h"
#include "Linecharts.h"
#include "FlightDisplayView.h" #include "FlightDisplayView.h"
#include "SetupView.h" #include "SetupView.h"
#include "QGCApplication.h" #include "QGCApplication.h"
...@@ -60,6 +58,8 @@ This file is part of the QGROUNDCONTROL project ...@@ -60,6 +58,8 @@ This file is part of the QGROUNDCONTROL project
#include "UAS.h" #include "UAS.h"
#ifndef __mobile__ #ifndef __mobile__
#include "QGCDataPlot2D.h"
#include "Linecharts.h"
#include "QGCUASFileViewMulti.h" #include "QGCUASFileViewMulti.h"
#include "UASQuickView.h" #include "UASQuickView.h"
#include "QGCTabbedInfoView.h" #include "QGCTabbedInfoView.h"
...@@ -95,6 +95,7 @@ const char* MainWindow::_uasStatusDetailsDockWidgetName = "Status Details"; ...@@ -95,6 +95,7 @@ const char* MainWindow::_uasStatusDetailsDockWidgetName = "Status Details";
const char* MainWindow::_pfdDockWidgetName = "Primary Flight Display"; const char* MainWindow::_pfdDockWidgetName = "Primary Flight Display";
const char* MainWindow::_uasInfoViewDockWidgetName = "Info View"; const char* MainWindow::_uasInfoViewDockWidgetName = "Info View";
const char* MainWindow::_hilDockWidgetName = "HIL Config"; const char* MainWindow::_hilDockWidgetName = "HIL Config";
const char* MainWindow::_analyzeDockWidgetName = "Analyze";
const char* MainWindow::_visibleWidgetsKey = "VisibleWidgets"; const char* MainWindow::_visibleWidgetsKey = "VisibleWidgets";
#endif #endif
...@@ -277,13 +278,11 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) ...@@ -277,13 +278,11 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
_ui.actionSetup->setShortcut(QApplication::translate("MainWindow", "Meta+1", 0)); _ui.actionSetup->setShortcut(QApplication::translate("MainWindow", "Meta+1", 0));
_ui.actionPlan->setShortcut(QApplication::translate("MainWindow", "Meta+2", 0)); _ui.actionPlan->setShortcut(QApplication::translate("MainWindow", "Meta+2", 0));
_ui.actionFlight->setShortcut(QApplication::translate("MainWindow", "Meta+3", 0)); _ui.actionFlight->setShortcut(QApplication::translate("MainWindow", "Meta+3", 0));
_ui.actionAnalyze->setShortcut(QApplication::translate("MainWindow", "Meta+4", 0));
_ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Meta+Return", 0)); _ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Meta+Return", 0));
#else #else
_ui.actionSetup->setShortcut(QApplication::translate("MainWindow", "Ctrl+1", 0)); _ui.actionSetup->setShortcut(QApplication::translate("MainWindow", "Ctrl+1", 0));
_ui.actionPlan->setShortcut(QApplication::translate("MainWindow", "Ctrl+2", 0)); _ui.actionPlan->setShortcut(QApplication::translate("MainWindow", "Ctrl+2", 0));
_ui.actionFlight->setShortcut(QApplication::translate("MainWindow", "Ctrl+3", 0)); _ui.actionFlight->setShortcut(QApplication::translate("MainWindow", "Ctrl+3", 0));
_ui.actionAnalyze->setShortcut(QApplication::translate("MainWindow", "Ctrl+4", 0));
_ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Ctrl+Return", 0)); _ui.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Ctrl+Return", 0));
#endif #endif
...@@ -367,6 +366,7 @@ void MainWindow::_buildCommonWidgets(void) ...@@ -367,6 +366,7 @@ void MainWindow::_buildCommonWidgets(void)
_pfdDockWidgetName, _pfdDockWidgetName,
_uasInfoViewDockWidgetName, _uasInfoViewDockWidgetName,
_hilDockWidgetName, _hilDockWidgetName,
_analyzeDockWidgetName,
}; };
static const size_t cDockWidgetNames = sizeof(rgDockWidgetNames) / sizeof(rgDockWidgetNames[0]); static const size_t cDockWidgetNames = sizeof(rgDockWidgetNames) / sizeof(rgDockWidgetNames[0]);
...@@ -419,6 +419,8 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName) ...@@ -419,6 +419,8 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName)
widget = new FlightDisplayWidget(widgetName, _mapName2Action[widgetName], this); widget = new FlightDisplayWidget(widgetName, _mapName2Action[widgetName], this);
} else if (widgetName == _hilDockWidgetName) { } else if (widgetName == _hilDockWidgetName) {
widget = new HILDockWidget(widgetName, _mapName2Action[widgetName], this); widget = new HILDockWidget(widgetName, _mapName2Action[widgetName], this);
} else if (widgetName == _analyzeDockWidgetName) {
widget = new Linecharts(widgetName, _mapName2Action[widgetName], mavlinkDecoder, this);
} else if (widgetName == _uasInfoViewDockWidgetName) { } else if (widgetName == _uasInfoViewDockWidgetName) {
QGCTabbedInfoView* pInfoView = new QGCTabbedInfoView(widgetName, _mapName2Action[widgetName], this); QGCTabbedInfoView* pInfoView = new QGCTabbedInfoView(widgetName, _mapName2Action[widgetName], this);
pInfoView->addSource(mavlinkDecoder); pInfoView->addSource(mavlinkDecoder);
...@@ -469,14 +471,6 @@ void MainWindow::_buildSetupView(void) ...@@ -469,14 +471,6 @@ void MainWindow::_buildSetupView(void)
} }
} }
void MainWindow::_buildAnalyzeView(void)
{
if (!_analyzeView) {
_analyzeView = new QGCDataPlot2D(this);
_analyzeView->setVisible(false);
}
}
void MainWindow::fullScreenActionItemCallback(bool) void MainWindow::fullScreenActionItemCallback(bool)
{ {
_ui.actionNormal->setChecked(false); _ui.actionNormal->setChecked(false);
...@@ -589,18 +583,10 @@ void MainWindow::connectCommonActions() ...@@ -589,18 +583,10 @@ void MainWindow::connectCommonActions()
{ {
// Bind together the perspective actions // Bind together the perspective actions
QActionGroup* perspectives = new QActionGroup(_ui.menuPerspectives); QActionGroup* perspectives = new QActionGroup(_ui.menuPerspectives);
perspectives->addAction(_ui.actionAnalyze);
perspectives->addAction(_ui.actionFlight);
perspectives->addAction(_ui.actionPlan); perspectives->addAction(_ui.actionPlan);
perspectives->addAction(_ui.actionSetup); perspectives->addAction(_ui.actionSetup);
perspectives->setExclusive(true); perspectives->setExclusive(true);
// Mark the right one as selected
if (_currentView == VIEW_ANALYZE)
{
_ui.actionAnalyze->setChecked(true);
_ui.actionAnalyze->activate(QAction::Trigger);
}
if (_currentView == VIEW_FLIGHT) if (_currentView == VIEW_FLIGHT)
{ {
_ui.actionFlight->setChecked(true); _ui.actionFlight->setChecked(true);
...@@ -625,7 +611,6 @@ void MainWindow::connectCommonActions() ...@@ -625,7 +611,6 @@ void MainWindow::connectCommonActions()
// Views actions // Views actions
connect(_ui.actionFlight, SIGNAL(triggered()), this, SLOT(loadFlightView())); connect(_ui.actionFlight, SIGNAL(triggered()), this, SLOT(loadFlightView()));
connect(_ui.actionAnalyze, SIGNAL(triggered()), this, SLOT(loadAnalyzeView()));
connect(_ui.actionPlan, SIGNAL(triggered()), this, SLOT(loadPlanView())); connect(_ui.actionPlan, SIGNAL(triggered()), this, SLOT(loadPlanView()));
// Help Actions // Help Actions
...@@ -695,18 +680,6 @@ void MainWindow::commsWidgetDestroyed(QObject *obj) ...@@ -695,18 +680,6 @@ void MainWindow::commsWidgetDestroyed(QObject *obj)
void MainWindow::_vehicleAdded(Vehicle* vehicle) void MainWindow::_vehicleAdded(Vehicle* vehicle)
{ {
connect(vehicle->uas(), SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)), this, SIGNAL(valueChanged(int,QString,QString,QVariant,quint64))); connect(vehicle->uas(), SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)), this, SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)));
if (!linechartWidget)
{
linechartWidget = new Linecharts(this);
linechartWidget->setVisible(false);
}
linechartWidget->addSource(mavlinkDecoder);
if (_analyzeView != linechartWidget)
{
_analyzeView = linechartWidget;
}
} }
/// Stores the state of the toolbar, status bar and widgets associated with the current view /// Stores the state of the toolbar, status bar and widgets associated with the current view
...@@ -733,11 +706,6 @@ void MainWindow::_loadCurrentViewState(void) ...@@ -733,11 +706,6 @@ void MainWindow::_loadCurrentViewState(void)
centerView = _setupView; centerView = _setupView;
break; break;
case VIEW_ANALYZE:
_buildAnalyzeView();
centerView = _analyzeView;
break;
case VIEW_FLIGHT: case VIEW_FLIGHT:
_buildFlightView(); _buildFlightView();
centerView = _flightView; centerView = _flightView;
...@@ -779,17 +747,6 @@ void MainWindow::_loadCurrentViewState(void) ...@@ -779,17 +747,6 @@ void MainWindow::_loadCurrentViewState(void)
emit repaintCanvas(); emit repaintCanvas();
} }
void MainWindow::loadAnalyzeView()
{
if (_currentView != VIEW_ANALYZE)
{
_storeCurrentViewState();
_currentView = VIEW_ANALYZE;
_ui.actionAnalyze->setChecked(true);
_loadCurrentViewState();
}
}
void MainWindow::loadPlanView() void MainWindow::loadPlanView()
{ {
if (_currentView != VIEW_MISSIONEDITOR) if (_currentView != VIEW_MISSIONEDITOR)
......
...@@ -56,7 +56,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -56,7 +56,6 @@ This file is part of the QGROUNDCONTROL project
#endif // QGC_MOUSE_ENABLED_WIN #endif // QGC_MOUSE_ENABLED_WIN
class QGCFirmwareUpdate;
class QSplashScreen; class QSplashScreen;
class QGCStatusBar; class QGCStatusBar;
class Linecharts; class Linecharts;
...@@ -122,7 +121,6 @@ public slots: ...@@ -122,7 +121,6 @@ public slots:
void loadSetupView(); void loadSetupView();
void loadFlightView(); void loadFlightView();
void loadAnalyzeView();
void loadPlanView(); void loadPlanView();
void manageLinks(); void manageLinks();
...@@ -187,7 +185,7 @@ protected: ...@@ -187,7 +185,7 @@ protected:
typedef enum _VIEW_SECTIONS typedef enum _VIEW_SECTIONS
{ {
VIEW_ANALYZE, // Engineering/Analyze view mode. Used for analyzing data and modifying onboard parameters VIEW_UNUSED5, // Unused (don't remove, or it will screw up saved settigns indices)
VIEW_UNUSED3, // Unused (don't remove, or it will screw up saved settigns indices) VIEW_UNUSED3, // Unused (don't remove, or it will screw up saved settigns indices)
VIEW_FLIGHT, // Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle. VIEW_FLIGHT, // Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle.
VIEW_UNUSED4, // Unused (don't remove, or it will screw up saved settigns indices) VIEW_UNUSED4, // Unused (don't remove, or it will screw up saved settigns indices)
...@@ -205,7 +203,6 @@ protected: ...@@ -205,7 +203,6 @@ protected:
void loadSettings(); void loadSettings();
void storeSettings(); void storeSettings();
QSettings settings; QSettings settings;
// Center widgets // Center widgets
...@@ -263,7 +260,6 @@ private: ...@@ -263,7 +260,6 @@ private:
QPointer<QWidget> _planView; QPointer<QWidget> _planView;
QPointer<QWidget> _flightView; QPointer<QWidget> _flightView;
QPointer<QWidget> _setupView; QPointer<QWidget> _setupView;
QPointer<QWidget> _analyzeView;
QPointer<QWidget> _missionEditorView; QPointer<QWidget> _missionEditorView;
#ifndef __mobile__ #ifndef __mobile__
...@@ -275,6 +271,7 @@ private: ...@@ -275,6 +271,7 @@ private:
static const char* _pfdDockWidgetName; static const char* _pfdDockWidgetName;
static const char* _uasInfoViewDockWidgetName; static const char* _uasInfoViewDockWidgetName;
static const char* _hilDockWidgetName; static const char* _hilDockWidgetName;
static const char* _analyzeDockWidgetName;
QMap<QString, QGCDockWidget*> _mapName2DockWidget; QMap<QString, QGCDockWidget*> _mapName2DockWidget;
QMap<QString, QAction*> _mapName2Action; QMap<QString, QAction*> _mapName2Action;
...@@ -283,7 +280,6 @@ private: ...@@ -283,7 +280,6 @@ private:
void _buildPlanView(void); void _buildPlanView(void);
void _buildFlightView(void); void _buildFlightView(void);
void _buildSetupView(void); void _buildSetupView(void);
void _buildAnalyzeView(void);
void _buildTerminalView(void); void _buildTerminalView(void);
void _buildMissionEditorView(void); void _buildMissionEditorView(void);
......
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
<addaction name="actionSetup"/> <addaction name="actionSetup"/>
<addaction name="actionPlan"/> <addaction name="actionPlan"/>
<addaction name="actionFlight"/> <addaction name="actionFlight"/>
<addaction name="actionAnalyze"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionFullscreen"/> <addaction name="actionFullscreen"/>
<addaction name="actionNormal"/> <addaction name="actionNormal"/>
...@@ -134,14 +133,6 @@ ...@@ -134,14 +133,6 @@
<string>Plan</string> <string>Plan</string>
</property> </property>
</action> </action>
<action name="actionAnalyze">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Analyze</string>
</property>
</action>
<action name="actionFlight"> <action name="actionFlight">
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
...@@ -237,9 +228,7 @@ ...@@ -237,9 +228,7 @@
</action> </action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources/>
<include location="../../qgroundcontrol.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>actionExit</sender> <sender>actionExit</sender>
......
...@@ -40,8 +40,11 @@ MultiVehicleDockWidget::MultiVehicleDockWidget(const QString& title, QAction* ac ...@@ -40,8 +40,11 @@ MultiVehicleDockWidget::MultiVehicleDockWidget(const QString& title, QAction* ac
void MultiVehicleDockWidget::init(void) void MultiVehicleDockWidget::init(void)
{ {
foreach (Vehicle* vehicle, MultiVehicleManager::instance()->vehicles()) {
_vehicleAdded(vehicle);
}
if (MultiVehicleManager::instance()->activeVehicle()) { if (MultiVehicleManager::instance()->activeVehicle()) {
_vehicleAdded(MultiVehicleManager::instance()->activeVehicle());
_activeVehicleChanged(MultiVehicleManager::instance()->activeVehicle()); _activeVehicleChanged(MultiVehicleManager::instance()->activeVehicle());
} }
} }
......
...@@ -5,99 +5,27 @@ ...@@ -5,99 +5,27 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "UAS.h" #include "UAS.h"
Linecharts::Linecharts(QWidget *parent) : Linecharts::Linecharts(const QString& title, QAction* action, MAVLinkDecoder* decoder, QWidget *parent)
QStackedWidget(parent), : MultiVehicleDockWidget(title, action, parent)
plots(), , _mavlinkDecoder(decoder)
active(true)
{ {
this->setVisible(false); init();
// Add each MAV
foreach (Vehicle* vehicle, MultiVehicleManager::instance()->vehicles()) {
addVehicle(vehicle);
}
connect(MultiVehicleManager::instance(), &MultiVehicleManager::vehicleAdded, this, &Linecharts::addVehicle);
}
void Linecharts::showEvent(QShowEvent* event) this->setVisible(false);
{
// React only to internal (pre-display)
// events
Q_UNUSED(event)
QWidget* prevWidget = currentWidget();
if (prevWidget)
{
LinechartWidget* chart = dynamic_cast<LinechartWidget*>(prevWidget);
if (chart) {
this->active = true;
chart->setActive(true);
}
}
QWidget::showEvent(event);
emit visibilityChanged(true);
} }
void Linecharts::hideEvent(QHideEvent* event) QWidget* Linecharts::_newVehicleWidget(Vehicle* vehicle, QWidget* parent)
{ {
// React only to internal (pre-display) LinechartWidget* widget = new LinechartWidget(vehicle->id(), parent);
// events
Q_UNUSED(event)
QWidget* prevWidget = currentWidget();
if (prevWidget) {
LinechartWidget* chart = dynamic_cast<LinechartWidget*>(prevWidget);
if (chart) {
this->active = false;
chart->setActive(false);
}
}
QWidget::hideEvent(event);
emit visibilityChanged(false);
}
void Linecharts::addVehicle(Vehicle* vehicle) // Connect valueChanged signals
{ connect(vehicle->uas(), &UAS::valueChanged, widget, &LinechartWidget::appendData);
UAS* uas = vehicle->uas();
// FIXME Add removeSystem() call
// Compatibility hack // Connect decoder
int uasid = 0; /*uas->getUASID()*/ connect(_mavlinkDecoder, &MAVLinkDecoder::valueChanged, widget, &LinechartWidget::appendData);
if (!plots.contains(uasid))
{
LinechartWidget* widget = new LinechartWidget(uasid, this);
addWidget(widget);
plots.insert(uasid, widget);
// Connect valueChanged signals
connect(uas, SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)), widget, SLOT(appendData(int,QString,QString,QVariant,quint64)));
connect(widget, SIGNAL(logfileWritten(QString)), this, SIGNAL(logfileWritten(QString))); // Select system
// Set system active if this is the only system widget->setActive(true);
// if (active)
// {
// if (plots.size() == 1)
// {
// FIXME XXX HACK
// Connect generic sources
for (int i = 0; i < genericSources.count(); ++i)
{
connect(genericSources[i], SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)), plots.values().first(), SLOT(appendData(int,QString,QString,QVariant,quint64)));
}
// Select system
widget->setActive(true);
//widget->selectActiveSystem(0);
}
// }
// }
}
void Linecharts::addSource(QObject* obj) return widget;
{
genericSources.append(obj);
// FIXME XXX HACK
if (plots.size() > 0)
{
// Connect generic source
connect(obj, SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)), plots.values().first(), SLOT(appendData(int,QString,QString,QVariant,quint64)));
}
} }
...@@ -7,34 +7,26 @@ ...@@ -7,34 +7,26 @@
#include "LinechartWidget.h" #include "LinechartWidget.h"
#include "Vehicle.h" #include "Vehicle.h"
#include "MultiVehicleDockWidget.h"
#include "MAVLinkDecoder.h"
class Linecharts : public QStackedWidget class Linecharts : public MultiVehicleDockWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Linecharts(QWidget *parent = 0); explicit Linecharts(const QString& title, QAction* action, MAVLinkDecoder* decoder, QWidget *parent = 0);
signals: signals:
/** @brief This signal is emitted once a logfile has been finished writing */ /** @brief This signal is emitted once a logfile has been finished writing */
void logfileWritten(QString fileName); void logfileWritten(QString fileName);
void visibilityChanged(bool visible); void visibilityChanged(bool visible);
public slots:
/** @brief Add a new system to the list of plots */
void addVehicle(Vehicle* vehicle);
/** @brief Add a new generic message source (not a system) */
void addSource(QObject* obj);
protected: protected:
// Override from MultiVehicleDockWidget
virtual QWidget* _newVehicleWidget(Vehicle* vehicle, QWidget* parent);
QMap<int, LinechartWidget*> plots; private:
QVector<QObject*> genericSources; MAVLinkDecoder* _mavlinkDecoder;
bool active;
/** @brief Start updating widget */
void showEvent(QShowEvent* event);
/** @brief Stop updating widget */
void hideEvent(QHideEvent* event);
}; };
#endif // LINECHARTS_H #endif // LINECHARTS_H
...@@ -161,12 +161,6 @@ void MainToolBar::onFlyViewMenu() ...@@ -161,12 +161,6 @@ void MainToolBar::onFlyViewMenu()
} }
} }
void MainToolBar::onAnalyzeView()
{
setCurrentView(MainWindow::VIEW_ANALYZE);
MainWindow::instance()->loadAnalyzeView();
}
void MainToolBar::onDisconnect(QString conf) void MainToolBar::onDisconnect(QString conf)
{ {
if(conf.isEmpty()) { if(conf.isEmpty()) {
...@@ -248,9 +242,6 @@ void MainToolBar::setCurrentView(int currentView) ...@@ -248,9 +242,6 @@ void MainToolBar::setCurrentView(int currentView)
{ {
ViewType_t view = ViewNone; ViewType_t view = ViewNone;
switch((MainWindow::VIEW_SECTIONS)currentView) { switch((MainWindow::VIEW_SECTIONS)currentView) {
case MainWindow::VIEW_ANALYZE:
view = ViewAnalyze;
break;
case MainWindow::VIEW_MISSIONEDITOR: case MainWindow::VIEW_MISSIONEDITOR:
view = ViewPlan; view = ViewPlan;
break; break;
...@@ -441,4 +432,4 @@ void MainToolBar::onToolBarMessageClosed(void) ...@@ -441,4 +432,4 @@ void MainToolBar::onToolBarMessageClosed(void)
{ {
_toolbarMessageVisible = false; _toolbarMessageVisible = false;
_delayedShowToolBarMessage(); _delayedShowToolBarMessage();
} }
\ No newline at end of file
...@@ -64,7 +64,6 @@ public: ...@@ -64,7 +64,6 @@ public:
Q_INVOKABLE void onPlanView(); Q_INVOKABLE void onPlanView();
Q_INVOKABLE void onFlyView(); Q_INVOKABLE void onFlyView();
Q_INVOKABLE void onFlyViewMenu(); Q_INVOKABLE void onFlyViewMenu();
Q_INVOKABLE void onAnalyzeView();
Q_INVOKABLE void onConnect(QString conf); Q_INVOKABLE void onConnect(QString conf);
Q_INVOKABLE void onDisconnect(QString conf); Q_INVOKABLE void onDisconnect(QString conf);
Q_INVOKABLE void onEnterMessageArea(int x, int y); Q_INVOKABLE void onEnterMessageArea(int x, int y);
......
...@@ -626,7 +626,6 @@ Rectangle { ...@@ -626,7 +626,6 @@ Rectangle {
setupButton.repaintChevron = true; setupButton.repaintChevron = true;
planButton.repaintChevron = true; planButton.repaintChevron = true;
flyButton.repaintChevron = true; flyButton.repaintChevron = true;
analyzeButton.repaintChevron = true;
} }
} }
...@@ -670,19 +669,6 @@ Rectangle { ...@@ -670,19 +669,6 @@ Rectangle {
} }
z: 800 z: 800
} }
QGCToolBarButton {
id: analyzeButton
width: getProportionalDimmension(90)
height: cellHeight
exclusiveGroup: mainActionGroup
text: qsTr("Analyze")
checked: (mainToolBar.currentView === MainToolBar.ViewAnalyze)
onClicked: {
mainToolBar.onAnalyzeView();
}
z: 700
}
} // Row } // Row
//--------------------------------------------------------------------- //---------------------------------------------------------------------
......
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