2020-08-03 13:27:42 -04:00
|
|
|
/*
|
2023-02-06 01:47:15 -05:00
|
|
|
* Copyright (C) 2021-2023 Savoir-faire Linux Inc.
|
2020-08-03 13:27:42 -04:00
|
|
|
* Author: Yang Wang <yang.wang@savoirfairelinux.com>
|
2021-07-16 10:34:50 -04:00
|
|
|
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
|
2020-08-03 13:27:42 -04:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2021-09-08 10:31:38 -04:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Controls
|
2021-03-17 14:23:21 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
import net.jami.Adapters 1.1
|
2021-08-23 13:24:08 -04:00
|
|
|
import net.jami.Constants 1.1
|
2022-07-26 11:29:26 -04:00
|
|
|
import net.jami.Models 1.1
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
import "../../commoncomponents"
|
|
|
|
|
2020-08-04 20:54:02 -04:00
|
|
|
Rectangle {
|
|
|
|
id: root
|
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
property int preferredHeight: createSIPAccountPageColumnLayout.implicitHeight + 2 * JamiTheme.preferredMarginSize
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
signal showThisPage
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
function clearAllTextFields() {
|
|
|
|
sipUsernameEdit.clear()
|
|
|
|
sipPasswordEdit.clear()
|
|
|
|
sipServernameEdit.clear()
|
|
|
|
sipProxyEdit.clear()
|
2022-07-26 11:29:26 -04:00
|
|
|
displayNameLineEdit.clear()
|
|
|
|
UtilsAdapter.setTempCreationImageFromString()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
Connections {
|
|
|
|
target: WizardViewStepModel
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
function onMainStepChanged() {
|
|
|
|
if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation &&
|
|
|
|
WizardViewStepModel.accountCreationOption ===
|
|
|
|
WizardViewStepModel.AccountCreationOption.CreateSipAccount) {
|
|
|
|
clearAllTextFields()
|
|
|
|
root.showThisPage()
|
|
|
|
}
|
|
|
|
}
|
2020-09-04 14:57:36 -04:00
|
|
|
}
|
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
color: JamiTheme.secondaryBackgroundColor
|
2021-07-16 10:34:50 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
StackLayout {
|
|
|
|
id: createAccountStack
|
2020-09-17 16:09:06 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
objectName: "createAccountStack"
|
|
|
|
anchors.fill: parent
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Rectangle {
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
color: JamiTheme.secondaryBackgroundColor
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
ColumnLayout {
|
|
|
|
id: createSIPAccountPageColumnLayout
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
spacing: JamiTheme.wizardViewPageLayoutSpacing
|
2020-09-03 09:58:01 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: JamiTheme.wizardViewLayoutTopMargin
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
width: Math.max(508, root.width - 100)
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Label {
|
2021-07-22 19:01:41 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
text: JamiStrings.sipAccount
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredWidth: Math.min(450, root.width - JamiTheme.preferredMarginSize * 2)
|
|
|
|
Layout.topMargin: 15
|
|
|
|
font.pixelSize: JamiTheme.wizardViewTitleFontPixelSize
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
color: JamiTheme.textColor
|
|
|
|
}
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Label {
|
|
|
|
text: JamiStrings.configureExistingSIP
|
|
|
|
Layout.preferredWidth: Math.min(360, root.width - JamiTheme.preferredMarginSize * 2)
|
|
|
|
Layout.topMargin: 15
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
font.pixelSize: JamiTheme.wizardViewDescriptionFontPixelSize
|
2022-07-28 13:22:47 -04:00
|
|
|
font.weight: Font.Medium
|
2022-07-26 11:29:26 -04:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
color: JamiTheme.textColor
|
|
|
|
}
|
2021-07-16 10:34:50 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
EditableLineEdit {
|
|
|
|
id: sipServernameEdit
|
2021-08-02 14:52:08 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
objectName: "sipServernameEdit"
|
2021-08-09 15:14:10 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2)
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
focus: visible
|
|
|
|
selectByMouse: true
|
|
|
|
placeholderText: JamiStrings.server
|
|
|
|
font.pointSize: JamiTheme.textFontSize
|
|
|
|
font.kerning: true
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
KeyNavigation.tab: sipProxyEdit
|
|
|
|
KeyNavigation.up: backButton
|
|
|
|
KeyNavigation.down: sipProxyEdit
|
2021-07-22 19:01:41 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
onEditingFinished: sipProxyEdit.forceActiveFocus()
|
|
|
|
}
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
EditableLineEdit {
|
|
|
|
id: sipProxyEdit
|
2021-08-02 14:52:08 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
objectName: "sipProxyEdit"
|
2021-08-09 15:14:10 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2)
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
focus: visible
|
|
|
|
selectByMouse: true
|
|
|
|
placeholderText: JamiStrings.proxy
|
|
|
|
font.pointSize: JamiTheme.textFontSize
|
|
|
|
font.kerning: true
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
KeyNavigation.tab: sipUsernameEdit
|
|
|
|
KeyNavigation.up: sipServernameEdit
|
|
|
|
KeyNavigation.down: sipUsernameEdit
|
2021-07-22 19:01:41 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
onEditingFinished: sipUsernameEdit.forceActiveFocus()
|
|
|
|
}
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
EditableLineEdit {
|
|
|
|
id: sipUsernameEdit
|
2021-08-02 14:52:08 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
objectName: "sipUsernameEdit"
|
2021-08-09 15:14:10 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2)
|
|
|
|
|
|
|
|
selectByMouse: true
|
|
|
|
placeholderText: JamiStrings.username
|
|
|
|
font.pointSize: JamiTheme.textFontSize
|
|
|
|
font.kerning: true
|
|
|
|
|
|
|
|
KeyNavigation.tab: sipPasswordEdit
|
|
|
|
KeyNavigation.up: sipProxyEdit
|
|
|
|
KeyNavigation.down: sipPasswordEdit
|
|
|
|
|
|
|
|
onEditingFinished: sipPasswordEdit.forceActiveFocus()
|
|
|
|
}
|
|
|
|
|
|
|
|
EditableLineEdit {
|
|
|
|
id: sipPasswordEdit
|
|
|
|
|
|
|
|
objectName: "sipPasswordEdit"
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2)
|
|
|
|
|
|
|
|
selectByMouse: true
|
|
|
|
echoMode: TextInput.Password
|
|
|
|
|
|
|
|
placeholderText: JamiStrings.password
|
|
|
|
font.pointSize: JamiTheme.textFontSize
|
|
|
|
font.kerning: true
|
|
|
|
|
|
|
|
KeyNavigation.tab: createAccountButton
|
|
|
|
KeyNavigation.up: sipUsernameEdit
|
|
|
|
KeyNavigation.down: createAccountButton
|
|
|
|
|
|
|
|
secondIco: JamiResources.eye_cross_svg
|
|
|
|
|
|
|
|
|
|
|
|
onEditingFinished: createAccountButton.forceActiveFocus()
|
|
|
|
|
|
|
|
onSecondIcoClicked: { toggleEchoMode() }
|
|
|
|
}
|
|
|
|
|
|
|
|
MaterialButton {
|
|
|
|
id: createAccountButton
|
|
|
|
|
|
|
|
objectName: "createSIPAccountButton"
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.bottomMargin: JamiTheme.wizardViewPageBackButtonMargins
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2)
|
2021-07-22 19:01:41 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
text: JamiStrings.addSip
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
KeyNavigation.tab: personalizeAccount
|
|
|
|
KeyNavigation.up: sipPasswordEdit
|
|
|
|
KeyNavigation.down: personalizeAccount
|
2021-08-02 14:52:08 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
onClicked: {
|
|
|
|
WizardViewStepModel.accountCreationInfo =
|
|
|
|
JamiQmlUtils.setUpAccountCreationInputPara(
|
|
|
|
{hostname : sipServernameEdit.text,
|
|
|
|
alias: displayNameLineEdit.text,
|
|
|
|
username : sipUsernameEdit.text,
|
|
|
|
password : sipPasswordEdit.text,
|
|
|
|
proxy : sipProxyEdit.text,
|
|
|
|
avatar: UtilsAdapter.tempCreationImage()})
|
|
|
|
WizardViewStepModel.nextStep()
|
|
|
|
}
|
|
|
|
}
|
2021-08-09 15:14:10 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
MaterialButton {
|
|
|
|
|
|
|
|
id: personalizeAccount
|
|
|
|
text: JamiStrings.personalizeAccount
|
|
|
|
tertiary: true
|
|
|
|
secHoveredColor: JamiTheme.secAndTertiHoveredBackgroundColor
|
|
|
|
preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2)
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.bottomMargin: JamiTheme.wizardViewPageBackButtonMargins*2
|
|
|
|
|
|
|
|
KeyNavigation.tab: backButton
|
|
|
|
KeyNavigation.up: createAccountButton
|
|
|
|
KeyNavigation.down: backButton
|
|
|
|
|
|
|
|
onClicked: createAccountStack.currentIndex += 1
|
|
|
|
}
|
|
|
|
}
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Rectangle {
|
|
|
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
color: JamiTheme.secondaryBackgroundColor
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
spacing: JamiTheme.wizardViewPageLayoutSpacing
|
|
|
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: JamiTheme.wizardViewLayoutTopMargin
|
|
|
|
|
|
|
|
width: Math.max(508, root.width - 100)
|
|
|
|
|
|
|
|
Label {
|
|
|
|
|
|
|
|
text: JamiStrings.personalizeAccount
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredWidth: Math.min(450, root.width - JamiTheme.preferredMarginSize * 2)
|
|
|
|
Layout.topMargin: 15
|
|
|
|
font.pixelSize: 26
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
color: JamiTheme.textColor
|
|
|
|
}
|
|
|
|
|
|
|
|
PhotoboothView {
|
|
|
|
id: currentAccountAvatar
|
|
|
|
darkTheme: UtilsAdapter.luma(JamiTheme.primaryBackgroundColor)
|
2022-11-30 11:45:32 -03:00
|
|
|
width: avatarSize
|
|
|
|
height: avatarSize
|
2020-09-03 09:58:01 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.topMargin: 50
|
2021-07-22 19:01:41 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
newItem: true
|
|
|
|
imageId: visible ? "temp" : ""
|
|
|
|
avatarSize: 150
|
|
|
|
buttonSize: JamiTheme.smartListAvatarSize
|
|
|
|
}
|
2021-08-09 14:00:23 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
EditableLineEdit {
|
2020-09-03 09:58:01 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
id: displayNameLineEdit
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2022-07-26 11:29:26 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredWidth: Math.min(300, root.width - JamiTheme.preferredMarginSize * 2)
|
|
|
|
Layout.topMargin: 30
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
|
|
|
font.pointSize: JamiTheme.textFontSize
|
|
|
|
|
|
|
|
placeholderText: JamiStrings.enterNickname
|
|
|
|
|
|
|
|
color: JamiTheme.textColor
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
|
|
|
|
Layout.topMargin: 15
|
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredWidth: Math.min(320, root.width - JamiTheme.preferredMarginSize * 2)
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
|
|
|
text: JamiStrings.customizeProfileDescription
|
|
|
|
font.pixelSize: JamiTheme.headerFontSize
|
|
|
|
color: JamiTheme.textColor
|
|
|
|
}
|
2021-08-02 14:52:08 -04:00
|
|
|
|
2020-08-04 20:54:02 -04:00
|
|
|
}
|
|
|
|
}
|
2022-07-26 11:29:26 -04:00
|
|
|
|
|
|
|
|
2020-09-04 14:57:36 -04:00
|
|
|
}
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
BackButton {
|
2020-09-04 14:57:36 -04:00
|
|
|
id: backButton
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-08-02 17:31:46 -04:00
|
|
|
objectName: "createSIPAccountPageBackButton"
|
|
|
|
|
2020-09-04 14:57:36 -04:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.margins: 20
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
preferredSize: JamiTheme.wizardViewPageBackButtonSize
|
2020-09-04 14:57:36 -04:00
|
|
|
|
2021-08-02 14:52:08 -04:00
|
|
|
KeyNavigation.tab: sipServernameEdit
|
2022-07-26 11:29:26 -04:00
|
|
|
KeyNavigation.up: personalizeAccount
|
|
|
|
KeyNavigation.down: sipServernameEdit
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
if (createAccountStack.currentIndex !== 0) {
|
|
|
|
createAccountStack.currentIndex--
|
|
|
|
} else {
|
|
|
|
WizardViewStepModel.previousStep()
|
|
|
|
}
|
|
|
|
}
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
}
|