Browse Source

Merge pull request #1271 from DonLakeFlyer/Firmware

Firmware Upgrade ui re-work, plus QGCComboBox work
QGC4.4
Don Gagne 10 years ago
parent
commit
059df23dbf
  1. 32
      src/QmlControls/QGCComboBox.qml
  2. 96
      src/VehicleSetup/FirmwareUpgrade.qml
  3. 21
      src/VehicleSetup/FirmwareUpgradeController.cc

32
src/QmlControls/QGCComboBox.qml

@ -1,10 +1,40 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QtQuick.Controls.Private 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
ComboBox { ComboBox {
property var __palette: QGCPalette { colorGroupEnabled: enabled } property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property bool __showHighlight: pressed | hovered
style: ComboBoxStyle {
textColor: __showHighlight ?
control.__qgcPal.buttonHighlightText :
control.__qgcPal.buttonText
background: Item {
implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
Rectangle {
anchors.fill: parent
color: __showHighlight ?
control.__qgcPal.buttonHighlight :
control.__qgcPal.button
}
Image {
id: imageItem
visible: control.menu !== null
source: "arrow-down.png"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: dropDownButtonWidth / 2
opacity: control.enabled ? 0.6 : 0.3
}
}
}
} }

96
src/VehicleSetup/FirmwareUpgrade.qml

@ -36,70 +36,44 @@ Rectangle {
width: 10 width: 10
} }
/* Row {
FIXME: Leaving this in here for now for possible text usage in ui that does better job of describing firmware version spacing: 10
_ui->statusLog->setText(tr("WARNING: BETA FIRMWARE\n" ListModel {
- "This firmware version is ONLY intended for beta testers. " id: firmwareItems
- "Although it has received FLIGHT TESTING, it represents actively changed code. Do NOT use for normal operation.\n\n" ListElement {
- SELECT_FIRMWARE_LICENSE)); text: qsTr("Standard Version (stable)");
- break; firmwareType: FirmwareUpgradeController.StableFirmware
- }
- case 2: ListElement {
- _ui->statusLog->setText(tr("WARNING: CONTINUOUS BUILD FIRMWARE\n" text: qsTr("Beta Testing (beta)");
- "This firmware has NOT BEEN FLIGHT TESTED. " firmwareType: FirmwareUpgradeController.BetaFirmware
- "It is only intended for DEVELOPERS. Run bench tests without props first. " }
- "Do NOT fly this without addional safety precautions. Follow the mailing " ListElement {
- "list actively when using it.\n\n" text: qsTr("Developer Build (master)");
- SELECT_FIRMWARE_LICENSE)); firmwareType: FirmwareUpgradeController.DeveloperFirmware
*/ }
ListElement {
ExclusiveGroup { id: firmwareGroup } text: qsTr("Custom firmware file...");
firmwareType: FirmwareUpgradeController.CustomFirmware
QGCRadioButton { }
id: stableFirwareRadio
exclusiveGroup: firmwareGroup
text: qsTr("Standard Version (stable)")
checked: true
enabled: upgradeButton.enabled
onClicked: {
if (checked)
controller.firmwareType = FirmwareUpgradeController.StableFirmware
} }
}
QGCRadioButton {
id: betaFirwareRadio
exclusiveGroup: firmwareGroup
text: qsTr("Beta Testing (beta)")
enabled: upgradeButton.enabled
onClicked: { if (checked) controller.firmwareType = FirmwareUpgradeController.BetaFirmware }
}
QGCRadioButton {
id: devloperFirwareRadio
exclusiveGroup: firmwareGroup
text: qsTr("Developer Build (master)")
enabled: upgradeButton.enabled
onClicked: { if (checked) controller.firmwareType = FirmwareUpgradeController.DeveloperFirmware }
}
QGCRadioButton {
id: customFirwareRadio
exclusiveGroup: firmwareGroup
text: qsTr("Custom firmware file...")
enabled: upgradeButton.enabled
onClicked: { if (checked) controller.firmwareType = FirmwareUpgradeController.CustomFirmware }
}
Item { QGCComboBox {
// Just used as a spacer id: firmwareCombo
height: 20 width: 200
width: 10 height: upgradeButton.height
} model: firmwareItems
}
QGCButton { QGCButton {
id: upgradeButton id: upgradeButton
text: "UPGRADE" text: "UPGRADE"
onClicked: { primary: true
controller.doFirmwareUpgrade(); onClicked: {
controller.firmwareType = firmwareItems.get(firmwareCombo.currentIndex).firmwareType
controller.doFirmwareUpgrade();
}
} }
} }

21
src/VehicleSetup/FirmwareUpgradeController.cc

@ -580,6 +580,27 @@ void FirmwareUpgradeController::_eraseProgressTick(void)
void FirmwareUpgradeController::doFirmwareUpgrade(void) void FirmwareUpgradeController::doFirmwareUpgrade(void)
{ {
QString warningMsg;
if (_firmwareType == BetaFirmware) {
warningMsg = tr("WARNING: BETA FIRMWARE\n"
"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.\n\n"
"Are you sure you want to continue?");
} else if (_firmwareType == DeveloperFirmware) {
warningMsg = tr("WARNING: CONTINUOUS BUILD FIRMWARE\n"
"This firmware has NOT BEEN FLIGHT TESTED. "
"It is only intended for DEVELOPERS. Run bench tests without props first. "
"Do NOT fly this without addional safety precautions. Follow the mailing "
"list actively when using it.\n\n"
"Are you sure you want to continue?");
}
if (!warningMsg.isEmpty()) {
if (QGCMessageBox::warning(tr("Firmware Upgrade"), warningMsg, QGCMessageBox::Yes | QGCMessageBox::No, QGCMessageBox::No) == QGCMessageBox::No) {
return;
}
}
Q_ASSERT(_upgradeButton); Q_ASSERT(_upgradeButton);
_upgradeButton->setEnabled(false); _upgradeButton->setEnabled(false);

Loading…
Cancel
Save