Commit 176c2fa0 authored by Jacob Walser's avatar Jacob Walser

Add frame parameter defaults option for Sub

parent da5d69d6
...@@ -40,14 +40,17 @@ APMAirframeComponentController::APMAirframeComponentController(void) : ...@@ -40,14 +40,17 @@ APMAirframeComponentController::APMAirframeComponentController(void) :
} }
_fillAirFrames(); _fillAirFrames();
Fact* frame; Fact* frame = NULL;
if (parameterExists(FactSystem::defaultComponentId, _oldFrameParam)) { if (parameterExists(FactSystem::defaultComponentId, _oldFrameParam)) {
frame = getParameterFact(FactSystem::defaultComponentId, _oldFrameParam); frame = getParameterFact(FactSystem::defaultComponentId, _oldFrameParam);
} else { } else if (parameterExists(FactSystem::defaultComponentId, _newFrameParam)){
frame = getParameterFact(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() APMAirframeComponentController::~APMAirframeComponentController()
......
...@@ -10,16 +10,26 @@ ...@@ -10,16 +10,26 @@
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QGroundControl.FactSystem 1.0 import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0 import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0 import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
SetupPage { SetupPage {
id: subFramePage id: subFramePage
pageComponent: subFramePageComponent pageComponent: subFramePageComponent
property var _flatParamList: ListModel {
ListElement {
name: "Blue Robotics BlueROV2"
file: "Sub/bluerov2-3_5.params"
}
}
APMAirframeComponentController { id: controller; factPanel: subFramePage.viewPanel }
Component { Component {
id: subFramePageComponent id: subFramePageComponent
...@@ -28,8 +38,6 @@ SetupPage { ...@@ -28,8 +38,6 @@ SetupPage {
id: mainColumn id: mainColumn
width: availableWidth width: availableWidth
FactPanelController { id: controller; factPanel: subFramePage.viewPanel }
QGCPalette { id: palette; colorGroupEnabled: true } QGCPalette { id: palette; colorGroupEnabled: true }
property Fact _frameConfig: controller.getParameterFact(-1, "FRAME_CONFIG") property Fact _frameConfig: controller.getParameterFact(-1, "FRAME_CONFIG")
...@@ -100,6 +108,19 @@ SetupPage { ...@@ -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 { Flow {
id: flowView id: flowView
width: parent.width width: parent.width
...@@ -148,4 +169,47 @@ SetupPage { ...@@ -148,4 +169,47 @@ SetupPage {
}// Flow }// Flow
} // Column } // Column
} // Component } // 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 } // 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