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)
Q_ASSERT(success);
}
void SetupView::showVehicleComponentSetup(const QUrl& url)
void SetupView::showVehicleComponentSetup(VehicleComponent* vehicleComponent)
{
QVariant returnedValue;
QVariant varSource = url;
bool success = QMetaObject::invokeMethod(getRootObject(),
"showVehicleComponentPanel",
Q_RETURN_ARG(QVariant, returnedValue),
Q_ARG(QVariant, varSource));
Q_ARG(QVariant, QVariant::fromValue((VehicleComponent*)vehicleComponent)));
Q_ASSERT(success);
}
#endif
......
......@@ -50,7 +50,7 @@ public:
void showFirmware(void);
void showParameters(void);
void showSummary(void);
void showVehicleComponentSetup(const QUrl& url);
void showVehicleComponentSetup(VehicleComponent* vehicleComponent);
#endif
AutoPilotPlugin* autopilot(void);
......
......@@ -76,13 +76,18 @@ Rectangle {
panelLoader.source = "SetupParameterEditor.qml";
}
function showVehicleComponentPanel(setupSource)
function showVehicleComponentPanel(vehicleComponent)
{
if (controller.autopilot.armed) {
messagePanelText = armedVehicleText
panelLoader.sourceComponent = messagePanelComponent
} 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 {
Item {
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: messagePanelText
anchors.margins: defaultTextWidth * 2
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
font.pointSize: ScreenTools.mediumFontPointSize
text: messagePanelText
}
}
}
......@@ -170,7 +179,7 @@ Rectangle {
exclusiveGroup: setupButtonGroup
text: modelData.name.toUpperCase()
onClicked: showVehicleComponentPanel(modelData.setupSource)
onClicked: showVehicleComponentPanel(modelData)
}
}
......
......@@ -106,7 +106,8 @@ void SetupViewTest::_clickThrough_test(void)
foreach(QVariant varComponent, components) {
VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(varComponent));
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
......
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