Skip to content
AnalyzePage.qml 3.64 KiB
Newer Older
Don Gagne's avatar
Don Gagne committed
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
Don Gagne's avatar
Don Gagne committed
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

import QtQuick          2.3
import QtQuick.Controls 1.2
Don Gagne's avatar
Don Gagne committed

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
    anchors.fill:               parent
    anchors.margins:            ScreenTools.defaultFontPixelWidth

Don Gagne's avatar
Don Gagne committed
    property alias  pageComponent:      pageLoader.sourceComponent
    property alias  pageName:           pageNameLabel.text
    property alias  pageDescription:    pageDescriptionLabel.text
    property alias  headerComponent:    headerLoader.sourceComponent
    property real   availableWidth:     width  - pageLoader.x
Gus Grubba's avatar
Gus Grubba committed
    property real   availableHeight:    height - mainContent.y
    property bool   poped:              false
    property real   _margins:           ScreenTools.defaultFontPixelHeight * 0.5
    signal popout()

    Loader {
        id:                     headerLoader
        anchors.topMargin:      _margins
        anchors.top:            parent.top
        anchors.left:           parent.left
Gus Grubba's avatar
Gus Grubba committed
        anchors.rightMargin:    _margins
        anchors.right:          floatIcon.left
Gus Grubba's avatar
Gus Grubba committed
        visible:                !ScreenTools.isShortScreen && headerLoader.sourceComponent !== null
    }

    Column {
        id:                     headingColumn
        anchors.topMargin:      _margins
        anchors.top:            parent.top
        anchors.left:           parent.left
Gus Grubba's avatar
Gus Grubba committed
        anchors.rightMargin:    _margins
        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
            visible:            !poped
        }
        QGCLabel {
            id:                 pageDescriptionLabel
            anchors.left:       parent.left
            anchors.right:      parent.right
            wrapMode:           Text.WordWrap
        }
    }

Gus Grubba's avatar
Gus Grubba committed
        id:                     mainContent
        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
        clip:                   true
Don Gagne's avatar
Don Gagne committed
    }

    QGCColoredImage {
        id:                     floatIcon
Gus Grubba's avatar
Gus Grubba committed
        anchors.verticalCenter: headerLoader.visible ? headerLoader.verticalCenter : headingColumn.verticalCenter
        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
}