blob: c3a4fd51d203cf0cb946bfff264dd7df477df8b5 [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 QtQuick.Controls.Universal 2.12
23import net.jami.Models 1.0
24
25import "../../commoncomponents"
26
27Rectangle {
28 id: outgoingCallPageRect
29
30 property int buttonPreferredSize: 50
31 property string callStatusPresentation: "outgoing"
32 property string contactImgSource: ""
33 property string bestName: "Best Name"
34 property string bestId: "Best Id"
35
36 signal callCancelButtonIsClicked
Sébastien Blin1f915762020-08-03 13:27:42 -040037
38 function updateUI(accountId, convUid) {
39 contactImgSource = "data:image/png;base64," + ClientWrapper.utilsAdaptor.getContactImageString(
40 accountId, convUid)
41 bestName = ClientWrapper.utilsAdaptor.getBestName(accountId, convUid)
42 var id = ClientWrapper.utilsAdaptor.getBestId(accountId, convUid)
43 bestId = (bestName !== id) ? id : ""
44 }
45
46 anchors.fill: parent
47
48 color: "black"
49
50
51 /*
52 * Prevent right click propagate to VideoCallPage.
53 */
54 MouseArea {
55 anchors.fill: parent
56 propagateComposedEvents: false
57 acceptedButtons: Qt.RightButton
58 }
59
Sébastien Blin1f915762020-08-03 13:27:42 -040060 ColumnLayout {
61 id: outgoingCallPageRectColumnLayout
62
63 anchors.fill: parent
64
65 Image {
66 id: contactImg
67
68 Layout.alignment: Qt.AlignCenter
69
70 Layout.preferredWidth: 100
71 Layout.preferredHeight: 100
72
73 fillMode: Image.PreserveAspectFit
74 source: contactImgSource
75 asynchronous: true
76 }
77
78 Rectangle {
79 id: outgoingCallPageTextRect
80
81 Layout.alignment: Qt.AlignCenter
82 Layout.topMargin: 5
83
84 Layout.preferredWidth: outgoingCallPageRect.width
85 Layout.preferredHeight: jamiBestNameText.height + jamiBestIdText.height
86 + callStatusText.height + spinnerImage.height + 20
87
88 color: "transparent"
89
90 ColumnLayout {
91 id: outgoingCallPageTextRectColumnLayout
92
93 Text {
94 id: jamiBestNameText
95
96 Layout.alignment: Qt.AlignCenter
97 Layout.preferredWidth: outgoingCallPageTextRect.width
98 Layout.preferredHeight: 50
99
100 font.pointSize: JamiTheme.textFontSize + 3
101
102 horizontalAlignment: Text.AlignHCenter
103 verticalAlignment: Text.AlignVCenter
104
105 text: textMetricsjamiBestNameText.elidedText
106 color: "white"
107
108 TextMetrics {
109 id: textMetricsjamiBestNameText
110 font: jamiBestNameText.font
111 text: bestName
112 elideWidth: outgoingCallPageTextRect.width - 50
113 elide: Qt.ElideMiddle
114 }
115 }
116
117 Text {
118 id: jamiBestIdText
119
120 Layout.alignment: Qt.AlignCenter
121 Layout.preferredWidth: outgoingCallPageTextRect.width
122 Layout.preferredHeight: 30
123
124 font.pointSize: JamiTheme.textFontSize
125
126 horizontalAlignment: Text.AlignHCenter
127 verticalAlignment: Text.AlignVCenter
128
129 text: textMetricsjamiBestIdText.elidedText
130 color: Qt.lighter("white", 1.5)
131
132 TextMetrics {
133 id: textMetricsjamiBestIdText
134 font: jamiBestIdText.font
135 text: bestId
136 elideWidth: outgoingCallPageTextRect.width - 50
137 elide: Qt.ElideMiddle
138 }
139 }
140
141 AnimatedImage {
142 id: spinnerImage
143
144 Layout.alignment: Qt.AlignCenter
145 Layout.preferredWidth: 20
146 Layout.preferredHeight: 5
147
148 source: "qrc:/images/waiting.gif"
149 }
150
151 Text {
152 id: callStatusText
153
154 Layout.alignment: Qt.AlignCenter
155 Layout.preferredWidth: outgoingCallPageTextRect.width
156 Layout.preferredHeight: 30
157
158 font.pointSize: JamiTheme.textFontSize
159
160 horizontalAlignment: Text.AlignHCenter
161 verticalAlignment: Text.AlignVCenter
162
163 text: callStatusPresentation + "..."
164 color: Qt.lighter("white", 1.5)
165 }
166 }
167 }
168
169 ColumnLayout {
170 id: callCancelButtonColumnLayout
171
172 Layout.alignment: Qt.AlignCenter
173
174 HoverableButton {
175 id: callCancelButton
176
177 Layout.alignment: Qt.AlignCenter
178
179 Layout.preferredWidth: buttonPreferredSize
180 Layout.preferredHeight: buttonPreferredSize
181
182 backgroundColor: JamiTheme.declineButtonRed
183 onEnterColor: JamiTheme.declineButtonHoverRed
184 onPressColor: JamiTheme.declineButtonPressedRed
185 onReleaseColor: JamiTheme.declineButtonHoverRed
186 onExitColor: JamiTheme.declineButtonRed
187
188 buttonImageHeight: buttonPreferredSize / 2
189 buttonImageWidth: buttonPreferredSize / 2
190 source: "qrc:/images/icons/ic_close_white_24dp.png"
191 radius: 30
192
Yang Wangb97bde42020-08-07 11:24:18 -0400193 toolTipText: qsTr("Cancel the call")
194
Sébastien Blin1f915762020-08-03 13:27:42 -0400195 onClicked: {
196 outgoingCallPageRect.callCancelButtonIsClicked()
197 }
198 }
199
200 Text {
201 id: cancelText
202
203 Layout.alignment: Qt.AlignCenter
204
205 font.pointSize: JamiTheme.textFontSize - 2
206 text: qsTr("Cancel")
207 }
208 }
209 }
210}