MainToolBar.qml 6.34 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.
 *
 ****************************************************************************/
dogmaphobic's avatar
dogmaphobic committed
9

10 11 12
import QtQuick          2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts  1.11
dogmaphobic's avatar
dogmaphobic committed
13

Don Gagne's avatar
Don Gagne committed
14
import QGroundControl                       1.0
15 16 17 18
import QGroundControl.Controls              1.0
import QGroundControl.Palette               1.0
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.ScreenTools           1.0
19
import QGroundControl.Controllers           1.0
dogmaphobic's avatar
dogmaphobic committed
20

21
Item {
22
    id:         toolBar
Don Gagne's avatar
Don Gagne committed
23

dogmaphobic's avatar
dogmaphobic committed
24 25 26 27
    Component.onCompleted: {
        //-- TODO: Get this from the actual state
        flyButton.checked = true
    }
28

Don Gagne's avatar
Don Gagne committed
29
    /// Bottom single pixel divider
30 31 32 33 34 35
    Rectangle {
        anchors.left:   parent.left
        anchors.right:  parent.right
        anchors.bottom: parent.bottom
        height:         1
        color:          "black"
36
        visible:        qgcPal.globalTheme === QGCPalette.Light
dogmaphobic's avatar
dogmaphobic committed
37 38
    }

Don Gagne's avatar
Don Gagne committed
39
    RowLayout {
40
        anchors.bottomMargin:   1
Don Gagne's avatar
Don Gagne committed
41 42
        anchors.rightMargin:    ScreenTools.defaultFontPixelWidth / 2
        anchors.fill:           parent
Don Gagne's avatar
Don Gagne committed
43
        spacing:                ScreenTools.defaultFontPixelWidth * 2
Don Gagne's avatar
Don Gagne committed
44

45 46 47 48
        ButtonGroup {
            buttons:            viewRow.children
        }

Don Gagne's avatar
Don Gagne committed
49 50 51
        //---------------------------------------------
        // Toolbar Row
        Row {
52 53 54
            id:                 viewRow
            Layout.fillHeight:  true
            spacing:            ScreenTools.defaultFontPixelWidth / 2
Don Gagne's avatar
Don Gagne committed
55 56 57 58 59

            QGCToolBarButton {
                id:                 settingsButton
                anchors.top:        parent.top
                anchors.bottom:     parent.bottom
60
                icon.source:        "/res/QGCLogoWhite"
Don Gagne's avatar
Don Gagne committed
61 62
                logo:               true
                visible:            !QGroundControl.corePlugin.options.combineSettingsAndSetup
63 64 65 66
                onClicked: {
                    checked = true
                    mainWindow.showSettingsView()
                }
Don Gagne's avatar
Don Gagne committed
67
            }
68

Don Gagne's avatar
Don Gagne committed
69 70 71 72
            QGCToolBarButton {
                id:                 setupButton
                anchors.top:        parent.top
                anchors.bottom:     parent.bottom
73 74 75 76 77
                icon.source:        "/qmlimages/Gears.svg"
                onClicked: {
                    checked = true
                    mainWindow.showSetupView()
                }
Don Gagne's avatar
Don Gagne committed
78
            }
79

Don Gagne's avatar
Don Gagne committed
80 81 82 83
            QGCToolBarButton {
                id:                 planButton
                anchors.top:        parent.top
                anchors.bottom:     parent.bottom
84 85 86 87 88
                icon.source:        "/qmlimages/Plan.svg"
                onClicked: {
                    checked = true
                    mainWindow.showPlanView()
                }
Don Gagne's avatar
Don Gagne committed
89
            }
Don Gagne's avatar
Don Gagne committed
90

Don Gagne's avatar
Don Gagne committed
91 92 93 94
            QGCToolBarButton {
                id:                 flyButton
                anchors.top:        parent.top
                anchors.bottom:     parent.bottom
95 96 97 98 99
                icon.source:        "/qmlimages/PaperPlane.svg"
                onClicked: {
                    checked = true
                    mainWindow.showFlyView()
                }
Don Gagne's avatar
Don Gagne committed
100
            }
Don Gagne's avatar
Don Gagne committed
101

Don Gagne's avatar
Don Gagne committed
102 103 104 105
            QGCToolBarButton {
                id:                 analyzeButton
                anchors.top:        parent.top
                anchors.bottom:     parent.bottom
106
                icon.source:        "/qmlimages/Analyze.svg"
107
                visible:            QGroundControl.corePlugin.showAdvancedUI
108 109 110 111
                onClicked: {
                    checked = true
                    mainWindow.showAnalyzeView()
                }
Don Gagne's avatar
Don Gagne committed
112
            }
Don Gagne's avatar
Don Gagne committed
113 114 115 116 117 118 119

            Rectangle {
                anchors.margins:    ScreenTools.defaultFontPixelHeight / 2
                anchors.top:        parent.top
                anchors.bottom:     parent.bottom
                width:              1
                color:              qgcPal.text
120
                visible:            activeVehicle
Don Gagne's avatar
Don Gagne committed
121
            }
122 123
        }

124 125 126 127
        Loader {
            id:                 toolbarIndicators
            height:             parent.height
            source:             "/toolbar/MainToolBarIndicators.qml"
Don Gagne's avatar
Don Gagne committed
128
            Layout.fillWidth:   true
129
        }
dogmaphobic's avatar
dogmaphobic committed
130
    }
dogmaphobic's avatar
dogmaphobic committed
131

132
    // Small parameter download progress bar
133
    Rectangle {
dogmaphobic's avatar
dogmaphobic committed
134 135
        anchors.bottom: parent.bottom
        height:         toolBar.height * 0.05
136
        width:          activeVehicle ? activeVehicle.parameterManager.loadProgress * parent.width : 0
137
        color:          qgcPal.colorGreen
138 139 140 141 142 143 144 145 146 147 148 149 150
        visible:        !largeProgressBar.visible
    }

    // Large parameter download progress bar
    Rectangle {
        id:             largeProgressBar
        anchors.bottom: parent.bottom
        anchors.left:   parent.left
        anchors.right:  parent.right
        height:         parent.height
        color:          qgcPal.window
        visible:        _showLargeProgress

151
        property bool _initialDownloadComplete: activeVehicle ? activeVehicle.parameterManager.parametersReady : true
152 153 154 155 156 157 158 159 160 161 162
        property bool _userHide:                false
        property bool _showLargeProgress:       !_initialDownloadComplete && !_userHide && qgcPal.globalTheme === QGCPalette.Light

        Connections {
            target:                 QGroundControl.multiVehicleManager
            onActiveVehicleChanged: largeProgressBar._userHide = false
        }

        Rectangle {
            anchors.top:    parent.top
            anchors.bottom: parent.bottom
163
            width:          activeVehicle ? activeVehicle.parameterManager.loadProgress * parent.width : 0
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
            color:          qgcPal.colorGreen
        }

        QGCLabel {
            anchors.centerIn:   parent
            text:               qsTr("Downloading Parameters")
            font.pointSize:     ScreenTools.largeFontPointSize
        }

        QGCLabel {
            anchors.margins:    _margin
            anchors.right:      parent.right
            anchors.bottom:     parent.bottom
            text:               qsTr("Click anywhere to hide")

            property real _margin: ScreenTools.defaultFontPixelWidth / 2
        }

        MouseArea {
            anchors.fill:   parent
            onClicked:      largeProgressBar._userHide = true
        }
186
    }
187
}