AnalyzePage.qml 3.64 KB
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (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.
 *
 ****************************************************************************/

10 11
import QtQuick          2.3
import QtQuick.Controls 1.2
Don Gagne's avatar
Don Gagne committed
12 13 14 15 16 17 18

import QGroundControl               1.0
import QGroundControl.Palette       1.0
import QGroundControl.Controls      1.0
import QGroundControl.ScreenTools   1.0

/// Base view control for all Analyze pages
19
Item {
20 21 22
    anchors.fill:               parent
    anchors.margins:            ScreenTools.defaultFontPixelWidth

Don Gagne's avatar
Don Gagne committed
23 24 25
    property alias  pageComponent:      pageLoader.sourceComponent
    property alias  pageName:           pageNameLabel.text
    property alias  pageDescription:    pageDescriptionLabel.text
26
    property alias  headerComponent:    headerLoader.sourceComponent
27
    property real   availableWidth:     width  - pageLoader.x
Gus Grubba's avatar
Gus Grubba committed
28
    property real   availableHeight:    height - mainContent.y
29
    property bool   poped:              false
30
    property real   _margins:           ScreenTools.defaultFontPixelHeight * 0.5
31

32 33 34 35 36 37 38
    signal popout()

    Loader {
        id:                     headerLoader
        anchors.topMargin:      _margins
        anchors.top:            parent.top
        anchors.left:           parent.left
Gus Grubba's avatar
Gus Grubba committed
39
        anchors.rightMargin:    _margins
40
        anchors.right:          floatIcon.left
Gus Grubba's avatar
Gus Grubba committed
41
        visible:                !ScreenTools.isShortScreen && headerLoader.sourceComponent !== null
42 43 44 45 46 47 48
    }

    Column {
        id:                     headingColumn
        anchors.topMargin:      _margins
        anchors.top:            parent.top
        anchors.left:           parent.left
Gus Grubba's avatar
Gus Grubba committed
49
        anchors.rightMargin:    _margins
50 51 52 53 54 55
        anchors.right:          floatIcon.left
        spacing:                _margins
        visible:                !ScreenTools.isShortScreen && headerLoader.sourceComponent === null
        QGCLabel {
            id:                 pageNameLabel
            font.pointSize:     ScreenTools.largeFontPointSize
Gus Grubba's avatar
Gus Grubba committed
56
            visible:            !poped
57 58 59 60 61 62 63 64 65
        }
        QGCLabel {
            id:                 pageDescriptionLabel
            anchors.left:       parent.left
            anchors.right:      parent.right
            wrapMode:           Text.WordWrap
        }
    }

66
    Item {
Gus Grubba's avatar
Gus Grubba committed
67
        id:                     mainContent
68 69 70 71 72
        anchors.topMargin:      ScreenTools.defaultFontPixelHeight
        anchors.top:            headerLoader.sourceComponent === null ? (headingColumn.visible ? headingColumn.bottom : parent.top) : headerLoader.bottom
        anchors.bottom:         parent.bottom
        anchors.left:           parent.left
        anchors.right:          parent.right
73
        clip:                   true
74 75 76
        Loader {
            id:                 pageLoader
        }
Don Gagne's avatar
Don Gagne committed
77
    }
78 79 80

    QGCColoredImage {
        id:                     floatIcon
Gus Grubba's avatar
Gus Grubba committed
81
        anchors.verticalCenter: headerLoader.visible ? headerLoader.verticalCenter : headingColumn.verticalCenter
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
        anchors.right:          parent.right
        width:                  ScreenTools.defaultFontPixelHeight * 2
        height:                 width
        sourceSize.width:       width
        source:                 "/qmlimages/FloatingWindow.svg"
        fillMode:               Image.PreserveAspectFit
        color:                  qgcPal.text
        visible:                !poped && !ScreenTools.isMobile
        MouseArea {
            anchors.fill: parent
            onClicked: {
                popout()
            }
        }
    }

Don Gagne's avatar
Don Gagne committed
98
}