diff --git a/src/QmlControls/ParameterEditorDialog.qml b/src/QmlControls/ParameterEditorDialog.qml index d4d0775cf342fbd8e9a763848458dd173b0bb416..7a0bb3b104f28960f8d95b6d79c786a715d79da5 100644 --- a/src/QmlControls/ParameterEditorDialog.qml +++ b/src/QmlControls/ParameterEditorDialog.qml @@ -44,6 +44,8 @@ QGCViewDialog { ParameterEditorController { id: controller; factPanel: parent } + QGCPalette { id: qgcPal; colorGroupEnabled: true } + function accept() { if (factCombo.visible) { fact.enumIndex = factCombo.currentIndex @@ -69,126 +71,155 @@ QGCViewDialog { //valueField.forceActiveFocus() } - Column { - spacing: defaultTextHeight - anchors.left: parent.left - anchors.right: parent.right + QGCFlickable { + anchors.fill: parent + contentHeight: _column.y + _column.height + 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 { - width: parent.width - wrapMode: Text.WordWrap - text: fact.shortDescription ? fact.shortDescription : "Description missing" - } + QGCLabel { + width: parent.width + wrapMode: Text.WordWrap + visible: fact.longDescription + text: fact.longDescription + } - QGCLabel { - width: parent.width - wrapMode: Text.WordWrap - visible: fact.longDescription - text: fact.longDescription - } + Row { + spacing: defaultTextWidth - QGCTextField { - id: valueField - text: validate ? validateValue : fact.valueString - visible: fact.enumStrings.length == 0 || validate - //focus: true + QGCTextField { + id: valueField + text: validate ? validateValue : fact.valueString + visible: fact.enumStrings.length == 0 || validate + //focus: true - // At this point all Facts are numeric - inputMethodHints: Qt.ImhFormattedNumbersOnly - } + // At this point all Facts are numeric + 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 { - id: factCombo - width: valueField.width - visible: _showCombo - model: fact.enumStrings + QGCComboBox { + id: factCombo + width: valueField.width + visible: _showCombo + model: fact.enumStrings - property bool _showCombo: fact.enumStrings.length != 0 && !validate + property bool _showCombo: fact.enumStrings.length != 0 && !validate - Component.onCompleted: { - // We can't bind directly to fact.enumIndex since that would add an unknown value - // if there are no enum strings. - if (_showCombo) { - currentIndex = fact.enumIndex + Component.onCompleted: { + // We can't bind directly to fact.enumIndex since that would add an unknown value + // if there are no enum strings. + if (_showCombo) { + currentIndex = fact.enumIndex + } } } - } - QGCLabel { text: fact.name } + QGCLabel { text: fact.name } - Row { - spacing: defaultTextWidth + Row { + spacing: defaultTextWidth - QGCLabel { text: "Units:" } - QGCLabel { text: fact.units ? fact.units : "none" } - } + QGCLabel { text: "Units:" } + QGCLabel { text: fact.units ? fact.units : "none" } + } - Row { - spacing: defaultTextWidth - visible: !fact.minIsDefaultForType + Row { + spacing: defaultTextWidth + visible: !fact.minIsDefaultForType - QGCLabel { text: "Minimum value:" } - QGCLabel { text: fact.minString } - } + QGCLabel { text: "Minimum value:" } + QGCLabel { text: fact.minString } + } - Row { - spacing: defaultTextWidth - visible: !fact.maxIsDefaultForType + Row { + spacing: defaultTextWidth + visible: !fact.maxIsDefaultForType - QGCLabel { text: "Maximum value:" } - QGCLabel { text: fact.maxString } - } + QGCLabel { text: "Maximum value:" } + QGCLabel { text: fact.maxString } + } - Row { - spacing: defaultTextWidth + Row { + spacing: defaultTextWidth - QGCLabel { text: "Default value:" } - QGCLabel { text: fact.defaultValueAvailable ? fact.defaultValueString : "none" } - } + QGCLabel { text: "Default value:" } + QGCLabel { text: fact.defaultValueAvailable ? fact.defaultValueString : "none" } + } - QGCLabel { - width: parent.width - wrapMode: Text.WordWrap - text: "Warning: Modifying parameters while vehicle is in flight can lead to vehicle instability and possible vehicle loss. " + + QGCLabel { + width: parent.width + wrapMode: Text.WordWrap + 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!" - } + } - QGCLabel { - id: validationError - width: parent.width - wrapMode: Text.WordWrap - color: "yellow" - } + QGCLabel { + id: validationError + width: parent.width + wrapMode: Text.WordWrap + color: "yellow" + } - QGCCheckBox { - id: forceSave - visible: false - text: "Force save (dangerous!)" - } - } // Column - Fact information + QGCCheckBox { + id: forceSave + visible: false + text: "Force save (dangerous!)" + } + Row { + width: parent.width + spacing: ScreenTools.defaultFontPixelWidth / 2 + visible: showRCToParam - QGCButton { - id: bottomButton - anchors.rightMargin: defaultTextWidth - anchors.right: rcButton.left - anchors.bottom: parent.bottom - visible: fact.defaultValueAvailable - text: "Reset to default" + Rectangle { + height: 1 + width: ScreenTools.defaultFontPixelWidth * 5 + color: qgcPal.text + anchors.verticalCenter: _advanced.verticalCenter + } - onClicked: { - fact.value = fact.defaultValue - fact.valueChanged(fact.value) - hideDialog() - } - } + QGCCheckBox { + id: _advanced + text: "Advanced settings" + } - QGCButton { - id: rcButton - anchors.right: parent.right - anchors.bottom: parent.bottom - text: "Set RC to Param..." - visible: !validate && showRCToParam - onClicked: controller.setRCToParam(fact.name) + Rectangle { + height: 1 + width: ScreenTools.defaultFontPixelWidth * 5 + color: qgcPal.text + anchors.verticalCenter: _advanced.verticalCenter + } + } + + QGCButton { + text: "Set RC to Param..." + visible: _advanced.checked && !validate && showRCToParam + onClicked: controller.setRCToParam(fact.name) + } + } // Column } } // QGCViewDialog diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index c8f9fc7d04375e4f60ddd7de5f18319a9cf617d3..cdea17adad8ca076525815e859f0557c8a909d1e 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -60,7 +60,7 @@ QGCView { controller.cancel() } - QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } + QGCPalette { id: qgcPal; colorGroupEnabled: true } FirmwareUpgradeController { id: controller @@ -108,9 +108,9 @@ QGCView { statusTextArea.append(highlightPrefix + "Found device" + highlightSuffix + ": " + controller.boardType) 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) - } - } - } + } + } + } onError: { hideDialog() @@ -131,7 +131,7 @@ QGCView { QGCViewDialog { anchors.fill: parent - property bool showFirmwareTypeSelection: advancedMode.checked + property bool showFirmwareTypeSelection: _advanced.checked property bool px4Flow: controller.boardType == "PX4 Flow" function accept() { @@ -176,7 +176,7 @@ QGCView { ListElement { text: "Custom firmware file..."; firmwareType: FirmwareUpgradeController.CustomFirmware - } + } } ListModel { @@ -189,7 +189,7 @@ QGCView { ListElement { text: "Custom firmware file..."; firmwareType: FirmwareUpgradeController.CustomFirmware - } + } } Column { @@ -232,6 +232,44 @@ QGCView { 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 { width: parent.width wrapMode: Text.WordWrap @@ -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:" } - Row { - spacing: 10 - QGCComboBox { - id: firmwareVersionCombo - width: 200 - visible: showFirmwareTypeSelection - model: px4Flow ? px4FlowTypeList : firmwareTypeList - currentIndex: controller.selectedFirmwareType - - onActivated: { - controller.selectedFirmwareType = index - if (model.get(index).firmwareType == FirmwareUpgradeController.BetaFirmware) { - firmwareVersionWarningLabel.visible = true - firmwareVersionWarningLabel.text = "WARNING: BETA FIRMWARE. " + - "This firmware version is ONLY intended for beta testers. " + - "Although it has received FLIGHT TESTING, it represents actively changed code. " + - "Do NOT use for normal operation." - } else if (model.get(index).firmwareType == FirmwareUpgradeController.DeveloperFirmware) { - firmwareVersionWarningLabel.visible = true - firmwareVersionWarningLabel.text = "WARNING: CONTINUOUS BUILD FIRMWARE. " + - "This firmware has NOT BEEN FLIGHT TESTED. " + - "It is only intended for DEVELOPERS. " + - "Run bench tests without props first. " + - "Do NOT fly this without additonal safety precautions. " + - "Follow the mailing list actively when using it." - } else { - firmwareVersionWarningLabel.visible = false - } + QGCComboBox { + id: firmwareVersionCombo + width: 200 + visible: showFirmwareTypeSelection + model: px4Flow ? px4FlowTypeList : firmwareTypeList + currentIndex: controller.selectedFirmwareType + + onActivated: { + controller.selectedFirmwareType = index + if (model.get(index).firmwareType == FirmwareUpgradeController.BetaFirmware) { + firmwareVersionWarningLabel.visible = true + firmwareVersionWarningLabel.text = "WARNING: BETA FIRMWARE. " + + "This firmware version is ONLY intended for beta testers. " + + "Although it has received FLIGHT TESTING, it represents actively changed code. " + + "Do NOT use for normal operation." + } else if (model.get(index).firmwareType == FirmwareUpgradeController.DeveloperFirmware) { + firmwareVersionWarningLabel.visible = true + firmwareVersionWarningLabel.text = "WARNING: CONTINUOUS BUILD FIRMWARE. " + + "This firmware has NOT BEEN FLIGHT TESTED. " + + "It is only intended for DEVELOPERS. " + + "Run bench tests without props first. " + + "Do NOT fly this without additonal safety precautions. " + + "Follow the mailing list actively when using it." + } else { + firmwareVersionWarningLabel.visible = false } } - - QGCComboBox { - id: vehicleTypeSelectionCombo - width: 200 - visible: apmFlightStack.checked - model: controller.apmAvailableVersions - } } QGCLabel { @@ -284,29 +312,7 @@ QGCView { wrapMode: Text.WordWrap visible: false } - } - - 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 - } + } // Column } // QGCViewDialog } // Component - pixhawkFirmwareSelectDialog