Skip to content
Snippets Groups Projects
Commit f88f566e authored by Fadi Shehadeh's avatar Fadi Shehadeh Committed by Sébastien Blin
Browse files

sip account creation: radiobutton for TLS/UDP

- created MaterialRadioButton
- added tls/udp options in sip wizard
- Fix some focus issues and some spacing

Change-Id: I18c5b7205bbe1c8178a5c3a966c9bfa0cffa93b4
parent 506eb7bc
No related branches found
No related tags found
No related merge requests found
...@@ -183,7 +183,8 @@ AccountAdapter::createSIPAccount(const QVariantMap& settings) ...@@ -183,7 +183,8 @@ AccountAdapter::createSIPAccount(const QVariantMap& settings)
confProps.hostname = settings["hostname"].toString(); confProps.hostname = settings["hostname"].toString();
confProps.username = settings["username"].toString(); confProps.username = settings["username"].toString();
confProps.password = settings["password"].toString(); confProps.password = settings["password"].toString();
confProps.routeset = settings["proxy"].toString(); confProps.TLS.enable = settings["tls"].toBool();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
confProps.Ringtone.ringtonePath = Utils::GetRingtonePath(); confProps.Ringtone.ringtonePath = Utils::GetRingtonePath();
#endif #endif
......
/*
* Copyright (C) 2023 Savoir-faire Linux Inc.
*
* 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 <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import net.jami.Constants 1.1
import net.jami.Models 1.1
RadioButton {
id: root
property string color: JamiTheme.textColor
font.pointSize: JamiTheme.textFontSize
indicator: Rectangle {
id: rect
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
border {
id: border
color: JamiTheme.buttonTintedBlue
width: 2
}
implicitWidth: 20
implicitHeight: 20
radius: 10
Rectangle {
id: innerRect
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: 10
height: 10
radius: 10
visible : checked || hovered
color: JamiTheme.buttonTintedBlue
HoverHandler {
target: parent
}
}
}
contentItem: Text {
text: root.text
color: "white"
leftPadding: root.indicator.width + root.spacing
verticalAlignment: Text.AlignVCenter
}
Keys.onPressed: function (event) {
if (event.key === Qt.Key_Enter
|| event.key === Qt.Key_Return) {
root.checked = true
}
}
onActiveFocusChanged: {
if (focus && !root.checked) {
border.width = 2.5
} else {
border.width = 2
}
}
}
...@@ -77,6 +77,7 @@ Loader { ...@@ -77,6 +77,7 @@ Loader {
Component { Component {
id: editComp id: editComp
MaterialTextField { MaterialTextField {
id: editCompField id: editCompField
...@@ -97,7 +98,7 @@ Loader { ...@@ -97,7 +98,7 @@ Loader {
text: staticText text: staticText
inputIsValid: root.inputIsValid inputIsValid: root.inputIsValid
onFocusChanged: { onFocusChanged: {
if (!focus) { if (!focus && root.editMode) {
root.editMode = false root.editMode = false
root.accepted() root.accepted()
} }
......
...@@ -415,6 +415,10 @@ Item { ...@@ -415,6 +415,10 @@ Item {
property string configureExistingSIP: qsTr("Configure an existing SIP account") property string configureExistingSIP: qsTr("Configure an existing SIP account")
property string personalizeAccount: qsTr("Personalize account") property string personalizeAccount: qsTr("Personalize account")
property string addSip: qsTr("Add SIP account") property string addSip: qsTr("Add SIP account")
property string tls: qsTr("TLS")
property string udp: qsTr("UDP")
property string displayName: qsTr("Display Name")
// CurrentAccountSettings && AdvancedSettings // CurrentAccountSettings && AdvancedSettings
property string backupSuccessful: qsTr("Backup successful") property string backupSuccessful: qsTr("Backup successful")
......
...@@ -184,6 +184,7 @@ Rectangle { ...@@ -184,6 +184,7 @@ Rectangle {
MaterialButton { MaterialButton {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: CurrentAccount.type === Profile.Type.SIP ? JamiTheme.preferredMarginSize : 0
Layout.leftMargin: JamiTheme.preferredMarginSize Layout.leftMargin: JamiTheme.preferredMarginSize
Layout.rightMargin: JamiTheme.preferredMarginSize Layout.rightMargin: JamiTheme.preferredMarginSize
......
...@@ -59,31 +59,30 @@ ColumnLayout { ...@@ -59,31 +59,30 @@ ColumnLayout {
} }
SettingsMaterialTextEdit { SettingsMaterialTextEdit {
id: proxySIP id: passSIPlineEdit
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight Layout.preferredHeight: JamiTheme.preferredFieldHeight
staticText: CurrentAccount.routeset staticText: CurrentAccount.password
titleField: JamiStrings.proxy titleField: JamiStrings.password
itemWidth: root.itemWidth itemWidth: root.itemWidth
isPassword: true
onEditFinished: CurrentAccount.routeset = dynamicText
} }
SettingsMaterialTextEdit { SettingsMaterialTextEdit {
id: passSIPlineEdit id: proxySIP
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight Layout.preferredHeight: JamiTheme.preferredFieldHeight
staticText: CurrentAccount.password staticText: CurrentAccount.routeset
titleField: JamiStrings.password titleField: JamiStrings.proxy
itemWidth: root.itemWidth itemWidth: root.itemWidth
isPassword: true
onEditFinished: CurrentAccount.password = dynamicText onEditFinished: CurrentAccount.routeset = dynamicText
} }
} }
...@@ -47,6 +47,7 @@ Rectangle { ...@@ -47,6 +47,7 @@ Rectangle {
WizardViewStepModel.AccountCreationOption.CreateSipAccount) { WizardViewStepModel.AccountCreationOption.CreateSipAccount) {
clearAllTextFields() clearAllTextFields()
root.showThisPage() root.showThisPage()
sipServernameEdit.focus = true
} }
} }
} }
...@@ -109,33 +110,13 @@ Rectangle { ...@@ -109,33 +110,13 @@ Rectangle {
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2) Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2)
focus: visible
placeholderText: JamiStrings.server placeholderText: JamiStrings.server
KeyNavigation.up: backButton
KeyNavigation.down: sipProxyEdit
KeyNavigation.tab: KeyNavigation.down KeyNavigation.tab: KeyNavigation.down
KeyNavigation.up: backButton
onAccepted: sipProxyEdit.forceActiveFocus()
}
ModalTextEdit {
id: sipProxyEdit
objectName: "sipProxyEdit"
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2)
placeholderText: JamiStrings.proxy
KeyNavigation.up: sipServernameEdit
KeyNavigation.down: sipUsernameEdit KeyNavigation.down: sipUsernameEdit
KeyNavigation.tab: KeyNavigation.down
onAccepted: sipUsernameEdit.forceActiveFocus() onAccepted: sipUsernameEdit.forceActiveFocus()
} }
ModalTextEdit { ModalTextEdit {
...@@ -148,9 +129,9 @@ Rectangle { ...@@ -148,9 +129,9 @@ Rectangle {
placeholderText: JamiStrings.username placeholderText: JamiStrings.username
KeyNavigation.up: sipProxyEdit
KeyNavigation.down: sipPasswordEdit
KeyNavigation.tab: KeyNavigation.down KeyNavigation.tab: KeyNavigation.down
KeyNavigation.up: sipServernameEdit
KeyNavigation.down: sipPasswordEdit
onAccepted: sipPasswordEdit.forceActiveFocus() onAccepted: sipPasswordEdit.forceActiveFocus()
} }
...@@ -165,13 +146,46 @@ Rectangle { ...@@ -165,13 +146,46 @@ Rectangle {
placeholderText: JamiStrings.password placeholderText: JamiStrings.password
KeyNavigation.tab: KeyNavigation.down
KeyNavigation.up: sipUsernameEdit KeyNavigation.up: sipUsernameEdit
KeyNavigation.down: createAccountButton KeyNavigation.down: tlsRadioButton
onAccepted: tlsRadioButton.forceActiveFocus()
}
ButtonGroup { id: optionsB }
RowLayout{
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2)
MaterialRadioButton {
id: tlsRadioButton
Layout.alignment: Qt.AlignHCenter
text: JamiStrings.tls
ButtonGroup.group: optionsB
checked: true
KeyNavigation.up: sipPasswordEdit
KeyNavigation.down: udpRadioButton
KeyNavigation.tab: KeyNavigation.down KeyNavigation.tab: KeyNavigation.down
onAccepted: createAccountButton.forceActiveFocus() }
MaterialRadioButton {
id: udpRadioButton
Layout.alignment: Qt.AlignHCenter
text: JamiStrings.udp
ButtonGroup.group: optionsB
color: JamiTheme.textColor
KeyNavigation.up: tlsRadioButton
KeyNavigation.down: createAccountButton
KeyNavigation.tab: KeyNavigation.down
} }
}
MaterialButton { MaterialButton {
id: createAccountButton id: createAccountButton
...@@ -185,7 +199,7 @@ Rectangle { ...@@ -185,7 +199,7 @@ Rectangle {
text: JamiStrings.addSip text: JamiStrings.addSip
KeyNavigation.up: sipPasswordEdit KeyNavigation.up: udpRadioButton
KeyNavigation.down: personalizeAccount KeyNavigation.down: personalizeAccount
KeyNavigation.tab: KeyNavigation.down KeyNavigation.tab: KeyNavigation.down
...@@ -196,7 +210,7 @@ Rectangle { ...@@ -196,7 +210,7 @@ Rectangle {
alias: displayNameLineEdit.dynamicText, alias: displayNameLineEdit.dynamicText,
username : sipUsernameEdit.dynamicText, username : sipUsernameEdit.dynamicText,
password : sipPasswordEdit.dynamicText, password : sipPasswordEdit.dynamicText,
proxy : sipProxyEdit.dynamicText, tls: tlsRadioButton.checked,
avatar: UtilsAdapter.tempCreationImage()}) avatar: UtilsAdapter.tempCreationImage()})
WizardViewStepModel.nextStep() WizardViewStepModel.nextStep()
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment