VehicleSummary.qml 3.87 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*=====================================================================

 QGroundControl Open Source Ground Control Station

 (c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

 This file is part of the QGROUNDCONTROL project

 QGROUNDCONTROL is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 QGROUNDCONTROL is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

 ======================================================================*/

24 25 26
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
27

28
import QGroundControl.FactSystem 1.0
29
import QGroundControl.Palette 1.0
Don Gagne's avatar
Don Gagne committed
30
import QGroundControl.Controls 1.0
31
import QGroundControl.ScreenTools 1.0
32 33

Rectangle {
Don Gagne's avatar
Don Gagne committed
34 35 36
    width: 600
    height: 400

37
    property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true }
38
    property ScreenTools screenTools: ScreenTools { }
39

40 41 42
    id: topLevel
    objectName: "topLevel"

43
    color: qgcPal.window
44

Don Gagne's avatar
Don Gagne committed
45
    Column {
46
        anchors.fill: parent
47

Don Gagne's avatar
Don Gagne committed
48 49
        QGCLabel {
            text: "VEHICLE SUMMARY"
50
            font.pointSize: screenTools.dpiAdjustedPointSize(20);
Don Gagne's avatar
Don Gagne committed
51
        }
52

Don Gagne's avatar
Don Gagne committed
53 54 55 56 57
        Item {
            // Just used as a spacer
            height: 20
            width: 10
        }
58

Don Gagne's avatar
Don Gagne committed
59 60 61
        Flow {
            width: parent.width
            spacing: 10
62

Don Gagne's avatar
Don Gagne committed
63 64
            Repeater {
                model: autopilot.components
65

Don Gagne's avatar
Don Gagne committed
66 67 68
                // Outer summary item rectangle
                Rectangle {
                    readonly property real titleHeight: 30
69

Don Gagne's avatar
Don Gagne committed
70 71 72
                    width:  250
                    height: 200
                    color:  qgcPal.windowShade
73

Don Gagne's avatar
Don Gagne committed
74 75
                    // Title bar
                    Rectangle {
76

Don Gagne's avatar
Don Gagne committed
77 78 79
                        width: parent.width
                        height: titleHeight
                        color: qgcPal.windowShadeDark
80

Don Gagne's avatar
Don Gagne committed
81 82 83
                        // Title text
                        Text {
                            anchors.fill:   parent
84

Don Gagne's avatar
Don Gagne committed
85 86 87
                            color:          qgcPal.buttonText
                            font.pixelSize: 12
                            text:           modelData.name.toUpperCase()
88

Don Gagne's avatar
Don Gagne committed
89 90
                            verticalAlignment:      TextEdit.AlignVCenter
                            horizontalAlignment:    TextEdit.AlignHCenter
91
                        }
Don Gagne's avatar
Don Gagne committed
92
                    }
93

Don Gagne's avatar
Don Gagne committed
94 95 96 97 98 99 100 101 102 103 104 105
                    // Setup indicator
                    Rectangle {
                        readonly property real indicatorRadius: 6
                        readonly property real indicatorRightInset: 5

                        x:      parent.width - (indicatorRadius * 2) - indicatorRightInset
                        y:      (parent.titleHeight - (indicatorRadius * 2)) / 2
                        width:  indicatorRadius * 2
                        height: indicatorRadius * 2
                        radius: indicatorRadius
                        color:  modelData.setupComplete ? "#00d932" : "red"
                    }
106

Don Gagne's avatar
Don Gagne committed
107 108 109 110 111 112
                    // Summary Qml
                    Rectangle {
                        y:      parent.titleHeight
                        width:  parent.width
                        height: parent.height - parent.titleHeight
                        color:  qgcPal.windowShade
113

Don Gagne's avatar
Don Gagne committed
114 115 116
                        Loader {
                            anchors.fill: parent
                            source: modelData.summaryQmlSource
117 118 119 120 121 122 123
                        }
                    }
                }
            }
        }
    }
}