VehicleSummary.qml 4.73 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 29 30 31 32
import QGroundControl.FactSystem            1.0
import QGroundControl.Palette               1.0
import QGroundControl.Controls              1.0
import QGroundControl.ScreenTools           1.0
import QGroundControl.MultiVehicleManager   1.0
33 34

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

38
    property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true }
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
        QGCLabel {
Don Gagne's avatar
Don Gagne committed
49 50
            text:           "VEHICLE SUMMARY"
            font.pixelSize: ScreenTools.largeFontPixelSize
Don Gagne's avatar
Don Gagne committed
51
        }
52

53 54 55 56 57 58 59
        Item {
            // Just used as a spacer
            height: 15
            width: 10
        }

        QGCLabel {
60 61
            width:			parent.width
			wrapMode:		Text.WordWrap
62
			color:			setupComplete ? qgcPal.text : qgcPal.warningText
Don Gagne's avatar
Don Gagne committed
63
            font.pixelSize: setupComplete ? ScreenTools.defaultFontPixelSize : ScreenTools.mediumFontPixelSize
64 65 66 67
			text:           setupComplete ?
                                "Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component." :
                                "WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left."

68
            property bool setupComplete: multiVehicleManager.activeVehicle.autopilot.setupComplete
69 70
        }

Don Gagne's avatar
Don Gagne committed
71 72 73 74 75
        Item {
            // Just used as a spacer
            height: 20
            width: 10
        }
76

Don Gagne's avatar
Don Gagne committed
77 78 79
        Flow {
            width: parent.width
            spacing: 10
80

Don Gagne's avatar
Don Gagne committed
81
            Repeater {
82 83
                model: multiVehicleManager.activeVehicle.autopilot.vehicleComponents

84

Don Gagne's avatar
Don Gagne committed
85 86 87
                // Outer summary item rectangle
                Rectangle {
                    readonly property real titleHeight: 30
88

Don Gagne's avatar
Don Gagne committed
89 90 91
                    width:  250
                    height: 200
                    color:  qgcPal.windowShade
92

Don Gagne's avatar
Don Gagne committed
93 94
                    // Title bar
                    Rectangle {
95

Don Gagne's avatar
Don Gagne committed
96 97 98
                        width: parent.width
                        height: titleHeight
                        color: qgcPal.windowShadeDark
99

Don Gagne's avatar
Don Gagne committed
100
                        // Title text
101
                        QGCLabel {
Don Gagne's avatar
Don Gagne committed
102
                            anchors.fill:   parent
103

Don Gagne's avatar
Don Gagne committed
104 105
                            color:          qgcPal.buttonText
                            text:           modelData.name.toUpperCase()
106

Don Gagne's avatar
Don Gagne committed
107 108
                            verticalAlignment:      TextEdit.AlignVCenter
                            horizontalAlignment:    TextEdit.AlignHCenter
109
                        }
Don Gagne's avatar
Don Gagne committed
110
                    }
111

Don Gagne's avatar
Don Gagne committed
112 113 114 115 116 117 118 119 120 121 122 123
                    // 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"
                    }
124

Don Gagne's avatar
Don Gagne committed
125 126 127 128 129 130
                    // Summary Qml
                    Rectangle {
                        y:      parent.titleHeight
                        width:  parent.width
                        height: parent.height - parent.titleHeight
                        color:  qgcPal.windowShade
131

Don Gagne's avatar
Don Gagne committed
132 133 134
                        Loader {
                            anchors.fill: parent
                            source: modelData.summaryQmlSource
135 136 137 138 139 140 141
                        }
                    }
                }
            }
        }
    }
}