From 094eaf2f6ff9d5e038bc1ef58c6b5d5187f30917 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Tue, 14 Apr 2015 14:31:27 -0700 Subject: [PATCH] New ParameterEditor control and dock widget --- QGCApplication.pro | 30 +++---- qgroundcontrol.qrc | 6 +- src/QGCConfig.h | 2 +- .../ParameterEditor.qml | 88 +++++++++---------- .../ParameterEditorController.cc | 0 .../ParameterEditorController.h | 0 src/QmlControls/qmldir | 2 + src/VehicleSetup/SetupParameterEditor.qml | 67 ++++++++++++++ src/VehicleSetup/SetupView.cc | 3 +- src/ViewWidgets/ParameterEditorWidget.h | 40 +++++++++ src/ViewWidgets/ParameterEditorWidget.qml | 42 +++++++++ src/ui/MainWindow.cc | 72 +++++---------- src/ui/MainWindow.h | 8 +- src/ui/QGCParamTreeWidget.h | 51 ----------- 14 files changed, 232 insertions(+), 179 deletions(-) rename src/{VehicleSetup => QmlControls}/ParameterEditor.qml (75%) rename src/{VehicleSetup => QmlControls}/ParameterEditorController.cc (100%) rename src/{VehicleSetup => QmlControls}/ParameterEditorController.h (100%) create mode 100644 src/VehicleSetup/SetupParameterEditor.qml create mode 100644 src/ViewWidgets/ParameterEditorWidget.h create mode 100644 src/ViewWidgets/ParameterEditorWidget.qml delete mode 100644 src/ui/QGCParamTreeWidget.h diff --git a/QGCApplication.pro b/QGCApplication.pro index d5f556093..4631cc1f6 100644 --- a/QGCApplication.pro +++ b/QGCApplication.pro @@ -147,7 +147,6 @@ INCLUDEPATH += \ src/input \ src/lib/qmapcontrol \ src/ui/mavlink \ - src/ui/param \ src/ui/map3D \ src/ui/mission \ src/ui/designer \ @@ -159,7 +158,8 @@ INCLUDEPATH += \ src/ui/mapdisplay \ src/VehicleSetup \ src/AutoPilotPlugins \ - src/QmlControls + src/QmlControls \ + src/ViewWidgets FORMS += \ src/ui/MainWindow.ui \ @@ -169,13 +169,11 @@ FORMS += \ src/ui/UASInfo.ui \ src/ui/Linechart.ui \ src/ui/UASView.ui \ - src/ui/ParameterInterface.ui \ src/ui/WaypointList.ui \ src/ui/JoystickWidget.ui \ src/ui/DebugConsole.ui \ src/ui/HDDisplay.ui \ src/ui/MAVLinkSettingsWidget.ui \ - src/ui/QGCSensorSettingsWidget.ui \ src/ui/QGCDataPlot2D.ui \ src/ui/QMap3D.ui \ src/ui/uas/QGCUnconnectedInfoWidget.ui \ @@ -263,7 +261,7 @@ HEADERS += \ src/comm/MAVLinkSimulationLink.h \ src/comm/UDPLink.h \ src/comm/TCPLink.h \ - src/ui/ParameterInterface.h \ + src/ViewWidgets/ParameterEditorWidget.h \ src/ui/WaypointList.h \ src/Waypoint.h \ src/input/JoystickInput.h \ @@ -273,8 +271,6 @@ HEADERS += \ src/ui/MAVLinkSettingsWidget.h \ src/GAudioOutput.h \ src/LogCompressor.h \ - src/ui/QGCParamWidget.h \ - src/ui/QGCSensorSettingsWidget.h \ src/ui/linechart/Linecharts.h \ src/uas/UASWaypointManager.h \ src/ui/HSIDisplay.h \ @@ -352,8 +348,6 @@ HEADERS += \ src/ui/configuration/ApmHighlighter.h \ src/uas/UASParameterDataModel.h \ src/uas/UASParameterCommsMgr.h \ - src/ui/QGCPendingParamWidget.h \ - src/ui/QGCBaseParamWidget.h \ src/ui/px4_configuration/PX4RCCalibration.h \ src/ui/px4_configuration/RCValueWidget.h \ src/uas/UASManagerInterface.h \ @@ -369,7 +363,6 @@ HEADERS += \ src/QGCQuickWidget.h \ src/QGCPalette.h \ src/QGCQmlWidgetHolder.h \ - src/ui/QGCParamTreeWidget.h \ src/ui/QGCMapRCToParamDialog.h \ src/QGCDockWidget.h \ src/ui/QGCLinkConfiguration.h \ @@ -379,9 +372,11 @@ HEADERS += \ src/uas/UASMessageHandler.h \ src/ui/toolbar/MainToolBar.h \ src/QmlControls/ScreenTools.h \ + src/QmlControls/ParameterEditorController.h \ src/QGCLoggingCategory.h \ src/ui/flightdisplay/QGCFlightDisplay.h \ - src/ui/mapdisplay/QGCMapDisplay.h + src/ui/mapdisplay/QGCMapDisplay.h \ + src/ViewWidgets/ViewWidgetController.h \ SOURCES += \ src/main.cc \ @@ -410,7 +405,7 @@ SOURCES += \ src/comm/MAVLinkSimulationLink.cc \ src/comm/UDPLink.cc \ src/comm/TCPLink.cc \ - src/ui/ParameterInterface.cc \ + src/ViewWidgets/ParameterEditorWidget.cc \ src/ui/WaypointList.cc \ src/Waypoint.cc \ src/input/JoystickInput.cc \ @@ -420,8 +415,6 @@ SOURCES += \ src/ui/MAVLinkSettingsWidget.cc \ src/GAudioOutput.cc \ src/LogCompressor.cc \ - src/ui/QGCParamWidget.cc \ - src/ui/QGCSensorSettingsWidget.cc \ src/ui/linechart/Linecharts.cc \ src/uas/UASWaypointManager.cc \ src/ui/HSIDisplay.cc \ @@ -496,8 +489,6 @@ SOURCES += \ src/ui/configuration/ApmHighlighter.cc \ src/uas/UASParameterDataModel.cc \ src/uas/UASParameterCommsMgr.cc \ - src/ui/QGCPendingParamWidget.cc \ - src/ui/QGCBaseParamWidget.cc \ src/ui/px4_configuration/PX4RCCalibration.cc \ src/ui/px4_configuration/RCValueWidget.cc \ src/uas/QGCUASFileManager.cc \ @@ -510,7 +501,6 @@ SOURCES += \ src/QGCQuickWidget.cc \ src/QGCPalette.cc \ src/QGCQmlWidgetHolder.cpp \ - src/ui/QGCParamTreeWidget.cpp \ src/ui/QGCMapRCToParamDialog.cpp \ src/QGCDockWidget.cc \ src/ui/QGCLinkConfiguration.cc \ @@ -520,9 +510,11 @@ SOURCES += \ src/uas/UASMessageHandler.cc \ src/ui/toolbar/MainToolBar.cc \ src/QmlControls/ScreenTools.cc \ + src/QmlControls/ParameterEditorController.cc \ src/QGCLoggingCategory.cc \ src/ui/flightdisplay/QGCFlightDisplay.cc \ - src/ui/mapdisplay/QGCMapDisplay.cc + src/ui/mapdisplay/QGCMapDisplay.cc \ + src/ViewWidgets/ViewWidgetController.cc \ # # Unit Test specific configuration goes here @@ -605,7 +597,6 @@ HEADERS+= \ src/VehicleSetup/SetupView.h \ src/VehicleSetup/VehicleComponent.h \ src/VehicleSetup/FirmwareUpgradeController.h \ - src/VehicleSetup/ParameterEditorController.h \ src/VehicleSetup/PX4Bootloader.h \ src/VehicleSetup/PX4FirmwareUpgradeThread.h \ src/AutoPilotPlugins/AutoPilotPluginManager.h \ @@ -630,7 +621,6 @@ SOURCES += \ src/VehicleSetup/SetupView.cc \ src/VehicleSetup/VehicleComponent.cc \ src/VehicleSetup/FirmwareUpgradeController.cc \ - src/VehicleSetup/ParameterEditorController.cc \ src/VehicleSetup/PX4Bootloader.cc \ src/VehicleSetup/PX4FirmwareUpgradeThread.cc \ src/AutoPilotPlugins/AutoPilotPluginManager.cc \ diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index accd87e43..4562dd999 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -29,13 +29,17 @@ src/QmlControls/VehicleRotationCal.qml src/QmlControls/VehicleSummaryRow.qml src/QmlControls/arrow-down.png + src/ViewWidgets/ViewWidget.qml + src/QmlControls/ParameterEditor.qml + + src/ViewWidgets/ParameterEditorWidget.qml src/VehicleSetup/SetupViewButtonsConnected.qml src/VehicleSetup/SetupViewButtonsDisconnected.qml src/VehicleSetup/VehicleSummary.qml src/VehicleSetup/FirmwareUpgrade.qml - src/VehicleSetup/ParameterEditor.qml + src/VehicleSetup/SetupParameterEditor.qml src/AutoPilotPlugins/PX4/SafetyComponent.qml src/AutoPilotPlugins/PX4/PowerComponent.qml src/AutoPilotPlugins/PX4/SensorsComponent.qml diff --git a/src/QGCConfig.h b/src/QGCConfig.h index 01966d7b7..07ae9ac8e 100644 --- a/src/QGCConfig.h +++ b/src/QGCConfig.h @@ -12,7 +12,7 @@ // If you need to make an incompatible changes to stored settings, bump this version number // up by 1. This will caused store settings to be cleared on next boot. -#define QGC_SETTINGS_VERSION 4 +#define QGC_SETTINGS_VERSION 5 #define QGC_APPLICATION_NAME "QGroundControl" #define QGC_ORG_NAME "QGroundControl.org" diff --git a/src/VehicleSetup/ParameterEditor.qml b/src/QmlControls/ParameterEditor.qml similarity index 75% rename from src/VehicleSetup/ParameterEditor.qml rename to src/QmlControls/ParameterEditor.qml index da3e113d4..f8cef4290 100644 --- a/src/VehicleSetup/ParameterEditor.qml +++ b/src/QmlControls/ParameterEditor.qml @@ -21,6 +21,9 @@ ======================================================================*/ +/// @file +/// @author Don Gagne + import QtQuick 2.3 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.2 @@ -33,61 +36,51 @@ import QGroundControl.FactSystem 1.0 import QGroundControl.FactControls 1.0 Rectangle { - QGCPalette { id: qgcPal; colorGroupEnabled: true } - ScreenTools { id: screenTools } - ParameterEditorController { id: controller } - QGCLabel { id: charWidth; text: "X"; visible: false } + /// true: show full information, false: for use in smaller widgets + property bool fullMode: true + + QGCPalette { id: __qgcPal; colorGroupEnabled: true } + ScreenTools { id: __screenTools } + ParameterEditorController { id: __controller } + QGCLabel { id: __charWidth; text: "X"; visible: false } - readonly property real leftMargin: 10 - readonly property real rightMargin: 20 - readonly property int maxParamChars: 16 + readonly property real __leftMargin: 10 + readonly property real __rightMargin: 20 + readonly property int __maxParamChars: 16 - color: qgcPal.window + color: __qgcPal.window // We use an ExclusiveGroup to maintain the visibility of a single editing control at a time ExclusiveGroup { - id: exclusiveEditorGroup + id: __exclusiveEditorGroup } Column { anchors.fill:parent - QGCLabel { - text: "PARAMETER EDITOR" - font.pointSize: screenTools.dpiAdjustedPointSize(20) - } - - Item { - height: 20 - width: 5 - } - Row { spacing: 10 layoutDirection: Qt.RightToLeft width: parent.width QGCButton { - text: "Clear RC to Param" - onClicked: controller.clearRCToParam() + text: "Clear RC to Param" + onClicked: __controller.clearRCToParam() } QGCButton { - text: "Save to file" - onClicked: controller.saveToFile() + text: "Save to file" + visible: fullMode + onClicked: __controller.saveToFile() } QGCButton { - text: "Load from file" - onClicked: controller.loadFromFile() + text: "Load from file" + visible: fullMode + onClicked: __controller.loadFromFile() } QGCButton { - id: firstButton - text: "Refresh" - onClicked: controller.refresh() - } - QGCLabel { - width: firstButton.x - parent.spacing - wrapMode: Text.WordWrap - text: "Click a parameter value to modify. Right-click to set an RC to Param mapping. Use caution when modifying parameters here since the values are not checked for validity." + id: firstButton + text: "Refresh" + onClicked: __controller.refresh() } } @@ -104,7 +97,7 @@ Rectangle { Column { Repeater { - model: controller.componentIds + model: __controller.componentIds Column { id: componentColumn @@ -113,7 +106,7 @@ Rectangle { QGCLabel { text: "Component #: " + componentId.toString() - font.pointSize: screenTools.dpiAdjustedPointSize(qgcPal.defaultFontPointSize + 4); + font.pointSize: __screenTools.dpiAdjustedPointSize(__qgcPal.defaultFontPointSize + 4); } Item { @@ -122,51 +115,51 @@ Rectangle { } Repeater { - model: controller.getGroupsForComponent(componentColumn.componentId) + model: __controller.getGroupsForComponent(componentColumn.componentId) Column { Rectangle { id: groupRect - color: qgcPal.windowShade + color: __qgcPal.windowShade height: groupBlock.height - width: scrollView.viewport.width - rightMargin + width: scrollView.viewport.width - __rightMargin Column { id: groupBlock Rectangle { - color: qgcPal.windowShadeDark + color: __qgcPal.windowShadeDark height: groupLabel.height width: groupRect.width QGCLabel { id: groupLabel height: contentHeight + 5 - x: leftMargin + x: __leftMargin text: modelData verticalAlignment: Text.AlignVCenter - font.pointSize: screenTools.dpiAdjustedPointSize(qgcPal.defaultFontPointSize + 2); + font.pointSize: __screenTools.dpiAdjustedPointSize(__qgcPal.defaultFontPointSize + 2); } } Repeater { - model: controller.getFactsForGroup(componentColumn.componentId, modelData) + model: __controller.getFactsForGroup(componentColumn.componentId, modelData) Row { spacing: 10 - x: leftMargin + x: __leftMargin Fact { id: modelFact; name: modelData + ":" + componentColumn.componentId } QGCLabel { text: modelFact.name - width: charWidth.contentWidth * (maxParamChars + 2) + width: __charWidth.contentWidth * (__maxParamChars + 2) } QGCLabel { text: modelFact.valueString + " " + modelFact.units - width: charWidth.contentWidth * 20 + width: __charWidth.contentWidth * 20 height: contentHeight MouseArea { @@ -178,7 +171,7 @@ Rectangle { editor.checked = true editor.focus = true } else if (mouse.button == Qt.RightButton) { - controller.setRCToParam(modelData) + __controller.setRCToParam(modelData) } } } @@ -195,7 +188,7 @@ Rectangle { // We use an ExclusiveGroup to manage visibility property bool checked: false - property ExclusiveGroup exclusiveGroup: exclusiveEditorGroup + property ExclusiveGroup exclusiveGroup: __exclusiveEditorGroup onExclusiveGroupChanged: { if (exclusiveGroup) exclusiveGroup.bindCheckable(editor) @@ -205,6 +198,7 @@ Rectangle { QGCLabel { text: modelFact.shortDescription + visible: fullMode } } // Row - Fact value } // Repeater - Facts diff --git a/src/VehicleSetup/ParameterEditorController.cc b/src/QmlControls/ParameterEditorController.cc similarity index 100% rename from src/VehicleSetup/ParameterEditorController.cc rename to src/QmlControls/ParameterEditorController.cc diff --git a/src/VehicleSetup/ParameterEditorController.h b/src/QmlControls/ParameterEditorController.h similarity index 100% rename from src/VehicleSetup/ParameterEditorController.h rename to src/QmlControls/ParameterEditorController.h diff --git a/src/QmlControls/qmldir b/src/QmlControls/qmldir index ba2a701c9..3731a8bac 100644 --- a/src/QmlControls/qmldir +++ b/src/QmlControls/qmldir @@ -13,4 +13,6 @@ SubMenuButton 1.0 SubMenuButton.qml IndicatorButton 1.0 IndicatorButton.qml VehicleRotationCal 1.0 VehicleRotationCal.qml VehicleSummaryRow 1.0 VehicleSummaryRow.qml +ParameterEditor 1.0 ParameterEditor.qml +ViewWidget 1.0 ViewWidget.qml diff --git a/src/VehicleSetup/SetupParameterEditor.qml b/src/VehicleSetup/SetupParameterEditor.qml new file mode 100644 index 000000000..4e9e3d4fc --- /dev/null +++ b/src/VehicleSetup/SetupParameterEditor.qml @@ -0,0 +1,67 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2015 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 . + + ======================================================================*/ + +import QtQuick 2.3 +import QtQuick.Controls 1.2 + +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Palette 1.0 + +Rectangle { + QGCPalette { id: qgcPal; colorGroupEnabled: true } + ScreenTools { id: screenTools } + + color: qgcPal.window + + // We use an ExclusiveGroup to maintain the visibility of a single editing control at a time + ExclusiveGroup { + id: exclusiveEditorGroup + } + + Column { + anchors.fill:parent + + QGCLabel { + text: "PARAMETER EDITOR" + font.pointSize: screenTools.dpiAdjustedPointSize(20) + } + + Item { + height: 20 + width: 5 + } + + QGCLabel { + id: infoLabel + width: parent.width + wrapMode: Text.WordWrap + text: "Click a parameter value to modify. Right-click to set an RC to Param mapping. Use caution when modifying parameters here since the values are not checked for validity." + } + + ParameterEditor { + width: parent.width + height: parent.height - (infoLabel.y + infoLabel.height) + } + } +} diff --git a/src/VehicleSetup/SetupView.cc b/src/VehicleSetup/SetupView.cc index adefb4a73..65cc0fca2 100644 --- a/src/VehicleSetup/SetupView.cc +++ b/src/VehicleSetup/SetupView.cc @@ -55,7 +55,6 @@ SetupView::SetupView(QWidget* parent) : Q_ASSERT(fSucceeded); qmlRegisterType("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); - qmlRegisterType("QGroundControl.Controllers", 1, 0, "ParameterEditorController"); _ui->buttonHolder->rootContext()->setContextProperty("controller", this); _ui->buttonHolder->setAutoPilot(NULL); @@ -137,7 +136,7 @@ void SetupView::parametersButtonClicked(void) Q_ASSERT(_autoPilotPlugin); setup->setAutoPilot(_autoPilotPlugin); - setup->setSource(QUrl::fromUserInput("qrc:/qml/ParameterEditor.qml")); + setup->setSource(QUrl::fromUserInput("qrc:/qml/SetupParameterEditor.qml")); _changeSetupWidget(setup); } diff --git a/src/ViewWidgets/ParameterEditorWidget.h b/src/ViewWidgets/ParameterEditorWidget.h new file mode 100644 index 000000000..809d647e6 --- /dev/null +++ b/src/ViewWidgets/ParameterEditorWidget.h @@ -0,0 +1,40 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2015 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 . + +======================================================================*/ + +/// @file +/// @author Don Gagne + +#ifndef PARAMETEREDITORWIDGET_H +#define PARAMETEREDITORWIDGET_H + +#include "QGCQmlWidgetHolder.h" + +class ParameterEditorWidget : public QGCQmlWidgetHolder +{ + Q_OBJECT + +public: + ParameterEditorWidget(QWidget *parent = 0); +}; + +#endif diff --git a/src/ViewWidgets/ParameterEditorWidget.qml b/src/ViewWidgets/ParameterEditorWidget.qml new file mode 100644 index 000000000..234dee17a --- /dev/null +++ b/src/ViewWidgets/ParameterEditorWidget.qml @@ -0,0 +1,42 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +(c) 2009, 2015 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 . + +======================================================================*/ + +/// @file +/// @author Don Gagne + +import QtQuick 2.2 + +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 + +ViewWidget { + connectedComponent: editorComponent + + Component { + id: editorComponent + + ParameterEditor { + fullMode: false + } + } +} diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 81cfc40c7..5e2813ba9 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -338,12 +338,7 @@ void MainWindow::resizeEvent(QResizeEvent * event) QString MainWindow::_getWindowStateKey() { - if (UASManager::instance()->getActiveUAS()) - { - return QString::number(_currentView)+"_windowstate_" + UASManager::instance()->getActiveUAS()->getAutopilotTypeName(); - } - else - return QString::number(_currentView)+"_windowstate_"; + return QString::number(_currentView)+"_windowstate_"; } QString MainWindow::_getWindowGeometryKey() @@ -372,22 +367,26 @@ void MainWindow::_buildCustomWidgets(void) void MainWindow::_createDockWidget(const QString& title, const QString& name, Qt::DockWidgetArea area, QWidget* innerWidget) { Q_ASSERT(!_mapName2DockWidget.contains(name)); - QGCDockWidget* dockWidget = new QGCDockWidget(title, this); - Q_CHECK_PTR(dockWidget); - dockWidget->setObjectName(name); - dockWidget->setVisible (false); - if (innerWidget) { - // Put inner widget inside QDockWidget - innerWidget->setParent(dockWidget); - dockWidget->setWidget(innerWidget); - innerWidget->setVisible(true); - } + // Add to menu QAction* action = new QAction(title, NULL); action->setCheckable(true); action->setData(name); connect(action, &QAction::triggered, this, &MainWindow::_showDockWidgetAction); _ui.menuTools->addAction(action); + + // Create widget + QGCDockWidget* dockWidget = new QGCDockWidget(title, action, this); + Q_CHECK_PTR(dockWidget); + dockWidget->setObjectName(name); + dockWidget->setVisible (false); + if (innerWidget) { + // Put inner widget inside QDockWidget + innerWidget->setParent(dockWidget); + dockWidget->setWidget(innerWidget); + innerWidget->setVisible(true); + } + _mapName2DockWidget[name] = dockWidget; _mapDockWidget2Action[dockWidget] = action; addDockWidget(area, dockWidget); @@ -421,7 +420,7 @@ void MainWindow::_buildCommonWidgets(void) { _uasListDockWidgetName, "Unmanned Systems", Qt::RightDockWidgetArea }, { _waypointsDockWidgetName, "Mission Plan", Qt::BottomDockWidgetArea }, { _mavlinkDockWidgetName, "MAVLink Inspector", Qt::RightDockWidgetArea }, - { _parametersDockWidgetName, "Onboard Parameters", Qt::RightDockWidgetArea }, + { _parametersDockWidgetName, "Parameter Editor", Qt::RightDockWidgetArea }, { _filesDockWidgetName, "Onboard Files", Qt::RightDockWidgetArea }, { _uasStatusDetailsDockWidgetName, "Status Details", Qt::RightDockWidgetArea }, { _mapViewDockWidgetName, "Map view", Qt::RightDockWidgetArea }, @@ -431,7 +430,7 @@ void MainWindow::_buildCommonWidgets(void) { _pfdDockWidgetName, "Primary Flight Display", Qt::RightDockWidgetArea }, { _hudDockWidgetName, "Video Downlink", Qt::RightDockWidgetArea }, { _uasInfoViewDockWidgetName, "Info View", Qt::LeftDockWidgetArea }, - { _debugConsoleDockWidgetName, "Communications Console", Qt::LeftDockWidgetArea } + { _debugConsoleDockWidgetName, "Communications Console", Qt::LeftDockWidgetArea }, }; static const size_t cDockWidgetInfo = sizeof(rgDockWidgetInfo) / sizeof(rgDockWidgetInfo[0]); @@ -550,7 +549,7 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName) } else if (widgetName == _mavlinkDockWidgetName) { widget = new QGCMAVLinkInspector(MAVLinkProtocol::instance(),this); } else if (widgetName == _parametersDockWidgetName) { - widget = new ParameterInterface(this); + widget = new ParameterEditorWidget(this); } else if (widgetName == _filesDockWidgetName) { widget = new QGCUASFileViewMulti(this); } else if (widgetName == _uasStatusDetailsDockWidgetName) { @@ -614,7 +613,7 @@ void MainWindow::_showHILConfigurationWidgets(void) if (!_mapUasId2HilDockWidget.contains(uasId)) { // Create QDockWidget - QGCDockWidget* dockWidget = new QGCDockWidget(tr("HIL Config %1").arg(uasId), this); + QGCDockWidget* dockWidget = new QGCDockWidget(tr("HIL Config %1").arg(uasId), NULL, this); Q_CHECK_PTR(dockWidget); dockWidget->setObjectName(tr("HIL_CONFIG_%1").arg(uasId)); dockWidget->setVisible (false); @@ -765,12 +764,11 @@ void MainWindow::storeSettings() settings.setValue("SHOW_STATUSBAR", _showStatusBar); settings.endGroup(); settings.setValue(_getWindowGeometryKey(), saveGeometry()); + // Save the last current view in any case settings.setValue("CURRENT_VIEW", _currentView); - // Save the current window state, but only if a system is connected (else no real number of widgets would be present)) - if (UASManager::instance()->getUASList().length() > 0) settings.setValue(_getWindowStateKey(), saveState()); - // Save the current UAS view if a UAS is connected - if (UASManager::instance()->getUASList().length() > 0) settings.setValue("CURRENT_VIEW_WITH_UAS_CONNECTED", _currentView); + settings.setValue(_getWindowStateKey(), saveState()); + // And save any custom weidgets QGCToolWidget::storeWidgetsToSettings(settings); } @@ -877,7 +875,6 @@ void MainWindow::connectCommonActions() // Connect internal actions connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), this, SLOT(UASCreated(UASInterface*))); - connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); // Unmanned System controls connect(_ui.actionLiftoff, SIGNAL(triggered()), UASManager::instance(), SLOT(launchActiveUAS())); @@ -978,21 +975,6 @@ void MainWindow::commsWidgetDestroyed(QObject *obj) } } -void MainWindow::setActiveUAS(UASInterface* uas) -{ - Q_UNUSED(uas); - if (settings.contains(_getWindowStateKey())) - { - restoreState(settings.value(_getWindowStateKey()).toByteArray()); - } -} - -void MainWindow::UASSpecsChanged(int uas) -{ - Q_UNUSED(uas); - // TODO: Update UAS properties if its specs change -} - void MainWindow::UASCreated(UASInterface* uas) { // The UAS actions are not enabled without connection to system @@ -1002,7 +984,6 @@ void MainWindow::UASCreated(UASInterface* uas) _ui.actionEmergency_Land->setEnabled(true); _ui.actionShutdownMAV->setEnabled(true); - connect(uas, SIGNAL(systemSpecsChanged(int)), this, SLOT(UASSpecsChanged(int))); connect(uas, SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)), this, SIGNAL(valueChanged(int,QString,QString,QVariant,quint64))); connect(uas, SIGNAL(misconfigurationDetected(UASInterface*)), this, SLOT(handleMisconfiguration(UASInterface*))); @@ -1020,15 +1001,6 @@ void MainWindow::UASCreated(UASInterface* uas) { _analyzeView = linechartWidget; } - - // Reload view state in case new widgets were added - _loadCurrentViewState(); -} - -void MainWindow::UASDeleted(UASInterface* uas) -{ - Q_UNUSED(uas); - // TODO: Update the UI when a UAS is deleted } /// Stores the state of the toolbar, status bar and widgets associated with the current view diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 90af8c0e1..95d78384c 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -53,7 +53,7 @@ This file is part of the QGROUNDCONTROL project #include "Mouse6dofInput.h" #endif // QGC_MOUSE_ENABLED_WIN #include "DebugConsole.h" -#include "ParameterInterface.h" +#include "ParameterEditorWidget.h" #include "HDDisplay.h" #include "HSIDisplay.h" #include "opmapcontrol.h" @@ -132,15 +132,9 @@ public slots: void showSettings(); /** @brief Simulate a link */ void simulateLink(bool simulate); - /** @brief Set the currently controlled UAS */ - void setActiveUAS(UASInterface* uas); /** @brief Add a new UAS */ void UASCreated(UASInterface* uas); - /** Delete an UAS */ - void UASDeleted(UASInterface* uas); - /** @brief Update system specs of a UAS */ - void UASSpecsChanged(int uas); void handleMisconfiguration(UASInterface* uas); /** @brief Load configuration views */ diff --git a/src/ui/QGCParamTreeWidget.h b/src/ui/QGCParamTreeWidget.h deleted file mode 100644 index 9c63456db..000000000 --- a/src/ui/QGCParamTreeWidget.h +++ /dev/null @@ -1,51 +0,0 @@ -/*===================================================================== - - QGroundControl Open Source Ground Control Station - - (c) 2009 - 2014 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 . - - ======================================================================*/ - -/// @file -/// @brief A treeview with context menus for parameters -/// @author Thomas Gubler - -#ifndef QGCPARAMTREEWIDGET_H -#define QGCPARAMTREEWIDGET_H - -#include - -/// Implements individual context menus for the QTreeWidgetItems -class QGCParamTreeWidget : public QTreeWidget -{ - Q_OBJECT -public: - QGCParamTreeWidget(QWidget *parent = 0); - ~QGCParamTreeWidget(); - -signals: - void mapRCToParamRequest(QString param_id); - void refreshParamRequest(QString param_id); - -public slots: - void showContextMenu(const QPoint &pos); - void contextMenuAction(); - -}; - -#endif // QGCPARAMTREEWIDGET_H -- 2.22.0