blob: cddc0ea854e3450fc1641f94a22687abf91c4031 [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001
2/*
3 * Copyright (C) 2020 by Savoir-faire Linux
Sébastien Blin8940f3c2020-07-23 17:03:11 -04004 * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
Sébastien Blin1f915762020-08-03 13:27:42 -04005 * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20import QtQuick 2.14
21import QtQuick.Controls 2.14
22import QtQuick.Layouts 1.14
23import QtQuick.Controls.Universal 2.12
24import QtQml 2.14
25import net.jami.Models 1.0
26
27import "../../commoncomponents"
28
29Rectangle {
Sébastien Blin8940f3c2020-07-23 17:03:11 -040030 id: root
Sébastien Blin1f915762020-08-03 13:27:42 -040031
32 /*
33 * ButtonCounts here is to make sure that flow layout margin is calculated correctly,
34 * since no other methods can make buttons at the layout center.
35 */
Sébastien Blin8940f3c2020-07-23 17:03:11 -040036 property int buttonPreferredSize: 24
Sébastien Blin1f915762020-08-03 13:27:42 -040037
Sébastien Blin1f915762020-08-03 13:27:42 -040038 signal chatButtonClicked
39 signal addToConferenceButtonClicked
Sébastien Blin1f915762020-08-03 13:27:42 -040040
41 function setButtonStatus(isPaused, isAudioOnly, isAudioMuted, isVideoMuted, isRecording, isSIP, isConferenceCall) {
42 noVideoButton.visible = !isAudioOnly
43 addToConferenceButton.visible = !isSIP
Sébastien Blin1f915762020-08-03 13:27:42 -040044
Sébastien Blin8940f3c2020-07-23 17:03:11 -040045 noMicButton.checked = isAudioMuted
46 noVideoButton.checked = isVideoMuted
Sébastien Blin1f915762020-08-03 13:27:42 -040047 }
48
Sébastien Blin8940f3c2020-07-23 17:03:11 -040049 color: "transparent"
50 z: 2
Sébastien Blin1f915762020-08-03 13:27:42 -040051
Sébastien Blin8940f3c2020-07-23 17:03:11 -040052 RowLayout {
53 id: callOverlayButtonGroup
54
55 spacing: 8
56 height: 56
Sébastien Blin1f915762020-08-03 13:27:42 -040057
58 anchors.fill: parent
59
Sébastien Blin8940f3c2020-07-23 17:03:11 -040060 Item {
61 Layout.preferredWidth: {
62 // 6 is the number of button
63 // If ~ 500px, go into wide mode
64 (callOverlayButtonGroup.width < buttonPreferredSize * 12 - callOverlayButtonGroup.spacing * 6 + 300)?
65 0 : callOverlayButtonGroup.width / 2 - buttonPreferredSize * 3 - callOverlayButtonGroup.spacing
Sébastien Blin1f915762020-08-03 13:27:42 -040066 }
67 }
68
Sébastien Blin8940f3c2020-07-23 17:03:11 -040069 HoverableButton {
Sébastien Blin1f915762020-08-03 13:27:42 -040070 id: noMicButton
71
Sébastien Blin8940f3c2020-07-23 17:03:11 -040072 Layout.preferredWidth: buttonPreferredSize * 2
73 Layout.preferredHeight: buttonPreferredSize * 2
Sébastien Blin1f915762020-08-03 13:27:42 -040074
Sébastien Blin8940f3c2020-07-23 17:03:11 -040075 backgroundColor: Qt.rgba(0, 0, 0, 0.75)
76 onEnterColor: Qt.rgba(0, 0, 0, 0.6)
77 onPressColor: Qt.rgba(0, 0, 0, 0.5)
78 onReleaseColor: Qt.rgba(0, 0, 0, 0.6)
79 onExitColor: Qt.rgba(0, 0, 0, 0.75)
80
81 buttonImageHeight: buttonPreferredSize
82 buttonImageWidth: buttonPreferredSize
83 baseImage: "qrc:/images/icons/ic_mic_white_24dp.png"
84 checkedImage: "qrc:/images/icons/ic_mic_off_white_24dp.png"
85 baseColor: "white"
86 checkedColor: JamiTheme.declineButtonPressedRed
87 radius: 30
Sébastien Blin1f915762020-08-03 13:27:42 -040088
89 onClicked: {
90 CallAdapter.muteThisCallToggle()
91 }
Sébastien Blin8940f3c2020-07-23 17:03:11 -040092 }
Sébastien Blin1f915762020-08-03 13:27:42 -040093
Sébastien Blin8940f3c2020-07-23 17:03:11 -040094 HoverableButton {
95 id: hangUpButton
Sébastien Blin1f915762020-08-03 13:27:42 -040096
Sébastien Blin8940f3c2020-07-23 17:03:11 -040097 Layout.preferredWidth: buttonPreferredSize * 2
98 Layout.preferredHeight: buttonPreferredSize * 2
99
100 backgroundColor: JamiTheme.declineButtonRed
101 onEnterColor: JamiTheme.declineButtonHoverRed
102 onPressColor: JamiTheme.declineButtonPressedRed
103 onReleaseColor: JamiTheme.declineButtonHoverRed
104 onExitColor: JamiTheme.declineButtonRed
105
106 buttonImageHeight: buttonPreferredSize
107 buttonImageWidth: buttonPreferredSize
108 source: "qrc:/images/icons/ic_call_end_white_24px.svg"
109 color: "white"
110 radius: 30
111
112 onClicked: {
113 CallAdapter.hangUpThisCall()
Sébastien Blin1f915762020-08-03 13:27:42 -0400114 }
115 }
116
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400117 HoverableButton {
Sébastien Blin1f915762020-08-03 13:27:42 -0400118 id: noVideoButton
119
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400120 Layout.preferredWidth: buttonPreferredSize * 2
121 Layout.preferredHeight: buttonPreferredSize * 2
Sébastien Blin1f915762020-08-03 13:27:42 -0400122
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400123 backgroundColor: Qt.rgba(0, 0, 0, 0.75)
124 onEnterColor: Qt.rgba(0, 0, 0, 0.6)
125 onPressColor: Qt.rgba(0, 0, 0, 0.5)
126 onReleaseColor: Qt.rgba(0, 0, 0, 0.6)
127 onExitColor: Qt.rgba(0, 0, 0, 0.75)
Sébastien Blin1f915762020-08-03 13:27:42 -0400128
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400129 buttonImageHeight: buttonPreferredSize
130 buttonImageWidth: buttonPreferredSize
131 baseImage: "qrc:/images/icons/ic_videocam_white.png"
132 checkedImage: "qrc:/images/icons/ic_videocam_off_white_24dp.png"
133 baseColor: "white"
134 checkedColor: JamiTheme.declineButtonPressedRed
135 radius: 30
Sébastien Blin1f915762020-08-03 13:27:42 -0400136
137 onClicked: {
138 CallAdapter.videoPauseThisCallToggle()
139 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400140 }
141
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400142 Item {
143 Layout.fillWidth: true
144 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400145
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400146 HoverableButton {
147 id: addToConferenceButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400148
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400149 Layout.preferredWidth: buttonPreferredSize * 2
150 Layout.preferredHeight: buttonPreferredSize * 2
Sébastien Blin1f915762020-08-03 13:27:42 -0400151
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400152 backgroundColor: Qt.rgba(0, 0, 0, 0.75)
153 onEnterColor: Qt.rgba(0, 0, 0, 0.6)
154 onPressColor: Qt.rgba(0, 0, 0, 0.5)
155 onReleaseColor: Qt.rgba(0, 0, 0, 0.6)
156 onExitColor: Qt.rgba(0, 0, 0, 0.75)
157
158 buttonImageHeight: buttonPreferredSize
159 buttonImageWidth: buttonPreferredSize
160 color: "white"
161 source: "qrc:/images/icons/ic_group_add_white_24dp.png"
162 radius: 30
Sébastien Blin1f915762020-08-03 13:27:42 -0400163
164 onClicked: {
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400165 root.addToConferenceButtonClicked()
Sébastien Blin1f915762020-08-03 13:27:42 -0400166 }
167 }
168
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400169 HoverableButton {
170 id: chatButton
Sébastien Blin1f915762020-08-03 13:27:42 -0400171
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400172 Layout.preferredWidth: buttonPreferredSize * 2
173 Layout.preferredHeight: buttonPreferredSize * 2
Sébastien Blin1f915762020-08-03 13:27:42 -0400174
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400175 backgroundColor: Qt.rgba(0, 0, 0, 0.75)
176 onEnterColor: Qt.rgba(0, 0, 0, 0.6)
177 onPressColor: Qt.rgba(0, 0, 0, 0.5)
178 onReleaseColor: Qt.rgba(0, 0, 0, 0.6)
179 onExitColor: Qt.rgba(0, 0, 0, 0.75)
Sébastien Blin1f915762020-08-03 13:27:42 -0400180
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400181 buttonImageHeight: buttonPreferredSize
182 buttonImageWidth: buttonPreferredSize
183 color: "white"
184 source: "qrc:/images/icons/ic_chat_white_24dp.png"
185 radius: 30
Sébastien Blin1f915762020-08-03 13:27:42 -0400186
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400187 onClicked: {
188 root.chatButtonClicked()
Sébastien Blin1f915762020-08-03 13:27:42 -0400189 }
190 }
Sébastien Blin8940f3c2020-07-23 17:03:11 -0400191
192 HoverableButton {
193 id: optionsButton
194
195 Layout.preferredWidth: buttonPreferredSize * 2
196 Layout.preferredHeight: buttonPreferredSize * 2
197
198 backgroundColor: Qt.rgba(0, 0, 0, 0.75)
199 onEnterColor: Qt.rgba(0, 0, 0, 0.6)
200 onPressColor: Qt.rgba(0, 0, 0, 0.5)
201 onReleaseColor: Qt.rgba(0, 0, 0, 0.6)
202 onExitColor: Qt.rgba(0, 0, 0, 0.75)
203
204 buttonImageHeight: buttonPreferredSize
205 buttonImageWidth: buttonPreferredSize
206 source: "qrc:/images/icons/more_vert-24px.svg"
207 radius: 30
208
209 onClicked: {
210 var rectPos = mapToItem(callStackViewWindow, optionsButton.x, optionsButton.y)
211 callViewContextMenu.activate()
212 callViewContextMenu.x = rectPos.x + optionsButton.width/2 - callViewContextMenu.width/2
213 callViewContextMenu.y = rectPos.y - 12 - callViewContextMenu.height
214 }
215 }
216
217 Item { Layout.preferredWidth: 8 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400218 }
Sébastien Blin1f915762020-08-03 13:27:42 -0400219}