blob: 8023fd148e8968573bd8c81e0c7c281719d65985 [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
Sébastien Blinc2220f82020-08-25 21:12:14 -040088 hoveredColor: JamiTheme.buttonTintedBlueHovered
89 pressedColor: JamiTheme.buttonTintedBluePressed
Yang Wangb97bde42020-08-07 11:24:18 -040090
Sébastien Blin1f915762020-08-03 13:27:42 -040091 onClicked: {
92 welcomePageRedirectPage(1)
93 }
94 }
95 }
96 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -040097 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -040098 Layout.fillWidth: true
99
Sébastien Blinc75335f2020-08-04 20:54:02 -0400100 Layout.maximumHeight: 36
Sébastien Blin1f915762020-08-03 13:27:42 -0400101 Layout.alignment: Qt.AlignHCenter
Sébastien Blinc75335f2020-08-04 20:54:02 -0400102 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400103 id: fromDeviceButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400104
Sébastien Blinc75335f2020-08-04 20:54:02 -0400105 text: qsTr("IMPORT FROM ANOTHER DEVICE")
Yang Wangb97bde42020-08-07 11:24:18 -0400106 toolTipText: qsTr("Import account from other device")
Sébastien Blinc75335f2020-08-04 20:54:02 -0400107 source: "qrc:/images/icons/devices-24px.svg"
108 color: JamiTheme.buttonTintedBlue
Sébastien Blinc2220f82020-08-25 21:12:14 -0400109 hoveredColor: JamiTheme.buttonTintedBlueHovered
110 pressedColor: JamiTheme.buttonTintedBluePressed
Yang Wangb97bde42020-08-07 11:24:18 -0400111
Sébastien Blin1f915762020-08-03 13:27:42 -0400112 onClicked: {
113 welcomePageRedirectPage(5)
114 }
115 }
116 }
117 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -0400118 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400119 Layout.fillWidth: true
120
Sébastien Blinc75335f2020-08-04 20:54:02 -0400121 Layout.maximumHeight: 36
Sébastien Blin1f915762020-08-03 13:27:42 -0400122 Layout.alignment: Qt.AlignHCenter
Sébastien Blinc75335f2020-08-04 20:54:02 -0400123 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400124 id: fromBackupButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400125
Sébastien Blinc75335f2020-08-04 20:54:02 -0400126 text: qsTr("CONNECT FROM BACKUP")
Yang Wangb97bde42020-08-07 11:24:18 -0400127 toolTipText: qsTr("Import account from backup file")
Sébastien Blinc75335f2020-08-04 20:54:02 -0400128 source: "qrc:/images/icons/backup-24px.svg"
129 color: JamiTheme.buttonTintedBlue
Sébastien Blinc2220f82020-08-25 21:12:14 -0400130 hoveredColor: JamiTheme.buttonTintedBlueHovered
131 pressedColor: JamiTheme.buttonTintedBluePressed
Yang Wangb97bde42020-08-07 11:24:18 -0400132
Sébastien Blin1f915762020-08-03 13:27:42 -0400133 onClicked: {
134 welcomePageRedirectPage(3)
135 }
136 }
137 }
138 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -0400139 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400140 Layout.fillWidth: true
141
Sébastien Blinc75335f2020-08-04 20:54:02 -0400142 Layout.maximumHeight: 36
Sébastien Blin1f915762020-08-03 13:27:42 -0400143 Layout.alignment: Qt.AlignHCenter
Sébastien Blinc75335f2020-08-04 20:54:02 -0400144 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400145 id: showAdvancedButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400146
Sébastien Blinc75335f2020-08-04 20:54:02 -0400147 text: qsTr("SHOW ADVANCED")
148 toolTipText: qsTr("Show advanced options")
149 color: JamiTheme.buttonTintedBlue
Sébastien Blinc2220f82020-08-25 21:12:14 -0400150 hoveredColor: JamiTheme.buttonTintedBlueHovered
151 pressedColor: JamiTheme.buttonTintedBluePressed
Sébastien Blinc75335f2020-08-04 20:54:02 -0400152 outlined: true
Sébastien Blin1f915762020-08-03 13:27:42 -0400153
Yang Wangb97bde42020-08-07 11:24:18 -0400154 hoverEnabled: true
155
156 ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
157 ToolTip.visible: hovered
158 ToolTip.text: qsTr("Show advanced options")
159
Sébastien Blin1f915762020-08-03 13:27:42 -0400160 onClicked: {
161 connectAccountManagerButton.visible = !connectAccountManagerButton.visible
162 newSIPAccountButton.visible = !newSIPAccountButton.visible
163 }
164 }
165 }
166 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -0400167 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400168 Layout.fillWidth: true
169 Layout.alignment: Qt.AlignHCenter
170
Sébastien Blinc75335f2020-08-04 20:54:02 -0400171 Layout.maximumHeight: 36
172 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400173 id: connectAccountManagerButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400174 visible: false
Sébastien Blin1f915762020-08-03 13:27:42 -0400175
Sébastien Blinc75335f2020-08-04 20:54:02 -0400176 text: qsTr("CONNECT TO MANAGEMENT SERVER")
Yang Wangb97bde42020-08-07 11:24:18 -0400177 toolTipText: qsTr("Login to account manager")
Sébastien Blinc75335f2020-08-04 20:54:02 -0400178 source: "qrc:/images/icons/router-24px.svg"
179 color: JamiTheme.buttonTintedBlue
Sébastien Blinc2220f82020-08-25 21:12:14 -0400180 hoveredColor: JamiTheme.buttonTintedBlueHovered
181 pressedColor: JamiTheme.buttonTintedBluePressed
Yang Wangb97bde42020-08-07 11:24:18 -0400182
Sébastien Blin1f915762020-08-03 13:27:42 -0400183 onClicked: {
184 welcomePageRedirectPage(6)
185 }
186 }
187 }
188 RowLayout {
Sébastien Blinc75335f2020-08-04 20:54:02 -0400189 spacing: 8
Sébastien Blin1f915762020-08-03 13:27:42 -0400190 Layout.fillWidth: true
191 Layout.alignment: Qt.AlignHCenter
Sébastien Blinc75335f2020-08-04 20:54:02 -0400192 Layout.maximumHeight: 36
193 MaterialButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400194 id: newSIPAccountButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400195 visible: false
Sébastien Blin1f915762020-08-03 13:27:42 -0400196
Sébastien Blinc75335f2020-08-04 20:54:02 -0400197 text: qsTr("CREATE A SIP ACCOUNT")
Yang Wangb97bde42020-08-07 11:24:18 -0400198 toolTipText: qsTr("Create new SIP account")
Sébastien Blinc75335f2020-08-04 20:54:02 -0400199 source: "qrc:/images/default_avatar_overlay.svg"
200 color: JamiTheme.buttonTintedBlue
Sébastien Blinc2220f82020-08-25 21:12:14 -0400201 hoveredColor: JamiTheme.buttonTintedBlueHovered
202 pressedColor: JamiTheme.buttonTintedBluePressed
Yang Wangb97bde42020-08-07 11:24:18 -0400203
Sébastien Blin1f915762020-08-03 13:27:42 -0400204 onClicked: {
205 welcomePageRedirectPage(2)
206 }
207 }
208 }
209 Item {
210 // put a spacer to make the buttons closs to the middle
211 Layout.fillHeight: true
212 Layout.preferredHeight: 65
213 Layout.fillWidth: true
214 }
Sébastien Blinc75335f2020-08-04 20:54:02 -0400215
216 HoverableButton {
217 id: cancelButton
218 z: 2
219
220 visible: {
221 return ClientWrapper.utilsAdaptor.getAccountListSize() > 0
222 }
223
224 anchors.right: parent.right
225 anchors.top: parent.top
226
227 rightPadding: 40
228 topPadding: 40
229
230 Layout.preferredWidth: 96
231 Layout.preferredHeight: 96
232
233 backgroundColor: "transparent"
234 onEnterColor: "transparent"
235 onPressColor: "transparent"
236 onReleaseColor: "transparent"
237 onExitColor: "transparent"
238
239 buttonImageHeight: 48
240 buttonImageWidth: 48
241 source: "qrc:/images/icons/ic_close_white_24dp.png"
242 radius: 48
243 baseColor: "#7c7c7c"
244 toolTipText: qsTr("Close")
245
246 Action {
247 enabled: parent.visible
248 shortcut: StandardKey.Cancel
249 onTriggered: leavePage()
250 }
251
252 onClicked: {
253 leavePage()
254 }
255 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400256}