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 += \
FORMS += \
src/QGCQmlWidgetHolder.ui \
src/ui/Linechart.ui \
src/ui/LogReplayLinkConfigurationWidget.ui \
src/ui/MainWindow.ui \
src/ui/MAVLinkSettingsWidget.ui \
src/ui/QGCCommConfiguration.ui \
src/ui/QGCDataPlot2D.ui \
src/ui/QGCLinkConfiguration.ui \
src/ui/QGCMapRCToParamDialog.ui \
src/ui/QGCMAVLinkLogPlayer.ui \
......@@ -185,7 +183,9 @@ FORMS += \
!MobileBuild {
FORMS += \
src/ui/Linechart.ui \
src/ui/MultiVehicleDockWidget.ui \
src/ui/QGCDataPlot2D.ui \
src/ui/QGCHilConfiguration.ui \
src/ui/QGCHilFlightGearConfiguration.ui \
src/ui/QGCHilJSBSimConfiguration.ui \
......@@ -252,19 +252,11 @@ HEADERS += \
src/uas/UAS.h \
src/uas/UASInterface.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/MainWindow.h \
src/ui/MAVLinkDecoder.h \
src/ui/MAVLinkSettingsWidget.h \
src/ui/QGCCommConfiguration.h \
src/ui/QGCDataPlot2D.h \
src/ui/QGCLinkConfiguration.h \
src/ui/QGCMapRCToParamDialog.h \
src/ui/QGCMAVLinkLogPlayer.h \
......@@ -292,7 +284,15 @@ HEADERS += \
src/comm/QGCXPlaneLink.h \
src/ui/CameraView.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/QGCDataPlot2D.h \
src/ui/QGCHilConfiguration.h \
src/ui/QGCHilFlightGearConfiguration.h \
src/ui/QGCHilJSBSimConfiguration.h \
......@@ -357,19 +357,11 @@ SOURCES += \
src/uas/FileManager.cc \
src/uas/UAS.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/MainWindow.cc \
src/ui/MAVLinkDecoder.cc \
src/ui/MAVLinkSettingsWidget.cc \
src/ui/QGCCommConfiguration.cc \
src/ui/QGCDataPlot2D.cc \
src/ui/QGCLinkConfiguration.cc \
src/ui/QGCMapRCToParamDialog.cpp \
src/ui/QGCMAVLinkLogPlayer.cc \
......@@ -396,7 +388,15 @@ SOURCES += \
src/comm/QGCXPlaneLink.cc \
src/ui/CameraView.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/QGCDataPlot2D.cc \
src/ui/QGCHilConfiguration.cc \
src/ui/QGCHilFlightGearConfiguration.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)
QTest::qWait(200);
_mainToolBar->onFlyView();
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.
setExpectedMessageBox(QGCMessageBox::Cancel);
......
......@@ -46,8 +46,6 @@ This file is part of the QGROUNDCONTROL project
#include "QGCMAVLinkLogPlayer.h"
#include "SettingsDialog.h"
#include "MAVLinkDecoder.h"
#include "QGCDataPlot2D.h"
#include "Linecharts.h"
#include "FlightDisplayView.h"
#include "SetupView.h"
#include "QGCApplication.h"
......@@ -60,6 +58,8 @@ This file is part of the QGROUNDCONTROL project
#include "UAS.h"
#ifndef __mobile__
#include "QGCDataPlot2D.h"
#include "Linecharts.h"
#include "QGCUASFileViewMulti.h"
#include "UASQuickView.h"
#include "QGCTabbedInfoView.h"
......@@ -95,6 +95,7 @@ const char* MainWindow::_uasStatusDetailsDockWidgetName = "Status Details";
const char* MainWindow::_pfdDockWidgetName = "Primary Flight Display";
const char* MainWindow::_uasInfoViewDockWidgetName = "Info View";
const char* MainWindow::_hilDockWidgetName = "HIL Config";
const char* MainWindow::_analyzeDockWidgetName = "Analyze";
const char* MainWindow::_visibleWidgetsKey = "VisibleWidgets";
#endif
......@@ -277,13 +278,11 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
_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));
_ui.actionAnalyze->setShortcut(QApplication::translate("MainWindow", "Meta+4", 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.actionFullscreen->setShortcut(QApplication::translate("MainWindow", "Ctrl+Return", 0));
#endif
......@@ -367,6 +366,7 @@ void MainWindow::_buildCommonWidgets(void)
_pfdDockWidgetName,
_uasInfoViewDockWidgetName,
_hilDockWidgetName,
_analyzeDockWidgetName,
};
static const size_t cDockWidgetNames = sizeof(rgDockWidgetNames) / sizeof(rgDockWidgetNames[0]);
......@@ -419,6 +419,8 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName)
widget = new FlightDisplayWidget(widgetName, _mapName2Action[widgetName], this);
} else if (widgetName == _hilDockWidgetName) {
widget = new HILDockWidget(widgetName, _mapName2Action[widgetName], this);
} else if (widgetName == _analyzeDockWidgetName) {
widget = new Linecharts(widgetName, _mapName2Action[widgetName], mavlinkDecoder, this);
} else if (widgetName == _uasInfoViewDockWidgetName) {
QGCTabbedInfoView* pInfoView = new QGCTabbedInfoView(widgetName, _mapName2Action[widgetName], this);
pInfoView->addSource(mavlinkDecoder);
......@@ -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)
{
_ui.actionNormal->setChecked(false);
......@@ -589,18 +583,10 @@ void MainWindow::connectCommonActions()
{
// Bind together the perspective actions
QActionGroup* perspectives = new QActionGroup(_ui.menuPerspectives);
perspectives->addAction(_ui.actionAnalyze);
perspectives->addAction(_ui.actionFlight);
perspectives->addAction(_ui.actionPlan);
perspectives->addAction(_ui.actionSetup);
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)
{
_ui.actionFlight->setChecked(true);
......@@ -625,7 +611,6 @@ void MainWindow::connectCommonActions()
// Views actions
connect(_ui.actionFlight, SIGNAL(triggered()), this, SLOT(loadFlightView()));
connect(_ui.actionAnalyze, SIGNAL(triggered()), this, SLOT(loadAnalyzeView()));
connect(_ui.actionPlan, SIGNAL(triggered()), this, SLOT(loadPlanView()));
// Help Actions
......@@ -695,18 +680,6 @@ void MainWindow::commsWidgetDestroyed(QObject *obj)
void MainWindow::_vehicleAdded(Vehicle* vehicle)
{
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
......@@ -733,11 +706,6 @@ void MainWindow::_loadCurrentViewState(void)
centerView = _setupView;
break;
case VIEW_ANALYZE:
_buildAnalyzeView();
centerView = _analyzeView;
break;
case VIEW_FLIGHT:
_buildFlightView();
centerView = _flightView;
......@@ -779,17 +747,6 @@ void MainWindow::_loadCurrentViewState(void)
emit repaintCanvas();
}
void MainWindow::loadAnalyzeView()
{
if (_currentView != VIEW_ANALYZE)
{
_storeCurrentViewState();
_currentView = VIEW_ANALYZE;
_ui.actionAnalyze->setChecked(true);
_loadCurrentViewState();
}
}
void MainWindow::loadPlanView()
{
if (_currentView != VIEW_MISSIONEDITOR)
......
......@@ -56,7 +56,6 @@ This file is part of the QGROUNDCONTROL project
#endif // QGC_MOUSE_ENABLED_WIN
class QGCFirmwareUpdate;
class QSplashScreen;
class QGCStatusBar;
class Linecharts;
......@@ -122,7 +121,6 @@ public slots:
void loadSetupView();
void loadFlightView();
void loadAnalyzeView();
void loadPlanView();
void manageLinks();
......@@ -187,7 +185,7 @@ protected:
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_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)
......@@ -205,7 +203,6 @@ protected:
void loadSettings();
void storeSettings();
QSettings settings;
// Center widgets
......@@ -263,7 +260,6 @@ private:
QPointer<QWidget> _planView;
QPointer<QWidget> _flightView;
QPointer<QWidget> _setupView;
QPointer<QWidget> _analyzeView;
QPointer<QWidget> _missionEditorView;
#ifndef __mobile__
......@@ -275,6 +271,7 @@ private:
static const char* _pfdDockWidgetName;
static const char* _uasInfoViewDockWidgetName;
static const char* _hilDockWidgetName;
static const char* _analyzeDockWidgetName;
QMap<QString, QGCDockWidget*> _mapName2DockWidget;
QMap<QString, QAction*> _mapName2Action;
......@@ -283,7 +280,6 @@ private:
void _buildPlanView(void);
void _buildFlightView(void);
void _buildSetupView(void);
void _buildAnalyzeView(void);
void _buildTerminalView(void);
void _buildMissionEditorView(void);
......
......@@ -80,7 +80,6 @@
<addaction name="actionSetup"/>
<addaction name="actionPlan"/>
<addaction name="actionFlight"/>
<addaction name="actionAnalyze"/>
<addaction name="separator"/>
<addaction name="actionFullscreen"/>
<addaction name="actionNormal"/>
......@@ -134,14 +133,6 @@
<string>Plan</string>
</property>
</action>
<action name="actionAnalyze">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Analyze</string>
</property>
</action>
<action name="actionFlight">
<property name="checkable">
<bool>true</bool>
......@@ -237,9 +228,7 @@
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="../../qgroundcontrol.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>actionExit</sender>
......
......@@ -40,8 +40,11 @@ MultiVehicleDockWidget::MultiVehicleDockWidget(const QString& title, QAction* ac
void MultiVehicleDockWidget::init(void)
{
foreach (Vehicle* vehicle, MultiVehicleManager::instance()->vehicles()) {
_vehicleAdded(vehicle);
}
if (MultiVehicleManager::instance()->activeVehicle()) {
_vehicleAdded(MultiVehicleManager::instance()->activeVehicle());
_activeVehicleChanged(MultiVehicleManager::instance()->activeVehicle());
}
}
......
......@@ -5,99 +5,27 @@
#include "MainWindow.h"
#include "UAS.h"
Linecharts::Linecharts(QWidget *parent) :
QStackedWidget(parent),
plots(),
active(true)
Linecharts::Linecharts(const QString& title, QAction* action, MAVLinkDecoder* decoder, QWidget *parent)
: MultiVehicleDockWidget(title, action, parent)
, _mavlinkDecoder(decoder)
{
this->setVisible(false);
// Add each MAV
foreach (Vehicle* vehicle, MultiVehicleManager::instance()->vehicles()) {
addVehicle(vehicle);
}
connect(MultiVehicleManager::instance(), &MultiVehicleManager::vehicleAdded, this, &Linecharts::addVehicle);
}
init();
void Linecharts::showEvent(QShowEvent* event)
{
// 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);
this->setVisible(false);
}
void Linecharts::hideEvent(QHideEvent* event)
QWidget* Linecharts::_newVehicleWidget(Vehicle* vehicle, QWidget* parent)
{
// 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 = false;
chart->setActive(false);
}
}
QWidget::hideEvent(event);
emit visibilityChanged(false);
}
LinechartWidget* widget = new LinechartWidget(vehicle->id(), parent);
void Linecharts::addVehicle(Vehicle* vehicle)
{
UAS* uas = vehicle->uas();
// FIXME Add removeSystem() call
// Connect valueChanged signals
connect(vehicle->uas(), &UAS::valueChanged, widget, &LinechartWidget::appendData);
// Compatibility hack
int uasid = 0; /*uas->getUASID()*/
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 decoder
connect(_mavlinkDecoder, &MAVLinkDecoder::valueChanged, widget, &LinechartWidget::appendData);
connect(widget, SIGNAL(logfileWritten(QString)), this, SIGNAL(logfileWritten(QString)));
// Set system active if this is the only system
// 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);
}
// }
// }
}
// Select system
widget->setActive(true);
void Linecharts::addSource(QObject* obj)
{
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)));
}
return widget;
}
......@@ -7,34 +7,26 @@
#include "LinechartWidget.h"
#include "Vehicle.h"
#include "MultiVehicleDockWidget.h"
#include "MAVLinkDecoder.h"
class Linecharts : public QStackedWidget
class Linecharts : public MultiVehicleDockWidget
{
Q_OBJECT
public:
explicit Linecharts(QWidget *parent = 0);
explicit Linecharts(const QString& title, QAction* action, MAVLinkDecoder* decoder, QWidget *parent = 0);
signals:
/** @brief This signal is emitted once a logfile has been finished writing */
void logfileWritten(QString fileName);
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:
// Override from MultiVehicleDockWidget
virtual QWidget* _newVehicleWidget(Vehicle* vehicle, QWidget* parent);
QMap<int, LinechartWidget*> plots;
QVector<QObject*> genericSources;
bool active;
/** @brief Start updating widget */
void showEvent(QShowEvent* event);
/** @brief Stop updating widget */
void hideEvent(QHideEvent* event);
private:
MAVLinkDecoder* _mavlinkDecoder;
};
#endif // LINECHARTS_H
......@@ -161,12 +161,6 @@ void MainToolBar::onFlyViewMenu()
}
}
void MainToolBar::onAnalyzeView()
{
setCurrentView(MainWindow::VIEW_ANALYZE);
MainWindow::instance()->loadAnalyzeView();
}
void MainToolBar::onDisconnect(QString conf)
{
if(conf.isEmpty()) {
......@@ -248,9 +242,6 @@ void MainToolBar::setCurrentView(int currentView)
{
ViewType_t view = ViewNone;
switch((MainWindow::VIEW_SECTIONS)currentView) {
case MainWindow::VIEW_ANALYZE:
view = ViewAnalyze;
break;
case MainWindow::VIEW_MISSIONEDITOR:
view = ViewPlan;
break;
......@@ -441,4 +432,4 @@ void MainToolBar::onToolBarMessageClosed(void)
{
_toolbarMessageVisible = false;
_delayedShowToolBarMessage();
}
\ No newline at end of file
}
......@@ -64,7 +64,6 @@ public:
Q_INVOKABLE void onPlanView();
Q_INVOKABLE void onFlyView();
Q_INVOKABLE void onFlyViewMenu();
Q_INVOKABLE void onAnalyzeView();
Q_INVOKABLE void onConnect(QString conf);
Q_INVOKABLE void onDisconnect(QString conf);
Q_INVOKABLE void onEnterMessageArea(int x, int y);
......
......@@ -626,7 +626,6 @@ Rectangle {
setupButton.repaintChevron = true;
planButton.repaintChevron = true;
flyButton.repaintChevron = true;
analyzeButton.repaintChevron = true;
}
}
......@@ -670,19 +669,6 @@ Rectangle {
}
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
//---------------------------------------------------------------------
......
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