QGCInstrumentWidget.qml 3.7 KB
Newer Older
dogmaphobic's avatar
dogmaphobic committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
/*=====================================================================

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

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

/**
 * @file
 *   @brief QGC Compass Widget
 *   @author Gus Grubba <mavlink@grubba.com>
 */

import QtQuick 2.4

import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0

Item {
    id:     root
    height: size

39 40 41
    property alias  heading:        compass.heading
    property alias  rollAngle:      attitude.rollAngle
    property alias  pitchAngle:     attitude.pitchAngle
dogmaphobic's avatar
dogmaphobic committed
42

43 44 45 46 47 48 49
    property real   size:           ScreenTools.defaultFontPixelSize * (10)
    property bool   isSatellite:    false
    property bool   active:         false

    property bool   _isVisible:     true

    //-- Instrument Pannel
dogmaphobic's avatar
dogmaphobic committed
50 51
    Rectangle {
        id:                 instrumentPannel
52
        anchors.right:      parent.right
dogmaphobic's avatar
dogmaphobic committed
53 54 55 56
        anchors.bottom:     parent.bottom
        height:             root.size
        width:              instruments.width + 8
        radius:             root.size / 2
57 58
        visible:            _isVisible
        color:              isSatellite ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5)
dogmaphobic's avatar
dogmaphobic committed
59 60 61 62 63 64 65 66
        Row {
            id:                 instruments
            height:             parent.height
            spacing:            4
            anchors.horizontalCenter:   parent.horizontalCenter
            QGCAttitudeWidget {
                id:             attitude
                size:           parent.height * 0.9
67
                active:         root.active
dogmaphobic's avatar
dogmaphobic committed
68 69 70 71 72
                anchors.verticalCenter: parent.verticalCenter
            }
            QGCCompassWidget {
                id:             compass
                size:           parent.height * 0.9
73
                active:         root.active
dogmaphobic's avatar
dogmaphobic committed
74 75 76
                anchors.verticalCenter: parent.verticalCenter
            }
        }
77 78 79 80 81 82 83
        MouseArea {
            anchors.fill: parent
            onClicked: {
                _isVisible = !_isVisible
            }
        }
    }
dogmaphobic's avatar
dogmaphobic committed
84

85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    //-- Show Instruments
    Rectangle {
        id:                 openButton
        anchors.right:      parent.right
        anchors.bottom:     parent.bottom
        height:             24
        width:              24
        radius:             4
        visible:            !_isVisible
        color:              isSatellite ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5)
        Image {
            width:              parent.width  * 0.75
            height:             parent.height * 0.75
            source:             "/qmlimages/buttonLeft.svg"
            mipmap:             true
            fillMode:           Image.PreserveAspectFit
            anchors.verticalCenter:     parent.verticalCenter
            anchors.horizontalCenter:   parent.horizontalCenter
        }
        MouseArea {
            anchors.fill: parent
            onClicked: {
                _isVisible = !_isVisible
            }
        }
dogmaphobic's avatar
dogmaphobic committed
110
    }
111

dogmaphobic's avatar
dogmaphobic committed
112
}