FirmwareUpgrade.qml 2.74 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 27 28
        anchors.fill:parent

        Text {
            text: "FIRMWARE UPDATE"
29
            color: qgcPal.text
30 31 32 33 34 35 36 37 38
            font.pointSize: 20
        }

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

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

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

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

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

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

91 92 93 94 95
        TextArea {
            id: statusTextArea
            width: parent.width
            height: 300
            readOnly: true
96
            frameVisible: false
97
            style: TextAreaStyle {
98
                textColor: qgcPal.text
99
                backgroundColor: qgcPal.windowShade
100
            }
101 102 103
        }
    }
}