SettingsSipAccountsEdit.qml 5.04 KB
Newer Older
1 2 3 4 5 6
import QtQuick 2.7

import Common 1.0

import App.Styles 1.0

7 8
import 'SettingsSipAccountsEdit.js' as Logic

9 10
// =============================================================================

11 12 13 14 15
DialogPlus {
  id: dialog

  property var account // Optional.

16 17 18 19
  property bool _sipAddressOk: false
  property bool _serverAddressOk: false
  property bool _routeOk: false

20 21 22 23 24 25 26
  buttons: [
    TextButtonA {
      text: qsTr('cancel')

      onClicked: exit(0)
    },
    TextButtonB {
27
      enabled: Logic.formIsValid()
28 29
      text: qsTr('confirm')

30
      onClicked: Logic.validProxyConfig()
31 32 33 34
    }
  ]

  centeredButtons: true
35

36 37 38 39 40 41
  height: SettingsSipAccountsEditStyle.height
  width: SettingsSipAccountsEditStyle.width

  // ---------------------------------------------------------------------------

  Component.onCompleted: Logic.initForm(account)
42 43 44

  // ---------------------------------------------------------------------------

45
  TabContainer {
46 47
    anchors.fill: parent

48 49
    Column {
      width: parent.width
50

51 52 53
      Form {
        title: qsTr('mainSipAccountSettingsTitle')
        width: parent.width
54

55 56 57
        FormLine {
          FormGroup {
            label: qsTr('sipAddressLabel') + '*'
58

59 60
            TextField {
              id: sipAddress
61

62 63 64 65 66
              error: dialog._sipAddressOk ? '' : qsTr('invalidSipAddress')

              onTextChanged: Logic.handleSipAddressChanged(text)
            }
          }
67 68
        }

69 70 71
        FormLine {
          FormGroup {
            label: qsTr('serverAddressLabel') + '*'
72

73 74
            TextField {
              id: serverAddress
75

76
              error: dialog._serverAddressOk ? '' : qsTr('invalidServerAddress')
77

78 79 80
              onTextChanged: Logic.handleServerAddressChanged(text)
            }
          }
81 82
        }

83 84 85
        FormLine {
          FormGroup {
            label: qsTr('registrationDurationLabel')
86

87 88 89 90
            NumericField {
              id: registrationDuration
            }
          }
91 92
        }

93 94 95
        FormLine {
          FormGroup {
            label: qsTr('transportLabel')
96

97 98
            ComboBox {
              id: transport
99

100 101
              enabled: dialog._serverAddressOk
              model: [ 'UDP', 'TCP', 'TLS', 'DTLS' ]
102

103 104 105
              onActivated: Logic.handleTransportChanged(model[index])
            }
          }
106 107
        }

108 109 110
        FormLine {
          FormGroup {
            label: qsTr('routeLabel')
111

112 113
            TextField {
              id: route
114

115
              error: dialog._routeOk ? '' : qsTr('invalidRoute')
116

117 118 119
              onTextChanged: Logic.handleRouteChanged(text)
            }
          }
120 121
        }

122 123 124
        FormLine {
          FormGroup {
            label: qsTr('contactParamsLabel')
125

126 127 128 129
            TextField {
              id: contactParams
            }
          }
130
        }
131

132 133 134
        FormLine {
          FormGroup {
            label: qsTr('avpfIntervalLabel')
135

136 137
            NumericField {
              id: avpfInterval
138

139 140 141 142
              maxValue: 5
              minValue: 1
            }
          }
143 144
        }

145 146 147
        FormLine {
          FormGroup {
            label: qsTr('registerEnabledLabel')
148

149 150
            Switch {
              id: registerEnabled
151

152 153 154
              onClicked: checked = !checked
            }
          }
155 156
        }

157 158 159
        FormLine {
          FormGroup {
            label: qsTr('publishPresenceLabel')
160

161 162
            Switch {
              id: publishPresence
163

164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
              onClicked: checked = !checked
            }
          }
        }

        FormLine {
          FormGroup {
            label: qsTr('avpfEnabledLabel')

            Switch {
              id: avpfEnabled

              onClicked: checked = !checked
            }
          }
179 180 181
        }
      }

182 183 184 185 186 187 188 189 190 191 192 193 194 195 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 232 233 234 235 236 237
      // -----------------------------------------------------------------------
      // NAT and Firewall.
      // -----------------------------------------------------------------------

      Form {
        title: qsTr('natAndFirewallTitle')
        width: parent.width

        FormLine {
          FormGroup {
            label: qsTr('enableIceLabel')

            Switch {
              id: iceEnabled

              onClicked: checked = !checked
            }
          }

          FormGroup {
            label: qsTr('stunServerLabel')

            TextField {
              id: stunServer

              readOnly: !iceEnabled.checked
            }
          }
        }

        FormLine {
          FormGroup {
            label: qsTr('enableTurnLabel')

            Switch {
              id: turnEnabled

              enabled: iceEnabled.checked

              onClicked: checked = !checked
            }
          }

          FormGroup {
            label: qsTr('turnUserLabel')

            TextField {
              id: turnUser

              readOnly: !turnEnabled.checked || !turnEnabled.enabled
            }
          }
        }

        FormLine {
          FormGroup {}
238

239 240
          FormGroup {
            label: qsTr('turnPasswordLabel')
241

242 243 244 245 246
            TextField {
              id: turnPassword
              readOnly: !turnEnabled.checked || !turnEnabled.enabled || !turnUser.text.length
            }
          }
247 248 249 250 251
        }
      }
    }
  }
}