diff --git a/src/VehicleSetup/SetupView.cc b/src/VehicleSetup/SetupView.cc index fa83988112314333286abf4c6585fdabc149262b..a744f4893eef3d75f596563708a465ec28f81af9 100644 --- a/src/VehicleSetup/SetupView.cc +++ b/src/VehicleSetup/SetupView.cc @@ -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 diff --git a/src/VehicleSetup/SetupView.h b/src/VehicleSetup/SetupView.h index dcca47bedacc4fc5d5ac8b629d2f666b16fe9ffe..c8566251c48e269f0cb35ccff9b687662cbd7a44 100644 --- a/src/VehicleSetup/SetupView.h +++ b/src/VehicleSetup/SetupView.h @@ -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); diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index 3dd60eadb4d0bc25570d09bc09a7d130efa3b76d..5eb099515734e0ea9b187afc387f61d869db2721 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -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) } } diff --git a/src/VehicleSetup/SetupViewTest.cc b/src/VehicleSetup/SetupViewTest.cc index 72449715e03856b7c77650f9199ef6aa216f6054..eedcf433cae2566c786bc4d1f6d50a566c78c380 100644 --- a/src/VehicleSetup/SetupViewTest.cc +++ b/src/VehicleSetup/SetupViewTest.cc @@ -106,7 +106,8 @@ void SetupViewTest::_clickThrough_test(void) foreach(QVariant varComponent, components) { VehicleComponent* component = qobject_cast(qvariant_cast(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