Commit 059df23d authored by Don Gagne's avatar Don Gagne

Merge pull request #1271 from DonLakeFlyer/Firmware

Firmware Upgrade ui re-work, plus QGCComboBox work
parents 0c388e55 5e5124b1
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Controls.Private 1.0
import QGroundControl.Palette 1.0
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
}
}
}
}
......@@ -36,70 +36,44 @@ Rectangle {
width: 10
}
/*
FIXME: Leaving this in here for now for possible text usage in ui that does better job of describing firmware version
_ui->statusLog->setText(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"
- SELECT_FIRMWARE_LICENSE));
- break;
-
- case 2:
- _ui->statusLog->setText(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"
- SELECT_FIRMWARE_LICENSE));
*/
ExclusiveGroup { id: firmwareGroup }
QGCRadioButton {
id: stableFirwareRadio
exclusiveGroup: firmwareGroup
text: qsTr("Standard Version (stable)")
checked: true
enabled: upgradeButton.enabled
onClicked: {
if (checked)
controller.firmwareType = FirmwareUpgradeController.StableFirmware
Row {
spacing: 10
ListModel {
id: firmwareItems
ListElement {
text: qsTr("Standard Version (stable)");
firmwareType: FirmwareUpgradeController.StableFirmware
}
ListElement {
text: qsTr("Beta Testing (beta)");
firmwareType: FirmwareUpgradeController.BetaFirmware
}
ListElement {
text: qsTr("Developer Build (master)");
firmwareType: FirmwareUpgradeController.DeveloperFirmware
}
ListElement {
text: qsTr("Custom firmware file...");
firmwareType: FirmwareUpgradeController.CustomFirmware
}
}
}
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 {
// Just used as a spacer
height: 20
width: 10
}
QGCComboBox {
id: firmwareCombo
width: 200
height: upgradeButton.height
model: firmwareItems
}
QGCButton {
id: upgradeButton
text: "UPGRADE"
onClicked: {
controller.doFirmwareUpgrade();
QGCButton {
id: upgradeButton
text: "UPGRADE"
primary: true
onClicked: {
controller.firmwareType = firmwareItems.get(firmwareCombo.currentIndex).firmwareType
controller.doFirmwareUpgrade();
}
}
}
......
......@@ -580,6 +580,27 @@ void FirmwareUpgradeController::_eraseProgressTick(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);
_upgradeButton->setEnabled(false);
......
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