blob: 2fb3f8d094295511026cc975603cd99fb9907d48 [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>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.14
20import QtQuick.Layouts 1.3
21import QtQuick.Controls 2.14
22
23import "../../constant"
24
25ColumnLayout {
26 Layout.fillWidth: true
27 Layout.fillHeight: true
28 spacing: 6
29
30 property bool successState: true
31 property string progressLabelEditText: "Generating your Jami account"
32
33 Item {
34 Layout.alignment: Qt.AlignHCenter
35 Layout.preferredHeight: 40
36 Layout.fillWidth: true
37 Layout.fillHeight: true
38 }
39 Label {
40 id: spinnerLabel
41 Layout.alignment: Qt.AlignHCenter
42 Layout.minimumWidth: 200
43 Layout.minimumHeight: 200
44
45 Layout.maximumWidth: 16777215
46 Layout.maximumHeight: 16777215
47
48 property string spinnerDisplyState: successState ? "spinnerLabel_Regular" : "spinnerLabel_Failure"
49 onSpinnerDisplyStateChanged: {
50 switch (spinnerDisplyState) {
51 case "spinnerLabel_Regular":
52 background = Qt.createQmlObject("import QtQuick 2.14;
53AnimatedImage {
54source: \"qrc:/images/jami_eclipse_spinner.gif\"
55
56playing: true
57paused: false
58fillMode: Image.PreserveAspectFit
59mipmap: true
60}", spinnerLabel)
61 break
62 case "spinnerLabel_Failure":
63 background = Qt.createQmlObject("import QtQuick 2.14;
64import \"qrc:/src/constant/\";
65Image {
66anchors.fill: parent;
67source:\"image://tintedPixmap/\" + (\"qrc:/images/icons/baseline-error_outline-24px.svg\").replace(\"qrc:/images/icons/\", \"\") + \"+\" + JamiTheme.urgentOrange_;
68mipmap: true;}", spinnerLabel)
69 break
70 }
71 }
72 }
73 Item {
74 Layout.alignment: Qt.AlignHCenter
75 Layout.preferredHeight: 40
76 Layout.fillWidth: true
77 Layout.fillHeight: true
78 }
79 Label {
80 id: progressLabel
81 Layout.alignment: Qt.AlignHCenter
82 text: successState ? progressLabelEditText : "Error creating account"
83 font.pointSize: 11
84 font.kerning: true
85
86 property string progressLabelState: successState ? "color_success" : "color_fail"
87 onProgressLabelStateChanged: {
88 switch (progressLabelState) {
89 case "color_success":
90 background = Qt.createQmlObject(
91 "import QtQuick 2.14; Rectangle { anchors.fill: parent; color: \"transparent\"; }",
92 progressLabel)
93 break
94 case "color_fail":
95 background = Qt.createQmlObject(
96 "import QtQuick 2.14; Rectangle { anchors.fill: parent; color: \"red\"; }",
97 progressLabel)
98 break
99 }
100 }
101 }
102 Item {
103 Layout.alignment: Qt.AlignHCenter
104 Layout.minimumHeight: 20
105 Layout.maximumHeight: 20
106 Layout.preferredHeight: 20
107 Layout.fillWidth: true
108 Layout.fillHeight: false
109 }
110}