GeneralSettings.qml 13.8 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
/*=====================================================================

 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 QtQuick.Controls.Styles  1.2
import QtQuick.Dialogs          1.1

import QGroundControl                       1.0
import QGroundControl.FactSystem            1.0
31
import QGroundControl.FactControls          1.0
dogmaphobic's avatar
dogmaphobic committed
32 33 34 35 36 37
import QGroundControl.Controls              1.0
import QGroundControl.ScreenTools           1.0
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.Palette               1.0

Rectangle {
38
    id:                 _generalRoot
39
    color:              qgcPal.window
40 41
    anchors.fill:       parent
    anchors.margins:    ScreenTools.defaultFontPixelWidth
dogmaphobic's avatar
dogmaphobic committed
42

43 44
    property Fact _percentRemainingAnnounce: QGroundControl.multiVehicleManager.disconnectedVehicle.battery.percentRemainingAnnounce

45
    QGCPalette { id: qgcPal }
dogmaphobic's avatar
dogmaphobic committed
46

Don Gagne's avatar
Don Gagne committed
47
    QGCFlickable {
dogmaphobic's avatar
dogmaphobic committed
48 49 50
        clip:               true
        anchors.fill:       parent
        contentHeight:      settingsColumn.height
Don Gagne's avatar
Don Gagne committed
51
        contentWidth:       settingsColumn.width
dogmaphobic's avatar
dogmaphobic committed
52 53 54 55

        Column {
            id:                 settingsColumn
            anchors.margins:    ScreenTools.defaultFontPixelWidth
56
            spacing:            ScreenTools.defaultFontPixelHeight / 2
Don Gagne's avatar
Don Gagne committed
57

dogmaphobic's avatar
dogmaphobic committed
58
            QGCLabel {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
59
                text:   qsTr("General Settings")
dogmaphobic's avatar
dogmaphobic committed
60 61
                font.pixelSize: ScreenTools.mediumFontPixelSize
            }
62 63 64 65 66
            Rectangle {
                height: 1
                width:  parent.width
                color:  qgcPal.button
            }
67 68
            Item {
                height: ScreenTools.defaultFontPixelHeight / 2
dogmaphobic's avatar
dogmaphobic committed
69 70
                width:  parent.width
            }
71

72 73 74 75 76 77 78 79 80
            //-----------------------------------------------------------------
            //-- Units

            Row {
                spacing:    ScreenTools.defaultFontPixelWidth

                QGCLabel {
                    id:                 distanceUnitsLabel
                    anchors.baseline:   distanceUnitsCombo.baseline
Tomaz Canabrava's avatar
Tomaz Canabrava committed
81
                    text:               qsTr("Distance units:")
82 83 84 85 86 87 88 89 90 91 92
                }

                FactComboBox {
                    id:         distanceUnitsCombo
                    width:      ScreenTools.defaultFontPixelWidth * 10
                    fact:       QGroundControl.distanceUnits
                    indexModel: false
                }

                QGCLabel {
                    anchors.baseline:   distanceUnitsCombo.baseline
Tomaz Canabrava's avatar
Tomaz Canabrava committed
93
                    text:               qsTr("(requires reboot to take affect)")
94 95 96 97 98 99 100 101 102 103
                }

            }

            Row {
                spacing:    ScreenTools.defaultFontPixelWidth

                QGCLabel {
                    anchors.baseline:   speedUnitsCombo.baseline
                    width:              distanceUnitsLabel.width
Tomaz Canabrava's avatar
Tomaz Canabrava committed
104
                    text:               qsTr("Speed units:")
105 106 107 108 109 110 111 112 113 114
                }

                FactComboBox {
                    id:         speedUnitsCombo
                    width:      ScreenTools.defaultFontPixelWidth * 20
                    fact:       QGroundControl.speedUnits
                    indexModel: false
                }

                QGCLabel {
115
                    anchors.baseline:   speedUnitsCombo.baseline
Tomaz Canabrava's avatar
Tomaz Canabrava committed
116
                    text:              qsTr("(requires reboot to take affect)")
117 118 119
                }
            }

dogmaphobic's avatar
dogmaphobic committed
120 121 122
            //-----------------------------------------------------------------
            //-- Audio preferences
            QGCCheckBox {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
123
                text:       qsTr("Mute all audio output")
dogmaphobic's avatar
dogmaphobic committed
124 125 126 127 128 129 130 131
                checked:    QGroundControl.isAudioMuted
                onClicked: {
                    QGroundControl.isAudioMuted = checked
                }
            }
            //-----------------------------------------------------------------
            //-- Prompt Save Log
            QGCCheckBox {
132
                id:         promptSaveLog
Tomaz Canabrava's avatar
Tomaz Canabrava committed
133
                text:       qsTr("Prompt to save Flight Data Log after each flight")
dogmaphobic's avatar
dogmaphobic committed
134 135 136 137 138 139 140
                checked:    QGroundControl.isSaveLogPrompt
                visible:    !ScreenTools.isMobile
                onClicked: {
                    QGroundControl.isSaveLogPrompt = checked
                }
            }
            //-----------------------------------------------------------------
141 142
            //-- Prompt Save even if not armed
            QGCCheckBox {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
143
                text:       qsTr("Prompt to save Flight Data Log even if vehicle was not armed")
144 145 146 147 148 149 150 151
                checked:    QGroundControl.isSaveLogPromptNotArmed
                visible:    !ScreenTools.isMobile
                enabled:    promptSaveLog.checked
                onClicked: {
                    QGroundControl.isSaveLogPromptNotArmed = checked
                }
            }
            //-----------------------------------------------------------------
dogmaphobic's avatar
dogmaphobic committed
152 153 154
            //-- Clear settings
            QGCCheckBox {
                id:         clearCheck
Tomaz Canabrava's avatar
Tomaz Canabrava committed
155
                text:       qsTr("Clear all settings on next start")
dogmaphobic's avatar
dogmaphobic committed
156 157 158 159 160 161 162 163 164
                checked:    false
                onClicked: {
                    checked ? clearDialog.visible = true : QGroundControl.clearDeleteAllSettingsNextBoot()
                }
                MessageDialog {
                    id:         clearDialog
                    visible:    false
                    icon:       StandardIcon.Warning
                    standardButtons: StandardButton.Yes | StandardButton.No
Tomaz Canabrava's avatar
Tomaz Canabrava committed
165 166
                    title:      qsTr("Clear Settings")
                    text:       qsTr("All saved settings will be reset the next time you start QGroundControl. Is this really what you want?")
dogmaphobic's avatar
dogmaphobic committed
167 168 169 170 171 172 173 174 175 176
                    onYes: {
                        QGroundControl.deleteAllSettingsNextBoot()
                        clearDialog.visible = false
                    }
                    onNo: {
                        clearCheck.checked  = false
                        clearDialog.visible = false
                    }
                }
            }
177 178 179 180 181 182 183 184
            //-----------------------------------------------------------------
            //-- Battery talker
            Row {
                spacing: ScreenTools.defaultFontPixelWidth

                QGCCheckBox {
                    id:                 announcePercentCheckbox
                    anchors.baseline:   announcePercent.baseline
Tomaz Canabrava's avatar
Tomaz Canabrava committed
185
                    text:               qsTr("Announce battery percent lower than:")
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
                    checked:            _percentRemainingAnnounce.value != 0

                    onClicked: {
                        if (checked) {
                            _percentRemainingAnnounce.value = _percentRemainingAnnounce.defaultValueString
                        } else {
                            _percentRemainingAnnounce.value = 0
                        }
                    }
                }

                FactTextField {
                    id:         announcePercent
                    fact:       _percentRemainingAnnounce
                    enabled:    announcePercentCheckbox.checked
                }
            }
203 204 205 206 207

            Item {
                height: ScreenTools.defaultFontPixelHeight / 2
                width:  parent.width
            }
dogmaphobic's avatar
dogmaphobic committed
208 209 210 211 212
            //-----------------------------------------------------------------
            //-- Map Providers
            Row {
                spacing:    ScreenTools.defaultFontPixelWidth
                QGCLabel {
213 214
                    anchors.baseline:   mapProviders.baseline
                    width:              ScreenTools.defaultFontPixelWidth * 16
Tomaz Canabrava's avatar
Tomaz Canabrava committed
215
                    text:               qsTr("Map Providers:")
dogmaphobic's avatar
dogmaphobic committed
216 217 218 219 220 221 222 223
                }
                QGCComboBox {
                    id:     mapProviders
                    width:  ScreenTools.defaultFontPixelWidth * 16
                    model:  QGroundControl.flightMapSettings.mapProviders
                    Component.onCompleted: {
                        var index = mapProviders.find(QGroundControl.flightMapSettings.mapProvider)
                        if (index < 0) {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
224
                            console.warn(qsTr("Active map provider not in combobox"), QGroundControl.flightMapSettings.mapProvider)
dogmaphobic's avatar
dogmaphobic committed
225 226 227 228 229 230 231
                        } else {
                            mapProviders.currentIndex = index
                        }
                    }
                    onActivated: {
                        if (index != -1) {
                            currentIndex = index
Tomaz Canabrava's avatar
Tomaz Canabrava committed
232
                            console.log(qsTr("New map provider: ") + model[index])
dogmaphobic's avatar
dogmaphobic committed
233 234 235 236 237 238 239 240 241 242
                            QGroundControl.flightMapSettings.mapProvider = model[index]
                        }
                    }
                }
            }
            //-----------------------------------------------------------------
            //-- Palette Styles
            Row {
                spacing:    ScreenTools.defaultFontPixelWidth
                QGCLabel {
243 244
                    anchors.baseline:   paletteCombo.baseline
                    width:              ScreenTools.defaultFontPixelWidth * 16
Tomaz Canabrava's avatar
Tomaz Canabrava committed
245
                    text:               qsTr("Style:")
dogmaphobic's avatar
dogmaphobic committed
246 247
                }
                QGCComboBox {
248
                    id: paletteCombo
dogmaphobic's avatar
dogmaphobic committed
249
                    width: ScreenTools.defaultFontPixelWidth * 16
Tomaz Canabrava's avatar
Tomaz Canabrava committed
250
                    model: [ qsTr("Indoor"), qsTr("Outdoor") ]
dogmaphobic's avatar
dogmaphobic committed
251 252 253 254 255 256 257 258 259
                    currentIndex: QGroundControl.isDarkStyle ? 0 : 1
                    onActivated: {
                        if (index != -1) {
                            currentIndex = index
                            QGroundControl.isDarkStyle = index === 0 ? true : false
                        }
                    }
                }
            }
Don Gagne's avatar
Don Gagne committed
260

261 262 263 264 265
            Item {
                height: ScreenTools.defaultFontPixelHeight / 2
                width:  parent.width
            }

Don Gagne's avatar
Don Gagne committed
266 267 268 269
            //-----------------------------------------------------------------
            //-- Autoconnect settings
            QGCLabel { text: "Autoconnect to the following devices:" }

270 271
            Row {
                spacing: ScreenTools.defaultFontPixelWidth * 2
Don Gagne's avatar
Don Gagne committed
272

273
                QGCCheckBox {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
274
                    text:       qsTr("Pixhawk")
275 276 277 278
                    visible:    !ScreenTools.isiOS
                    checked:    QGroundControl.linkManager.autoconnectPixhawk
                    onClicked:  QGroundControl.linkManager.autoconnectPixhawk = checked
                }
Don Gagne's avatar
Don Gagne committed
279

280
                QGCCheckBox {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
281
                    text:       qsTr("SiK Radio")
282 283 284 285
                    visible:    !ScreenTools.isiOS
                    checked:    QGroundControl.linkManager.autoconnect3DRRadio
                    onClicked:  QGroundControl.linkManager.autoconnect3DRRadio = checked
                }
Don Gagne's avatar
Don Gagne committed
286

287
                QGCCheckBox {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
288
                    text:       qsTr("PX4 Flow")
289 290 291 292 293 294
                    visible:    !ScreenTools.isiOS
                    checked:    QGroundControl.linkManager.autoconnectPX4Flow
                    onClicked:  QGroundControl.linkManager.autoconnectPX4Flow = checked
                }

                QGCCheckBox {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
295
                    text:       qsTr("UDP")
296 297 298
                    checked:    QGroundControl.linkManager.autoconnectUDP
                    onClicked:  QGroundControl.linkManager.autoconnectUDP = checked
                }
Don Gagne's avatar
Don Gagne committed
299
            }
300 301 302 303 304 305 306 307 308

            Item {
                height: ScreenTools.defaultFontPixelHeight / 2
                width:  parent.width
            }

            //-----------------------------------------------------------------
            //-- Virtual joystick settings
            QGCCheckBox {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
309
                text:       qsTr("Virtual Joystick")
310 311 312
                checked:    QGroundControl.virtualTabletJoystick
                onClicked:  QGroundControl.virtualTabletJoystick = checked
            }
313 314 315 316 317 318

            Item {
                height: ScreenTools.defaultFontPixelHeight / 2
                width:  parent.width
            }

319 320
            //-----------------------------------------------------------------
            //-- Offline mission editing settings
321 322 323 324
            Row {
                spacing: ScreenTools.defaultFontPixelWidth

                QGCLabel {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
325
                    text:               qsTr("Offline mission editing vehicle type:")
326 327 328 329 330 331 332 333 334 335
                    anchors.baseline:   offlineTypeCombo.baseline
                }

                FactComboBox {
                    id:         offlineTypeCombo
                    width:      ScreenTools.defaultFontPixelWidth * 25
                    fact:       QGroundControl.offlineEditingFirmwareType
                    indexModel: false
                }
            }
336 337 338 339 340 341 342 343 344

            Item {
                height: ScreenTools.defaultFontPixelHeight / 2
                width:  parent.width
            }

            //-----------------------------------------------------------------
            //-- Experimental Survey settings
            QGCCheckBox {
Tomaz Canabrava's avatar
Tomaz Canabrava committed
345
                text:       qsTr("Experimental Survey [WIP - no bugs reports please]")
346 347 348
                checked:    QGroundControl.experimentalSurvey
                onClicked:  QGroundControl.experimentalSurvey = checked
            }
dogmaphobic's avatar
dogmaphobic committed
349 350 351
        }
    }
}