Commit 64934b4b authored by Don Gagne's avatar Don Gagne

Merge pull request #2872 from DonLakeFlyer/SideDialog

Restructure side dialog ui to flow from top to bottom
parents 36d57743 7d72fc20
...@@ -44,6 +44,8 @@ QGCViewDialog { ...@@ -44,6 +44,8 @@ QGCViewDialog {
ParameterEditorController { id: controller; factPanel: parent } ParameterEditorController { id: controller; factPanel: parent }
QGCPalette { id: qgcPal; colorGroupEnabled: true }
function accept() { function accept() {
if (factCombo.visible) { if (factCombo.visible) {
fact.enumIndex = factCombo.currentIndex fact.enumIndex = factCombo.currentIndex
...@@ -69,126 +71,155 @@ QGCViewDialog { ...@@ -69,126 +71,155 @@ QGCViewDialog {
//valueField.forceActiveFocus() //valueField.forceActiveFocus()
} }
Column { QGCFlickable {
spacing: defaultTextHeight anchors.fill: parent
anchors.left: parent.left contentHeight: _column.y + _column.height
anchors.right: parent.right flickableDirection: Flickable.VerticalFlick
Column {
id: _column
spacing: defaultTextHeight
anchors.left: parent.left
anchors.right: parent.right
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: fact.shortDescription ? fact.shortDescription : "Description missing"
}
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: fact.shortDescription ? fact.shortDescription : "Description missing" visible: fact.longDescription
} text: fact.longDescription
}
QGCLabel { Row {
width: parent.width spacing: defaultTextWidth
wrapMode: Text.WordWrap
visible: fact.longDescription
text: fact.longDescription
}
QGCTextField { QGCTextField {
id: valueField id: valueField
text: validate ? validateValue : fact.valueString text: validate ? validateValue : fact.valueString
visible: fact.enumStrings.length == 0 || validate visible: fact.enumStrings.length == 0 || validate
//focus: true //focus: true
// At this point all Facts are numeric // At this point all Facts are numeric
inputMethodHints: Qt.ImhFormattedNumbersOnly inputMethodHints: Qt.ImhFormattedNumbersOnly
} }
QGCButton {
anchors.baseline: valueField.baseline
visible: fact.defaultValueAvailable
text: "Reset to default"
onClicked: {
fact.value = fact.defaultValue
fact.valueChanged(fact.value)
hideDialog()
}
}
}
QGCComboBox { QGCComboBox {
id: factCombo id: factCombo
width: valueField.width width: valueField.width
visible: _showCombo visible: _showCombo
model: fact.enumStrings model: fact.enumStrings
property bool _showCombo: fact.enumStrings.length != 0 && !validate property bool _showCombo: fact.enumStrings.length != 0 && !validate
Component.onCompleted: { Component.onCompleted: {
// We can't bind directly to fact.enumIndex since that would add an unknown value // We can't bind directly to fact.enumIndex since that would add an unknown value
// if there are no enum strings. // if there are no enum strings.
if (_showCombo) { if (_showCombo) {
currentIndex = fact.enumIndex currentIndex = fact.enumIndex
}
} }
} }
}
QGCLabel { text: fact.name } QGCLabel { text: fact.name }
Row { Row {
spacing: defaultTextWidth spacing: defaultTextWidth
QGCLabel { text: "Units:" } QGCLabel { text: "Units:" }
QGCLabel { text: fact.units ? fact.units : "none" } QGCLabel { text: fact.units ? fact.units : "none" }
} }
Row { Row {
spacing: defaultTextWidth spacing: defaultTextWidth
visible: !fact.minIsDefaultForType visible: !fact.minIsDefaultForType
QGCLabel { text: "Minimum value:" } QGCLabel { text: "Minimum value:" }
QGCLabel { text: fact.minString } QGCLabel { text: fact.minString }
} }
Row { Row {
spacing: defaultTextWidth spacing: defaultTextWidth
visible: !fact.maxIsDefaultForType visible: !fact.maxIsDefaultForType
QGCLabel { text: "Maximum value:" } QGCLabel { text: "Maximum value:" }
QGCLabel { text: fact.maxString } QGCLabel { text: fact.maxString }
} }
Row { Row {
spacing: defaultTextWidth spacing: defaultTextWidth
QGCLabel { text: "Default value:" } QGCLabel { text: "Default value:" }
QGCLabel { text: fact.defaultValueAvailable ? fact.defaultValueString : "none" } QGCLabel { text: fact.defaultValueAvailable ? fact.defaultValueString : "none" }
} }
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: "Warning: Modifying parameters while vehicle is in flight can lead to vehicle instability and possible vehicle loss. " + text: "Warning: Modifying parameters while vehicle is in flight can lead to vehicle instability and possible vehicle loss. " +
"Make sure you know what you are doing and double-check your values before Save!" "Make sure you know what you are doing and double-check your values before Save!"
} }
QGCLabel { QGCLabel {
id: validationError id: validationError
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: "yellow" color: "yellow"
} }
QGCCheckBox { QGCCheckBox {
id: forceSave id: forceSave
visible: false visible: false
text: "Force save (dangerous!)" text: "Force save (dangerous!)"
} }
} // Column - Fact information
Row {
width: parent.width
spacing: ScreenTools.defaultFontPixelWidth / 2
visible: showRCToParam
QGCButton { Rectangle {
id: bottomButton height: 1
anchors.rightMargin: defaultTextWidth width: ScreenTools.defaultFontPixelWidth * 5
anchors.right: rcButton.left color: qgcPal.text
anchors.bottom: parent.bottom anchors.verticalCenter: _advanced.verticalCenter
visible: fact.defaultValueAvailable }
text: "Reset to default"
onClicked: { QGCCheckBox {
fact.value = fact.defaultValue id: _advanced
fact.valueChanged(fact.value) text: "Advanced settings"
hideDialog() }
}
}
QGCButton { Rectangle {
id: rcButton height: 1
anchors.right: parent.right width: ScreenTools.defaultFontPixelWidth * 5
anchors.bottom: parent.bottom color: qgcPal.text
text: "Set RC to Param..." anchors.verticalCenter: _advanced.verticalCenter
visible: !validate && showRCToParam }
onClicked: controller.setRCToParam(fact.name) }
QGCButton {
text: "Set RC to Param..."
visible: _advanced.checked && !validate && showRCToParam
onClicked: controller.setRCToParam(fact.name)
}
} // Column
} }
} // QGCViewDialog } // QGCViewDialog
...@@ -60,7 +60,7 @@ QGCView { ...@@ -60,7 +60,7 @@ QGCView {
controller.cancel() controller.cancel()
} }
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } QGCPalette { id: qgcPal; colorGroupEnabled: true }
FirmwareUpgradeController { FirmwareUpgradeController {
id: controller id: controller
...@@ -108,9 +108,9 @@ QGCView { ...@@ -108,9 +108,9 @@ QGCView {
statusTextArea.append(highlightPrefix + "Found device" + highlightSuffix + ": " + controller.boardType) statusTextArea.append(highlightPrefix + "Found device" + highlightSuffix + ": " + controller.boardType)
if (controller.boardType == "Pixhawk" || controller.boardType == "AeroCore" || controller.boardType == "PX4 Flow" || controller.boardType == "PX4 FMU V1") { if (controller.boardType == "Pixhawk" || controller.boardType == "AeroCore" || controller.boardType == "PX4 Flow" || controller.boardType == "PX4 FMU V1") {
showDialog(pixhawkFirmwareSelectDialog, title, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) showDialog(pixhawkFirmwareSelectDialog, title, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} }
} }
} }
onError: { onError: {
hideDialog() hideDialog()
...@@ -131,7 +131,7 @@ QGCView { ...@@ -131,7 +131,7 @@ QGCView {
QGCViewDialog { QGCViewDialog {
anchors.fill: parent anchors.fill: parent
property bool showFirmwareTypeSelection: advancedMode.checked property bool showFirmwareTypeSelection: _advanced.checked
property bool px4Flow: controller.boardType == "PX4 Flow" property bool px4Flow: controller.boardType == "PX4 Flow"
function accept() { function accept() {
...@@ -176,7 +176,7 @@ QGCView { ...@@ -176,7 +176,7 @@ QGCView {
ListElement { ListElement {
text: "Custom firmware file..."; text: "Custom firmware file...";
firmwareType: FirmwareUpgradeController.CustomFirmware firmwareType: FirmwareUpgradeController.CustomFirmware
} }
} }
ListModel { ListModel {
...@@ -189,7 +189,7 @@ QGCView { ...@@ -189,7 +189,7 @@ QGCView {
ListElement { ListElement {
text: "Custom firmware file..."; text: "Custom firmware file...";
firmwareType: FirmwareUpgradeController.CustomFirmware firmwareType: FirmwareUpgradeController.CustomFirmware
} }
} }
Column { Column {
...@@ -232,6 +232,44 @@ QGCView { ...@@ -232,6 +232,44 @@ QGCView {
onClicked: parent.firmwareVersionChanged(firmwareTypeList) onClicked: parent.firmwareVersionChanged(firmwareTypeList)
} }
QGCComboBox {
id: vehicleTypeSelectionCombo
width: 200
visible: apmFlightStack.checked
model: controller.apmAvailableVersions
}
Row {
width: parent.width
spacing: ScreenTools.defaultFontPixelWidth / 2
visible: !px4Flow
Rectangle {
height: 1
width: ScreenTools.defaultFontPixelWidth * 5
color: qgcPal.text
anchors.verticalCenter: _advanced.verticalCenter
}
QGCCheckBox {
id: _advanced
text: "Advanced settings"
checked: px4Flow ? true : false
onClicked: {
firmwareVersionCombo.currentIndex = 0
firmwareVersionWarningLabel.visible = false
}
}
Rectangle {
height: 1
width: ScreenTools.defaultFontPixelWidth * 5
color: qgcPal.text
anchors.verticalCenter: _advanced.verticalCenter
}
}
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
...@@ -239,43 +277,33 @@ QGCView { ...@@ -239,43 +277,33 @@ QGCView {
text: px4Flow ? "Select which version of the firmware you would like to install:" : "Select which version of the above flight stack you would like to install:" text: px4Flow ? "Select which version of the firmware you would like to install:" : "Select which version of the above flight stack you would like to install:"
} }
Row { QGCComboBox {
spacing: 10 id: firmwareVersionCombo
QGCComboBox { width: 200
id: firmwareVersionCombo visible: showFirmwareTypeSelection
width: 200 model: px4Flow ? px4FlowTypeList : firmwareTypeList
visible: showFirmwareTypeSelection currentIndex: controller.selectedFirmwareType
model: px4Flow ? px4FlowTypeList : firmwareTypeList
currentIndex: controller.selectedFirmwareType onActivated: {
controller.selectedFirmwareType = index
onActivated: { if (model.get(index).firmwareType == FirmwareUpgradeController.BetaFirmware) {
controller.selectedFirmwareType = index firmwareVersionWarningLabel.visible = true
if (model.get(index).firmwareType == FirmwareUpgradeController.BetaFirmware) { firmwareVersionWarningLabel.text = "WARNING: BETA FIRMWARE. " +
firmwareVersionWarningLabel.visible = true "This firmware version is ONLY intended for beta testers. " +
firmwareVersionWarningLabel.text = "WARNING: BETA FIRMWARE. " + "Although it has received FLIGHT TESTING, it represents actively changed code. " +
"This firmware version is ONLY intended for beta testers. " + "Do NOT use for normal operation."
"Although it has received FLIGHT TESTING, it represents actively changed code. " + } else if (model.get(index).firmwareType == FirmwareUpgradeController.DeveloperFirmware) {
"Do NOT use for normal operation." firmwareVersionWarningLabel.visible = true
} else if (model.get(index).firmwareType == FirmwareUpgradeController.DeveloperFirmware) { firmwareVersionWarningLabel.text = "WARNING: CONTINUOUS BUILD FIRMWARE. " +
firmwareVersionWarningLabel.visible = true "This firmware has NOT BEEN FLIGHT TESTED. " +
firmwareVersionWarningLabel.text = "WARNING: CONTINUOUS BUILD FIRMWARE. " + "It is only intended for DEVELOPERS. " +
"This firmware has NOT BEEN FLIGHT TESTED. " + "Run bench tests without props first. " +
"It is only intended for DEVELOPERS. " + "Do NOT fly this without additonal safety precautions. " +
"Run bench tests without props first. " + "Follow the mailing list actively when using it."
"Do NOT fly this without additonal safety precautions. " + } else {
"Follow the mailing list actively when using it." firmwareVersionWarningLabel.visible = false
} else {
firmwareVersionWarningLabel.visible = false
}
} }
} }
QGCComboBox {
id: vehicleTypeSelectionCombo
width: 200
visible: apmFlightStack.checked
model: controller.apmAvailableVersions
}
} }
QGCLabel { QGCLabel {
...@@ -284,29 +312,7 @@ QGCView { ...@@ -284,29 +312,7 @@ QGCView {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
visible: false visible: false
} }
} } // Column
QGCCheckBox {
id: advancedMode
anchors.bottom: parent.bottom
text: "Advanced mode"
checked: px4Flow ? true : false
visible: !px4Flow
onClicked: {
firmwareVersionCombo.currentIndex = 0
firmwareVersionWarningLabel.visible = false
}
}
QGCButton {
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
anchors.left: advancedMode.right
anchors.bottom: parent.bottom
text: "Help me pick a flight stack"
onClicked: Qt.openUrlExternally("http://pixhawk.org/choice")
visible: !px4Flow
}
} // QGCViewDialog } // QGCViewDialog
} // Component - pixhawkFirmwareSelectDialog } // Component - pixhawkFirmwareSelectDialog
......
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