SetupViewButtons.qml 2.45 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.FactSystem 1.0
5 6 7
import QtGraphicalEffects 1.0

import QGroundControl.Palette 1.0
Don Gagne's avatar
Don Gagne committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
import QGroundControl.Controls 1.0

Rectangle {
    id: topLevel

    QGCPalette { id: palette; colorGroup: QGCPalette.Active }
    color: palette.window

    signal firmwareButtonClicked;
    signal summaryButtonClicked;
    signal parametersButtonClicked;
    signal setupButtonClicked(variant component);

    ExclusiveGroup { id: setupButtonGroup }

    Component {
        id: disconnectedButtons

        Column {
            spacing: 10

            SetupButton {
                id: firmwareButton; objectName: "firmwareButton"
                width: parent.width
                text: "FIRMWARE"
                setupIndicator: false
                exclusiveGroup: setupButtonGroup
                onClicked: topLevel.firmwareButtonClicked()
            }
        }
    }

    Component {
        id: connectedButtons

        Column {
            spacing: 10

            SetupButton {
                id: summaryButton; objectName: "summaryButton"
                width: parent.width
49
                text: "SUMMARY"
Don Gagne's avatar
Don Gagne committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
                setupIndicator: false
                exclusiveGroup: setupButtonGroup
                onClicked: topLevel.summaryButtonClicked()
            }

            SetupButton {
                id: firmwareButton; objectName: "firmwareButton"
                width: parent.width
                text: "FIRMWARE"
                setupIndicator: false
                exclusiveGroup: setupButtonGroup
                onClicked: topLevel.firmwareButtonClicked()
            }

            Repeater {
                model: autopilot.components

                SetupButton {
                    width: parent.width
                    text: modelData.name.toUpperCase()
                    setupComplete: modelData.setupComplete
                    exclusiveGroup: setupButtonGroup
                    onClicked: topLevel.setupButtonClicked(modelData)
                }
            }

            SetupButton {
                width: parent.width
                text: "PARAMETERS"
                setupIndicator: false
                exclusiveGroup: setupButtonGroup
                onClicked: topLevel.parametersButtonClicked()
            }
        }
    }


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