Commit 64095e38 authored by Don Gagne's avatar Don Gagne

Add setup pre-req check

parent 29efb185
...@@ -127,14 +127,13 @@ void SetupView::showSummary(void) ...@@ -127,14 +127,13 @@ void SetupView::showSummary(void)
Q_ASSERT(success); Q_ASSERT(success);
} }
void SetupView::showVehicleComponentSetup(const QUrl& url) void SetupView::showVehicleComponentSetup(VehicleComponent* vehicleComponent)
{ {
QVariant returnedValue; QVariant returnedValue;
QVariant varSource = url;
bool success = QMetaObject::invokeMethod(getRootObject(), bool success = QMetaObject::invokeMethod(getRootObject(),
"showVehicleComponentPanel", "showVehicleComponentPanel",
Q_RETURN_ARG(QVariant, returnedValue), Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, varSource)); Q_ARG(QVariant, QVariant::fromValue((VehicleComponent*)vehicleComponent)));
Q_ASSERT(success); Q_ASSERT(success);
} }
#endif #endif
......
...@@ -50,7 +50,7 @@ public: ...@@ -50,7 +50,7 @@ public:
void showFirmware(void); void showFirmware(void);
void showParameters(void); void showParameters(void);
void showSummary(void); void showSummary(void);
void showVehicleComponentSetup(const QUrl& url); void showVehicleComponentSetup(VehicleComponent* vehicleComponent);
#endif #endif
AutoPilotPlugin* autopilot(void); AutoPilotPlugin* autopilot(void);
......
...@@ -76,13 +76,18 @@ Rectangle { ...@@ -76,13 +76,18 @@ Rectangle {
panelLoader.source = "SetupParameterEditor.qml"; panelLoader.source = "SetupParameterEditor.qml";
} }
function showVehicleComponentPanel(setupSource) function showVehicleComponentPanel(vehicleComponent)
{ {
if (controller.autopilot.armed) { if (controller.autopilot.armed) {
messagePanelText = armedVehicleText messagePanelText = armedVehicleText
panelLoader.sourceComponent = messagePanelComponent panelLoader.sourceComponent = messagePanelComponent
} else { } else {
panelLoader.source = setupSource if (vehicleComponent.prerequisiteSetup != "") {
messagePanelText = vehicleComponent.prerequisiteSetup + " setup must be completed prior to " + vehicleComponent.name + " setup."
panelLoader.sourceComponent = messagePanelComponent
} else {
panelLoader.source = vehicleComponent.setupSource
}
} }
} }
...@@ -126,9 +131,13 @@ Rectangle { ...@@ -126,9 +131,13 @@ Rectangle {
Item { Item {
QGCLabel { QGCLabel {
anchors.fill: parent anchors.margins: defaultTextWidth * 2
wrapMode: Text.WordWrap anchors.fill: parent
text: messagePanelText verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
font.pointSize: ScreenTools.mediumFontPointSize
text: messagePanelText
} }
} }
} }
...@@ -170,7 +179,7 @@ Rectangle { ...@@ -170,7 +179,7 @@ Rectangle {
exclusiveGroup: setupButtonGroup exclusiveGroup: setupButtonGroup
text: modelData.name.toUpperCase() text: modelData.name.toUpperCase()
onClicked: showVehicleComponentPanel(modelData.setupSource) onClicked: showVehicleComponentPanel(modelData)
} }
} }
......
...@@ -106,7 +106,8 @@ void SetupViewTest::_clickThrough_test(void) ...@@ -106,7 +106,8 @@ void SetupViewTest::_clickThrough_test(void)
foreach(QVariant varComponent, components) { foreach(QVariant varComponent, components) {
VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(varComponent)); VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(varComponent));
qDebug() << "Showing" << component->name(); qDebug() << "Showing" << component->name();
setupView->showVehicleComponentSetup(component->setupSource()); setupView->showVehicleComponentSetup(component);
QTest::qWait(1000);
} }
// On MainWindow close we should get a message box telling the user to disconnect first. Disconnect will then pop // On MainWindow close we should get a message box telling the user to disconnect first. Disconnect will then pop
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment