diff --git a/files/Setup/cogwheels.png b/files/Setup/cogwheels.png
new file mode 100644
index 0000000..7ef3297
Binary files /dev/null and b/files/Setup/cogwheels.png differ
diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro
index 9c43027..30889e5 100644
--- a/qgroundcontrol.pro
+++ b/qgroundcontrol.pro
@@ -208,6 +208,8 @@ ReleaseBuild {
}
}
+QML_IMPORT_PATH = $$BASEDIR/qml
+
# qextserialport should not be used by general QGroundControl code. Use QSerialPort instead. This is only
# here to support special case Firmware Upgrade code.
include(libs/qextserialport/src/qextserialport.pri)
@@ -343,7 +345,7 @@ FORMS += \
src/ui/px4_configuration/PX4FirmwareUpgrade.ui \
src/ui/QGCUASFileView.ui \
src/QGCQmlWidgetHolder.ui \
- src/ui/QGCMapRCToParamDialog.ui
+ src/ui/QGCMapRCToParamDialog.ui \
HEADERS += \
src/MG.h \
@@ -713,13 +715,12 @@ FORMS += \
src/VehicleSetup/ParameterEditor.ui \
src/ui/QGCPX4VehicleConfig.ui \
src/AutoPilotPlugins/PX4/FlightModeConfig.ui \
- src/VehicleSetup/SetupWidgetHolder.ui \
+ src/VehicleSetup/SetupView.ui \
HEADERS+= \
src/VehicleSetup/SetupView.h \
src/VehicleSetup/ParameterEditor.h \
src/VehicleSetup/VehicleComponent.h \
- src/VehicleSetup/VehicleComponentSummaryItem.h \
src/AutoPilotPlugins/AutoPilotPluginManager.h \
src/AutoPilotPlugins/AutoPilotPlugin.h \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h \
@@ -733,13 +734,11 @@ HEADERS+= \
src/AutoPilotPlugins/PX4/SensorsComponent.h \
src/AutoPilotPlugins/PX4/SafetyComponent.h \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.h \
- src/VehicleSetup/SetupWidgetHolder.h \
SOURCES += \
src/VehicleSetup/SetupView.cc \
src/VehicleSetup/ParameterEditor.cc \
src/VehicleSetup/VehicleComponent.cc \
- src/VehicleSetup/VehicleComponentSummaryItem.cc \
src/AutoPilotPlugins/AutoPilotPluginManager.cc \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \
src/AutoPilotPlugins/Generic/GenericParameterFacts.cc \
@@ -752,7 +751,6 @@ SOURCES += \
src/AutoPilotPlugins/PX4/SensorsComponent.cc \
src/AutoPilotPlugins/PX4/SafetyComponent.cc \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.cc \
- src/VehicleSetup/SetupWidgetHolder.cc \
# Fact System code
diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 1e687da..7069cad 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -241,19 +241,18 @@
src/test.qml
qml/QGroundControl/FactControls/qmldir
-
-
- qml/QGroundControl/FactControls/SetupButton.qml
qml/QGroundControl/FactControls/FactLabel.qml
qml/QGroundControl/FactControls/FactTextField.qml
qml/QGroundControl/FactControls/FactCheckBox.qml
+ qml/QGroundControl/Controls/qmldir
+ qml/QGroundControl/Controls/SetupButton.qml
+
files/images/px4/airframes/octo_x.png
files/images/px4/boards/px4fmu_2.x.png
- src/VehicleSetup/SetupViewConnected.qml
- src/VehicleSetup/SetupViewDisconnected.qml
- src/VehicleSetup/SetupPane.qml
+ src/VehicleSetup/SetupViewButtons.qml
+ src/VehicleSetup/VehicleSummary.qml
src/AutoPilotPlugins/PX4/SafetyComponent.qml
@@ -263,6 +262,8 @@
src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml
src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml
+ files/Setup/cogwheels.png
+
diff --git a/qml/QGroundControl/Controls/SetupButton.qml b/qml/QGroundControl/Controls/SetupButton.qml
new file mode 100644
index 0000000..64b7206
--- /dev/null
+++ b/qml/QGroundControl/Controls/SetupButton.qml
@@ -0,0 +1,88 @@
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
+import QtGraphicalEffects 1.0
+import QGroundControl.FactSystem 1.0
+
+Button {
+ checkable: true
+ height: 80
+
+ text: "Button"
+ property bool setupComplete: true
+ property bool setupIndicator: true
+
+ style: ButtonStyle {
+ id: buttonStyle
+
+ property var __qgcpal: QGCPalette {
+ colorGroup: control.enabled ? QGCPalette.Active : QGCPalette.Disabled
+ }
+
+ background: Rectangle {
+ id: innerRect
+ readonly property real titleHeight: 30
+
+ border.color: control.checked ? "#eee333" : "#676767"
+ radius: 10
+
+ color: control.checked ? "#eee333" : "#343434"
+
+ Text {
+ id: titleBar
+
+ width: parent.width
+ height: parent.titleHeight
+
+ verticalAlignment: TextEdit.AlignVCenter
+ horizontalAlignment: TextEdit.AlignHCenter
+
+ text: control.text
+ font.pixelSize: 12
+ color: control.checked ? "black" : "white"
+
+ Rectangle {
+ id: setupIndicator
+
+ readonly property real indicatorRadius: 6
+
+ x: parent.width - (indicatorRadius * 2) - 5
+ y: (parent.height - (indicatorRadius * 2)) / 2
+ width: indicatorRadius * 2
+ height: indicatorRadius * 2
+
+ radius: indicatorRadius
+ color: control.setupIndicator ? (control.setupComplete ? "green" : "red") : innerRect.color
+ }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: parent.height - parent.titleHeight
+
+ y: parent.titleHeight
+
+ color: __qgcpal.window
+ border.color: control.checked ? "#eee333" : "#676767"
+
+ Image {
+ id: buttonImage
+ source: "setupButtonImage.png"
+ sourceSize: Qt.size(parent.width - 20, parent.height - 20)
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ smooth: true
+ visible: false
+ }
+
+ ColorOverlay {
+ anchors.fill: buttonImage
+ source: buttonImage
+ color: control.checked ? "#eee333" : "#58585a"
+ }
+ }
+ }
+
+ label: Item {}
+ }
+}
diff --git a/qml/QGroundControl/Controls/qmldir b/qml/QGroundControl/Controls/qmldir
new file mode 100644
index 0000000..48c30e1
--- /dev/null
+++ b/qml/QGroundControl/Controls/qmldir
@@ -0,0 +1,2 @@
+Module QGroundControl.Controls
+SetupButton 1.0 SetupButton.qml
\ No newline at end of file
diff --git a/qml/QGroundControl/FactControls/SetupButton.qml b/qml/QGroundControl/FactControls/SetupButton.qml
deleted file mode 100644
index 867537a..0000000
--- a/qml/QGroundControl/FactControls/SetupButton.qml
+++ /dev/null
@@ -1,163 +0,0 @@
-import QtQuick 2.2
-import QtQuick.Controls 1.2
-import QtQuick.Controls.Styles 1.2
-
-Button {
- text: "Button"
- property bool setupComplete: false
-
- property var summaryModel: ListModel {
- ListElement { name: "Row 1"; state: "State 1" }
- ListElement { name: "Row 2"; state: "State 2" }
- ListElement { name: "Row 3"; state: "State 3" }
- }
-
- style: ButtonStyle {
- id: buttonStyle
- background: Rectangle {
- id: innerRect
- readonly property real titleHeight: 30
-
- //property alias summaryModel: summaryList.model
-
- border.color: "#888"
- radius: 10
-
- color: control.activeFocus ? "#47b" : "white"
- opacity: control.hovered || control.activeFocus ? 1 : 0.75
- Behavior on opacity {NumberAnimation{ duration: 100 }}
-
- Text {
- id: titleBar
-
- width: parent.width
- height: parent.titleHeight
-
- verticalAlignment: TextEdit.AlignVCenter
- horizontalAlignment: TextEdit.AlignHCenter
-
- text: control.text
- font.pixelSize: 12
-
- Rectangle {
- id: setupIndicator
-
- property bool setupComplete: true
- readonly property real indicatorRadius: 6
-
- x: parent.width - (indicatorRadius * 2) - 5
- y: (parent.height - (indicatorRadius * 2)) / 2
- width: indicatorRadius * 2
- height: indicatorRadius * 2
-
- radius: indicatorRadius
- color: control.setupComplete ? "green" : "red"
- }
- }
-
- Rectangle {
- width: parent.width
- height: parent.height - parent.titleHeight
-
- y: parent.titleHeight
-
- border.color: "#888"
-
- gradient: Gradient {
- GradientStop { position: 0; color: "#ffffff" }
- GradientStop { position: 1; color: "#000000" }
- }
-
- ListView {
- id: summaryList
- anchors.fill: parent
- model: control.summaryModel
- delegate: Row {
- Text { text: modelData.name }
- Text { text: modelData.state }
- }
- }
- }
- }
-
- label: Item {}
- }
-}
-
-/*
-Rectangle {
- readonly property real titleHeight: 30
-
- property alias title: titleBar.text
- property alias setupComplete: setupIndicator.setupComplete
- //property alias summaryModel: summaryList.model
-
- border.color: "#888"
- radius: 10
-
- gradient: Gradient {
- GradientStop { position: 0 ; color: "#cccccc" }
- GradientStop { position: 1 ; color: "#aaa" }
- }
-
- Text {
- id: titleBar
-
- width: parent.width
- height: parent.titleHeight
-
- verticalAlignment: TextEdit.AlignVCenter
- horizontalAlignment: TextEdit.AlignHCenter
-
- text: qsTr("TITLE")
- font.pixelSize: 12
-
- Rectangle {
- id: setupIndicator
-
- property bool setupComplete: true
- readonly property real indicatorRadius: 6
-
- x: parent.width - (indicatorRadius * 2) - 5
- y: (parent.height - (indicatorRadius * 2)) / 2
- width: indicatorRadius * 2
- height: indicatorRadius * 2
-
- radius: indicatorRadius
- color: setupComplete ? "green" : "red"
- }
- }
-
- Rectangle {
- width: parent.width
- height: parent.height - parent.titleHeight
-
- y: parent.titleHeight
-
- border.color: "#888"
-
- gradient: Gradient {
- GradientStop {
- position: 0
- color: "#ffffff"
- }
-
- GradientStop {
- position: 1
- color: "#000000"
- }
- }
-
- ListView {
- id: summaryList
- anchors.fill: parent
- model: ListModel {
- ListElement { name: "Row 1"; state: "State 1" }
- ListElement { name: "Row 2"; state: "State 2" }
- ListElement { name: "Row 3"; state: "State 3" }
- }
- delegate: Row { Text { text: modelData.name } Text { text: modelData.state } }
- }
- }
-}
-*/
\ No newline at end of file
diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.cc b/src/AutoPilotPlugins/PX4/AirframeComponent.cc
index 708438c..1f0fefc 100644
--- a/src/AutoPilotPlugins/PX4/AirframeComponent.cc
+++ b/src/AutoPilotPlugins/PX4/AirframeComponent.cc
@@ -26,7 +26,6 @@
#include "AirframeComponent.h"
#include "QGCPX4AirframeConfig.h"
-#include "VehicleComponentSummaryItem.h"
/// @brief Parameters which signal a change in setupComplete state
static const char* triggerParams[] = { "SYS_AUTOSTART", NULL };
diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc
index 8c00845..5252478 100644
--- a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc
+++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc
@@ -26,7 +26,6 @@
#include "FlightModesComponent.h"
#include "FlightModeConfig.h"
-#include "VehicleComponentSummaryItem.h"
#include "PX4AutoPilotPlugin.h"
/// @brief Parameters which signal a change in setupComplete state
diff --git a/src/AutoPilotPlugins/PX4/RadioComponent.cc b/src/AutoPilotPlugins/PX4/RadioComponent.cc
index 31e555f..768dd73 100644
--- a/src/AutoPilotPlugins/PX4/RadioComponent.cc
+++ b/src/AutoPilotPlugins/PX4/RadioComponent.cc
@@ -26,7 +26,6 @@
#include "RadioComponent.h"
#include "PX4RCCalibration.h"
-#include "VehicleComponentSummaryItem.h"
#include "PX4AutoPilotPlugin.h"
/// @brief Parameters which signal a change in setupComplete state
diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.cc b/src/AutoPilotPlugins/PX4/SafetyComponent.cc
index fab4641..f12d37e 100644
--- a/src/AutoPilotPlugins/PX4/SafetyComponent.cc
+++ b/src/AutoPilotPlugins/PX4/SafetyComponent.cc
@@ -26,7 +26,6 @@
#include "SafetyComponent.h"
#include "PX4RCCalibration.h"
-#include "VehicleComponentSummaryItem.h"
#include "QGCQmlWidgetHolder.h"
#include "PX4AutoPilotPlugin.h"
diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.cc b/src/AutoPilotPlugins/PX4/SensorsComponent.cc
index d97a957..29b6282 100644
--- a/src/AutoPilotPlugins/PX4/SensorsComponent.cc
+++ b/src/AutoPilotPlugins/PX4/SensorsComponent.cc
@@ -26,7 +26,6 @@
#include "SensorsComponent.h"
#include "QGCPX4SensorCalibration.h"
-#include "VehicleComponentSummaryItem.h"
#include "PX4AutoPilotPlugin.h"
// These two list must be kept in sync
diff --git a/src/FactSystem/FactSystem.cc b/src/FactSystem/FactSystem.cc
index a18b6f9..0fe30b3 100644
--- a/src/FactSystem/FactSystem.cc
+++ b/src/FactSystem/FactSystem.cc
@@ -44,7 +44,6 @@ FactSystem::FactSystem(QObject* parent) :
// FIXME: Where should these go?
qmlRegisterUncreatableType(_factSystemQmlUri, 1, 0, "VehicleComponent", "Can only reference VehicleComponent");
- qmlRegisterUncreatableType(_factSystemQmlUri, 1, 0, "VehicleComponentSummaryItem", "Can only reference VehicleComponentSummaryItem");
qmlRegisterType(_factSystemQmlUri, 1, 0, "QGCPalette");
}
diff --git a/src/VehicleSetup/SetupPane.qml b/src/VehicleSetup/SetupPane.qml
deleted file mode 100644
index 4c53fa7..0000000
--- a/src/VehicleSetup/SetupPane.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-import QtQuick 2.2
-import QtQuick.Controls 1.2
-import QtQuick.Controls.Styles 1.2
-//import QGroundControl.FactControls 1.0
-
-Item {
- id: item1
- width: 500
- height: 500
-
- Rectangle {
- id: innerRect
- color: "#d298d2"
- z: 1
- anchors.rightMargin: 15
- anchors.leftMargin: 15
- anchors.bottomMargin: 15
- anchors.topMargin: 40
- anchors.fill: parent
-
- Rectangle {
- id: close
- x: parent.width - (width / 2)
- y: 0 - (height / 2)
- width: 30
- height: 30
- color: "#ffffff"
- radius: 15
- z: 2
- border.color: "#000000"
- }
-
- }
-
- Rectangle {
- id: outerRect
- color: "#ffffff"
- opacity: 0.8
- anchors.fill: parent
-
- Text {
- id: title
- x: 237
- y: 8
- text: qsTr("Setup Pane")
- anchors.horizontalCenter: parent.horizontalCenter
- font.pointSize: 20
- }
- }
-
-}
diff --git a/src/VehicleSetup/SetupView.cc b/src/VehicleSetup/SetupView.cc
index d48af88..fd13f54 100644
--- a/src/VehicleSetup/SetupView.cc
+++ b/src/VehicleSetup/SetupView.cc
@@ -25,13 +25,14 @@
/// @author Don Gagne
#include "SetupView.h"
+#include "ui_SetupView.h"
#include "UASManager.h"
#include "AutoPilotPluginManager.h"
#include "VehicleComponent.h"
#include "PX4FirmwareUpgrade.h"
#include "ParameterEditor.h"
-#include "SetupWidgetHolder.h"
+#include "QGCQmlWidgetHolder.h"
#include "MainWindow.h"
#include "QGCMessageBox.h"
@@ -40,16 +41,38 @@
#include
SetupView::SetupView(QWidget* parent) :
- QGCQuickWidget(parent),
+ QWidget(parent),
_uasCurrent(NULL),
_initComplete(false),
- _autoPilotPlugin(NULL)
+ _autoPilotPlugin(NULL),
+ _currentSetupWidget(NULL),
+ _ui(new Ui::SetupView)
{
+ _ui->setupUi(this);
+
bool fSucceeded = connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(_setActiveUAS(UASInterface*)));
Q_UNUSED(fSucceeded);
Q_ASSERT(fSucceeded);
- setResizeMode(SizeRootObjectToView);
+ //setResizeMode(SizeRootObjectToView);
+
+ _ui->buttonHolder->setAutoPilot(NULL);
+ _ui->buttonHolder->setSource(QUrl::fromUserInput("qrc:/qml/SetupViewButtons.qml"));
+
+ QObject* rootObject = (QObject*)_ui->buttonHolder->rootObject();
+ Q_ASSERT(rootObject);
+
+ fSucceeded = connect(rootObject, SIGNAL(setupButtonClicked(QVariant)), this, SLOT(_setupButtonClicked(QVariant)));
+ Q_ASSERT(fSucceeded);
+
+ fSucceeded = connect(rootObject, SIGNAL(firmwareButtonClicked()), this, SLOT(_firmwareButtonClicked()));
+ Q_ASSERT(fSucceeded);
+
+ fSucceeded = connect(rootObject, SIGNAL(parametersButtonClicked()), this, SLOT(_parametersButtonClicked()));
+ Q_ASSERT(fSucceeded);
+
+ fSucceeded = connect(rootObject, SIGNAL(summaryButtonClicked()), this, SLOT(_summaryButtonClicked()));
+ Q_ASSERT(fSucceeded);
_setActiveUAS(UASManager::instance()->getActiveUAS());
}
@@ -63,10 +86,16 @@ void SetupView::_setActiveUAS(UASInterface* uas)
{
if (_uasCurrent) {
Q_ASSERT(_autoPilotPlugin);
- disconnect(_autoPilotPlugin);
- _autoPilotPlugin = NULL;
+ disconnect(_autoPilotPlugin, &AutoPilotPlugin::pluginReady, this, &SetupView::_pluginReady);
}
+ _autoPilotPlugin = NULL;
+ _ui->buttonHolder->setAutoPilot(NULL);
+ _firmwareButtonClicked();
+ QObject* button = _ui->buttonHolder->rootObject()->findChild("firmwareButton");
+ Q_ASSERT(button);
+ button->setProperty("checked", true);
+
_uasCurrent = uas;
if (_uasCurrent) {
@@ -74,48 +103,27 @@ void SetupView::_setActiveUAS(UASInterface* uas)
connect(_autoPilotPlugin, &AutoPilotPlugin::pluginReady, this, &SetupView::_pluginReady);
if (_autoPilotPlugin->pluginIsReady()) {
- _setConnectedView();
+ _pluginReady();
}
- } else {
- _setDisconnectedView();
}
}
void SetupView::_pluginReady(void)
{
- _setConnectedView();
-}
-
-void SetupView::_setViewConnections(void)
-{
- QObject*button = rootObject()->findChild("firmwareButton");
+ _ui->buttonHolder->setAutoPilot(_autoPilotPlugin);
+ _summaryButtonClicked();
+ QObject* button = _ui->buttonHolder->rootObject()->findChild("summaryButton");
Q_ASSERT(button);
- connect(button, SIGNAL(clicked()), this, SLOT(_firmwareButtonClicked()));
-
- button = rootObject()->findChild("parametersButton");
- if (button) {
- connect(button, SIGNAL(clicked()), this, SLOT(_parametersButtonClicked()));
- }
+ button->setProperty("checked", true);
}
-void SetupView::_setDisconnectedView(void)
+void SetupView::_changeSetupWidget(QWidget* newWidget)
{
- setSource(QUrl::fromUserInput("qrc:qml/SetupViewDisconnected.qml"));
- _setViewConnections();
-}
-
-void SetupView::_setConnectedView(void)
-{
- Q_ASSERT(_uasCurrent);
- Q_ASSERT(_autoPilotPlugin);
-
- setAutoPilot(_autoPilotPlugin);
-
- setSource(QUrl::fromUserInput("qrc:qml/SetupViewConnected.qml"));
- disconnect(_autoPilotPlugin);
- _setViewConnections();
-
- connect((QObject*)rootObject(), SIGNAL(buttonClicked(QVariant)), this, SLOT(_setupButtonClicked(QVariant)));
+ if (_currentSetupWidget) {
+ delete _currentSetupWidget;
+ }
+ _currentSetupWidget = newWidget;
+ _ui->setupWidgetLayout->addWidget(newWidget);
}
void SetupView::_firmwareButtonClicked(void)
@@ -125,24 +133,27 @@ void SetupView::_firmwareButtonClicked(void)
return;
}
- SetupWidgetHolder* dialog = new SetupWidgetHolder(MainWindow::instance());
- dialog->setModal(true);
- dialog->setWindowTitle("Firmware Upgrade");
-
- PX4FirmwareUpgrade* setup = new PX4FirmwareUpgrade(dialog);
- dialog->setInnerWidget(setup);
- dialog->exec();
+ PX4FirmwareUpgrade* setup = new PX4FirmwareUpgrade(this);
+ _changeSetupWidget(setup);
}
void SetupView::_parametersButtonClicked(void)
{
- SetupWidgetHolder* dialog = new SetupWidgetHolder(MainWindow::instance());
- dialog->setModal(true);
- dialog->setWindowTitle("Parameter Editor");
+ ParameterEditor* setup = new ParameterEditor(_uasCurrent, QStringList(), this);
+ _changeSetupWidget(setup);
+}
+
+void SetupView::_summaryButtonClicked(void)
+{
+ Q_ASSERT(_autoPilotPlugin);
- ParameterEditor* setup = new ParameterEditor(_uasCurrent, QStringList(), dialog);
- dialog->setInnerWidget(setup);
- dialog->exec();
+ QGCQmlWidgetHolder* summary = new QGCQmlWidgetHolder;
+ Q_CHECK_PTR(summary);
+
+ summary->setAutoPilot(_autoPilotPlugin);
+ summary->setSource(QUrl::fromUserInput("qrc:/qml/VehicleSummary.qml"));
+
+ _changeSetupWidget(summary);
}
void SetupView::_setupButtonClicked(const QVariant& component)
@@ -161,15 +172,5 @@ void SetupView::_setupButtonClicked(const QVariant& component)
return;
}
- SetupWidgetHolder dialog(MainWindow::instance());
- dialog.setModal(true);
- dialog.setWindowTitle(vehicle->name());
-
- QWidget* setupWidget = vehicle->setupWidget();
-
- dialog.resize(setupWidget->minimumSize());
- dialog.setInnerWidget(setupWidget);
- dialog.exec();
-
- delete setupWidget;
+ _changeSetupWidget(vehicle->setupWidget());
}
diff --git a/src/VehicleSetup/SetupView.h b/src/VehicleSetup/SetupView.h
index 24f974e..8c4a6bc 100644
--- a/src/VehicleSetup/SetupView.h
+++ b/src/VehicleSetup/SetupView.h
@@ -24,18 +24,22 @@
#ifndef SETUPVIEW_H
#define SETUPVIEW_H
-
#include "UASInterface.h"
#include "ParameterEditor.h"
#include "VehicleComponent.h"
-#include "QGCQuickWidget.h"
#include "AutoPilotPlugin.h"
+#include
+
/// @file
/// @brief This class is used to display the UI for the VehicleComponent objects.
/// @author Don Gagne
-class SetupView : public QGCQuickWidget
+namespace Ui {
+ class SetupView;
+}
+
+class SetupView : public QWidget
{
Q_OBJECT
@@ -48,16 +52,18 @@ private slots:
void _pluginReady(void);
void _firmwareButtonClicked(void);
void _parametersButtonClicked(void);
+ void _summaryButtonClicked(void);
void _setupButtonClicked(const QVariant& component);
private:
- void _setConnectedView(void);
- void _setDisconnectedView(void);
- void _setViewConnections(void);
-
+ void _changeSetupWidget(QWidget* newWidget);
+
UASInterface* _uasCurrent; ///< Currently active UAS
bool _initComplete; ///< true: parameters are ready and ui has been setup
AutoPilotPlugin* _autoPilotPlugin;
+ QWidget* _currentSetupWidget;
+
+ Ui::SetupView* _ui;
};
#endif
diff --git a/src/VehicleSetup/SetupView.ui b/src/VehicleSetup/SetupView.ui
new file mode 100644
index 0000000..d5bc228
--- /dev/null
+++ b/src/VehicleSetup/SetupView.ui
@@ -0,0 +1,90 @@
+
+
+ SetupView
+
+
+
+ 0
+ 0
+ 946
+ 821
+
+
+
+ Form
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 160
+ 0
+
+
+
+
+ 160
+ 16777215
+
+
+
+ QGCQuickWidget::SizeRootObjectToView
+
+
+
+ -
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+ true
+
+
+
-
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
+
+ QGCQuickWidget
+ QQuickWidget
+
+ 1
+
+
+
+
+
diff --git a/src/VehicleSetup/SetupViewButtons.qml b/src/VehicleSetup/SetupViewButtons.qml
new file mode 100644
index 0000000..8d8aa34
--- /dev/null
+++ b/src/VehicleSetup/SetupViewButtons.qml
@@ -0,0 +1,88 @@
+import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Styles 1.2
+import QGroundControl.FactSystem 1.0
+import QGroundControl.Controls 1.0
+
+Rectangle {
+ id: topLevel
+
+ QGCPalette { id: palette; colorGroup: QGCPalette.Active }
+ color: palette.window
+
+ signal firmwareButtonClicked;
+ signal summaryButtonClicked;
+ signal parametersButtonClicked;
+ signal setupButtonClicked(variant component);
+
+ ExclusiveGroup { id: setupButtonGroup }
+
+ Component {
+ id: disconnectedButtons
+
+ Column {
+ spacing: 10
+
+ SetupButton {
+ id: firmwareButton; objectName: "firmwareButton"
+ width: parent.width
+ text: "FIRMWARE"
+ setupIndicator: false
+ exclusiveGroup: setupButtonGroup
+ onClicked: topLevel.firmwareButtonClicked()
+ }
+ }
+ }
+
+ Component {
+ id: connectedButtons
+
+ Column {
+ spacing: 10
+
+ SetupButton {
+ id: summaryButton; objectName: "summaryButton"
+ width: parent.width
+ text: "VEHICLE SUMMARY"
+ setupIndicator: false
+ exclusiveGroup: setupButtonGroup
+ onClicked: topLevel.summaryButtonClicked()
+ }
+
+ SetupButton {
+ id: firmwareButton; objectName: "firmwareButton"
+ width: parent.width
+ text: "FIRMWARE"
+ setupIndicator: false
+ exclusiveGroup: setupButtonGroup
+ onClicked: topLevel.firmwareButtonClicked()
+ }
+
+ Repeater {
+ model: autopilot.components
+
+ SetupButton {
+ width: parent.width
+ text: modelData.name.toUpperCase()
+ setupComplete: modelData.setupComplete
+ exclusiveGroup: setupButtonGroup
+ onClicked: topLevel.setupButtonClicked(modelData)
+ }
+ }
+
+ SetupButton {
+ width: parent.width
+ text: "PARAMETERS"
+ setupIndicator: false
+ exclusiveGroup: setupButtonGroup
+ onClicked: topLevel.parametersButtonClicked()
+ }
+ }
+ }
+
+
+ Loader {
+ anchors.fill: parent
+ sourceComponent: autopilot ? connectedButtons : disconnectedButtons
+ }
+}
diff --git a/src/VehicleSetup/SetupViewDisconnected.qml b/src/VehicleSetup/SetupViewDisconnected.qml
deleted file mode 100644
index 5ab9829..0000000
--- a/src/VehicleSetup/SetupViewDisconnected.qml
+++ /dev/null
@@ -1,34 +0,0 @@
-import QtQuick 2.2
-import QtQuick.Controls 1.2
-import QtQuick.Controls.Styles 1.2
-import QGroundControl.FactSystem 1.0
-
-Rectangle {
- QGCPalette { id: palette; colorGroup: QGCPalette.Active }
-
- color: palette.window
-
- Item {
- anchors.margins: 20
- anchors.fill: parent
-
- Rectangle { id: header; color: "lightblue"; radius: 10.0; width: parent.width; height: titleText.height + 20; opacity: 0.8;
- Text { id: titleText; anchors.centerIn: parent; font.pointSize: 24; text: "Vehicle Setup" }
- }
-
- Text { width: parent.width; height: parent.height - header.height - footer.height;
- anchors.top: header.bottom
- color: palette.windowText
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- text: "Vehicle Setup is only available while vehicle is connected." }
-
- Rectangle { id: footer; anchors.bottom: parent.bottom; color: "lightblue"; radius: 10.0; width: parent.width; height: titleText.height + 20; opacity: 0.8;
-
- Button { id: firmwareButton; objectName: "firmwareButton";
- anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter;
- text: "Firmware Upgrade"
- }
- }
- }
-}
diff --git a/src/VehicleSetup/SetupWidgetHolder.cc b/src/VehicleSetup/SetupWidgetHolder.cc
deleted file mode 100644
index 4e7e58c..0000000
--- a/src/VehicleSetup/SetupWidgetHolder.cc
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "SetupWidgetHolder.h"
-#include "ui_SetupWidgetHolder.h"
-
-SetupWidgetHolder::SetupWidgetHolder(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::SetupWidgetHolder)
-{
- ui->setupUi(this);
-}
-
-SetupWidgetHolder::~SetupWidgetHolder()
-{
- delete ui;
-}
-
-void SetupWidgetHolder::setInnerWidget(QWidget* widget)
-{
- ui->setupWidgetLayout->addWidget(widget);
-}
diff --git a/src/VehicleSetup/SetupWidgetHolder.h b/src/VehicleSetup/SetupWidgetHolder.h
deleted file mode 100644
index be2f3f2..0000000
--- a/src/VehicleSetup/SetupWidgetHolder.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef SETUPWIDGETHOLDER_H
-#define SETUPWIDGETHOLDER_H
-
-#include
-
-namespace Ui {
-class SetupWidgetHolder;
-}
-
-class SetupWidgetHolder : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit SetupWidgetHolder(QWidget *parent = 0);
- ~SetupWidgetHolder();
-
- void setInnerWidget(QWidget* widget);
-
-private:
- Ui::SetupWidgetHolder *ui;
-};
-
-#endif // SETUPWIDGETHOLDER_H
diff --git a/src/VehicleSetup/SetupWidgetHolder.ui b/src/VehicleSetup/SetupWidgetHolder.ui
deleted file mode 100644
index 05e3a0b..0000000
--- a/src/VehicleSetup/SetupWidgetHolder.ui
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
- SetupWidgetHolder
-
-
-
- 0
- 0
- 400
- 300
-
-
-
- Form
-
-
- true
-
-
- -
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
diff --git a/src/VehicleSetup/VehicleComponentSummaryItem.cc b/src/VehicleSetup/VehicleComponentSummaryItem.cc
deleted file mode 100644
index 753d6de..0000000
--- a/src/VehicleSetup/VehicleComponentSummaryItem.cc
+++ /dev/null
@@ -1,35 +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
-/// @author Don Gagne
-
-#include "VehicleComponentSummaryItem.h"
-
-VehicleComponentSummaryItem::VehicleComponentSummaryItem(const QString& name, const QString& state, QObject* parent) :
- QObject(parent),
- _name(name),
- _state(state)
-{
-
-}
diff --git a/src/VehicleSetup/VehicleComponentSummaryItem.h b/src/VehicleSetup/VehicleComponentSummaryItem.h
deleted file mode 100644
index c9f1bed..0000000
--- a/src/VehicleSetup/VehicleComponentSummaryItem.h
+++ /dev/null
@@ -1,57 +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 .
-
- ======================================================================*/
-
-#ifndef VehicleComponentSummaryItem_H
-#define VehicleComponentSummaryItem_H
-
-#include
-#include
-#include
-
-#include "UASInterface.h"
-
-/// @file
-/// @brief Vehicle Component class. A vehicle component is an object which
-/// abstracts the physical portion of a vehicle into a set of
-/// configurable values and user interface.
-/// @author Don Gagne
-
-class VehicleComponentSummaryItem : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString name READ name CONSTANT)
- Q_PROPERTY(QString state READ state CONSTANT)
-
-public:
- VehicleComponentSummaryItem(const QString& name, const QString& state, QObject* parent = NULL);
-
- QString name(void) const { return _name; }
- QString state(void) const { return _state; }
-
-protected:
- QString _name;
- QString _state;
-};
-
-#endif
diff --git a/src/VehicleSetup/SetupViewConnected.qml b/src/VehicleSetup/VehicleSummary.qml
similarity index 71%
rename from src/VehicleSetup/SetupViewConnected.qml
rename to src/VehicleSetup/VehicleSummary.qml
index cd2956d..8569e29 100644
--- a/src/VehicleSetup/SetupViewConnected.qml
+++ b/src/VehicleSetup/VehicleSummary.qml
@@ -4,34 +4,29 @@ import QtQuick.Controls.Styles 1.2
import QGroundControl.FactSystem 1.0
Rectangle {
+ width: 600
+ height: 400
+
QGCPalette { id: palette; colorGroup: QGCPalette.Active }
id: topLevel
objectName: "topLevel"
color: palette.window
-
- signal buttonClicked(variant component);
-
Image {
anchors.fill: parent
fillMode: Image.PreserveAspectFit
smooth: true
source: autopilot.setupBackgroundImage;
}
-
Column {
anchors.margins: 20
anchors.fill: parent
spacing: 5
- Rectangle { id: header; color: "lightblue"; radius: 10.0; width: parent.width; height: titleText.height + 20; opacity: 0.8;
- Text { id: titleText; anchors.centerIn: parent; font.pointSize: 24; text: "Vehicle Setup" }
- }
-
Flow {
width: parent.width;
- height: parent.height - header.height - footer.height
+ height: parent.height
spacing: 5
Repeater {
@@ -54,9 +49,8 @@ Rectangle {
border.color: "#888"
radius: 10
- color: control.activeFocus ? "#47b" : "white"
- opacity: control.hovered || control.activeFocus ? 1 : 0.8
- Behavior on opacity {NumberAnimation{ duration: 100 }}
+ color: "white"
+ opacity: 0.8
Text {
id: titleBar
@@ -108,23 +102,8 @@ Rectangle {
label: Item {}
}
-
- onClicked: topLevel.buttonClicked(modelData)
}
}
}
-
- Rectangle { id: footer; color: "lightblue"; radius: 10.0; width: parent.width; height: titleText.height + 20; opacity: 0.8;
-
- property real spacing: (width - firmwareButton.width - parametersButton.width) / 3
-
- Button { id: firmwareButton; objectName: "firmwareButton";
- x: parent.spacing; anchors.verticalCenter: parent.verticalCenter;
- text: "Firmware Upgrade" }
- Button { id: parametersButton; objectName: "parametersButton"
- x: firmwareButton.width + (parent.spacing*2); anchors.verticalCenter: parent.verticalCenter;
- text: "Parameters" }
- }
-
}
}
diff --git a/src/test.qml b/src/test.qml
index e623f49..fa45fe2 100644
--- a/src/test.qml
+++ b/src/test.qml
@@ -1,10 +1,14 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
-//import QGroundControl.FactControls 1.0
+import QGroundControl.FactControls 1.0
-Row {
-width: 200
-Text { id: firstCol; text: "Col 1" }
-Text { horizontalAlignment: Text.AlignRight; width: parent.width - firstCol.contentWidth; text: "Col 2" }
+
+Rectangle {
+ QGCPalette { id: palette; colorGroup: enabled ? QGCPalette.Active : QGCPalette.Disabled }
+
+ width: 100
+ height: 100
+ color: "#e43f3f"
+ // palette.windowText
}