2020-09-08 12:59:34 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 by Savoir-faire Linux
|
|
|
|
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
|
|
|
*
|
|
|
|
* This program 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.
|
|
|
|
*
|
|
|
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Window 2.14
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Controls.Universal 2.12
|
|
|
|
import QtGraphicalEffects 1.14
|
|
|
|
import QtQuick.Controls.Styles 1.4
|
|
|
|
import net.jami.Models 1.0
|
|
|
|
import net.jami.Adapters 1.0
|
|
|
|
import Qt.labs.platform 1.1
|
|
|
|
import "../../commoncomponents"
|
|
|
|
import "../../constant"
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property int itemWidth
|
|
|
|
property bool isSIP
|
|
|
|
|
|
|
|
function updateConnectivityAccountInfos() {
|
|
|
|
registrationExpireTimeoutSpinBox.setValue(SettingsAdapter.getAccountConfig_Registration_Expire())
|
|
|
|
networkInterfaceSpinBox.setValue(SettingsAdapter.getAccountConfig_Localport())
|
|
|
|
checkBoxUPnP.checked = SettingsAdapter.getAccountConfig_UpnpEnabled()
|
|
|
|
checkBoxTurnEnable.checked = SettingsAdapter.getAccountConfig_TURN_Enabled()
|
|
|
|
lineEditTurnAddress.setText(SettingsAdapter.getAccountConfig_TURN_Server())
|
|
|
|
lineEditTurnUsername.setText(SettingsAdapter.getAccountConfig_TURN_Username())
|
|
|
|
lineEditTurnPassword.setText(SettingsAdapter.getAccountConfig_TURN_Password())
|
|
|
|
checkBoxSTUNEnable.checked = SettingsAdapter.getAccountConfig_STUN_Enabled()
|
|
|
|
lineEditSTUNAddress.setText(SettingsAdapter.getAccountConfig_STUN_Server())
|
|
|
|
lineEditTurnRealmSIP.setText(SettingsAdapter.getAccountConfig_TURN_Realm())
|
|
|
|
lineEditTurnRealmSIP.setEnabled(SettingsAdapter.getAccountConfig_TURN_Enabled())
|
|
|
|
lineEditSTUNAddress.setEnabled(SettingsAdapter.getAccountConfig_STUN_Enabled())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ElidedTextLabel {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
|
|
|
|
2020-09-11 17:30:46 -04:00
|
|
|
eText: JamiStrings.connectivity
|
2020-09-08 12:59:34 -04:00
|
|
|
fontSize: JamiTheme.headerFontSize
|
|
|
|
maxWidth: width
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: JamiTheme.preferredMarginSize
|
|
|
|
|
|
|
|
SettingSpinBox {
|
|
|
|
id: registrationExpireTimeoutSpinBox
|
|
|
|
visible: isSIP
|
|
|
|
|
2020-09-11 17:30:46 -04:00
|
|
|
title: JamiStrings.registrationTimeOut
|
2020-09-08 12:59:34 -04:00
|
|
|
itemWidth: root.itemWidth
|
|
|
|
bottomValue: 0
|
|
|
|
topValue: 3000
|
|
|
|
step: 1
|
|
|
|
|
|
|
|
onNewValue: SettingsAdapter.registrationTimeoutSpinBoxValueChanged(valueField)
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingSpinBox {
|
|
|
|
id: networkInterfaceSpinBox
|
|
|
|
visible: isSIP
|
|
|
|
|
2020-09-11 17:30:46 -04:00
|
|
|
title: JamiStrings.networkInterface
|
2020-09-08 12:59:34 -04:00
|
|
|
itemWidth: root.itemWidth
|
|
|
|
bottomValue: 0
|
|
|
|
topValue: 65536
|
|
|
|
step: 1
|
|
|
|
|
|
|
|
onNewValue: SettingsAdapter.networkInterfaceSpinBoxValueChanged(valueField)
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleSwitch {
|
|
|
|
id: checkBoxUPnP
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2020-09-11 17:30:46 -04:00
|
|
|
labelText: JamiStrings.useUPnP
|
2020-09-08 12:59:34 -04:00
|
|
|
fontPointSize: JamiTheme.settingsFontSize
|
|
|
|
|
|
|
|
onSwitchToggled: SettingsAdapter.setUseUPnP(checked)
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleSwitch {
|
|
|
|
id: checkBoxTurnEnable
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2020-09-11 17:30:46 -04:00
|
|
|
labelText: JamiStrings.useTURN
|
2020-09-08 12:59:34 -04:00
|
|
|
fontPointSize: JamiTheme.settingsFontSize
|
|
|
|
|
|
|
|
onSwitchToggled: {
|
|
|
|
SettingsAdapter.setUseTURN(checked)
|
|
|
|
if (isSIP) {
|
|
|
|
lineEditTurnAddress.setEnabled(checked)
|
|
|
|
lineEditTurnUsername.setEnabled(checked)
|
|
|
|
lineEditTurnPassword.setEnabled(checked)
|
|
|
|
lineEditTurnRealmSIP.setEnabled(checked)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsMaterialLineEdit {
|
|
|
|
id: lineEditTurnAddress
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
|
|
|
itemWidth: root.itemWidth
|
2020-09-11 17:30:46 -04:00
|
|
|
titleField: JamiStrings.turnAdress
|
2020-09-08 12:59:34 -04:00
|
|
|
onEditFinished: SettingsAdapter.setTURNAddress(textField)
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsMaterialLineEdit {
|
|
|
|
id: lineEditTurnUsername
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
|
|
|
itemWidth: root.itemWidth
|
2020-09-11 17:30:46 -04:00
|
|
|
titleField: JamiStrings.turnUsername
|
2020-09-08 12:59:34 -04:00
|
|
|
onEditFinished: SettingsAdapter.setTURNUsername(textField)
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsMaterialLineEdit {
|
|
|
|
id: lineEditTurnPassword
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
|
|
|
itemWidth: root.itemWidth
|
2020-09-11 17:30:46 -04:00
|
|
|
titleField: JamiStrings.turnPassword
|
2020-09-08 12:59:34 -04:00
|
|
|
onEditFinished: SettingsAdapter.setTURNPassword(textField)
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsMaterialLineEdit {
|
|
|
|
id: lineEditTurnRealmSIP
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
|
|
|
itemWidth: root.itemWidth
|
2020-09-11 17:30:46 -04:00
|
|
|
titleField: JamiStrings.turnRealm
|
2020-09-08 12:59:34 -04:00
|
|
|
onEditFinished: SettingsAdapter.setTURNRealm(textField)
|
|
|
|
}
|
|
|
|
|
|
|
|
ToggleSwitch {
|
|
|
|
id: checkBoxSTUNEnable
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
2020-09-11 17:30:46 -04:00
|
|
|
labelText: JamiStrings.useSTUN
|
2020-09-08 12:59:34 -04:00
|
|
|
fontPointSize: JamiTheme.settingsFontSize
|
|
|
|
|
|
|
|
onSwitchToggled: {
|
|
|
|
SettingsAdapter.setUseSTUN(checked)
|
|
|
|
lineEditSTUNAddress.enabled = checked
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsMaterialLineEdit {
|
|
|
|
id: lineEditSTUNAddress
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
|
|
|
itemWidth: root.itemWidth
|
2020-09-11 17:30:46 -04:00
|
|
|
titleField: JamiStrings.stunAdress
|
2020-09-08 12:59:34 -04:00
|
|
|
onEditFinished: SettingsAdapter.setSTUNAddress(textField)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|