MainWindowLeftPanel.qml 8.68 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
/*=====================================================================

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

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

import QtQuick          2.5
import QtQuick.Controls 1.2
import QtPositioning    5.2

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


//-- Left Menu
Item {
37
    id:             settingsMenu
dogmaphobic's avatar
dogmaphobic committed
38 39
    anchors.fill:   parent

dogmaphobic's avatar
dogmaphobic committed
40 41 42
    readonly property real __closeButtonSize:   ScreenTools.defaultFontPixelHeight * 1.5
    readonly property real _margins:            ScreenTools.defaultFontPixelHeight * 0.5
    readonly property real _buttonHeight:       ScreenTools.isTinyScreen ? ScreenTools.defaultFontPixelHeight * 3 : ScreenTools.defaultFontPixelHeight * 2
dogmaphobic's avatar
dogmaphobic committed
43

44 45
    QGCPalette { id: qgcPal }

46 47 48 49 50
    Component.onCompleted: {
        //-- Default to General Settings
        __rightPanel.source = "GeneralSettings.qml"
        _generalButton.checked = true
        panelActionGroup.current = _generalButton
dogmaphobic's avatar
dogmaphobic committed
51 52 53 54 55 56 57 58 59
    }

    // This covers the screen with a transparent section
    Rectangle {
        id:             __transparentSection
        height:         parent.height - toolBar.height
        anchors.bottom: parent.bottom
        anchors.left:   parent.left
        opacity:        0.0
60
        color:          qgcPal.window
dogmaphobic's avatar
dogmaphobic committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
        visible:        __rightPanel.source == ""
    }

    //-- Top Separator
    Rectangle {
        id:             __topSeparator
        width:          parent.width
        height:         1
        y:              toolBar.height
        anchors.left:   parent.left
        color:          QGroundControl.isDarkStyle ? "#909090" : "#7f7f7f"
    }

    // This is the menu dialog panel which is anchored to the left edge
    Rectangle {
        id:             __leftMenu
77
        width:          ScreenTools.defaultFontPixelWidth * 16
dogmaphobic's avatar
dogmaphobic committed
78 79 80
        anchors.left:   parent.left
        anchors.top:    __topSeparator.bottom
        anchors.bottom: parent.bottom
81
        color:          qgcPal.windowShadeDark
dogmaphobic's avatar
dogmaphobic committed
82

Don Gagne's avatar
Don Gagne committed
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
        QGCFlickable {
            anchors.fill:       parent
            contentHeight:      buttonColumn.height + _margins
            flickableDirection: Flickable.VerticalFlick
            clip:               true

            ExclusiveGroup { id: panelActionGroup }

            Column {
                id:                     buttonColumn
                anchors.leftMargin:     _margins
                anchors.rightMargin:    _margins
                anchors.left:           parent.left
                anchors.right:          parent.right
                anchors.topMargin:      _margins
                anchors.top:            parent.top
99
                spacing:                ScreenTools.defaultFontPixelHeight * 0.5
Don Gagne's avatar
Don Gagne committed
100 101

                QGCLabel {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
102
                    text:           qsTr("Preferences")
Don Gagne's avatar
Don Gagne committed
103 104
                    anchors.horizontalCenter: parent.horizontalCenter
                }
dogmaphobic's avatar
dogmaphobic committed
105

Don Gagne's avatar
Don Gagne committed
106
                QGCButton {
107
                    id:             _generalButton
dogmaphobic's avatar
dogmaphobic committed
108
                    height:         _buttonHeight
Don Gagne's avatar
Don Gagne committed
109 110
                    anchors.left:   parent.left
                    anchors.right:  parent.right
Tomaz Canabrava's avatar
Tomaz Canabrava committed
111
                    text:           qsTr("General")
Don Gagne's avatar
Don Gagne committed
112 113 114 115 116 117
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "GeneralSettings.qml") {
                            __rightPanel.source = "GeneralSettings.qml"
                        }
                        checked = true
dogmaphobic's avatar
dogmaphobic committed
118 119
                    }
                }
Don Gagne's avatar
Don Gagne committed
120 121

                QGCButton {
dogmaphobic's avatar
dogmaphobic committed
122
                    height:         _buttonHeight
Don Gagne's avatar
Don Gagne committed
123 124
                    anchors.left:   parent.left
                    anchors.right:  parent.right
Tomaz Canabrava's avatar
Tomaz Canabrava committed
125
                    text:           qsTr("Comm Links")
Don Gagne's avatar
Don Gagne committed
126 127 128 129 130 131
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "LinkSettings.qml") {
                            __rightPanel.source = "LinkSettings.qml"
                        }
                        checked = true
132 133
                    }
                }
Don Gagne's avatar
Don Gagne committed
134 135

                QGCButton {
dogmaphobic's avatar
dogmaphobic committed
136
                    height:         _buttonHeight
Don Gagne's avatar
Don Gagne committed
137 138
                    anchors.left:   parent.left
                    anchors.right:  parent.right
Tomaz Canabrava's avatar
Tomaz Canabrava committed
139
                    text:           qsTr("Offline Maps")
Don Gagne's avatar
Don Gagne committed
140 141 142 143 144 145
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "OfflineMap.qml") {
                            __rightPanel.source = "OfflineMap.qml"
                        }
                        checked = true
dogmaphobic's avatar
dogmaphobic committed
146 147
                    }
                }
Don Gagne's avatar
Don Gagne committed
148 149

                QGCButton {
dogmaphobic's avatar
dogmaphobic committed
150
                    height:         _buttonHeight
Don Gagne's avatar
Don Gagne committed
151 152
                    anchors.left:   parent.left
                    anchors.right:  parent.right
Tomaz Canabrava's avatar
Tomaz Canabrava committed
153
                    text:           qsTr("MavLink")
Don Gagne's avatar
Don Gagne committed
154 155 156 157 158 159
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "MavlinkSettings.qml") {
                            __rightPanel.source = "MavlinkSettings.qml"
                        }
                        checked = true
dogmaphobic's avatar
dogmaphobic committed
160 161
                    }
                }
Don Gagne's avatar
Don Gagne committed
162

163
                QGCButton {
dogmaphobic's avatar
dogmaphobic committed
164
                    height:         _buttonHeight
165 166
                    anchors.left:   parent.left
                    anchors.right:  parent.right
167
                    text:           qsTr("Console")
168 169 170 171 172 173 174 175 176
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "QGroundControl/Controls/AppMessages.qml") {
                            __rightPanel.source = "QGroundControl/Controls/AppMessages.qml"
                        }
                        checked = true
                    }
                }

Don Gagne's avatar
Don Gagne committed
177
                QGCButton {
dogmaphobic's avatar
dogmaphobic committed
178
                    height:         _buttonHeight
Don Gagne's avatar
Don Gagne committed
179 180
                    anchors.left:   parent.left
                    anchors.right:  parent.right
Tomaz Canabrava's avatar
Tomaz Canabrava committed
181
                    text:           qsTr("Mock Link")
Don Gagne's avatar
Don Gagne committed
182 183 184 185 186 187 188
                    visible:        ScreenTools.isDebug
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "MockLink.qml") {
                            __rightPanel.source = "MockLink.qml"
                        }
                        checked = true
189 190
                    }
                }
Don Gagne's avatar
Don Gagne committed
191 192

                QGCButton {
dogmaphobic's avatar
dogmaphobic committed
193
                    height:         _buttonHeight
Don Gagne's avatar
Don Gagne committed
194 195
                    anchors.left:   parent.left
                    anchors.right:  parent.right
Tomaz Canabrava's avatar
Tomaz Canabrava committed
196
                    text:           qsTr("Debug")
Don Gagne's avatar
Don Gagne committed
197 198 199 200 201 202 203
                    visible:        ScreenTools.isDebug
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "DebugWindow.qml") {
                            __rightPanel.source = "DebugWindow.qml"
                        }
                        checked = true
dogmaphobic's avatar
dogmaphobic committed
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
                    }
                }
            }
        }
    }

    //-- Vertical Separator
    Rectangle {
        id:             __verticalSeparator
        width:          1
        height:         parent.height - toolBar.height
        anchors.left:   __leftMenu.right
        anchors.bottom: parent.bottom
        color:          QGroundControl.isDarkStyle ? "#909090" : "#7f7f7f"
    }

    //-- Main Setting Display Area
    Rectangle {
222
        id:             settingDisplayArea
dogmaphobic's avatar
dogmaphobic committed
223 224 225 226 227
        anchors.left:   __verticalSeparator.right
        width:          mainWindow.width - __leftMenu.width - __verticalSeparator.width
        height:         parent.height - toolBar.height - __topSeparator.height
        anchors.bottom: parent.bottom
        visible:        __rightPanel.source != ""
228
        color:          qgcPal.window
dogmaphobic's avatar
dogmaphobic committed
229 230 231 232 233 234 235
        //-- Panel Contents
        Loader {
            id:             __rightPanel
            anchors.fill:   parent
        }
    }
}