MainWindowLeftPanel.qml 8.12 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 13 14 15 16 17 18 19 20 21 22 23


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 {
24
    id:             settingsMenu
dogmaphobic's avatar
dogmaphobic committed
25 26
    anchors.fill:   parent

dogmaphobic's avatar
dogmaphobic committed
27 28 29
    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
30

31 32
    QGCPalette { id: qgcPal }

33 34 35 36 37
    Component.onCompleted: {
        //-- Default to General Settings
        __rightPanel.source = "GeneralSettings.qml"
        _generalButton.checked = true
        panelActionGroup.current = _generalButton
dogmaphobic's avatar
dogmaphobic committed
38 39 40 41 42 43 44 45 46
    }

    // 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
47
        color:          qgcPal.window
dogmaphobic's avatar
dogmaphobic committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
        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
64
        width:          ScreenTools.defaultFontPixelWidth * 16
dogmaphobic's avatar
dogmaphobic committed
65 66 67
        anchors.left:   parent.left
        anchors.top:    __topSeparator.bottom
        anchors.bottom: parent.bottom
68
        color:          qgcPal.windowShadeDark
dogmaphobic's avatar
dogmaphobic committed
69

Don Gagne's avatar
Don Gagne committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
        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
86
                spacing:                ScreenTools.defaultFontPixelHeight * 0.5
Don Gagne's avatar
Don Gagne committed
87 88

                QGCLabel {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
89
                    text:           qsTr("Preferences")
Don Gagne's avatar
Don Gagne committed
90 91
                    anchors.horizontalCenter: parent.horizontalCenter
                }
dogmaphobic's avatar
dogmaphobic committed
92

Don Gagne's avatar
Don Gagne committed
93
                QGCButton {
94
                    id:             _generalButton
dogmaphobic's avatar
dogmaphobic committed
95
                    height:         _buttonHeight
Don Gagne's avatar
Don Gagne committed
96 97
                    anchors.left:   parent.left
                    anchors.right:  parent.right
Tomaz Canabrava's avatar
Tomaz Canabrava committed
98
                    text:           qsTr("General")
Don Gagne's avatar
Don Gagne committed
99 100 101 102 103 104
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "GeneralSettings.qml") {
                            __rightPanel.source = "GeneralSettings.qml"
                        }
                        checked = true
dogmaphobic's avatar
dogmaphobic committed
105 106
                    }
                }
Don Gagne's avatar
Don Gagne committed
107 108

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

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

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

150
                QGCButton {
dogmaphobic's avatar
dogmaphobic committed
151
                    height:         _buttonHeight
152 153
                    anchors.left:   parent.left
                    anchors.right:  parent.right
154
                    text:           qsTr("Console")
155 156 157 158 159 160 161 162 163
                    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
164
                QGCButton {
dogmaphobic's avatar
dogmaphobic committed
165
                    height:         _buttonHeight
Don Gagne's avatar
Don Gagne committed
166 167
                    anchors.left:   parent.left
                    anchors.right:  parent.right
Tomaz Canabrava's avatar
Tomaz Canabrava committed
168
                    text:           qsTr("Mock Link")
Don Gagne's avatar
Don Gagne committed
169 170 171 172 173 174 175
                    visible:        ScreenTools.isDebug
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "MockLink.qml") {
                            __rightPanel.source = "MockLink.qml"
                        }
                        checked = true
176 177
                    }
                }
Don Gagne's avatar
Don Gagne committed
178 179

                QGCButton {
dogmaphobic's avatar
dogmaphobic committed
180
                    height:         _buttonHeight
Don Gagne's avatar
Don Gagne committed
181 182
                    anchors.left:   parent.left
                    anchors.right:  parent.right
Tomaz Canabrava's avatar
Tomaz Canabrava committed
183
                    text:           qsTr("Debug")
Don Gagne's avatar
Don Gagne committed
184 185 186 187 188 189 190
                    visible:        ScreenTools.isDebug
                    exclusiveGroup: panelActionGroup
                    onClicked: {
                        if(__rightPanel.source != "DebugWindow.qml") {
                            __rightPanel.source = "DebugWindow.qml"
                        }
                        checked = true
dogmaphobic's avatar
dogmaphobic committed
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
                    }
                }
            }
        }
    }

    //-- 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 {
209
        id:             settingDisplayArea
dogmaphobic's avatar
dogmaphobic committed
210 211 212 213 214
        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 != ""
215
        color:          qgcPal.window
dogmaphobic's avatar
dogmaphobic committed
216 217 218 219 220 221 222
        //-- Panel Contents
        Loader {
            id:             __rightPanel
            anchors.fill:   parent
        }
    }
}