From 72806be5c73a4d3dc6389ac9cc078d1002dc4aba Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Wed, 24 Dec 2014 18:26:24 -0800 Subject: [PATCH] Summary button content now comes from QML --- qgroundcontrol.qrc | 10 ++ src/AutoPilotPlugins/PX4/AirframeComponent.cc | 62 +--------- src/AutoPilotPlugins/PX4/AirframeComponent.h | 2 +- .../PX4/AirframeComponentSummary.qml | 32 ++++++ .../PX4/FlightModesComponent.cc | 41 +------ .../PX4/FlightModesComponent.h | 2 +- .../PX4/FlightModesComponentSummary.qml | 54 +++++++++ src/AutoPilotPlugins/PX4/RadioComponent.cc | 51 +-------- src/AutoPilotPlugins/PX4/RadioComponent.h | 2 +- src/AutoPilotPlugins/PX4/SafetyComponent.cc | 34 +----- src/AutoPilotPlugins/PX4/SafetyComponent.h | 2 +- src/AutoPilotPlugins/PX4/SafetyComponent.qml | 2 +- .../PX4/SafetyComponentSummary.qml | 65 +++++++++++ src/AutoPilotPlugins/PX4/SensorsComponent.cc | 108 +----------------- src/AutoPilotPlugins/PX4/SensorsComponent.h | 2 +- .../PX4/SensorsComponentSummary.qml | 54 +++++++++ src/VehicleSetup/SetupViewConnected.qml | 14 +-- src/VehicleSetup/SetupViewDisconnected.qml | 4 +- src/VehicleSetup/VehicleComponent.h | 4 +- 19 files changed, 239 insertions(+), 306 deletions(-) create mode 100644 src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml create mode 100644 src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml create mode 100644 src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml create mode 100644 src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index f96b3370f..1e687daef 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -235,7 +235,9 @@ files/QLoggingCategory/qtlogging.ini + + src/test.qml qml/QGroundControl/FactControls/qmldir @@ -254,7 +256,15 @@ src/VehicleSetup/SetupPane.qml src/AutoPilotPlugins/PX4/SafetyComponent.qml + + src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml + src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml + src/AutoPilotPlugins/PX4/RadioComponentSummary.qml + src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml + src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml + + src/AutoPilotPlugins/PX4/ParameterFactMetaData.xml diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.cc b/src/AutoPilotPlugins/PX4/AirframeComponent.cc index 18cf67fd7..c9c40938d 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponent.cc +++ b/src/AutoPilotPlugins/PX4/AirframeComponent.cc @@ -162,65 +162,7 @@ QWidget* AirframeComponent::setupWidget(void) const return new QGCPX4AirframeConfig; } -const QVariantList& AirframeComponent::summaryItems(void) +QUrl AirframeComponent::summaryQmlSource(void) const { - // Fill the items on first reference - // FIXME: These items are not live - - if (!_summaryItems.count()) { - QString name; - QString state; - QVariant value; - - name = "System ID:"; - if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "MAV_SYS_ID", value)) { - if (value.toInt() == 0) { - state = "Setup required"; - } else { - state = value.toString(); - } - } else { - // Why is the parameter missing? - Q_ASSERT(false); - } - - VehicleComponentSummaryItem* item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - - name = "Airframe:"; - if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "SYS_AUTOSTART", value)) { - if (value.toInt() == 0) { - state = "Setup required"; - } else { - state = value.toString(); - } - } else { - // Why is the parameter missing? - Q_ASSERT(false); - } - - item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - - name = "Type:"; - if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "MAV_TYPE", value)) { - int index = value.toInt(); - - if (index < 0 || index >= (int)cMavTypes) { - state = "Unknown"; - } else { - state = mavTypeInfo[index].description; - } - } else { - // Why is the parameter missing? - Q_ASSERT(false); - state = "Unknown"; - } - - item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - } - - return _summaryItems; + return QUrl::fromUserInput("qrc:/qml/AirframeComponentSummary.qml"); } - diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.h b/src/AutoPilotPlugins/PX4/AirframeComponent.h index c4d1143a8..67d240113 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponent.h +++ b/src/AutoPilotPlugins/PX4/AirframeComponent.h @@ -49,7 +49,7 @@ public: virtual QString setupStateDescription(void) const; virtual QWidget* setupWidget(void) const; virtual QStringList paramFilterList(void) const; - virtual const QVariantList& summaryItems(void); + virtual QUrl summaryQmlSource(void) const; private: const QString _name; diff --git a/src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml b/src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml new file mode 100644 index 000000000..352151fa0 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml @@ -0,0 +1,32 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 + +Column { + anchors.fill: parent + anchors.margins: 8 + + Row { + width: parent.width + + Text { id: systemId; text: "System ID:" } + Text { + horizontalAlignment: Text.AlignRight + width: parent.width - systemId.contentWidth + text: autopilot.parameters["MAV_SYS_ID"].value + } + } + + Row { + width: parent.width + + Text { id: airframe; text: "Airframe:" } + Text { + horizontalAlignment: Text.AlignRight + width: parent.width - airframe.contentWidth + text: autopilot.parameters["SYS_AUTOSTART"].value == 0 ? "Setup required" : autopilot.parameters["SYS_AUTOSTART"].value + } + } +} diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc index 4d66d670f..18c49bddf 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc +++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc @@ -117,44 +117,7 @@ QWidget* FlightModesComponent::setupWidget(void) const return new FlightModeConfig(); } -const QVariantList& FlightModesComponent::summaryItems(void) +QUrl FlightModesComponent::summaryQmlSource(void) const { - if (!_summaryItems.count()) { - - // Create summary items for each mode switch - - for (size_t i=0; igetParameterValue(_paramMgr->getDefaultComponentId(), switchList[i].param, value)) { - int chan = value.toInt(); - - if (chan == 0) { - // Switch is not mapped - if (i == 0) { - // Mode switch is required - Q_ASSERT(strcmp(switchList[0].param, "RC_MAP_MODE_SW") == 0); - state = "Setup required"; - } else { - state = "None"; - } - } else { - state = tr("Chan %1").arg(chan); - } - } else { - // Why is the parameter missing? - Q_ASSERT(false); - state = "Unknown"; - } - - VehicleComponentSummaryItem* item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - } - } - - return _summaryItems; + return QUrl::fromUserInput("qrc:/qml/FlightModesComponentSummary.qml"); } diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.h b/src/AutoPilotPlugins/PX4/FlightModesComponent.h index ccae9b096..e284859da 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponent.h +++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.h @@ -49,7 +49,7 @@ public: virtual QString setupStateDescription(void) const; virtual QWidget* setupWidget(void) const; virtual QStringList paramFilterList(void) const; - virtual const QVariantList& summaryItems(void); + virtual QUrl summaryQmlSource(void) const; private: const QString _name; diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml b/src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml new file mode 100644 index 000000000..ac8ab7ae1 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml @@ -0,0 +1,54 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 + +Column { + anchors.fill: parent + anchors.margins: 8 + + Row { + width: parent.width + + Text { id: mode; text: "Mode switch:" } + Text { + horizontalAlignment: Text.AlignRight + width: parent.width - mode.contentWidth + text: autopilot.parameters["RC_MAP_MODE_SW"].value == 0 ? "Setup required" : autopilot.parameters["RC_MAP_MODE_SW"].value + } + } + + Row { + width: parent.width + + Text { id: posctl; text: "Position Ctl switch:" } + Text { + horizontalAlignment: Text.AlignRight + width: parent.width - posctl.contentWidth + text: autopilot.parameters["RC_MAP_POSCTL_SW"].value == 0 ? "Not mapped" : autopilot.parameters["RC_MAP_POSCTL_SW"].value + } + } + + Row { + width: parent.width + + Text { id: loiter; text: "Loiter switch:" } + Text { + horizontalAlignment: Text.AlignRight + width: parent.width - loiter.contentWidth + text: autopilot.parameters["RC_MAP_LOITER_SW"].value == 0 ? "Not mapped" : autopilot.parameters["RC_MAP_LOITER_SW"].value + } + } + + Row { + width: parent.width + + Text { id: rtl; text: "Return switch:" } + Text { + horizontalAlignment: Text.AlignRight + width: parent.width - rtl.contentWidth + text: autopilot.parameters["RC_MAP_RETURN_SW"].value == 0 ? "Not mapped" : autopilot.parameters["RC_MAP_RETURN_SW"].value + } + } +} diff --git a/src/AutoPilotPlugins/PX4/RadioComponent.cc b/src/AutoPilotPlugins/PX4/RadioComponent.cc index 0e6ca4346..b9b151554 100644 --- a/src/AutoPilotPlugins/PX4/RadioComponent.cc +++ b/src/AutoPilotPlugins/PX4/RadioComponent.cc @@ -101,54 +101,7 @@ QWidget* RadioComponent::setupWidget(void) const return new PX4RCCalibration; } -const QVariantList& RadioComponent::summaryItems(void) +QUrl RadioComponent::summaryQmlSource(void) const { - 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)); - } - - return _summaryItems; + return QUrl::fromUserInput("qrc:/qml/RadioComponentSummary.qml"); } diff --git a/src/AutoPilotPlugins/PX4/RadioComponent.h b/src/AutoPilotPlugins/PX4/RadioComponent.h index 092e26530..06dbe0cc5 100644 --- a/src/AutoPilotPlugins/PX4/RadioComponent.h +++ b/src/AutoPilotPlugins/PX4/RadioComponent.h @@ -50,7 +50,7 @@ public: virtual QString setupStateDescription(void) const; virtual QWidget* setupWidget(void) const; virtual QStringList paramFilterList(void) const; - virtual const QVariantList& summaryItems(void); + virtual QUrl summaryQmlSource(void) const; private: const QString _name; diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.cc b/src/AutoPilotPlugins/PX4/SafetyComponent.cc index 3ddaf3dc6..e9bfc540c 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.cc +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.cc @@ -100,37 +100,7 @@ QWidget* SafetyComponent::setupWidget(void) const return holder; } -const QVariantList& SafetyComponent::summaryItems(void) +QUrl SafetyComponent::summaryQmlSource(void) const { - if (!_summaryItems.count()) { - QString name; - QString state; - - name = "RTL min alt:"; - - VehicleComponentSummaryItem* item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - - name = "RTL home alt:"; - - item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - - name = "RTL home loiter:"; - - item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - - name = "Telemetry loss RTL:"; - - item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - - name = "RC loss RTL:"; - - item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - } - - return _summaryItems; + return QUrl::fromUserInput("qrc:/qml/SafetyComponentSummary.qml"); } diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.h b/src/AutoPilotPlugins/PX4/SafetyComponent.h index 3d137790c..853394f8a 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.h +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.h @@ -50,7 +50,7 @@ public: virtual QString setupStateDescription(void) const; virtual QWidget* setupWidget(void) const; virtual QStringList paramFilterList(void) const; - virtual const QVariantList& summaryItems(void); + virtual QUrl summaryQmlSource(void) const; private: const QString _name; diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.qml b/src/AutoPilotPlugins/PX4/SafetyComponent.qml index d0d14a77e..f6187dc10 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.qml +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.qml @@ -32,7 +32,7 @@ Rectangle { id: homeLoiterCheckbox property Fact fact: autopilot.parameters["RTL_LAND_DELAY"] - checked: fact.value < 0 + checked: fact.value > 0 text: "Loiter at Home altitude for " onClicked: { diff --git a/src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml b/src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml new file mode 100644 index 000000000..913077d80 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml @@ -0,0 +1,65 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 + +Column { + anchors.fill: parent + anchors.margins: 8 + + Row { + width: parent.width + + Text { id: rtlMinAlt; text: "RTL min alt:" } + Text { + horizontalAlignment: Text.AlignRight; + width: parent.width - rtlMinAlt.contentWidth; + text: autopilot.parameters["RTL_RETURN_ALT"].valueString + } + } + + Row { + width: parent.width + + Text { id: rtlHomeAlt; text: "RTL home alt:" } + Text { + horizontalAlignment: Text.AlignRight; + width: parent.width - rtlHomeAlt.contentWidth; + text: autopilot.parameters["RTL_DESCEND_ALT"].valueString + } + } + + Row { + width: parent.width + + Text { id: rtlLoiter; text: "RTL loiter delay:" } + Text { + horizontalAlignment: Text.AlignRight; + width: parent.width - rtlLoiter.contentWidth; + text: autopilot.parameters["RTL_LAND_DELAY"].value < 0 ? "Disabled" : autopilot.parameters["RTL_LAND_DELAY"].valueString + } + } + + Row { + width: parent.width + + Text { id: commLoss; text: "Telemetry loss RTL:" } + Text { + horizontalAlignment: Text.AlignRight; + width: parent.width - commLoss.contentWidth; + text: autopilot.parameters["COM_DL_LOSS_EN"].value != 1 ? "Disabled" : autopilot.parameters["NAV_DLL_N"].valueString + } + } + + Row { + width: parent.width + + Text { id: rcLoss; text: "RC loss RTL (seconds):" } + Text { + horizontalAlignment: Text.AlignRight; + width: parent.width - rcLoss.contentWidth; + text: autopilot.parameters["COM_RC_LOSS_T"].valueString + } + } +} diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.cc b/src/AutoPilotPlugins/PX4/SensorsComponent.cc index afeefc967..bd3710a1b 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.cc +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.cc @@ -33,9 +33,6 @@ /// @brief Parameters which signal a change in setupComplete state static const char* triggerParams[] = { "SENS_MAG_XOFF", "SENS_GYRO_XOFF", "SENS_ACC_XOFF", "SENS_DPRES_OFF", NULL }; -/// @brief Used to translate from parameter name to user string -static const char* triggerSensors[] = { "Compass", "Gyro", "Acceleromter", "Airspeed", NULL }; - SensorsComponent::SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) : PX4Component(uas, autopilot, parent), _name(tr("Sensors")) @@ -117,108 +114,7 @@ QWidget* SensorsComponent::setupWidget(void) const return new QGCPX4SensorCalibration; } -const QVariantList& SensorsComponent::summaryItems(void) +QUrl SensorsComponent::summaryQmlSource(void) const { - if (!_summaryItems.count()) { - QString name; - QString state; - - // Summary item for each Sensor - - int i = 0; - while (triggerParams[i] != NULL) { - QVariant value; - - name = tr("%1:").arg(triggerSensors[i]); - - if (_paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), triggerParams[i], value)) { - if (value.toFloat() == 0.0f) { - state = "Setup required"; - } else { - state = "Ready"; - } - } else { - // Why is the parameter missing? - Q_ASSERT(false); - } - - VehicleComponentSummaryItem* item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - - i++; - } - - // Summary item for each orientation param - - static const char* orientationSensors[] = { "Autopilot orientation:", "Compass orientation:" }; - static const char* orientationParams[] = { "SENS_BOARD_ROT", "SENS_EXT_MAG_ROT" }; - static const size_t cOrientationSensors = sizeof(orientationSensors)/sizeof(orientationSensors[0]); - - static const char* orientationValues[] = { - "Line of flight", - "Yaw:45", - "Yaw:90", - "Yaw:135", - "Yaw:180", - "Yaw:225", - "Yaw:270", - "Yaw:315", - "Roll:180", - "Roll:180 Yaw:45", - "Roll:180 Yaw:90", - "Roll:180 Yaw:135", - "Pitch:180", - "Roll:180 Yaw:225", - "Roll:180 Yaw:270", - "Roll:180 Yaw:315", - "Roll:90", - "Roll:90 Yaw:45", - "Roll:90 Yaw:90", - "Roll:90 Yaw:135", - "Roll:270", - "Roll:270 Yaw:45", - "Roll:270 Yaw:90", - "Roll:270 Yaw:135", - "Pitch:90", - "Pitch:270", - "Pitch:180", - "Pitch:180 Yaw:90", - "Pitch:180 Yaw:270", - "Roll:90 Pitch:90", - "Roll:180 Pitch:90", - "Roll:270 Pitch:90", - "Roll:90 Pitch:180", - "Roll:270 Pitch:180", - "Roll:90 Pitch:270", - "Roll:180 Pitch:270", - "Roll:270 Pitch:270", - "Roll:90 Pitch:180 Yaw:90", - "Roll:90 Yaw:270" - }; - static const size_t cOrientationValues = sizeof(orientationValues)/sizeof(orientationValues[0]); - - for (size_t i=0; igetParameterValue(_paramMgr->getDefaultComponentId(), orientationParams[i], value)) { - int index = value.toInt(); - if (index < 0 || index >= (int)cOrientationValues) { - state = "Setup required"; - } else { - state = orientationValues[index]; - } - } else { - // Why is the parameter missing? - Q_ASSERT(false); - state = "Unknown"; - } - - VehicleComponentSummaryItem* item = new VehicleComponentSummaryItem(name, state, this); - _summaryItems.append(QVariant::fromValue(item)); - } - } - - return _summaryItems; + return QUrl::fromUserInput("qrc:/qml/SensorsComponentSummary.qml"); } diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.h b/src/AutoPilotPlugins/PX4/SensorsComponent.h index 7872f45b3..5fae18b00 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.h +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.h @@ -49,7 +49,7 @@ public: virtual QString setupStateDescription(void) const; virtual QWidget* setupWidget(void) const; virtual QStringList paramFilterList(void) const; - virtual const QVariantList& summaryItems(void); + virtual QUrl summaryQmlSource(void) const; private: const QString _name; diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml b/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml new file mode 100644 index 000000000..be7b52d23 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml @@ -0,0 +1,54 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 + +Column { + anchors.fill: parent + anchors.margins: 8 + + Row { + width: parent.width + + Text { id: compass; text: "Compass:" } + Text { + horizontalAlignment: Text.AlignRight; + width: parent.width - compass.contentWidth; + text: autopilot.parameters["SENS_MAG_XOFF"].value == 0.0 ? "Setup required" : "Ready" + } + } + + Row { + width: parent.width + + Text { id: gyro; text: "Gyro:" } + Text { + horizontalAlignment: Text.AlignRight; + width: parent.width - gyro.contentWidth; + text: autopilot.parameters["SENS_GYRO_XOFF"].value == 0.0 ? "Setup required" : "Ready" + } + } + + Row { + width: parent.width + + Text { id: accel; text: "Accelerometer:" } + Text { + horizontalAlignment: Text.AlignRight; + width: parent.width - accel.contentWidth; + text: autopilot.parameters["SENS_ACC_XOFF"].value == 0.0 ? "Setup required" : "Ready" + } + } + + Row { + width: parent.width + + Text { id: airspeed; text: "Airspeed:" } + Text { + horizontalAlignment: Text.AlignRight; + width: parent.width - airspeed.contentWidth; + text: autopilot.parameters["SENS_DPRES_OFF"].value == 0.0 ? "Setup required" : "Ready" + } + } +} diff --git a/src/VehicleSetup/SetupViewConnected.qml b/src/VehicleSetup/SetupViewConnected.qml index 46226eda2..b0857fd14 100644 --- a/src/VehicleSetup/SetupViewConnected.qml +++ b/src/VehicleSetup/SetupViewConnected.qml @@ -27,7 +27,7 @@ Rectangle { 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 Summary" } + Text { id: titleText; anchors.centerIn: parent; font.pointSize: 24; text: "Vehicle Setup" } } Flow { @@ -42,7 +42,7 @@ Rectangle { width: 250 height: 200 - property var summaryModel: modelData.summaryItems + property var summaryQmlSource: modelData.summaryQmlSource text: modelData.name property bool setupComplete: modelData.setupComplete @@ -100,15 +100,9 @@ Rectangle { GradientStop { position: 1; color: "#000000" } } - ListView { - id: summaryList + Loader { anchors.fill: parent - anchors.margins: 4 - model: control.summaryModel - delegate: Row { width: parent.width - Text { id: firstCol; text: modelData.name } - Text { horizontalAlignment: Text.AlignRight; width: parent.width - firstCol.contentWidth; text: modelData.state } - } + source: summaryQmlSource } } } diff --git a/src/VehicleSetup/SetupViewDisconnected.qml b/src/VehicleSetup/SetupViewDisconnected.qml index f2d1926a5..37e0a35cb 100644 --- a/src/VehicleSetup/SetupViewDisconnected.qml +++ b/src/VehicleSetup/SetupViewDisconnected.qml @@ -14,7 +14,7 @@ Rectangle { 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 Summary" } + Text { id: titleText; anchors.centerIn: parent; font.pointSize: 24; text: "Vehicle Setup" } } Text { width: parent.width; height: parent.height - header.height - footer.height; @@ -22,7 +22,7 @@ Rectangle { color: palette.windowText horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - text: "No vehicle currently connected. Vehicle Setup is only available while vehicle is connected." } + 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; diff --git a/src/VehicleSetup/VehicleComponent.h b/src/VehicleSetup/VehicleComponent.h index 4c603b4d8..3dddff787 100644 --- a/src/VehicleSetup/VehicleComponent.h +++ b/src/VehicleSetup/VehicleComponent.h @@ -49,7 +49,7 @@ class VehicleComponent : public QObject Q_PROPERTY(QString setupStateDescription READ setupStateDescription STORED false) Q_PROPERTY(QString icon READ icon CONSTANT) Q_PROPERTY(QWidget* setupWidget READ setupWidget STORED false) - Q_PROPERTY(QVariantList summaryItems READ summaryItems CONSTANT); + Q_PROPERTY(QUrl summaryQmlSource READ summaryQmlSource CONSTANT); public: VehicleComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL); @@ -63,7 +63,7 @@ public: virtual QString setupStateDescription(void) const = 0; virtual QWidget* setupWidget(void) const = 0; virtual QStringList paramFilterList(void) const = 0; - virtual const QVariantList& summaryItems(void) = 0; + virtual QUrl summaryQmlSource(void) const = 0; virtual void addSummaryQmlComponent(QQmlContext* context, QQuickItem* parent); -- 2.22.0