diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro
index c18ac1a..26d0dab 100644
--- a/qgroundcontrol.pro
+++ b/qgroundcontrol.pro
@@ -341,7 +341,8 @@ FORMS += \
src/ui/px4_configuration/QGCPX4SensorCalibration.ui \
src/ui/px4_configuration/PX4RCCalibration.ui \
src/ui/px4_configuration/PX4FirmwareUpgrade.ui \
- src/ui/QGCUASFileView.ui
+ src/ui/QGCUASFileView.ui \
+ src/QGCQmlWidgetHolder.ui \
HEADERS += \
src/MG.h \
@@ -493,6 +494,7 @@ HEADERS += \
src/audio/QGCAudioWorker.h \
src/QGCQuickWidget.h \
src/QGCPalette.h \
+ src/QGCQmlWidgetHolder.h \
SOURCES += \
src/main.cc \
@@ -633,6 +635,7 @@ SOURCES += \
src/audio/QGCAudioWorker.cpp \
src/QGCQuickWidget.cc \
src/QGCPalette.cc \
+ src/QGCQmlWidgetHolder.cpp \
#
# Unit Test specific configuration goes here
@@ -725,6 +728,7 @@ HEADERS+= \
src/AutoPilotPlugins/PX4/FlightModeConfig.h \
src/AutoPilotPlugins/PX4/AirframeComponent.h \
src/AutoPilotPlugins/PX4/SensorsComponent.h \
+ src/AutoPilotPlugins/PX4/SafetyComponent.h \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.h \
src/VehicleSetup/SetupWidgetHolder.h \
@@ -743,6 +747,7 @@ SOURCES += \
src/AutoPilotPlugins/PX4/FlightModeConfig.cc \
src/AutoPilotPlugins/PX4/AirframeComponent.cc \
src/AutoPilotPlugins/PX4/SensorsComponent.cc \
+ src/AutoPilotPlugins/PX4/SafetyComponent.cc \
src/AutoPilotPlugins/PX4/PX4ParameterFacts.cc \
src/VehicleSetup/SetupWidgetHolder.cc \
diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index bca9f09..4074339 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -239,10 +239,11 @@
src/test.qml
qml/QGroundControl/FactControls/qmldir
qml/QGroundControl/FactControls/SetupButton.qml
- src/VehicleSetup/SetupViewConnected.qml
- src/VehicleSetup/SetupViewDisconnected.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/AutoPilotPlugins/PX4/SafetyComponent.qml
src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml
diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.cc b/src/AutoPilotPlugins/PX4/AirframeComponent.cc
index c63f533..18cf67f 100644
--- a/src/AutoPilotPlugins/PX4/AirframeComponent.cc
+++ b/src/AutoPilotPlugins/PX4/AirframeComponent.cc
@@ -62,8 +62,8 @@ static const struct mavType mavTypeInfo[] = {
};
static size_t cMavTypes = sizeof(mavTypeInfo) / sizeof(mavTypeInfo[0]);
-AirframeComponent::AirframeComponent(UASInterface* uas, QObject* parent) :
- PX4Component(uas, parent),
+AirframeComponent::AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
+ PX4Component(uas, autopilot, parent),
_name(tr("Airframe"))
{
// Validate that our mavTypeInfo array hasn't gotten out of sync
diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.h b/src/AutoPilotPlugins/PX4/AirframeComponent.h
index 5891a18..c4d1143 100644
--- a/src/AutoPilotPlugins/PX4/AirframeComponent.h
+++ b/src/AutoPilotPlugins/PX4/AirframeComponent.h
@@ -35,7 +35,7 @@ class AirframeComponent : public PX4Component
Q_OBJECT
public:
- AirframeComponent(UASInterface* uas, QObject* parent = NULL);
+ AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;
diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc
index d797d81..4d66d67 100644
--- a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc
+++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc
@@ -45,8 +45,8 @@ static const SwitchListItem switchList[] = {
};
static const size_t cSwitchList = sizeof(switchList) / sizeof(switchList[0]);
-FlightModesComponent::FlightModesComponent(UASInterface* uas, QObject* parent) :
- PX4Component(uas, parent),
+FlightModesComponent::FlightModesComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
+ PX4Component(uas, autopilot, parent),
_name(tr("Flight Modes"))
{
}
diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.h b/src/AutoPilotPlugins/PX4/FlightModesComponent.h
index 079d290..ccae9b0 100644
--- a/src/AutoPilotPlugins/PX4/FlightModesComponent.h
+++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.h
@@ -35,7 +35,7 @@ class FlightModesComponent : public PX4Component
Q_OBJECT
public:
- FlightModesComponent(UASInterface* uas, QObject* parent = NULL);
+ FlightModesComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;
diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
index 446a8c7..0a1ab92 100644
--- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
+++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
@@ -26,6 +26,7 @@
#include "RadioComponent.h"
#include "SensorsComponent.h"
#include "FlightModesComponent.h"
+#include "SafetyComponent.h"
#include "AutoPilotPluginManager.h"
#include "UASManager.h"
#include "QGCUASParamManagerInterface.h"
@@ -196,19 +197,23 @@ const QVariantList& PX4AutoPilotPlugin::components(void)
Q_ASSERT(_uas);
- component = new AirframeComponent(_uas);
+ component = new AirframeComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
- component = new RadioComponent(_uas);
+ component = new RadioComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
- component = new FlightModesComponent(_uas);
+ component = new FlightModesComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
- component = new SensorsComponent(_uas);
+ component = new SensorsComponent(_uas, this);
+ Q_CHECK_PTR(component);
+ _components.append(QVariant::fromValue(component));
+
+ component = new SafetyComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
}
diff --git a/src/AutoPilotPlugins/PX4/PX4Component.cc b/src/AutoPilotPlugins/PX4/PX4Component.cc
index 2c551e4..6fea92c 100644
--- a/src/AutoPilotPlugins/PX4/PX4Component.cc
+++ b/src/AutoPilotPlugins/PX4/PX4Component.cc
@@ -26,8 +26,8 @@
#include "PX4Component.h"
-PX4Component::PX4Component(UASInterface* uas, QObject* parent) :
- VehicleComponent(uas, parent)
+PX4Component::PX4Component(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
+ VehicleComponent(uas, autopilot, parent)
{
bool fSuccess = connect(_paramMgr, SIGNAL(parameterUpdated(int, QString, QVariant)), this, SLOT(_parameterUpdated(int, QString, QVariant)));
Q_ASSERT(fSuccess);
diff --git a/src/AutoPilotPlugins/PX4/PX4Component.h b/src/AutoPilotPlugins/PX4/PX4Component.h
index 70a58e1..9bffafb 100644
--- a/src/AutoPilotPlugins/PX4/PX4Component.h
+++ b/src/AutoPilotPlugins/PX4/PX4Component.h
@@ -35,7 +35,7 @@ class PX4Component : public VehicleComponent
Q_OBJECT
public:
- PX4Component(UASInterface* uas, QObject* parent = NULL);
+ PX4Component(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
/// @brief Returns an array of parameter names for which a change should cause the setupCompleteChanged
/// signal to be emitted. Last element is signalled by NULL. Must be implemented by upper level class.
@@ -45,7 +45,6 @@ private slots:
/// @brief Connected to QGCUASParamManagerInterface::parameterUpdated signal in order to signal
/// setupCompleteChanged at appropriate times.
void _parameterUpdated(int compId, QString paramName, QVariant value);
-
};
#endif
diff --git a/src/AutoPilotPlugins/PX4/RadioComponent.cc b/src/AutoPilotPlugins/PX4/RadioComponent.cc
index a071a6c..0e6ca43 100644
--- a/src/AutoPilotPlugins/PX4/RadioComponent.cc
+++ b/src/AutoPilotPlugins/PX4/RadioComponent.cc
@@ -31,8 +31,8 @@
/// @brief Parameters which signal a change in setupComplete state
static const char* triggerParams[] = { "RC_MAP_MODE_SW", NULL };
-RadioComponent::RadioComponent(UASInterface* uas, QObject* parent) :
- PX4Component(uas, parent),
+RadioComponent::RadioComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
+ PX4Component(uas, autopilot, parent),
_name(tr("Radio"))
{
}
diff --git a/src/AutoPilotPlugins/PX4/RadioComponent.h b/src/AutoPilotPlugins/PX4/RadioComponent.h
index 8c6c948..092e265 100644
--- a/src/AutoPilotPlugins/PX4/RadioComponent.h
+++ b/src/AutoPilotPlugins/PX4/RadioComponent.h
@@ -36,7 +36,7 @@ class RadioComponent : public PX4Component
Q_OBJECT
public:
- RadioComponent(UASInterface* uas, QObject* parent = NULL);
+ RadioComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;
diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.cc b/src/AutoPilotPlugins/PX4/SafetyComponent.cc
new file mode 100644
index 0000000..7858864
--- /dev/null
+++ b/src/AutoPilotPlugins/PX4/SafetyComponent.cc
@@ -0,0 +1,156 @@
+/*=====================================================================
+
+ 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 "SafetyComponent.h"
+#include "PX4RCCalibration.h"
+#include "VehicleComponentSummaryItem.h"
+#include "QGCQmlWidgetHolder.h"
+
+/// @brief Parameters which signal a change in setupComplete state
+static const char* triggerParams[] = { NULL };
+
+SafetyComponent::SafetyComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
+ PX4Component(uas, autopilot, parent),
+ _name(tr("Safety"))
+{
+}
+
+QString SafetyComponent::name(void) const
+{
+ return _name;
+}
+
+QString SafetyComponent::description(void) const
+{
+ return tr("The Safety Component is used to setup triggers for Return to Land as well as the settings for Return to Land itself.");
+}
+
+QString SafetyComponent::icon(void) const
+{
+ return ":/files/images/px4/menu/remote.png";
+}
+
+bool SafetyComponent::requiresSetup(void) const
+{
+ return false;
+}
+
+bool SafetyComponent::setupComplete(void) const
+{
+ // FIXME: What aboout invalid settings?
+ return true;
+}
+
+QString SafetyComponent::setupStateDescription(void) const
+{
+ const char* stateDescription;
+
+ if (requiresSetup()) {
+ stateDescription = "Requires setup";
+ } else {
+ stateDescription = "Setup complete";
+ }
+ return QString(stateDescription);
+}
+
+const char** SafetyComponent::setupCompleteChangedTriggerList(void) const
+{
+ return triggerParams;
+}
+
+QStringList SafetyComponent::paramFilterList(void) const
+{
+ QStringList list;
+
+ return list;
+}
+
+QWidget* SafetyComponent::setupWidget(void) const
+{
+ QGCQmlWidgetHolder* holder = new QGCQmlWidgetHolder();
+ Q_CHECK_PTR(holder);
+
+ holder->setAutoPilot(_autopilot);
+
+ holder->setSource(QUrl::fromUserInput("qrc:/qml/SafetyComponent.qml"));
+
+ return holder;
+}
+
+const QVariantList& SafetyComponent::summaryItems(void)
+{
+ // FIXME: No summary items yet
+#if 0
+ if (!_summaryItems.count()) {
+ QString name;
+ QString state;
+
+ // FIXME: Need to pull receiver type from RSSI value
+ name = "Receiver type:";
+ state = "n/a";
+
+ VehicleComponentSummaryItem* item = new VehicleComponentSummaryItem(name, state, this);
+ _summaryItems.append(QVariant::fromValue(item));
+
+ static const char* stickParams[] = { "RC_MAP_ROLL", "RC_MAP_PITCH", "RC_MAP_YAW", "RC_MAP_THROTTLE" };
+
+ QString summary("Chan ");
+
+ bool allSticksMapped = true;
+ for (size_t i=0; igetParameterValue(_paramMgr->getDefaultComponentId(), stickParams[i], value)) {
+ if (value.toInt() == 0) {
+ allSticksMapped = false;
+ break;
+ } else {
+ if (i != 0) {
+ summary += ",";
+ }
+ summary += value.toString();
+ }
+ } else {
+ // Why is the parameter missing?
+ Q_ASSERT(false);
+ summary += "?";
+ }
+ }
+
+ if (!allSticksMapped) {
+ summary = "Not mapped";
+ }
+
+ name = "Ail, Ele, Rud, Throt:";
+ state = summary;
+
+ item = new VehicleComponentSummaryItem(name, state, this);
+ _summaryItems.append(QVariant::fromValue(item));
+ }
+#endif
+
+ return _summaryItems;
+}
diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.h b/src/AutoPilotPlugins/PX4/SafetyComponent.h
new file mode 100644
index 0000000..3d13779
--- /dev/null
+++ b/src/AutoPilotPlugins/PX4/SafetyComponent.h
@@ -0,0 +1,60 @@
+/*=====================================================================
+
+ 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 SafetyComponent_H
+#define SafetyComponent_H
+
+#include "PX4Component.h"
+
+/// @file
+/// @brief The Radio VehicleComponent is used to calibrate the trasmitter and assign function mapping
+/// to channels.
+/// @author Don Gagne
+
+class SafetyComponent : public PX4Component
+{
+ Q_OBJECT
+
+public:
+ SafetyComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
+
+ // Virtuals from PX4Component
+ virtual const char** setupCompleteChangedTriggerList(void) const;
+
+ // Virtuals from VehicleComponent
+ virtual QString name(void) const;
+ virtual QString description(void) const;
+ virtual QString icon(void) const;
+ virtual bool requiresSetup(void) const;
+ virtual bool setupComplete(void) const;
+ virtual QString setupStateDescription(void) const;
+ virtual QWidget* setupWidget(void) const;
+ virtual QStringList paramFilterList(void) const;
+ virtual const QVariantList& summaryItems(void);
+
+private:
+ const QString _name;
+ QVariantList _summaryItems;
+};
+
+#endif
diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.qml b/src/AutoPilotPlugins/PX4/SafetyComponent.qml
new file mode 100644
index 0000000..3ef0471
--- /dev/null
+++ b/src/AutoPilotPlugins/PX4/SafetyComponent.qml
@@ -0,0 +1,17 @@
+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 }
+
+ width: 400
+ height: 400
+ color: palette.window
+
+ Column {
+ Label { text: "Work in Progress"; color: palette.windowText }
+ Label { text: autopilot.parameters["RTL_RETURN_ALT"].value; color: palette.windowText }
+ }
+}
diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.cc b/src/AutoPilotPlugins/PX4/SensorsComponent.cc
index 2e2cd57..afeefc9 100644
--- a/src/AutoPilotPlugins/PX4/SensorsComponent.cc
+++ b/src/AutoPilotPlugins/PX4/SensorsComponent.cc
@@ -36,8 +36,8 @@ static const char* triggerParams[] = { "SENS_MAG_XOFF", "SENS_GYRO_XOFF", "SENS
/// @brief Used to translate from parameter name to user string
static const char* triggerSensors[] = { "Compass", "Gyro", "Acceleromter", "Airspeed", NULL };
-SensorsComponent::SensorsComponent(UASInterface* uas, QObject* parent) :
- PX4Component(uas, parent),
+SensorsComponent::SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
+ PX4Component(uas, autopilot, parent),
_name(tr("Sensors"))
{
}
diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.h b/src/AutoPilotPlugins/PX4/SensorsComponent.h
index 52a6815..7872f45 100644
--- a/src/AutoPilotPlugins/PX4/SensorsComponent.h
+++ b/src/AutoPilotPlugins/PX4/SensorsComponent.h
@@ -35,7 +35,7 @@ class SensorsComponent : public PX4Component
Q_OBJECT
public:
- SensorsComponent(UASInterface* uas, QObject* parent = NULL);
+ SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;
diff --git a/src/QGCQmlWidgetHolder.cpp b/src/QGCQmlWidgetHolder.cpp
new file mode 100644
index 0000000..75beeb7
--- /dev/null
+++ b/src/QGCQmlWidgetHolder.cpp
@@ -0,0 +1,49 @@
+/*=====================================================================
+
+ 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 "QGCQmlWidgetHolder.h"
+
+QGCQmlWidgetHolder::QGCQmlWidgetHolder(QWidget *parent) :
+ QWidget(parent)
+{
+ _ui.setupUi(this);
+}
+
+QGCQmlWidgetHolder::~QGCQmlWidgetHolder()
+{
+
+}
+
+void QGCQmlWidgetHolder::setAutoPilot(AutoPilotPlugin* autoPilot)
+{
+ _ui.qmlWidget->rootContext()->setContextProperty("autopilot", autoPilot);
+}
+
+void QGCQmlWidgetHolder::setSource(const QUrl& qmlUrl)
+{
+ _ui.qmlWidget->setSource(qmlUrl);
+ _ui.qmlWidget->setMinimumSize(_ui.qmlWidget->rootObject()->width(), _ui.qmlWidget->rootObject()->height());
+}
diff --git a/src/QGCQmlWidgetHolder.h b/src/QGCQmlWidgetHolder.h
new file mode 100644
index 0000000..90b8e08
--- /dev/null
+++ b/src/QGCQmlWidgetHolder.h
@@ -0,0 +1,59 @@
+/*=====================================================================
+
+ 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 QGCQmlWidgetHolder_h
+#define QGCQmlWidgetHolder_h
+
+/// @file
+/// @author Don Gagne
+
+#include
+
+#include "ui_QGCQmlWidgetHolder.h"
+#include "AutoPilotPlugin.h"
+
+namespace Ui {
+class QGCQmlWidgetHolder;
+}
+
+/// This is used to create widgets which are implemented in QML.
+
+class QGCQmlWidgetHolder : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit QGCQmlWidgetHolder(QWidget *parent = 0);
+ ~QGCQmlWidgetHolder();
+
+ /// Sets the UAS into the widget which in turn will load facts into the context
+ void setAutoPilot(AutoPilotPlugin* autoPilot);
+
+ /// Sets the QML into the control
+ void setSource(const QUrl& qmlUrl);
+
+private:
+ Ui::QGCQmlWidgetHolder _ui;
+};
+
+#endif
diff --git a/src/QGCQmlWidgetHolder.ui b/src/QGCQmlWidgetHolder.ui
new file mode 100644
index 0000000..0a000a7
--- /dev/null
+++ b/src/QGCQmlWidgetHolder.ui
@@ -0,0 +1,32 @@
+
+
+ QGCQmlWidgetHolder
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+ -
+
+
+
+
+
+
+ QGCQuickWidget
+ QQuickWidget
+
+ 1
+
+
+
+
+
diff --git a/src/VehicleSetup/SetupView.cc b/src/VehicleSetup/SetupView.cc
index caebee6..3718e29 100644
--- a/src/VehicleSetup/SetupView.cc
+++ b/src/VehicleSetup/SetupView.cc
@@ -142,13 +142,15 @@ void SetupView::_setupButtonClicked(const QVariant& component)
VehicleComponent* vehicle = qobject_cast(component.value());
Q_ASSERT(vehicle);
- SetupWidgetHolder* dialog = new SetupWidgetHolder(MainWindow::instance());
- dialog->setModal(true);
- dialog->setWindowTitle(vehicle->name());
+ SetupWidgetHolder dialog(MainWindow::instance());
+ dialog.setModal(true);
+ dialog.setWindowTitle(vehicle->name());
QWidget* setupWidget = vehicle->setupWidget();
- qDebug() << setupWidget->minimumSize();
- dialog->resize(setupWidget->minimumSize());
- dialog->setInnerWidget(setupWidget);
- dialog->exec();
+
+ dialog.resize(setupWidget->minimumSize());
+ dialog.setInnerWidget(setupWidget);
+ dialog.exec();
+
+ delete setupWidget;
}
diff --git a/src/VehicleSetup/VehicleComponent.cc b/src/VehicleSetup/VehicleComponent.cc
index 0bb5eb9..956e607 100644
--- a/src/VehicleSetup/VehicleComponent.cc
+++ b/src/VehicleSetup/VehicleComponent.cc
@@ -25,13 +25,18 @@
/// @author Don Gagne
#include "VehicleComponent.h"
+#include "AutoPilotPlugin.h"
-VehicleComponent::VehicleComponent(UASInterface* uas, QObject* parent) :
+VehicleComponent::VehicleComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
QObject(parent),
_uas(uas),
- _paramMgr(_uas->getParamManager())
+ _autopilot(autopilot)
{
+ Q_ASSERT(uas);
+ Q_ASSERT(autopilot);
+ _paramMgr = _uas->getParamManager();
+ Q_ASSERT(_paramMgr);
}
VehicleComponent::~VehicleComponent()
diff --git a/src/VehicleSetup/VehicleComponent.h b/src/VehicleSetup/VehicleComponent.h
index 48c5c69..4c603b4 100644
--- a/src/VehicleSetup/VehicleComponent.h
+++ b/src/VehicleSetup/VehicleComponent.h
@@ -21,6 +21,9 @@
======================================================================*/
+/// @file
+/// @author Don Gagne
+
#ifndef VEHICLECOMPONENT_H
#define VEHICLECOMPONENT_H
@@ -30,11 +33,10 @@
#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 AutoPilotPlugin;
+
+/// A vehicle component is an object which abstracts the physical portion of a vehicle into a set of
+/// configurable values and user interface.
class VehicleComponent : public QObject
{
@@ -50,7 +52,7 @@ class VehicleComponent : public QObject
Q_PROPERTY(QVariantList summaryItems READ summaryItems CONSTANT);
public:
- VehicleComponent(UASInterface* uas, QObject* parent = NULL);
+ VehicleComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
~VehicleComponent();
virtual QString name(void) const = 0;
@@ -70,6 +72,7 @@ signals:
protected:
UASInterface* _uas;
+ AutoPilotPlugin* _autopilot;
QGCUASParamManagerInterface* _paramMgr;
};