SetupViewButtons.qml 2.88 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1
import QtQuick 2.3
Don Gagne's avatar
Don Gagne committed
2 3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
4 5
import QtGraphicalEffects 1.0

Don Gagne's avatar
Don Gagne committed
6
import QGroundControl.FactSystem 1.0
7
import QGroundControl.Palette 1.0
Don Gagne's avatar
Don Gagne committed
8 9 10 11 12
import QGroundControl.Controls 1.0

Rectangle {
    id: topLevel

13
    QGCPalette { id: palette; colorGroupEnabled: true }
Don Gagne's avatar
Don Gagne committed
14 15 16 17 18 19 20 21
    color: palette.window

    ExclusiveGroup { id: setupButtonGroup }

    Component {
        id: disconnectedButtons

        Column {
22 23
            anchors.fill: parent

24
            SubMenuButton {
Don Gagne's avatar
Don Gagne committed
25 26 27
                id: firmwareButton; objectName: "firmwareButton"
                width: parent.width
                text: "FIRMWARE"
28
                imageResource: "FirmwareUpgradeIcon.png"
Don Gagne's avatar
Don Gagne committed
29 30
                setupIndicator: false
                exclusiveGroup: setupButtonGroup
Don Gagne's avatar
Don Gagne committed
31
                onClicked: controller.firmwareButtonClicked()
Don Gagne's avatar
Don Gagne committed
32
            }
33 34 35 36 37 38 39 40 41

            Item { width: parent.width; height: 10 }    // spacer

            QGCLabel {
                width: parent.width
                text: "You must be connected to your board to use all available setup options."
                wrapMode: Text.WordWrap
                horizontalAlignment: Text.AlignHCenter
            }
Don Gagne's avatar
Don Gagne committed
42 43 44 45 46 47 48
        }
    }

    Component {
        id: connectedButtons

        Column {
49 50
            anchors.fill: parent

51
            SubMenuButton {
Don Gagne's avatar
Don Gagne committed
52 53
                id: summaryButton; objectName: "summaryButton"
                width: parent.width
54
                text: "SUMMARY"
55
                imageResource: "VehicleSummaryIcon.png"
Don Gagne's avatar
Don Gagne committed
56 57
                setupIndicator: false
                exclusiveGroup: setupButtonGroup
Don Gagne's avatar
Don Gagne committed
58
                onClicked: controller.summaryButtonClicked()
Don Gagne's avatar
Don Gagne committed
59 60
            }

61
            SubMenuButton {
Don Gagne's avatar
Don Gagne committed
62 63 64
                id: firmwareButton; objectName: "firmwareButton"
                width: parent.width
                text: "FIRMWARE"
65
                imageResource: "FirmwareUpgradeIcon.png"
Don Gagne's avatar
Don Gagne committed
66 67
                setupIndicator: false
                exclusiveGroup: setupButtonGroup
Don Gagne's avatar
Don Gagne committed
68
                onClicked: controller.firmwareButtonClicked()
Don Gagne's avatar
Don Gagne committed
69 70 71 72 73
            }

            Repeater {
                model: autopilot.components

74
                SubMenuButton {
Don Gagne's avatar
Don Gagne committed
75 76
                    width: parent.width
                    text: modelData.name.toUpperCase()
77
                    imageResource: modelData.iconResource
Don Gagne's avatar
Don Gagne committed
78 79
                    setupComplete: modelData.setupComplete
                    exclusiveGroup: setupButtonGroup
Don Gagne's avatar
Don Gagne committed
80
                    onClicked: controller.setupButtonClicked(modelData)
Don Gagne's avatar
Don Gagne committed
81 82 83
                }
            }

84
            SubMenuButton {
Don Gagne's avatar
Don Gagne committed
85 86 87 88
                width: parent.width
                text: "PARAMETERS"
                setupIndicator: false
                exclusiveGroup: setupButtonGroup
Don Gagne's avatar
Don Gagne committed
89
                onClicked: controller.parametersButtonClicked()
Don Gagne's avatar
Don Gagne committed
90 91 92 93 94 95 96 97 98 99
            }
        }
    }


    Loader {
        anchors.fill: parent
        sourceComponent: autopilot ? connectedButtons : disconnectedButtons
    }
}