Commit 8bc1336d authored by Don Gagne's avatar Don Gagne

Convert setup pages to use SetupPage

parent 76013297
......@@ -45,10 +45,10 @@ public:
Q_PROPERTY(int minChannelCount MEMBER _chanMinimum CONSTANT)
Q_PROPERTY(int channelCount READ channelCount NOTIFY channelCountChanged)
Q_PROPERTY(QQuickItem* statusText MEMBER _statusText)
Q_PROPERTY(QQuickItem* cancelButton MEMBER _cancelButton)
Q_PROPERTY(QQuickItem* nextButton MEMBER _nextButton)
Q_PROPERTY(QQuickItem* skipButton MEMBER _skipButton)
Q_PROPERTY(QQuickItem* statusText MEMBER _statusText NOTIFY statusTextChanged)
Q_PROPERTY(QQuickItem* cancelButton MEMBER _cancelButton NOTIFY cancelButtonChanged)
Q_PROPERTY(QQuickItem* nextButton MEMBER _nextButton NOTIFY nextButtonChanged)
Q_PROPERTY(QQuickItem* skipButton MEMBER _skipButton NOTIFY skipButtonChanged)
Q_PROPERTY(bool rollChannelMapped READ rollChannelMapped NOTIFY rollChannelMappedChanged)
Q_PROPERTY(bool pitchChannelMapped READ pitchChannelMapped NOTIFY pitchChannelMappedChanged)
......@@ -103,6 +103,11 @@ public:
void setTransmitterMode(int mode);
signals:
void statusTextChanged(void);
void cancelButtonChanged(void);
void nextButtonChanged(void);
void skipButtonChanged(void);
void channelCountChanged(int channelCount);
void channelRCValueChanged(int channel, int rcValue);
......
......@@ -24,7 +24,9 @@ QGCView {
id: setupView
viewPanel: setupPanel
property alias pageComponent: pageLoader.sourceComponent
property alias pageComponent: pageLoader.sourceComponent
property real availableWidth: width - pageLoader.x
property real availableHeight: height - pageLoader.y
property real _margins: ScreenTools.defaultFontPixelHeight / 2
......@@ -36,14 +38,13 @@ QGCView {
QGCFlickable {
anchors.fill: parent
contentWidth: pageLoader.item.x + pageLoader.item.width
contentHeight: pageLoader.item.y + pageLoader.item.height
contentWidth: pageLoader.x + pageLoader.item.width
contentHeight: pageLoader.y + pageLoader.item.height
clip: true
Column {
id: headingColumn
anchors.left: parent.left
anchors.right: parent.right
width: setupPanel.width
spacing: _margins
QGCLabel {
......@@ -62,9 +63,10 @@ QGCView {
}
Loader {
id: pageLoader
anchors.topMargin: _margins
anchors.top: headingColumn.bottom
id: pageLoader
}
}
}
......
......@@ -113,7 +113,7 @@ QString AirframeComponent::name(void) const
QString AirframeComponent::description(void) const
{
return tr("The Airframe Component is used to select the airframe which matches your vehicle. "
return tr("Airframe Setup is used to select the airframe which matches your vehicle. "
"This will in turn set up the various tuning values for flight parameters.");
}
......
......@@ -20,140 +20,131 @@ import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: qgcView
viewPanel: panel
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
property real _minW: ScreenTools.defaultFontPixelWidth * 30
property real _boxWidth: _minW
property real _boxSpace: ScreenTools.defaultFontPixelWidth
function computeDimensions() {
var sw = 0
var rw = 0
var idx = Math.floor(scroll.width / (_minW + ScreenTools.defaultFontPixelWidth))
if(idx < 1) {
_boxWidth = scroll.width
_boxSpace = 0
} else {
_boxSpace = 0
if(idx > 1) {
_boxSpace = ScreenTools.defaultFontPixelWidth
sw = _boxSpace * (idx - 1)
}
rw = scroll.width - sw
_boxWidth = rw / idx
}
}
AirframeComponentController {
id: controller
factPanel: panel
Component.onCompleted: {
if (controller.showCustomConfigPanel) {
showDialog(customConfigDialogComponent, qsTr("Custom Airframe Config"), qgcView.showDialogDefaultWidth, StandardButton.Reset)
}
}
}
SetupPage {
id: airframePage
pageComponent: pageComponent
Component {
id: customConfigDialogComponent
id: pageComponent
QGCViewMessage {
id: customConfigDialog
message: qsTr("Your vehicle is using a custom airframe configuration. ") +
qsTr("This configuration can only be modified through the Parameter Editor.\n\n") +
qsTr("If you want to reset your airframe configuration and select a standard configuration, click 'Reset' above.")
Column {
id: mainColumn
width: availableWidth
property Fact sys_autostart: controller.getParameterFact(-1, "SYS_AUTOSTART")
property real _minW: ScreenTools.defaultFontPixelWidth * 30
property real _boxWidth: _minW
property real _boxSpace: ScreenTools.defaultFontPixelWidth
function accept() {
sys_autostart.value = 0
customConfigDialog.hideDialog()
readonly property real spacerHeight: ScreenTools.defaultFontPixelHeight
onWidthChanged: {
computeDimensions()
}
}
}
Component {
id: applyRestartDialogComponent
Component.onCompleted: computeDimensions()
function computeDimensions() {
var sw = 0
var rw = 0
var idx = Math.floor(mainColumn.width / (_minW + ScreenTools.defaultFontPixelWidth))
if(idx < 1) {
_boxWidth = mainColumn.width
_boxSpace = 0
} else {
_boxSpace = 0
if(idx > 1) {
_boxSpace = ScreenTools.defaultFontPixelWidth
sw = _boxSpace * (idx - 1)
}
rw = mainColumn.width - sw
_boxWidth = rw / idx
}
}
QGCViewDialog {
id: applyRestartDialog
AirframeComponentController {
id: controller
factPanel: airframePage.viewPanel
function accept() {
controller.changeAutostart()
applyRestartDialog.hideDialog()
Component.onCompleted: {
if (controller.showCustomConfigPanel) {
showDialog(customConfigDialogComponent, qsTr("Custom Airframe Config"), qgcView.showDialogDefaultWidth, StandardButton.Reset)
}
}
}
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: qsTr("Clicking “Apply” will save the changes you have made to your airframe configuration. ") +
qsTr("Your vehicle will also be restarted in order to complete the process.")
Component {
id: customConfigDialogComponent
QGCViewMessage {
id: customConfigDialog
message: qsTr("Your vehicle is using a custom airframe configuration. ") +
qsTr("This configuration can only be modified through the Parameter Editor.\n\n") +
qsTr("If you want to reset your airframe configuration and select a standard configuration, click 'Reset' above.")
property Fact sys_autostart: controller.getParameterFact(-1, "SYS_AUTOSTART")
function accept() {
sys_autostart.value = 0
customConfigDialog.hideDialog()
}
}
}
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
readonly property real spacerHeight: ScreenTools.defaultFontPixelHeight
Item {
id: helpApplyRow
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: Math.max(helpText.contentHeight, applyButton.height)
QGCLabel {
id: helpText
width: parent.width - applyButton.width - 5
text: (controller.currentVehicleName != "" ?
qsTr("You've connected a %1.").arg(controller.currentVehicleName) :
qsTr("Airframe is not set.")) +
qsTr("To change this configuration, select the desired airframe below then click “Apply and Restart”.")
font.family: ScreenTools.demiboldFontFamily
wrapMode: Text.WordWrap
Component {
id: applyRestartDialogComponent
QGCViewDialog {
id: applyRestartDialog
function accept() {
controller.changeAutostart()
applyRestartDialog.hideDialog()
}
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: qsTr("Clicking “Apply” will save the changes you have made to your airframe configuration. ") +
qsTr("Your vehicle will also be restarted in order to complete the process.")
}
}
}
QGCButton {
id: applyButton
Item {
id: helpApplyRow
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Apply and Restart")
height: Math.max(helpText.contentHeight, applyButton.height)
QGCLabel {
id: helpText
width: parent.width - applyButton.width - 5
text: (controller.currentVehicleName != "" ?
qsTr("You've connected a %1.").arg(controller.currentVehicleName) :
qsTr("Airframe is not set.")) +
qsTr("To change this configuration, select the desired airframe below then click “Apply and Restart”.")
font.family: ScreenTools.demiboldFontFamily
wrapMode: Text.WordWrap
}
QGCButton {
id: applyButton
anchors.right: parent.right
text: qsTr("Apply and Restart")
onClicked: showDialog(applyRestartDialogComponent, qsTr("Apply and Restart"), qgcView.showDialogDefaultWidth, StandardButton.Apply | StandardButton.Cancel)
onClicked: showDialog(applyRestartDialogComponent, qsTr("Apply and Restart"), qgcView.showDialogDefaultWidth, StandardButton.Apply | StandardButton.Cancel)
}
}
}
Item {
id: lastSpacer
anchors.top: helpApplyRow.bottom
height: parent.spacerHeight
width: 10
}
QGCFlickable {
id: scroll
anchors.top: lastSpacer.bottom
anchors.bottom: parent.bottom
width: parent.width
clip: true
contentHeight: flowView.height
contentWidth: parent.width
flickableDirection: Flickable.VerticalFlick
onWidthChanged: {
computeDimensions()
Item {
id: lastSpacer
height: parent.spacerHeight
width: 10
}
Flow {
id: flowView
width: scroll.width
width: parent.width
spacing: _boxSpace
ExclusiveGroup {
......@@ -246,6 +237,6 @@ QGCView {
}
} // Repeater - summary boxes
} // Flow - summary boxes
} // Scroll View - summary boxes
} // QGCViewPanel
} // QGCView
} // Column
} // Component
} // SetupPage
......@@ -29,7 +29,7 @@ QString CameraComponent::name(void) const
QString CameraComponent::description(void) const
{
return tr("The Camera is used to setup the camera modes and hardware configuration to use it.");
return tr("Camera setup is used to adjust camera and gimbal settings.");
}
QString CameraComponent::iconResource(void) const
......
......@@ -33,9 +33,7 @@ QString FlightModesComponent::name(void) const
QString FlightModesComponent::description(void) const
{
// FIXME: Better text
return tr("The Flight Modes Component is used to set the switches associated with Flight Modes. "
"At a minimum the Main Mode Switch must be assigned prior to flight.");
return tr("Flight Modes Setup is used to configure the transmitter switches associated with Flight Modes.");
}
QString FlightModesComponent::iconResource(void) const
......
......@@ -91,8 +91,6 @@ Item {
readonly property real modeSpacing: ScreenTools.defaultFontPixelHeight / 3
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
PX4AdvancedFlightModesController {
id: controller
factPanel: qgcViewPanel
......
......@@ -23,33 +23,31 @@ import QGroundControl.ScreenTools 1.0
/// PX4 Flight Mode configuration. This control will load either the Simple or Advanced Flight Mode config
/// based on current parameter settings.
QGCView {
id: rootQGCView
viewPanel: panel
SetupPage {
id: flightModesPage
pageComponent: pageComponent
property Fact _nullFact
property bool _rcMapFltmodeExists: controller.parameterExists(-1, "RC_MAP_FLTMODE")
property Fact _rcMapFltmode: _rcMapFltmodeExists ? controller.getParameterFact(-1, "RC_MAP_FLTMODE") : _nullFact
property Fact _rcMapModeSw: controller.getParameterFact(-1, "RC_MAP_MODE_SW")
property bool _simpleMode: _rcMapFltmodeExists ? _rcMapFltmode.value > 0 || _rcMapModeSw.value == 0 : false
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
FactPanelController {
id: controller
factPanel: panel
}
QGCViewPanel {
id: panel
anchors.fill: parent
Component {
id: pageComponent
Loader {
anchors.fill: parent
source: _simpleMode ? "qrc:/qml/PX4SimpleFlightModes.qml" : "qrc:/qml/PX4AdvancedFlightModes.qml"
property var qgcView: rootQGCView
property var qgcViewPanel: panel
width: availableWidth
height: availableHeight
source: _simpleMode ? "qrc:/qml/PX4SimpleFlightModes.qml" : "qrc:/qml/PX4AdvancedFlightModes.qml"
property Fact _nullFact
property bool _rcMapFltmodeExists: controller.parameterExists(-1, "RC_MAP_FLTMODE")
property Fact _rcMapFltmode: _rcMapFltmodeExists ? controller.getParameterFact(-1, "RC_MAP_FLTMODE") : _nullFact
property Fact _rcMapModeSw: controller.getParameterFact(-1, "RC_MAP_MODE_SW")
property bool _simpleMode: _rcMapFltmodeExists ? _rcMapFltmode.value > 0 || _rcMapModeSw.value == 0 : false
FactPanelController {
id: controller
factPanel: flightModesPage.viewPanel
}
property var qgcView: flightModesPage
property var qgcViewPanel: flightModesPage.viewPanel
}
} // QGCViewPanel
} // QGCView
}
}
......@@ -24,9 +24,8 @@ QString PX4RadioComponent::name(void) const
QString PX4RadioComponent::description(void) const
{
return tr("The Radio Component is used to setup which channels on your RC Transmitter you will use for each vehicle control such as Roll, Pitch, Yaw and Throttle. "
"It also allows you to assign switches and dials to the various flight modes. "
"Prior to flight you must also calibrate the extents for all of your channels.");
return tr("Radio Setup is used to calibrate your transmitter. "
"It also assign channels for Roll, Pitch, Yaw and Throttle vehicle control as well as determining whether they are reversed.");
}
QString PX4RadioComponent::iconResource(void) const
......
......@@ -30,8 +30,6 @@ Item {
readonly property real _flightModeComboWidth: ScreenTools.defaultFontPixelWidth * 13
readonly property real _channelComboWidth: ScreenTools.defaultFontPixelWidth * 13
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
PX4SimpleFlightModesController {
id: controller
factPanel: qgcViewPanel
......
......@@ -25,7 +25,7 @@ QString PX4TuningComponent::name(void) const
QString PX4TuningComponent::description(void) const
{
return tr("The Tuning Component is used to tune the flight characteristics of the Vehicle.");
return tr("Tuning Setup is used to tune the flight characteristics of the Vehicle.");
}
QString PX4TuningComponent::iconResource(void) const
......
......@@ -13,63 +13,72 @@ import QtQuick.Controls 1.4
import QGroundControl.Controls 1.0
FactSliderPanel {
anchors.fill: parent
panelTitle: "Tuning"
SetupPage {
id: tuningPage
pageComponent: pageComponent
sliderModel: ListModel {
ListElement {
title: qsTr("Hover Throttle")
description: qsTr("Adjust throttle so hover is at mid-throttle. Slide to the left if hover is lower than throttle center. Slide to the right if hover is higher than throttle center.")
param: "MPC_THR_HOVER"
min: 20
max: 80
step: 1
}
Component {
id: pageComponent
ListElement {
title: qsTr("Manual minimum throttle")
description: qsTr("Slide to the left to start the motors with less idle power. Slide to the right if descending in manual flight becomes unstable.")
param: "MPC_MANTHR_MIN"
min: 0
max: 15
step: 1
}
FactSliderPanel {
width: availableWidth
qgcViewPanel: tuningPage.viewPanel
ListElement {
title: qsTr("Roll sensitivity")
description: qsTr("Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy.")
param: "MC_ROLL_TC"
min: 0.15
max: 0.25
step: 0.01
}
sliderModel: ListModel {
ListElement {
title: qsTr("Hover Throttle")
description: qsTr("Adjust throttle so hover is at mid-throttle. Slide to the left if hover is lower than throttle center. Slide to the right if hover is higher than throttle center.")
param: "MPC_THR_HOVER"
min: 20
max: 80
step: 1
}
ListElement {
title: qsTr("Pitch sensitivity")
description: qsTr("Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy.")
param: "MC_PITCH_TC"
min: 0.15
max: 0.25
step: 0.01
}
ListElement {
title: qsTr("Manual minimum throttle")
description: qsTr("Slide to the left to start the motors with less idle power. Slide to the right if descending in manual flight becomes unstable.")
param: "MPC_MANTHR_MIN"
min: 0
max: 15
step: 1
}
ListElement {
title: qsTr("Altitude control sensitivity")
description: qsTr("Slide to the left to make altitude control smoother and less twitchy. Slide to the right to make altitude control more accurate and more aggressive.")
param: "MPC_Z_FF"
min: 0
max: 1.0
step: 0.1
}
ListElement {
title: qsTr("Roll sensitivity")
description: qsTr("Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy.")
param: "MC_ROLL_TC"
min: 0.15
max: 0.25
step: 0.01
}
ListElement {
title: qsTr("Pitch sensitivity")
description: qsTr("Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy.")
param: "MC_PITCH_TC"
min: 0.15
max: 0.25
step: 0.01
}
ListElement {
title: qsTr("Altitude control sensitivity")
description: qsTr("Slide to the left to make altitude control smoother and less twitchy. Slide to the right to make altitude control more accurate and more aggressive.")
param: "MPC_Z_FF"
min: 0
max: 1.0
step: 0.1
}
ListElement {
title: qsTr("Position control sensitivity")
description: qsTr("Slide to the left to make flight in position control mode smoother and less twitchy. Slide to the right to make position control more accurate and more aggressive.")
param: "MPC_XY_FF"
min: 0
max: 1.0
step: 0.1
ListElement {
title: qsTr("Position control sensitivity")
description: qsTr("Slide to the left to make flight in position control mode smoother and less twitchy. Slide to the right to make position control more accurate and more aggressive.")
param: "MPC_XY_FF"
min: 0
max: 1.0
step: 0.1
}
}
}
}
}
} // Component
} // SetupPage
......@@ -13,44 +13,54 @@ import QtQuick.Controls 1.4
import QGroundControl.Controls 1.0
FactSliderPanel {
anchors.fill: parent
sliderModel: ListModel {
ListElement {
title: "Roll sensitivity"
description: "Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy."
param: "FW_R_TC"
min: 0.2
max: 0.8
step: 0.01
}
SetupPage {
id: tuningPage
pageComponent: pageComponent
ListElement {
title: "Pitch sensitivity"
description: "Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy."
param: "FW_P_TC"
min: 0.2
max: 0.8
step: 0.01
}
Component {
id: pageComponent
ListElement {
title: "Cruise throttle"
description: "This is the throttle setting required to achieve the desired cruise speed. Most planes need 50-60%."
param: "FW_THR_CRUISE"
min: 20
max: 80
step: 1
}
FactSliderPanel {
width: availableWidth
qgcViewPanel: tuningPage.viewPanel
sliderModel: ListModel {
ListElement {
title: "Roll sensitivity"
description: "Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy."
param: "FW_R_TC"
min: 0.2
max: 0.8
step: 0.01
}
ListElement {
title: "Pitch sensitivity"
description: "Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy."
param: "FW_P_TC"
min: 0.2
max: 0.8
step: 0.01
}
ListElement {
title: "Cruise throttle"
description: "This is the throttle setting required to achieve the desired cruise speed. Most planes need 50-60%."
param: "FW_THR_CRUISE"
min: 20
max: 80
step: 1
}
ListElement {
title: "Mission mode sensitivity"
description: "Slide to the left to make position control more accurate and more aggressive. Slide to the right to make flight in mission mode smoother and less twitchy."
param: "FW_L1_PERIOD"
min: 12
max: 50
step: 0.5
ListElement {
title: "Mission mode sensitivity"
description: "Slide to the left to make position control more accurate and more aggressive. Slide to the right to make flight in mission mode smoother and less twitchy."
param: "FW_L1_PERIOD"
min: 12
max: 50
step: 0.5
}
}
}
}
}
......@@ -13,98 +13,108 @@ import QtQuick.Controls 1.4
import QGroundControl.Controls 1.0
FactSliderPanel {
anchors.fill: parent
sliderModel: ListModel {
ListElement {
title: qsTr("Hover Roll sensitivity")
description: qsTr("Slide to the left to make roll control during hover faster and more accurate. Slide to the right if roll oscillates or is too twitchy.")
param: "MC_ROLL_TC"
min: 0.15
max: 0.25
step: 0.01
}
SetupPage {
id: tuningPage
pageComponent: pageComponent
ListElement {
title: qsTr("Hover Pitch sensitivity")
description: qsTr("Slide to the left to make pitch control during hover faster and more accurate. Slide to the right if pitch oscillates or is too twitchy.")