blob: 5ec6cbd67ebc9b9d34a00c991c02c8362ed926ec [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>
Sébastien Blinc75335f2020-08-04 20:54:02 -04004 * Author: Sébastien blin <sebastien.blin@savoirfairelinux.com>
Sébastien Blin1f915762020-08-03 13:27:42 -04005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20import QtQuick 2.14
21import QtQuick.Layouts 1.3
22import QtQuick.Controls 2.14
Sébastien Blinc75335f2020-08-04 20:54:02 -040023import QtGraphicalEffects 1.15
24import net.jami.Models 1.0
Sébastien Blin1f915762020-08-03 13:27:42 -040025
26import "../../constant"
27import "../../commoncomponents"
28
29ColumnLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -040030 anchors.fill: parent
31 anchors.verticalCenter: parent.verticalCenter
32 anchors.horizontalCenter: parent.horizontalCenter
Sébastien Blin1f915762020-08-03 13:27:42 -040033
34 signal welcomePageRedirectPage(int toPageIndex)
Sébastien Blinc75335f2020-08-04 20:54:02 -040035 signal leavePage
Sébastien Blin1f915762020-08-03 13:27:42 -040036
37 Item {
38 // put a spacer to make the buttons closs to the middle
Sébastien Blinc75335f2020-08-04 20:54:02 -040039 Layout.preferredHeight: 48
Sébastien Blin1f915762020-08-03 13:27:42 -040040 Layout.fillWidth: true
Sébastien Blinc75335f2020-08-04 20:54:02 -040041 Layout.fillHeight: true
Sébastien Blin1f915762020-08-03 13:27:42 -040042 }
43 RowLayout {
44 Layout.fillWidth: true
45 Layout.alignment: Qt.AlignHCenter
46 Label {
47 id: welcomeLabel
48 Layout.maximumHeight: 40
49 Layout.alignment: Qt.AlignCenter
50 text: qsTr("Welcome to")
51 font.pointSize: 30
52 font.kerning: true
53 }
54 }
Sébastien Blin1f915762020-08-03 13:27:42 -040055 RowLayout {
56 Layout.fillWidth: true
57 Layout.alignment: Qt.AlignHCenter
58 Label {
59 id: welcomeLogo
60 Layout.alignment: Qt.AlignCenter
61 Layout.minimumWidth: 100
62 Layout.minimumHeight: 100
63 Layout.maximumWidth: 16777215
64 Layout.maximumHeight: 16777215
65 Layout.preferredWidth: 300
66 Layout.preferredHeight: 150
67 color: "transparent"
68 background: Image {
69 id: logoIMG
70 source: "qrc:/images/logo-jami-standard-coul.png"
71 fillMode: Image.PreserveAspectFit
72 mipmap: true
73 }
74 }
75 }
Sébastien Blin1f915762020-08-03 13:27:42 -040076 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -040077 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -040078 Layout.fillWidth: true
Sébastien Blinc75335f2020-08-04 20:54:02 -040079 Layout.maximumHeight: 36
Sébastien Blin1f915762020-08-03 13:27:42 -040080 Layout.alignment: Qt.AlignHCenter
Sébastien Blinc75335f2020-08-04 20:54:02 -040081 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -040082 id: newAccountButton
83
Sébastien Blinc75335f2020-08-04 20:54:02 -040084 text: qsTr("CREATE A JAMI ACCOUNT")
Yang Wangb97bde42020-08-07 11:24:18 -040085 toolTipText: qsTr("Create new Jami account")
Sébastien Blinc75335f2020-08-04 20:54:02 -040086 source: "qrc:/images/default_avatar_overlay.svg"
87 color: JamiTheme.buttonTintedBlue
Yang Wangb97bde42020-08-07 11:24:18 -040088
Sébastien Blin1f915762020-08-03 13:27:42 -040089 onClicked: {
90 welcomePageRedirectPage(1)
91 }
92 }
93 }
94 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -040095 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -040096 Layout.fillWidth: true
97
Sébastien Blinc75335f2020-08-04 20:54:02 -040098 Layout.maximumHeight: 36
Sébastien Blin1f915762020-08-03 13:27:42 -040099 Layout.alignment: Qt.AlignHCenter
Sébastien Blinc75335f2020-08-04 20:54:02 -0400100 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400101 id: fromDeviceButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400102
Sébastien Blinc75335f2020-08-04 20:54:02 -0400103 text: qsTr("IMPORT FROM ANOTHER DEVICE")
Yang Wangb97bde42020-08-07 11:24:18 -0400104 toolTipText: qsTr("Import account from other device")
Sébastien Blinc75335f2020-08-04 20:54:02 -0400105 source: "qrc:/images/icons/devices-24px.svg"
106 color: JamiTheme.buttonTintedBlue
Yang Wangb97bde42020-08-07 11:24:18 -0400107
Sébastien Blin1f915762020-08-03 13:27:42 -0400108 onClicked: {
109 welcomePageRedirectPage(5)
110 }
111 }
112 }
113 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -0400114 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400115 Layout.fillWidth: true
116
Sébastien Blinc75335f2020-08-04 20:54:02 -0400117 Layout.maximumHeight: 36
Sébastien Blin1f915762020-08-03 13:27:42 -0400118 Layout.alignment: Qt.AlignHCenter
Sébastien Blinc75335f2020-08-04 20:54:02 -0400119 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400120 id: fromBackupButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400121
Sébastien Blinc75335f2020-08-04 20:54:02 -0400122 text: qsTr("CONNECT FROM BACKUP")
Yang Wangb97bde42020-08-07 11:24:18 -0400123 toolTipText: qsTr("Import account from backup file")
Sébastien Blinc75335f2020-08-04 20:54:02 -0400124 source: "qrc:/images/icons/backup-24px.svg"
125 color: JamiTheme.buttonTintedBlue
Yang Wangb97bde42020-08-07 11:24:18 -0400126
Sébastien Blin1f915762020-08-03 13:27:42 -0400127 onClicked: {
128 welcomePageRedirectPage(3)
129 }
130 }
131 }
132 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -0400133 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400134 Layout.fillWidth: true
135
Sébastien Blinc75335f2020-08-04 20:54:02 -0400136 Layout.maximumHeight: 36
Sébastien Blin1f915762020-08-03 13:27:42 -0400137 Layout.alignment: Qt.AlignHCenter
Sébastien Blinc75335f2020-08-04 20:54:02 -0400138 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400139 id: showAdvancedButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400140
Sébastien Blinc75335f2020-08-04 20:54:02 -0400141 text: qsTr("SHOW ADVANCED")
142 toolTipText: qsTr("Show advanced options")
143 color: JamiTheme.buttonTintedBlue
144 outlined: true
Sébastien Blin1f915762020-08-03 13:27:42 -0400145
Yang Wangb97bde42020-08-07 11:24:18 -0400146 hoverEnabled: true
147
148 ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
149 ToolTip.visible: hovered
150 ToolTip.text: qsTr("Show advanced options")
151
Sébastien Blin1f915762020-08-03 13:27:42 -0400152 onClicked: {
153 connectAccountManagerButton.visible = !connectAccountManagerButton.visible
154 newSIPAccountButton.visible = !newSIPAccountButton.visible
155 }
156 }
157 }
158 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -0400159 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400160 Layout.fillWidth: true
161 Layout.alignment: Qt.AlignHCenter
162
Sébastien Blinc75335f2020-08-04 20:54:02 -0400163 Layout.maximumHeight: 36
164 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400165 id: connectAccountManagerButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400166 visible: false
Sébastien Blin1f915762020-08-03 13:27:42 -0400167
Sébastien Blinc75335f2020-08-04 20:54:02 -0400168 text: qsTr("CONNECT TO MANAGEMENT SERVER")
Yang Wangb97bde42020-08-07 11:24:18 -0400169 toolTipText: qsTr("Login to account manager")
Sébastien Blinc75335f2020-08-04 20:54:02 -0400170 source: "qrc:/images/icons/router-24px.svg"
171 color: JamiTheme.buttonTintedBlue
Yang Wangb97bde42020-08-07 11:24:18 -0400172
Sébastien Blin1f915762020-08-03 13:27:42 -0400173 onClicked: {
174 welcomePageRedirectPage(6)
175 }
176 }
177 }
178 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -0400179 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400180 Layout.fillWidth: true
181 Layout.alignment: Qt.AlignHCenter
Sébastien Blinc75335f2020-08-04 20:54:02 -0400182 Layout.maximumHeight: 36
183 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400184 id: newSIPAccountButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400185 visible: false
Sébastien Blin1f915762020-08-03 13:27:42 -0400186
Sébastien Blinc75335f2020-08-04 20:54:02 -0400187 text: qsTr("CREATE A SIP ACCOUNT")
Yang Wangb97bde42020-08-07 11:24:18 -0400188 toolTipText: qsTr("Create new SIP account")
Sébastien Blinc75335f2020-08-04 20:54:02 -0400189 source: "qrc:/images/default_avatar_overlay.svg"
190 color: JamiTheme.buttonTintedBlue
Yang Wangb97bde42020-08-07 11:24:18 -0400191
Sébastien Blin1f915762020-08-03 13:27:42 -0400192 onClicked: {
193 welcomePageRedirectPage(2)
194 }
195 }
196 }
197 Item {
198 // put a spacer to make the buttons closs to the middle
199 Layout.fillHeight: true
200 Layout.preferredHeight: 65
201 Layout.fillWidth: true
202 }
Sébastien Blinc75335f2020-08-04 20:54:02 -0400203
204 HoverableButton {
205 id: cancelButton
206 z: 2
207
208 visible: {
209 return ClientWrapper.utilsAdaptor.getAccountListSize() > 0
210 }
211
212 anchors.right: parent.right
213 anchors.top: parent.top
214
215 rightPadding: 40
216 topPadding: 40
217
218 Layout.preferredWidth: 96
219 Layout.preferredHeight: 96
220
221 backgroundColor: "transparent"
222 onEnterColor: "transparent"
223 onPressColor: "transparent"
224 onReleaseColor: "transparent"
225 onExitColor: "transparent"
226
227 buttonImageHeight: 48
228 buttonImageWidth: 48
229 source: "qrc:/images/icons/ic_close_white_24dp.png"
230 radius: 48
231 baseColor: "#7c7c7c"
232 toolTipText: qsTr("Close")
233
234 Action {
235 enabled: parent.visible
236 shortcut: StandardKey.Cancel
237 onTriggered: leavePage()
238 }
239
240 onClicked: {
241 leavePage()
242 }
243 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400244}