VehicleSummary.qml 3.45 KB
Newer Older
1 2 3
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
4

5
import QGroundControl.FactSystem 1.0
6
import QGroundControl.Palette 1.0
7 8

Rectangle {
Don Gagne's avatar
Don Gagne committed
9 10 11
    width: 600
    height: 400

12 13
    QGCPalette { id: palette; colorGroup: QGCPalette.Active }

14 15 16
    id: topLevel
    objectName: "topLevel"

17
    color: palette.window
18 19 20 21 22 23 24 25 26 27 28 29 30
    Image {
        anchors.fill: parent
        fillMode: Image.PreserveAspectFit
        smooth: true
        source: autopilot.setupBackgroundImage;
    }
    Column {
        anchors.margins: 20
        anchors.fill: parent
        spacing: 5

        Flow {
            width: parent.width;
Don Gagne's avatar
Don Gagne committed
31
            height: parent.height
32 33 34 35 36 37 38 39 40
            spacing: 5

            Repeater {
                model: autopilot.components

                Button {
                    width: 250
                    height: 200

41
                    property var summaryQmlSource: modelData.summaryQmlSource
42 43 44 45 46 47 48 49 50 51 52 53
                    text: modelData.name
                    property bool setupComplete: modelData.setupComplete

                    style: ButtonStyle {
                        id: buttonStyle
                        background: Rectangle {
                            id: innerRect
                            readonly property real titleHeight: 30

                            border.color: "#888"
                            radius: 10

Don Gagne's avatar
Don Gagne committed
54 55
                            color: "white"
                            opacity: 0.8
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 92 93 94 95 96 97

                            Text {
                                id: titleBar

                                width: parent.width
                                height: parent.titleHeight

                                verticalAlignment: TextEdit.AlignVCenter
                                horizontalAlignment: TextEdit.AlignHCenter

                                text: control.text
                                font.pixelSize: 12

                                Rectangle {
                                    id: setupIndicator

                                    property bool setupComplete: true
                                    readonly property real indicatorRadius: 6

                                    x: parent.width - (indicatorRadius * 2) - 5
                                    y: (parent.height - (indicatorRadius * 2)) / 2
                                    width: indicatorRadius * 2
                                    height: indicatorRadius * 2

                                    radius: indicatorRadius
                                    color: control.setupComplete ? "green" : "red"
                                }
                            }

                            Rectangle {
                                width: parent.width
                                height: parent.height - parent.titleHeight

                                y: parent.titleHeight

                                border.color: "#888"

                                gradient: Gradient {
                                    GradientStop { position: 0; color: "#ffffff" }
                                    GradientStop { position: 1; color: "#000000" }
                                }

98
                                Loader {
99
                                    anchors.fill: parent
100
                                    source: summaryQmlSource
101 102 103 104 105 106 107 108 109 110 111
                                }
                            }
                        }

                    label: Item {}
                    }
                }
            }
        }
    }
}