Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 by Savoir-faire Linux |
| 3 | * Author: Yang Wang <yang.wang@savoirfairelinux.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | import QtQuick 2.14 |
| 20 | import QtQuick.Layouts 1.3 |
| 21 | import QtQuick.Controls 2.14 |
| 22 | |
| 23 | import "../../constant" |
| 24 | import "../../commoncomponents" |
| 25 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 26 | |
| 27 | Rectangle { |
| 28 | id: root |
| 29 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 30 | property alias text_sipServernameEditAlias: sipServernameEdit.text |
| 31 | property alias text_sipProxyEditAlias: sipProxyEdit.text |
| 32 | property alias text_sipUsernameEditAlias: sipUsernameEdit.text |
| 33 | property alias text_sipPasswordEditAlias: sipPasswordEdit.text |
| 34 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 35 | property /*alias*/ var boothImgBase64: null//setSIPAvatarWidget.imgBase64 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 36 | |
| 37 | function initializeOnShowUp() { |
| 38 | clearAllTextFields() |
| 39 | } |
| 40 | |
| 41 | function clearAllTextFields() { |
| 42 | sipUsernameEdit.clear() |
| 43 | sipPasswordEdit.clear() |
| 44 | sipServernameEdit.clear() |
| 45 | sipProxyEdit.clear() |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 46 | sipUsernameEdit.clear() |
| 47 | } |
| 48 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 49 | signal createAccount |
| 50 | signal leavePage |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 51 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 52 | anchors.fill: parent |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 53 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 54 | color: JamiTheme.backgroundColor |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 55 | |
| 56 | ColumnLayout { |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 57 | spacing: 12 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 58 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 59 | anchors.horizontalCenter: parent.horizontalCenter |
| 60 | anchors.verticalCenter: parent.verticalCenter |
| 61 | Layout.preferredWidth: createAccountButton.width |
| 62 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter |
| 63 | |
| 64 | RowLayout { |
| 65 | spacing: 12 |
| 66 | height: 48 |
| 67 | |
| 68 | anchors.left: createAccountButton.left |
| 69 | anchors.right: createAccountButton.right |
| 70 | |
| 71 | Label { |
| 72 | text: qsTr("Configure an existing SIP account") |
| 73 | } |
| 74 | |
| 75 | Label { |
| 76 | text: qsTr("Required") |
| 77 | color: "#ff1f62" |
| 78 | padding: 8 |
| 79 | |
| 80 | background: Rectangle { |
| 81 | color: "#fee4e9" |
| 82 | radius: 24 |
| 83 | anchors.fill: parent |
| 84 | } |
| 85 | } |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 86 | } |
| 87 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 88 | MaterialLineEdit { |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 89 | id: sipServernameEdit |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 90 | |
| 91 | fieldLayoutWidth: createAccountButton.width |
| 92 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 93 | Layout.alignment: Qt.AlignHCenter |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 94 | |
| 95 | selectByMouse: true |
| 96 | placeholderText: qsTr("Server") |
| 97 | font.pointSize: 10 |
| 98 | font.kerning: true |
| 99 | } |
| 100 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 101 | MaterialLineEdit { |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 102 | id: sipProxyEdit |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 103 | |
| 104 | fieldLayoutWidth: createAccountButton.width |
| 105 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 106 | Layout.alignment: Qt.AlignHCenter |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 107 | |
| 108 | selectByMouse: true |
| 109 | placeholderText: qsTr("Proxy") |
| 110 | font.pointSize: 10 |
| 111 | font.kerning: true |
| 112 | } |
| 113 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 114 | MaterialLineEdit { |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 115 | id: sipUsernameEdit |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 116 | |
| 117 | fieldLayoutWidth: createAccountButton.width |
| 118 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 119 | Layout.alignment: Qt.AlignHCenter |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 120 | |
| 121 | selectByMouse: true |
| 122 | placeholderText: qsTr("Username") |
| 123 | font.pointSize: 10 |
| 124 | font.kerning: true |
| 125 | } |
| 126 | |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 127 | MaterialLineEdit { |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 128 | id: sipPasswordEdit |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 129 | |
| 130 | fieldLayoutWidth: createAccountButton.width |
| 131 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 132 | Layout.alignment: Qt.AlignHCenter |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 133 | |
| 134 | selectByMouse: true |
| 135 | echoMode: TextInput.Password |
| 136 | placeholderText: qsTr("Password") |
| 137 | font.pointSize: 10 |
| 138 | font.kerning: true |
| 139 | } |
Sébastien Blin | c75335f | 2020-08-04 20:54:02 -0400 | [diff] [blame] | 140 | |
| 141 | MaterialButton { |
| 142 | id: createAccountButton |
| 143 | text: qsTr("CREATE SIP ACCOUNT") |
| 144 | color: JamiTheme.wizardBlueButtons |
| 145 | |
| 146 | onClicked: { |
| 147 | createAccount() |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | HoverableButton { |
| 153 | id: cancelButton |
| 154 | z: 2 |
| 155 | |
| 156 | anchors.right: parent.right |
| 157 | anchors.top: parent.top |
| 158 | |
| 159 | rightPadding: 90 |
| 160 | topPadding: 90 |
| 161 | |
| 162 | Layout.preferredWidth: 96 |
| 163 | Layout.preferredHeight: 96 |
| 164 | |
| 165 | backgroundColor: "transparent" |
| 166 | onEnterColor: "transparent" |
| 167 | onPressColor: "transparent" |
| 168 | onReleaseColor: "transparent" |
| 169 | onExitColor: "transparent" |
| 170 | |
| 171 | buttonImageHeight: 48 |
| 172 | buttonImageWidth: 48 |
| 173 | source: "qrc:/images/icons/ic_close_white_24dp.png" |
| 174 | radius: 48 |
| 175 | baseColor: "#7c7c7c" |
| 176 | toolTipText: qsTr("Return to welcome page") |
| 177 | |
| 178 | Action { |
| 179 | enabled: parent.visible |
| 180 | shortcut: StandardKey.Cancel |
| 181 | onTriggered: leavePage() |
| 182 | } |
| 183 | |
| 184 | onClicked: { |
| 185 | leavePage() |
| 186 | } |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 187 | } |
| 188 | } |