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 |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 31 | anchors.fill: parent |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 32 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 33 | Rectangle { |
| 34 | id: welcomeRectComponentsGroup |
| 35 | |
| 36 | anchors.centerIn: parent |
| 37 | |
ababi | a284cae | 2020-08-10 12:33:34 +0200 | [diff] [blame] | 38 | width: Math.max(mainViewStackPreferredWidth, welcomeRect.width - 100) |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 39 | 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 |
ababi | df651a2 | 2020-07-30 13:38:57 +0200 | [diff] [blame] | 83 | font.pointSize: JamiTheme.textFontSize |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 84 | |
| 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 | |
ababi | df651a2 | 2020-07-30 13:38:57 +0200 | [diff] [blame] | 119 | font.pointSize: JamiTheme.textFontSize + 1 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 120 | |
| 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 | |
ababi | df651a2 | 2020-07-30 13:38:57 +0200 | [diff] [blame] | 138 | HoverableButton { |
| 139 | id: copyRegisterednameButton |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 140 | |
| 141 | Layout.alignment: Qt.AlignCenter |
ababi | df651a2 | 2020-07-30 13:38:57 +0200 | [diff] [blame] | 142 | Layout.preferredWidth: buttonPreferredSize |
| 143 | Layout.preferredHeight: buttonPreferredSize |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 144 | |
ababi | df651a2 | 2020-07-30 13:38:57 +0200 | [diff] [blame] | 145 | radius: 30 |
| 146 | source: "qrc:/images/icons/ic_content_copy.svg" |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 147 | |
ababi | df651a2 | 2020-07-30 13:38:57 +0200 | [diff] [blame] | 148 | onClicked: { |
| 149 | ClientWrapper.utilsAdaptor.setText( |
| 150 | textMetricsjamiRegisteredNameText.text) |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 151 | } |
| 152 | } |
| 153 | } |
| 154 | } |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 155 | } |
| 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 | } |