blob: 1b355b8fae60a2e9c56494ea3dbe63b36a392e9c [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001/*
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
19import QtQuick 2.14
20import QtQuick.Layouts 1.3
21import QtQuick.Controls 2.14
22
23import "../../constant"
24import "../../commoncomponents"
25
Sébastien Blinc75335f2020-08-04 20:54:02 -040026
27Rectangle {
28 id: root
29
Sébastien Blin1f915762020-08-03 13:27:42 -040030 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 Blinc75335f2020-08-04 20:54:02 -040035 property /*alias*/ var boothImgBase64: null//setSIPAvatarWidget.imgBase64
Sébastien Blin1f915762020-08-03 13:27:42 -040036
37 function initializeOnShowUp() {
38 clearAllTextFields()
39 }
40
41 function clearAllTextFields() {
42 sipUsernameEdit.clear()
43 sipPasswordEdit.clear()
44 sipServernameEdit.clear()
45 sipProxyEdit.clear()
Sébastien Blin1f915762020-08-03 13:27:42 -040046 sipUsernameEdit.clear()
47 }
48
Sébastien Blinc75335f2020-08-04 20:54:02 -040049 signal createAccount
50 signal leavePage
Sébastien Blin1f915762020-08-03 13:27:42 -040051
Sébastien Blinc75335f2020-08-04 20:54:02 -040052 anchors.fill: parent
Sébastien Blin1f915762020-08-03 13:27:42 -040053
Sébastien Blinc75335f2020-08-04 20:54:02 -040054 color: JamiTheme.backgroundColor
Sébastien Blin1f915762020-08-03 13:27:42 -040055
56 ColumnLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -040057 spacing: 12
Sébastien Blin1f915762020-08-03 13:27:42 -040058
Sébastien Blinc75335f2020-08-04 20:54:02 -040059 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 Blin1f915762020-08-03 13:27:42 -040086 }
87
Sébastien Blinc75335f2020-08-04 20:54:02 -040088 MaterialLineEdit {
Sébastien Blin1f915762020-08-03 13:27:42 -040089 id: sipServernameEdit
Sébastien Blinc75335f2020-08-04 20:54:02 -040090
91 fieldLayoutWidth: createAccountButton.width
92
Sébastien Blin1f915762020-08-03 13:27:42 -040093 Layout.alignment: Qt.AlignHCenter
Sébastien Blin1f915762020-08-03 13:27:42 -040094
95 selectByMouse: true
96 placeholderText: qsTr("Server")
97 font.pointSize: 10
98 font.kerning: true
99 }
100
Sébastien Blinc75335f2020-08-04 20:54:02 -0400101 MaterialLineEdit {
Sébastien Blin1f915762020-08-03 13:27:42 -0400102 id: sipProxyEdit
Sébastien Blinc75335f2020-08-04 20:54:02 -0400103
104 fieldLayoutWidth: createAccountButton.width
105
Sébastien Blin1f915762020-08-03 13:27:42 -0400106 Layout.alignment: Qt.AlignHCenter
Sébastien Blin1f915762020-08-03 13:27:42 -0400107
108 selectByMouse: true
109 placeholderText: qsTr("Proxy")
110 font.pointSize: 10
111 font.kerning: true
112 }
113
Sébastien Blinc75335f2020-08-04 20:54:02 -0400114 MaterialLineEdit {
Sébastien Blin1f915762020-08-03 13:27:42 -0400115 id: sipUsernameEdit
Sébastien Blinc75335f2020-08-04 20:54:02 -0400116
117 fieldLayoutWidth: createAccountButton.width
118
Sébastien Blin1f915762020-08-03 13:27:42 -0400119 Layout.alignment: Qt.AlignHCenter
Sébastien Blin1f915762020-08-03 13:27:42 -0400120
121 selectByMouse: true
122 placeholderText: qsTr("Username")
123 font.pointSize: 10
124 font.kerning: true
125 }
126
Sébastien Blinc75335f2020-08-04 20:54:02 -0400127 MaterialLineEdit {
Sébastien Blin1f915762020-08-03 13:27:42 -0400128 id: sipPasswordEdit
Sébastien Blinc75335f2020-08-04 20:54:02 -0400129
130 fieldLayoutWidth: createAccountButton.width
131
Sébastien Blin1f915762020-08-03 13:27:42 -0400132 Layout.alignment: Qt.AlignHCenter
Sébastien Blin1f915762020-08-03 13:27:42 -0400133
134 selectByMouse: true
135 echoMode: TextInput.Password
136 placeholderText: qsTr("Password")
137 font.pointSize: 10
138 font.kerning: true
139 }
Sébastien Blinc75335f2020-08-04 20:54:02 -0400140
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 Blin1f915762020-08-03 13:27:42 -0400187 }
188}