FirmwareUpgrade.qml 2.82 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1
import QtQuick 2.3
2 3 4 5 6 7
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2

import QGroundControl.Controls 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
8
import QGroundControl.FirmwareUpgradeController 1.0
9 10 11

Rectangle {
    width: 600
12
    height: 600
13

14
    property var qgcPal: QGCPalette { colorGroupEnabled: true }
15 16
    property FirmwareUpgradeController controller: FirmwareUpgradeController {
        upgradeButton: upgradeButton
17
        progressBar: progressBar
18 19 20
        statusLog: statusTextArea
        firmwareType: FirmwareUpgradeController.StableFirmware
    }
21 22 23 24

    color: qgcPal.window

    Column {
25 26
        anchors.fill:parent

Don Gagne's avatar
Don Gagne committed
27
        QGCLabel {
28 29 30 31 32 33 34 35 36 37
            text: "FIRMWARE UPDATE"
            font.pointSize: 20
        }

        Item {
            // Just used as a spacer
            height: 20
            width: 10
        }

38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
        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
                }
59 60
            }

61 62 63 64 65 66
            QGCComboBox {
                id: firmwareCombo
                width: 200
                height: upgradeButton.height
                model: firmwareItems
            }
67

68 69 70 71 72 73 74 75
            QGCButton {
                id: upgradeButton
                text: "UPGRADE"
                primary: true
                onClicked: {
                    controller.firmwareType = firmwareItems.get(firmwareCombo.currentIndex).firmwareType
                    controller.doFirmwareUpgrade();
                }
76 77 78 79 80 81 82 83 84
            }
        }

        Item {
            // Just used as a spacer
            height: 20
            width: 10
        }

85 86 87 88 89
        ProgressBar {
            id: progressBar
            width: parent.width
        }

90 91 92 93 94
        TextArea {
            id: statusTextArea
            width: parent.width
            height: 300
            readOnly: true
95
            frameVisible: false
Don Gagne's avatar
Don Gagne committed
96
            text: qsTr("Please disconnect all connections and unplug board from USB before selecting Upgrade.")
97
            style: TextAreaStyle {
98
                textColor: qgcPal.text
99
                backgroundColor: qgcPal.windowShade
100
            }
101 102 103
        }
    }
}