blob: 3563eeadacb72530927d677b03b73047be22b8af [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001
2/*
3 * Copyright (C) 2020 by Savoir-faire Linux
4 * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
5 *
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 */
19import QtQuick 2.14
20import QtQuick.Controls 2.14
21import QtQuick.Layouts 1.14
22import net.jami.Models 1.0
23
24import "../../commoncomponents"
25
26Rectangle {
27 id: welcomeRect
28
29 property int currentAccountIndex: 0
30 property int buttonPreferredSize: 30
ababia284cae2020-08-10 12:33:34 +020031 anchors.fill: parent
Sébastien Blin1f915762020-08-03 13:27:42 -040032
Sébastien Blin1f915762020-08-03 13:27:42 -040033 Rectangle {
34 id: welcomeRectComponentsGroup
35
36 anchors.centerIn: parent
37
ababia284cae2020-08-10 12:33:34 +020038 width: Math.max(mainViewStackPreferredWidth, welcomeRect.width - 100)
Sébastien Blin1f915762020-08-03 13:27:42 -040039 height: mainViewWindow.minimumHeight
40
41 ColumnLayout {
42 id: welcomeRectComponentsGroupColumnLayout
43
44 Image {
45 id: jamiLogoImage
46
47 Layout.alignment: Qt.AlignCenter
48 Layout.preferredWidth: welcomeRectComponentsGroup.width
49 Layout.preferredHeight: 100
50 Layout.topMargin: 50
51 Layout.bottomMargin: 10
52
53 fillMode: Image.PreserveAspectFit
54 source: "qrc:/images/logo-jami-standard-coul.png"
55 mipmap: true
56 }
57
58 Label {
59 id: jamiIntroText
60
61 Layout.alignment: Qt.AlignCenter
62 Layout.preferredWidth: welcomeRectComponentsGroup.width
63 Layout.preferredHeight: 100
64 Layout.bottomMargin: 5
65
66 wrapMode: Text.WordWrap
67 font.pointSize: JamiTheme.textFontSize + 1
68
69 horizontalAlignment: Text.AlignHCenter
70 verticalAlignment: Text.AlignVCenter
71
72 text: qsTr("Jami is a free software for universal communication which repects the freedoms and privacy of its user.")
73 }
74
75 Label {
76 id: jamiShareWithFriendText
77
78 Layout.alignment: Qt.AlignCenter
79 Layout.preferredWidth: welcomeRectComponentsGroup.width
80 Layout.preferredHeight: 50
81
82 wrapMode: Text.WordWrap
ababidf651a22020-07-30 13:38:57 +020083 font.pointSize: JamiTheme.textFontSize
Sébastien Blin1f915762020-08-03 13:27:42 -040084
85 horizontalAlignment: Text.AlignHCenter
86 verticalAlignment: Text.AlignVCenter
87
88 visible: accountListModel.data(accountListModel.index(
89 currentAccountIndex, 0),
90 260) === 1
91 text: qsTr("This is your ID.\nCopy and share it with your friends")
92 color: JamiTheme.faddedFontColor
93 }
94
95 Rectangle {
96 id: jamiRegisteredNameRect
97
98 Layout.alignment: Qt.AlignCenter
99 Layout.preferredWidth: welcomeRectComponentsGroup.width
100 Layout.preferredHeight: 65
101 Layout.bottomMargin: 5
102
103 visible: accountListModel.data(accountListModel.index(
104 currentAccountIndex, 0),
105 260) === 1
106
107 ColumnLayout {
108 id: jamiRegisteredNameRectColumnLayout
109
110 spacing: 0
111
112 Text {
113 id: jamiRegisteredNameText
114
115 Layout.alignment: Qt.AlignCenter
116 Layout.preferredWidth: welcomeRectComponentsGroup.width
117 Layout.preferredHeight: 30
118
ababidf651a22020-07-30 13:38:57 +0200119 font.pointSize: JamiTheme.textFontSize + 1
Sébastien Blin1f915762020-08-03 13:27:42 -0400120
121 horizontalAlignment: Text.AlignHCenter
122 verticalAlignment: Text.AlignVCenter
123
124 text: textMetricsjamiRegisteredNameText.elidedText
125
126 TextMetrics {
127 id: textMetricsjamiRegisteredNameText
128
129 font: jamiRegisteredNameText.font
130 text: accountListModel.data(
131 accountListModel.index(
132 currentAccountIndex, 0), 258)
133 elideWidth: welcomeRectComponentsGroup.width
134 elide: Qt.ElideMiddle
135 }
136 }
137
ababidf651a22020-07-30 13:38:57 +0200138 HoverableButton {
139 id: copyRegisterednameButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400140
141 Layout.alignment: Qt.AlignCenter
ababidf651a22020-07-30 13:38:57 +0200142 Layout.preferredWidth: buttonPreferredSize
143 Layout.preferredHeight: buttonPreferredSize
Sébastien Blin1f915762020-08-03 13:27:42 -0400144
ababidf651a22020-07-30 13:38:57 +0200145 radius: 30
146 source: "qrc:/images/icons/ic_content_copy.svg"
Sébastien Blin1f915762020-08-03 13:27:42 -0400147
ababidf651a22020-07-30 13:38:57 +0200148 onClicked: {
149 ClientWrapper.utilsAdaptor.setText(
150 textMetricsjamiRegisteredNameText.text)
Sébastien Blin1f915762020-08-03 13:27:42 -0400151 }
152 }
153 }
154 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400155 }
156 }
157
158 CustomBorder {
159 commonBorder: false
160 lBorderwidth: 1
161 rBorderwidth: 0
162 tBorderwidth: 0
163 bBorderwidth: 0
164 borderColor: JamiTheme.tabbarBorderColor
165 }
166}