FactPanel.qml 1.73 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
9 10 11 12 13


/// @file
///     @author Don Gagne <don@thegagnes.com>

14 15
import QtQuick 2.3
import QtQuick.Controls 1.2
16 17 18 19 20

import QGroundControl.FactSystem 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0

21 22
FocusScope {
    property alias color: rectangle.color
Don Gagne's avatar
Don Gagne committed
23

24 25
    property string __missingParams:    ""
    property string __errorMsg:         ""
Don Gagne's avatar
Don Gagne committed
26

27
    QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
28

Don Gagne's avatar
Don Gagne committed
29
    function showMissingParameterOverlay(missingParamName) {
30 31 32
        if (__missingParams.length != 0) {
            __missingParams = __missingParams.concat(", ")
        }
Don Gagne's avatar
Don Gagne committed
33 34 35 36 37 38 39
        __missingParams = __missingParams.concat(missingParamName)
        __missingParamsOverlay.visible = true
    }

    function showError(errorMsg) {
        __errorMsg = errorMsg
        __missingParamsOverlay.visible = true
40 41 42
    }

    Rectangle {
43 44 45 46 47
        id:     rectangle
        color: qgcPal.window

        Rectangle {
            id:             __missingParamsOverlay
48
            anchors.fill:   parent
49 50 51 52 53 54 55 56
            z:              9999
            visible:        false
            color:          qgcPal.window
            opacity:        0.85

            QGCLabel {
                anchors.fill:   parent
                wrapMode:       Text.WordWrap
57
                text:           __errorMsg.length ? __errorMsg : qsTr("Parameters(s) missing: %1").arg(__missingParams)
58
            }
59 60 61
        }
    }
}