Skip to content
VehicleSummary.qml 4.14 KiB
Newer Older
/*=====================================================================

 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/>.

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

import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.Palette 1.0
Don Gagne's avatar
Don Gagne committed
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0

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

    property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true }
    property ScreenTools screenTools: ScreenTools { }
    id: topLevel
    objectName: "topLevel"

    color: qgcPal.window
Don Gagne's avatar
Don Gagne committed
    Column {
        anchors.fill: parent
Don Gagne's avatar
Don Gagne committed
        QGCLabel {
            text: "VEHICLE SUMMARY"
            font.pointSize: screenTools.dpiAdjustedPointSize(20);
Don Gagne's avatar
Don Gagne committed
        }
        Item {
            // Just used as a spacer
            height: 15
            width: 10
        }

        QGCLabel {
            width: parent.width
            text: "If any of the setup indicators below are shown as red YOU SHOULD NOT FLY until you complete the setup of those components."
        }

Don Gagne's avatar
Don Gagne committed
        Item {
            // Just used as a spacer
            height: 20
            width: 10
        }
Don Gagne's avatar
Don Gagne committed
        Flow {
            width: parent.width
            spacing: 10
Don Gagne's avatar
Don Gagne committed
            Repeater {
                model: autopilot.vehicleComponents
Don Gagne's avatar
Don Gagne committed
                // Outer summary item rectangle
                Rectangle {
                    readonly property real titleHeight: 30
Don Gagne's avatar
Don Gagne committed
                    width:  250
                    height: 200
                    color:  qgcPal.windowShade
Don Gagne's avatar
Don Gagne committed
                    // Title bar
                    Rectangle {
Don Gagne's avatar
Don Gagne committed
                        width: parent.width
                        height: titleHeight
                        color: qgcPal.windowShadeDark
Don Gagne's avatar
Don Gagne committed
                        // Title text
Don Gagne's avatar
Don Gagne committed
                            anchors.fill:   parent
Don Gagne's avatar
Don Gagne committed
                            color:          qgcPal.buttonText
                            text:           modelData.name.toUpperCase()
Don Gagne's avatar
Don Gagne committed
                            verticalAlignment:      TextEdit.AlignVCenter
                            horizontalAlignment:    TextEdit.AlignHCenter
Don Gagne's avatar
Don Gagne committed
                    // 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"
                    }
Don Gagne's avatar
Don Gagne committed
                    // Summary Qml
                    Rectangle {
                        y:      parent.titleHeight
                        width:  parent.width
                        height: parent.height - parent.titleHeight
                        color:  qgcPal.windowShade
Don Gagne's avatar
Don Gagne committed
                        Loader {
                            anchors.fill: parent
                            source: modelData.summaryQmlSource