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

Rectangle {
35
    color: qgcPal.window
36

37 38 39 40 41
    QGCPalette {
        id:                 qgcPal
        colorGroupEnabled:  enabled
    }

Don Gagne's avatar
Don Gagne committed
42
    Column {
43 44
        anchors.fill:   parent
        spacing:        ScreenTools.defaultFontPixelHeight
45

Don Gagne's avatar
Don Gagne committed
46
        QGCLabel {
Don Gagne's avatar
Don Gagne committed
47 48
            text:           "VEHICLE SUMMARY"
            font.pixelSize: ScreenTools.largeFontPixelSize
Don Gagne's avatar
Don Gagne committed
49
        }
50

51
        QGCLabel {
52 53
            width:			parent.width
			wrapMode:		Text.WordWrap
54
			color:			setupComplete ? qgcPal.text : qgcPal.warningText
Don Gagne's avatar
Don Gagne committed
55
            font.pixelSize: setupComplete ? ScreenTools.defaultFontPixelSize : ScreenTools.mediumFontPixelSize
56 57 58 59
			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."

60
            property bool setupComplete: multiVehicleManager.activeVehicle.autopilot.setupComplete
61 62
        }

Don Gagne's avatar
Don Gagne committed
63
        Flow {
64 65
            width:      parent.width
            spacing:    ScreenTools.defaultFontPixelWidth
66

Don Gagne's avatar
Don Gagne committed
67
            Repeater {
68 69
                model: multiVehicleManager.activeVehicle.autopilot.vehicleComponents

70

Don Gagne's avatar
Don Gagne committed
71 72
                // Outer summary item rectangle
                Rectangle {
73 74
                    width:  ScreenTools.defaultFontPixelWidth * 28
                    height: ScreenTools.defaultFontPixelHeight * 13
Don Gagne's avatar
Don Gagne committed
75
                    color:  qgcPal.windowShade
76

77 78
                    readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 2

Don Gagne's avatar
Don Gagne committed
79 80
                    // Title bar
                    Rectangle {
81 82
                        id:     titleBar
                        width:  parent.width
Don Gagne's avatar
Don Gagne committed
83
                        height: titleHeight
84
                        color:  qgcPal.windowShadeDark
85

Don Gagne's avatar
Don Gagne committed
86
                        // Title text
87
                        QGCLabel {
88
                            anchors.fill:           parent
Don Gagne's avatar
Don Gagne committed
89 90
                            verticalAlignment:      TextEdit.AlignVCenter
                            horizontalAlignment:    TextEdit.AlignHCenter
91
                            text:                   modelData.name.toUpperCase()
92
                        }
93

94 95 96 97 98 99 100 101 102 103 104
                        // Setup indicator
                        Rectangle {
                            anchors.rightMargin:    ScreenTools.defaultFontPixelWidth / 3
                            anchors.right:          parent.right
                            anchors.verticalCenter: parent.verticalCenter
                            width:                  10//radius * 2
                            height:                 10//height
                            radius:                 (ScreenTools.defaultFontPixelHeight * .75) * 2
                            color:                  modelData.setupComplete ? "#00d932" : "red"
                            visible:                modelData.requiresSetup
                        }
Don Gagne's avatar
Don Gagne committed
105
                    }
106

Don Gagne's avatar
Don Gagne committed
107 108
                    // Summary Qml
                    Rectangle {
109 110
                        anchors.top:    titleBar.bottom
                        width:          parent.width
111

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