Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright (C) 2020 by Savoir-faire Linux |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 4 | * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 5 | * 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 | */ |
| 20 | import QtQuick 2.14 |
| 21 | import QtQuick.Controls 2.14 |
| 22 | import QtQuick.Layouts 1.14 |
| 23 | import QtQuick.Controls.Universal 2.12 |
| 24 | import QtQml 2.14 |
| 25 | import net.jami.Models 1.0 |
| 26 | |
| 27 | import "../../commoncomponents" |
| 28 | |
| 29 | Rectangle { |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 30 | id: root |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 31 | |
| 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 Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 36 | property int buttonPreferredSize: 24 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 37 | |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 38 | signal chatButtonClicked |
| 39 | signal addToConferenceButtonClicked |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 40 | |
| 41 | function setButtonStatus(isPaused, isAudioOnly, isAudioMuted, isVideoMuted, isRecording, isSIP, isConferenceCall) { |
| 42 | noVideoButton.visible = !isAudioOnly |
| 43 | addToConferenceButton.visible = !isSIP |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 44 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 45 | noMicButton.checked = isAudioMuted |
| 46 | noVideoButton.checked = isVideoMuted |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 47 | } |
| 48 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 49 | color: "transparent" |
| 50 | z: 2 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 51 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 52 | RowLayout { |
| 53 | id: callOverlayButtonGroup |
| 54 | |
| 55 | spacing: 8 |
| 56 | height: 56 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 57 | |
| 58 | anchors.fill: parent |
| 59 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 60 | 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 Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 66 | } |
| 67 | } |
| 68 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 69 | HoverableButton { |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 70 | id: noMicButton |
| 71 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 72 | Layout.preferredWidth: buttonPreferredSize * 2 |
| 73 | Layout.preferredHeight: buttonPreferredSize * 2 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 74 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 75 | 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 Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 88 | |
| 89 | onClicked: { |
| 90 | CallAdapter.muteThisCallToggle() |
| 91 | } |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 92 | } |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 93 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 94 | HoverableButton { |
| 95 | id: hangUpButton |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 96 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 97 | 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 Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 114 | } |
| 115 | } |
| 116 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 117 | HoverableButton { |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 118 | id: noVideoButton |
| 119 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 120 | Layout.preferredWidth: buttonPreferredSize * 2 |
| 121 | Layout.preferredHeight: buttonPreferredSize * 2 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 122 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 123 | 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 Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 128 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 129 | 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 Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 136 | |
| 137 | onClicked: { |
| 138 | CallAdapter.videoPauseThisCallToggle() |
| 139 | } |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 140 | } |
| 141 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 142 | Item { |
| 143 | Layout.fillWidth: true |
| 144 | } |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 145 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 146 | HoverableButton { |
| 147 | id: addToConferenceButton |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 148 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 149 | Layout.preferredWidth: buttonPreferredSize * 2 |
| 150 | Layout.preferredHeight: buttonPreferredSize * 2 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 151 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 152 | 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 Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 163 | |
| 164 | onClicked: { |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 165 | root.addToConferenceButtonClicked() |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 166 | } |
| 167 | } |
| 168 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 169 | HoverableButton { |
| 170 | id: chatButton |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 171 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 172 | Layout.preferredWidth: buttonPreferredSize * 2 |
| 173 | Layout.preferredHeight: buttonPreferredSize * 2 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 174 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 175 | 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 Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 180 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 181 | buttonImageHeight: buttonPreferredSize |
| 182 | buttonImageWidth: buttonPreferredSize |
| 183 | color: "white" |
| 184 | source: "qrc:/images/icons/ic_chat_white_24dp.png" |
| 185 | radius: 30 |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 186 | |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 187 | onClicked: { |
| 188 | root.chatButtonClicked() |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 189 | } |
| 190 | } |
Sébastien Blin | 8940f3c | 2020-07-23 17:03:11 -0400 | [diff] [blame^] | 191 | |
| 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 Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 218 | } |
Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame] | 219 | } |