blob: 9397701cf1bb2b7e70bf4dc3351f4edfb77c625c [file] [log] [blame]
Sébastien Blin6607e0e2020-07-24 15:15:47 -04001
2/*
3 * Copyright (C) 2020 by Savoir-faire Linux
4 * Author: Sébastien Blin <sebastien.blin@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 QtGraphicalEffects 1.12
22import net.jami.Models 1.0
23
24import "../../commoncomponents"
25
26import "../js/videodevicecontextmenuitemcreation.js" as VideoDeviceContextMenuItemCreation
27import "../js/selectscreenwindowcreation.js" as SelectScreenWindowCreation
28
29Menu {
30 id: root
31
32 property int generalMenuSeparatorCount: 0
33 property int commonBorderWidth: 1
34 font.pointSize: JamiTheme.textFontSize + 3
35 property var uri: ""
36 property var maximized: true
37 property var active: true
38
39 function showHangup(show) {
40 if (show) {
41 hangupItem.visible = true
42 hangupItem.height = hangupItem.preferredHeight
43 } else {
44 hangupItem.visible = false
45 hangupItem.height = 0
46 }
47 }
48
49 function showMaximize(show) {
50 if (show) {
51 maximizeItem.visible = true
52 maximizeItem.height = hangupItem.preferredHeight
53 } else {
54 maximizeItem.visible = false
55 maximizeItem.height = 0
56 }
57 }
58
59 function showMinimize(show) {
60 if (show) {
61 minimizeItem.visible = true
62 minimizeItem.height = hangupItem.preferredHeight
63 } else {
64 minimizeItem.visible = false
65 minimizeItem.height = 0
66 }
67 }
68
69 function setHeight(visibleItems) {
70 root.height = hangupItem.preferredHeight * visibleItems;
71 }
72
73 /*
74 * All GeneralMenuItems should remain the same width / height.
75 */
76 GeneralMenuItem {
77 id: hangupItem
78
79 itemName: qsTr("Hangup")
80 iconSource: "qrc:/images/icons/ic_call_end_white_24px.svg"
81 icon.color: "black"
82 leftBorderWidth: commonBorderWidth
83 rightBorderWidth: commonBorderWidth
84
85 onClicked: {
86 CallAdapter.hangupCall(uri)
87 root.close()
88 }
89 }
90 GeneralMenuItem {
91 id: maximizeItem
92
93 itemName: qsTr("Maximize participant")
94 iconSource: "qrc:/images/icons/open_in_full-24px.svg"
95 leftBorderWidth: commonBorderWidth
96 rightBorderWidth: commonBorderWidth
97 visible: !maximized
98
99 onClicked: {
100 CallAdapter.maximizeParticipant(uri, active)
101 root.close()
102 }
103 }
104 GeneralMenuItem {
105 id: minimizeItem
106
107 itemName: qsTr("Minimize participant")
108 iconSource: "qrc:/images/icons/close_fullscreen-24px.svg"
109 leftBorderWidth: commonBorderWidth
110 rightBorderWidth: commonBorderWidth
111 visible: maximized
112
113 onClicked: {
114 CallAdapter.minimizeParticipant()
115 root.close()
116 }
117 }
118
119 background: Rectangle {
120 implicitWidth: hangupItem.preferredWidth
121 implicitHeight: hangupItem.preferredHeight * 3
122
123 border.width: commonBorderWidth
124 border.color: JamiTheme.tabbarBorderColor
125 }
126}
127