AirmapSettings.qml 11.9 KB
Newer Older
Gus Grubba's avatar
Gus Grubba 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 37
/****************************************************************************
 *
 *   (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.
 *
 ****************************************************************************/


import QtQuick                  2.3
import QtQuick.Controls         1.2
import QtQuick.Controls.Styles  1.4
import QtQuick.Dialogs          1.2
import QtMultimedia             5.5
import QtQuick.Layouts          1.2

import QGroundControl                       1.0
import QGroundControl.FactSystem            1.0
import QGroundControl.FactControls          1.0
import QGroundControl.Controls              1.0
import QGroundControl.ScreenTools           1.0
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.Palette               1.0
import QGroundControl.Controllers           1.0
import QGroundControl.SettingsManager       1.0

QGCView {
    id:                 _qgcView
    viewPanel:          panel
    color:              qgcPal.window
    anchors.fill:       parent
    anchors.margins:    ScreenTools.defaultFontPixelWidth

    property real _labelWidth:                  ScreenTools.defaultFontPixelWidth * 20
    property real _editFieldWidth:              ScreenTools.defaultFontPixelWidth * 30
    property real _panelWidth:                  _qgcView.width * _internalWidthRatio
Gus Grubba's avatar
Gus Grubba committed
38
    property Fact _enableAirMapFact:            QGroundControl.settingsManager.airMapSettings.enableAirMap
Gus Grubba's avatar
Gus Grubba committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
    property bool _airMapEnabled:               _enableAirMapFact.rawValue

    readonly property real _internalWidthRatio:          0.8

    QGCPalette { id: qgcPal }

    QGCViewPanel {
        id:             panel
        anchors.fill:   parent
        QGCFlickable {
            clip:               true
            anchors.fill:       parent
            contentHeight:      settingsColumn.height
            contentWidth:       settingsColumn.width
            Column {
                id:                 settingsColumn
                width:              _qgcView.width
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                anchors.margins:    ScreenTools.defaultFontPixelWidth
                //-----------------------------------------------------------------
                //-- General
                Item {
                    width:                      _panelWidth
                    height:                     generalLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.unitsSettings.visible
                    QGCLabel {
                        id:             generalLabel
                        text:           qsTr("General")
                        font.family:    ScreenTools.demiboldFontFamily
                    }
                }
                Rectangle {
                    height:                     generalCol.height + (ScreenTools.defaultFontPixelHeight * 2)
                    width:                      _panelWidth
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    Column {
                        id:             generalCol
                        spacing:        ScreenTools.defaultFontPixelWidth
                        anchors.centerIn: parent
                        FactCheckBox {
                            text:       qsTr("Enable AirMap Services")
                            fact:       _enableAirMapFact
                            visible:    _enableAirMapFact.visible
                        }
Gus Grubba's avatar
Gus Grubba committed
87 88 89 90
                        FactCheckBox {
                            text:       qsTr("Enable Telemetry")
                            fact:       _enableTelemetryFact
                            visible:    _enableTelemetryFact.visible
Gus Grubba's avatar
Gus Grubba committed
91
                            enabled:    _airMapEnabled
Gus Grubba's avatar
Gus Grubba committed
92
                            property Fact _enableTelemetryFact: QGroundControl.settingsManager.airMapSettings.enableTelemetry
Gus Grubba's avatar
Gus Grubba committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
                        }
                    }
                }
                //-----------------------------------------------------------------
                //-- Login / Registration
                Item {
                    width:                      _panelWidth
                    height:                     loginLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    QGCLabel {
                        id:             loginLabel
                        text:           qsTr("Login / Registration")
                        font.family:    ScreenTools.demiboldFontFamily
                    }
                }
                Rectangle {
                    height:                     loginGrid.height + (ScreenTools.defaultFontPixelHeight * 2)
                    width:                      _panelWidth
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    GridLayout {
                        id:                 loginGrid
                        columns:            2
                        rowSpacing:         ScreenTools.defaultFontPixelHeight * 0.25
                        anchors.centerIn:   parent
                        QGCLabel { text: qsTr("Email:") }
Gus Grubba's avatar
Gus Grubba committed
121 122 123 124 125
                        FactTextField {
                            fact:           _loginEmailFact
                            enabled:        _airMapEnabled
                            visible:        _loginEmailFact.visible
                            property Fact _loginEmailFact: QGroundControl.settingsManager.airMapSettings.loginEmail
Gus Grubba's avatar
Gus Grubba committed
126 127
                        }
                        QGCLabel { text: qsTr("Password:") }
Gus Grubba's avatar
Gus Grubba committed
128 129 130 131 132
                        FactTextField {
                            fact:           _loginPasswordFact
                            enabled:        _airMapEnabled
                            visible:        _loginPasswordFact.visible
                            property Fact _loginPasswordFact: QGroundControl.settingsManager.airMapSettings.loginPassword
Gus Grubba's avatar
Gus Grubba committed
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
                        }
                        Item {
                            width:  1
                            height: 1
                            Layout.columnSpan: 2
                        }
                        QGCLabel {
                            text:   qsTr("Forgot Your AirMap Password?")
                            Layout.alignment:  Qt.AlignHCenter
                            Layout.columnSpan: 2
                        }
                        Item {
                            width:  1
                            height: 1
                            Layout.columnSpan: 2
                        }
                        QGCButton {
                            text:   qsTr("Register for an AirMap Account")
                            Layout.alignment:  Qt.AlignHCenter
                            Layout.columnSpan: 2
                            enabled:           _airMapEnabled
Gus Grubba's avatar
Gus Grubba committed
154 155 156
                            onClicked: {
                                Qt.openUrlExternally("https://www.airmap.com");
                            }
Gus Grubba's avatar
Gus Grubba committed
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
                        }
                    }
                }
                //-----------------------------------------------------------------
                //-- Pilot Profile
                Item {
                    width:                      _panelWidth
                    height:                     profileLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.appSettings.visible
                    QGCLabel {
                        id:             profileLabel
                        text:           qsTr("Pilot Profile")
                        font.family:    ScreenTools.demiboldFontFamily
                    }
                }
                Rectangle {
                    height:                     profileGrid.height + (ScreenTools.defaultFontPixelHeight * 2)
                    width:                      _panelWidth
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    GridLayout {
                        id:                 profileGrid
                        columns:            2
                        columnSpacing:      ScreenTools.defaultFontPixelHeight * 2
                        rowSpacing:         ScreenTools.defaultFontPixelWidth  * 0.25
                        anchors.centerIn:   parent
                        QGCLabel { text: qsTr("Name:") }
                        QGCLabel { text: qsTr("John Doe") }
                        QGCLabel { text: qsTr("User Name:") }
                        QGCLabel { text: qsTr("joe36") }
                        QGCLabel { text: qsTr("Email:") }
                        QGCLabel { text: qsTr("jonh@doe.com") }
                        QGCLabel { text: qsTr("Phone:") }
                        QGCLabel { text: qsTr("+1 212 555 1212") }
                    }
                }
Gus Grubba's avatar
Gus Grubba committed
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
                //-----------------------------------------------------------------
                //-- License (Will this stay here?)
                Item {
                    width:                      _panelWidth
                    height:                     licenseLabel.height
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    visible:                    QGroundControl.settingsManager.appSettings.visible
                    QGCLabel {
                        id:             licenseLabel
                        text:           qsTr("License")
                        font.family:    ScreenTools.demiboldFontFamily
                    }
                }
                Rectangle {
                    height:                     licenseGrid.height + (ScreenTools.defaultFontPixelHeight * 2)
                    width:                      _panelWidth
                    color:                      qgcPal.windowShade
                    anchors.margins:            ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter:   parent.horizontalCenter
                    GridLayout {
                        id:                 licenseGrid
                        columns:            2
                        columnSpacing:      ScreenTools.defaultFontPixelHeight * 2
                        rowSpacing:         ScreenTools.defaultFontPixelWidth  * 0.25
                        anchors.centerIn:   parent
                        QGCLabel        { text: qsTr("API Key:") }
                        FactTextField   { fact: QGroundControl.settingsManager.airMapSettings.apiKey; }
                        QGCLabel        { text: qsTr("Client ID:") }
                        FactTextField   { fact: QGroundControl.settingsManager.airMapSettings.clientID; }
                        QGCLabel        { text: qsTr("User Name:") }
                        FactTextField   { fact: QGroundControl.settingsManager.airMapSettings.userName; }
                        QGCLabel        { text: qsTr("Password:") }
                        FactTextField   { fact: QGroundControl.settingsManager.airMapSettings.password; echoMode: TextInput.Password }
                    }
                }
Gus Grubba's avatar
Gus Grubba committed
232 233 234 235
            }
        }
    }
}