Commit 93989274 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #5219 from jaxxzer/brov2-param-download

Add frame parameter defaults option for Sub
parents 64ead8f0 176c2fa0
......@@ -40,14 +40,17 @@ APMAirframeComponentController::APMAirframeComponentController(void) :
}
_fillAirFrames();
Fact* frame;
Fact* frame = NULL;
if (parameterExists(FactSystem::defaultComponentId, _oldFrameParam)) {
frame = getParameterFact(FactSystem::defaultComponentId, _oldFrameParam);
} else {
} else if (parameterExists(FactSystem::defaultComponentId, _newFrameParam)){
frame = getParameterFact(FactSystem::defaultComponentId, _newFrameParam);
}
connect(frame, &Fact::rawValueChanged, this, &APMAirframeComponentController::_factFrameChanged);
_factFrameChanged(frame->rawValue());
if (frame) {
connect(frame, &Fact::rawValueChanged, this, &APMAirframeComponentController::_factFrameChanged);
_factFrameChanged(frame->rawValue());
}
}
APMAirframeComponentController::~APMAirframeComponentController()
......
......@@ -10,16 +10,26 @@
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
SetupPage {
id: subFramePage
pageComponent: subFramePageComponent
property var _flatParamList: ListModel {
ListElement {
name: "Blue Robotics BlueROV2"
file: "Sub/bluerov2-3_5.params"
}
}
APMAirframeComponentController { id: controller; factPanel: subFramePage.viewPanel }
Component {
id: subFramePageComponent
......@@ -28,8 +38,6 @@ SetupPage {
id: mainColumn
width: availableWidth
FactPanelController { id: controller; factPanel: subFramePage.viewPanel }
QGCPalette { id: palette; colorGroupEnabled: true }
property Fact _frameConfig: controller.getParameterFact(-1, "FRAME_CONFIG")
......@@ -100,6 +108,19 @@ SetupPage {
}
}
Item {
anchors.left: parent.left
anchors.right: parent.right
height: defaultsButton.height
QGCButton {
id: defaultsButton
anchors.left: parent.left
text: qsTr("Load Vehicle Default Parameters")
onClicked: showDialog(selectParamFileDialogComponent, qsTr("Load Vehicle Default Parameters"), qgcView.showDialogDefaultWidth, StandardButton.Close)
}
}
Flow {
id: flowView
width: parent.width
......@@ -148,4 +169,47 @@ SetupPage {
}// Flow
} // Column
} // Component
Component {
id: selectParamFileDialogComponent
QGCViewDialog {
QGCLabel {
id: applyParamsText
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: _margins
wrapMode: Text.WordWrap
text: qsTr("Select your vehicle to load the default parameters:")
}
Flow {
anchors.margins: _margins
anchors.top: applyParamsText.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing : _margins
layoutDirection: Qt.Vertical;
Repeater {
id: airframePicker
model: _flatParamList
delegate: QGCButton {
width: parent.width / 2.1
height: (ScreenTools.defaultFontPixelHeight * 14) / 5
text: name
onClicked : {
controller.loadParameters(file)
hideDialog()
}
}
}
}
}
}
} // SetupPage
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