Browse Source

Make scrollable, fix broken combobox

QGC4.4
DonLakeFlyer 5 years ago
parent
commit
21f9447a76
  1. 309
      src/VehicleSetup/FirmwareUpgrade.qml

309
src/VehicleSetup/FirmwareUpgrade.qml

@ -151,8 +151,7 @@ SetupPage { @@ -151,8 +151,7 @@ SetupPage {
id: pixhawkFirmwareSelectDialogComponent
QGCViewDialog {
id: pixhawkFirmwareSelectDialog
anchors.fill: parent
id: pixhawkFirmwareSelectDialog
property bool showFirmwareTypeSelection: _advanced.checked
property bool px4Flow: controller.px4FlowBoard
@ -303,187 +302,197 @@ SetupPage { @@ -303,187 +302,197 @@ SetupPage {
}
}
Column {
QGCFlickable {
anchors.fill: parent
spacing: defaultTextHeight
contentHeight: mainColumn.height
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: (_singleFirmwareMode || !QGroundControl.apmFirmwareSupported) ? _singleFirmwareLabel : (px4Flow ? _px4FlowLabel : _pixhawkLabel)
Column {
id: mainColumn
anchors.left: parent.left
anchors.right: parent.right
spacing: defaultTextHeight
readonly property string _px4FlowLabel: qsTr("Detected PX4 Flow board. The firmware you use on the PX4 Flow must match the AutoPilot firmware type you are using on the vehicle:")
readonly property string _pixhawkLabel: qsTr("Detected Pixhawk board. You can select from the following flight stacks:")
readonly property string _singleFirmwareLabel: qsTr("Press Ok to upgrade your vehicle.")
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: (_singleFirmwareMode || !QGroundControl.apmFirmwareSupported) ? _singleFirmwareLabel : (px4Flow ? _px4FlowLabel : _pixhawkLabel)
QGCLabel { text: qsTr("Flight Stack"); visible: QGroundControl.apmFirmwareSupported }
readonly property string _px4FlowLabel: qsTr("Detected PX4 Flow board. The firmware you use on the PX4 Flow must match the AutoPilot firmware type you are using on the vehicle:")
readonly property string _pixhawkLabel: qsTr("Detected Pixhawk board. You can select from the following flight stacks:")
readonly property string _singleFirmwareLabel: qsTr("Press Ok to upgrade your vehicle.")
}
Column {
QGCLabel { text: qsTr("Flight Stack"); visible: QGroundControl.apmFirmwareSupported }
Column {
Component.onCompleted: {
if(!QGroundControl.apmFirmwareSupported) {
_defaultFirmwareFact.rawValue = _defaultFimwareTypePX4
firmwareVersionChanged(firmwareBuildTypeList)
Component.onCompleted: {
if(!QGroundControl.apmFirmwareSupported) {
_defaultFirmwareFact.rawValue = _defaultFimwareTypePX4
firmwareVersionChanged(firmwareBuildTypeList)
}
}
}
QGCRadioButton {
id: px4FlightStackRadio
text: qsTr("PX4 Pro ")
textBold: _defaultFirmwareIsPX4
checked: _defaultFirmwareIsPX4
visible: !_singleFirmwareMode && !px4Flow && QGroundControl.apmFirmwareSupported
QGCRadioButton {
id: px4FlightStackRadio
text: qsTr("PX4 Pro ")
textBold: _defaultFirmwareIsPX4
checked: _defaultFirmwareIsPX4
visible: !_singleFirmwareMode && !px4Flow && QGroundControl.apmFirmwareSupported
onClicked: {
_defaultFirmwareFact.rawValue = _defaultFimwareTypePX4
firmwareVersionChanged(firmwareBuildTypeList)
onClicked: {
_defaultFirmwareFact.rawValue = _defaultFimwareTypePX4
firmwareVersionChanged(firmwareBuildTypeList)
}
}
}
QGCRadioButton {
id: apmFlightStack
text: qsTr("ArduPilot")
textBold: !_defaultFirmwareIsPX4
checked: !_defaultFirmwareIsPX4
visible: !_singleFirmwareMode && !px4Flow && QGroundControl.apmFirmwareSupported
QGCRadioButton {
id: apmFlightStack
text: qsTr("ArduPilot")
textBold: !_defaultFirmwareIsPX4
checked: !_defaultFirmwareIsPX4
visible: !_singleFirmwareMode && !px4Flow && QGroundControl.apmFirmwareSupported
onClicked: {
_defaultFirmwareFact.rawValue = _defaultFimwareTypeAPM
firmwareVersionChanged(firmwareBuildTypeList)
onClicked: {
_defaultFirmwareFact.rawValue = _defaultFimwareTypeAPM
firmwareVersionChanged(firmwareBuildTypeList)
}
}
}
}
FactComboBox {
anchors.left: parent.left
anchors.right: parent.right
visible: !px4Flow && apmFlightStack.checked
fact: _firmwareUpgradeSettings.apmChibiOS
indexModel: false
}
FactComboBox {
anchors.left: parent.left
anchors.right: parent.right
visible: !px4Flow && apmFlightStack.checked
fact: _firmwareUpgradeSettings.apmChibiOS
indexModel: false
}
FactComboBox {
id: apmVehicleTypeCombo
anchors.left: parent.left
anchors.right: parent.right
visible: !px4Flow && apmFlightStack.checked
fact: _firmwareUpgradeSettings.apmVehicleType
indexModel: false
}
FactComboBox {
id: apmVehicleTypeCombo
anchors.left: parent.left
anchors.right: parent.right
visible: !px4Flow && apmFlightStack.checked
fact: _firmwareUpgradeSettings.apmVehicleType
indexModel: false
}
QGCComboBox {
id: ardupilotFirmwareSelectionCombo
anchors.left: parent.left
anchors.right: parent.right
visible: !px4Flow && apmFlightStack.checked && !controller.downloadingFirmwareList && controller.apmFirmwareNames.length !== 0
model: controller.apmFirmwareNames
QGCComboBox {
id: ardupilotFirmwareSelectionCombo
anchors.left: parent.left
anchors.right: parent.right
visible: !px4Flow && apmFlightStack.checked && !controller.downloadingFirmwareList && controller.apmFirmwareNames.length !== 0
model: controller.apmFirmwareNames
onModelChanged: console.log("model", model)
}
onModelChanged: console.log("model", model)
}
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: qsTr("Downloading list of available firmwares...")
visible: controller.downloadingFirmwareList
}
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: qsTr("Downloading list of available firmwares...")
visible: controller.downloadingFirmwareList
}
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: qsTr("No Firmware Available")
visible: !controller.downloadingFirmwareList && (QGroundControl.apmFirmwareSupported && controller.apmFirmwareNames.length === 0)
}
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: qsTr("No Firmware Available")
visible: !controller.downloadingFirmwareList && (QGroundControl.apmFirmwareSupported && controller.apmFirmwareNames.length === 0)
}
QGCComboBox {
id: px4FlowTypeSelectionCombo
anchors.left: parent.left
anchors.right: parent.right
visible: px4Flow
model: px4FlowFirmwareList
currentIndex: _defaultFirmwareIsPX4 ? 0 : 1
}
QGCComboBox {
id: px4FlowTypeSelectionCombo
anchors.left: parent.left
anchors.right: parent.right
visible: px4Flow
model: px4FlowFirmwareList
currentIndex: _defaultFirmwareIsPX4 ? 0 : 1
}
Row {
width: parent.width
spacing: ScreenTools.defaultFontPixelWidth / 2
visible: !px4Flow
Row {
width: parent.width
spacing: ScreenTools.defaultFontPixelWidth / 2
visible: !px4Flow
Rectangle {
height: 1
width: ScreenTools.defaultFontPixelWidth * 5
color: qgcPal.text
anchors.verticalCenter: _advanced.verticalCenter
}
Rectangle {
height: 1
width: ScreenTools.defaultFontPixelWidth * 5
color: qgcPal.text
anchors.verticalCenter: _advanced.verticalCenter
}
QGCCheckBox {
id: _advanced
text: qsTr("Advanced settings")
checked: px4Flow ? true : false
QGCCheckBox {
id: _advanced
text: qsTr("Advanced settings")
checked: px4Flow ? true : false
onClicked: {
firmwareBuildTypeCombo.currentIndex = 0
firmwareWarningMessageVisible = false
updatePX4VersionDisplay()
onClicked: {
firmwareBuildTypeCombo.currentIndex = 0
firmwareWarningMessageVisible = false
updatePX4VersionDisplay()
}
}
}
Rectangle {
height: 1
width: ScreenTools.defaultFontPixelWidth * 5
color: qgcPal.text
anchors.verticalCenter: _advanced.verticalCenter
Rectangle {
height: 1
width: ScreenTools.defaultFontPixelWidth * 5
color: qgcPal.text
anchors.verticalCenter: _advanced.verticalCenter
}
}
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
visible: showFirmwareTypeSelection
text: _singleFirmwareMode ? qsTr("Select the standard version or one from the file system (previously downloaded):") : (px4Flow ? qsTr("Select which version of the firmware you would like to install:") : qsTr("Select which version of the above flight stack you would like to install:"))
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
visible: showFirmwareTypeSelection
text: _singleFirmwareMode ? qsTr("Select the standard version or one from the file system (previously downloaded):") :
(px4Flow ? qsTr("Select which version of the firmware you would like to install:") :
qsTr("Select which version of the above flight stack you would like to install:"))
}
QGCComboBox {
id: firmwareBuildTypeCombo
anchors.left: parent.left
anchors.right: parent.right
visible: showFirmwareTypeSelection
model: _singleFirmwareMode ? singleFirmwareModeTypeList : (px4Flow ? px4FlowTypeList : firmwareBuildTypeList)
currentIndex: controller.selectedFirmwareBuildType
onActivated: {
controller.selectedFirmwareBuildType = model.get(index).firmwareType
if (model.get(index).firmwareType === FirmwareUpgradeController.BetaFirmware) {
firmwareWarningMessageVisible = true
firmwareVersionWarningLabel.text = qsTr("WARNING: BETA FIRMWARE. ") +
qsTr("This firmware version is ONLY intended for beta testers. ") +
qsTr("Although it has received FLIGHT TESTING, it represents actively changed code. ") +
qsTr("Do NOT use for normal operation.")
} else if (model.get(index).firmwareType === FirmwareUpgradeController.DeveloperFirmware) {
firmwareWarningMessageVisible = true
firmwareVersionWarningLabel.text = qsTr("WARNING: CONTINUOUS BUILD FIRMWARE. ") +
qsTr("This firmware has NOT BEEN FLIGHT TESTED. ") +
qsTr("It is only intended for DEVELOPERS. ") +
qsTr("Run bench tests without props first. ") +
qsTr("Do NOT fly this without additional safety precautions. ") +
qsTr("Follow the mailing list actively when using it.")
} else {
firmwareWarningMessageVisible = false
QGCComboBox {
id: firmwareBuildTypeCombo
anchors.left: parent.left
anchors.right: parent.right
visible: showFirmwareTypeSelection
textRole: "text"
model: _singleFirmwareMode ? singleFirmwareModeTypeList : (px4Flow ? px4FlowTypeList : firmwareBuildTypeList)
currentIndex: controller.selectedFirmwareBuildType
onActivated: {
controller.selectedFirmwareBuildType = model.get(index).firmwareType
if (model.get(index).firmwareType === FirmwareUpgradeController.BetaFirmware) {
firmwareWarningMessageVisible = true
firmwareVersionWarningLabel.text = qsTr("WARNING: BETA FIRMWARE. ") +
qsTr("This firmware version is ONLY intended for beta testers. ") +
qsTr("Although it has received FLIGHT TESTING, it represents actively changed code. ") +
qsTr("Do NOT use for normal operation.")
} else if (model.get(index).firmwareType === FirmwareUpgradeController.DeveloperFirmware) {
firmwareWarningMessageVisible = true
firmwareVersionWarningLabel.text = qsTr("WARNING: CONTINUOUS BUILD FIRMWARE. ") +
qsTr("This firmware has NOT BEEN FLIGHT TESTED. ") +
qsTr("It is only intended for DEVELOPERS. ") +
qsTr("Run bench tests without props first. ") +
qsTr("Do NOT fly this without additional safety precautions. ") +
qsTr("Follow the mailing list actively when using it.")
} else {
firmwareWarningMessageVisible = false
}
updatePX4VersionDisplay()
}
updatePX4VersionDisplay()
}
}
QGCLabel {
id: firmwareVersionWarningLabel
width: parent.width
wrapMode: Text.WordWrap
visible: firmwareWarningMessageVisible
}
} // Column
QGCLabel {
id: firmwareVersionWarningLabel
width: parent.width
wrapMode: Text.WordWrap
visible: firmwareWarningMessageVisible
}
} // Column
} // QGCFLickable
} // QGCViewDialog
} // Component - pixhawkFirmwareSelectDialogComponent

Loading…
Cancel
Save