Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame^] | 1 | |
| 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 | */ |
| 19 | import QtQuick 2.14 |
| 20 | import QtQuick.Controls 2.14 |
| 21 | import QtQuick.Layouts 1.14 |
| 22 | import net.jami.Models 1.0 |
| 23 | |
| 24 | import "../../commoncomponents" |
| 25 | |
| 26 | Rectangle { |
| 27 | id: welcomeRect |
| 28 | |
| 29 | property int currentAccountIndex: 0 |
| 30 | property int buttonPreferredSize: 30 |
| 31 | |
| 32 | anchors.fill: parent |
| 33 | |
| 34 | Rectangle { |
| 35 | id: welcomeRectComponentsGroup |
| 36 | |
| 37 | anchors.centerIn: parent |
| 38 | |
| 39 | width: Math.max(welcomePageGroupPreferedWidth, welcomeRect.width - 100) |
| 40 | height: mainViewWindow.minimumHeight |
| 41 | |
| 42 | ColumnLayout { |
| 43 | id: welcomeRectComponentsGroupColumnLayout |
| 44 | |
| 45 | Image { |
| 46 | id: jamiLogoImage |
| 47 | |
| 48 | Layout.alignment: Qt.AlignCenter |
| 49 | Layout.preferredWidth: welcomeRectComponentsGroup.width |
| 50 | Layout.preferredHeight: 100 |
| 51 | Layout.topMargin: 50 |
| 52 | Layout.bottomMargin: 10 |
| 53 | |
| 54 | fillMode: Image.PreserveAspectFit |
| 55 | source: "qrc:/images/logo-jami-standard-coul.png" |
| 56 | mipmap: true |
| 57 | } |
| 58 | |
| 59 | Label { |
| 60 | id: jamiIntroText |
| 61 | |
| 62 | Layout.alignment: Qt.AlignCenter |
| 63 | Layout.preferredWidth: welcomeRectComponentsGroup.width |
| 64 | Layout.preferredHeight: 100 |
| 65 | Layout.bottomMargin: 5 |
| 66 | |
| 67 | wrapMode: Text.WordWrap |
| 68 | font.pointSize: JamiTheme.textFontSize + 1 |
| 69 | |
| 70 | horizontalAlignment: Text.AlignHCenter |
| 71 | verticalAlignment: Text.AlignVCenter |
| 72 | |
| 73 | text: qsTr("Jami is a free software for universal communication which repects the freedoms and privacy of its user.") |
| 74 | } |
| 75 | |
| 76 | Label { |
| 77 | id: jamiShareWithFriendText |
| 78 | |
| 79 | Layout.alignment: Qt.AlignCenter |
| 80 | Layout.preferredWidth: welcomeRectComponentsGroup.width |
| 81 | Layout.preferredHeight: 50 |
| 82 | |
| 83 | wrapMode: Text.WordWrap |
| 84 | font.pointSize: JamiTheme.textFontSize - 1 |
| 85 | |
| 86 | horizontalAlignment: Text.AlignHCenter |
| 87 | verticalAlignment: Text.AlignVCenter |
| 88 | |
| 89 | visible: accountListModel.data(accountListModel.index( |
| 90 | currentAccountIndex, 0), |
| 91 | 260) === 1 |
| 92 | text: qsTr("This is your ID.\nCopy and share it with your friends") |
| 93 | color: JamiTheme.faddedFontColor |
| 94 | } |
| 95 | |
| 96 | Rectangle { |
| 97 | id: jamiRegisteredNameRect |
| 98 | |
| 99 | Layout.alignment: Qt.AlignCenter |
| 100 | Layout.preferredWidth: welcomeRectComponentsGroup.width |
| 101 | Layout.preferredHeight: 65 |
| 102 | Layout.bottomMargin: 5 |
| 103 | |
| 104 | visible: accountListModel.data(accountListModel.index( |
| 105 | currentAccountIndex, 0), |
| 106 | 260) === 1 |
| 107 | |
| 108 | ColumnLayout { |
| 109 | id: jamiRegisteredNameRectColumnLayout |
| 110 | |
| 111 | spacing: 0 |
| 112 | |
| 113 | Text { |
| 114 | id: jamiRegisteredNameText |
| 115 | |
| 116 | Layout.alignment: Qt.AlignCenter |
| 117 | Layout.preferredWidth: welcomeRectComponentsGroup.width |
| 118 | Layout.preferredHeight: 30 |
| 119 | |
| 120 | font.pointSize: JamiTheme.textFontSize |
| 121 | |
| 122 | horizontalAlignment: Text.AlignHCenter |
| 123 | verticalAlignment: Text.AlignVCenter |
| 124 | |
| 125 | text: textMetricsjamiRegisteredNameText.elidedText |
| 126 | |
| 127 | TextMetrics { |
| 128 | id: textMetricsjamiRegisteredNameText |
| 129 | |
| 130 | font: jamiRegisteredNameText.font |
| 131 | text: accountListModel.data( |
| 132 | accountListModel.index( |
| 133 | currentAccountIndex, 0), 258) |
| 134 | elideWidth: welcomeRectComponentsGroup.width |
| 135 | elide: Qt.ElideMiddle |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | RowLayout { |
| 140 | id: jamiRegisteredNameRowLayout |
| 141 | |
| 142 | Layout.alignment: Qt.AlignCenter |
| 143 | Layout.preferredWidth: buttonPreferredSize * 2 + 20 |
| 144 | Layout.preferredHeight: 30 |
| 145 | |
| 146 | HoverableButton { |
| 147 | id: copyRegisterednameButton |
| 148 | |
| 149 | Layout.alignment: Qt.AlignCenter |
| 150 | Layout.preferredWidth: buttonPreferredSize |
| 151 | Layout.preferredHeight: buttonPreferredSize |
| 152 | |
| 153 | radius: 30 |
| 154 | source: "qrc:/images/icons/ic_content_copy.svg" |
| 155 | |
| 156 | onClicked: { |
| 157 | ClientWrapper.utilsAdaptor.setText( |
| 158 | textMetricsjamiRegisteredNameText.text) |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | HoverableButton { |
| 163 | id: qrCodeGenerateButton |
| 164 | |
| 165 | Layout.alignment: Qt.AlignCenter |
| 166 | Layout.preferredWidth: buttonPreferredSize |
| 167 | Layout.preferredHeight: buttonPreferredSize |
| 168 | |
| 169 | radius: 30 |
| 170 | source: "qrc:/images/qrcode.png" |
| 171 | |
| 172 | onClicked: { |
| 173 | qrDialog.open() |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | Image { |
| 181 | id: sipImage |
| 182 | |
| 183 | Layout.alignment: Qt.AlignCenter |
| 184 | Layout.preferredWidth: 200 |
| 185 | Layout.preferredHeight: 200 |
| 186 | |
| 187 | |
| 188 | /* |
| 189 | * Check if account type is ring. |
| 190 | */ |
| 191 | visible: accountListModel.data(accountListModel.index( |
| 192 | currentAccountIndex, 0), |
| 193 | 260) === 1 ? false : true |
| 194 | fillMode: Image.PreserveAspectFit |
| 195 | |
| 196 | |
| 197 | /* |
| 198 | * Requested size. |
| 199 | */ |
| 200 | sourceSize.width: 200 |
| 201 | sourceSize.height: 200 |
| 202 | mipmap: true |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | HoverableButton { |
| 207 | id: aboutButton |
| 208 | |
| 209 | anchors.horizontalCenter: welcomeRectComponentsGroup.horizontalCenter |
| 210 | anchors.bottom: welcomeRectComponentsGroup.bottom |
| 211 | anchors.bottomMargin: 5 |
| 212 | |
| 213 | width: 80 |
| 214 | height: buttonPreferredSize |
| 215 | |
| 216 | text: qsTr("About") |
| 217 | fontPointSize: JamiTheme.textFontSize |
| 218 | radius: 10 |
| 219 | |
| 220 | onClicked: { |
| 221 | aboutPopUpDialog.open() |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | CustomBorder { |
| 227 | commonBorder: false |
| 228 | lBorderwidth: 1 |
| 229 | rBorderwidth: 0 |
| 230 | tBorderwidth: 0 |
| 231 | bBorderwidth: 0 |
| 232 | borderColor: JamiTheme.tabbarBorderColor |
| 233 | } |
| 234 | } |