blob: 87d883a5d118e928d0f3bde168b168797a403f58 [file] [log] [blame]
Sébastien Blin6607e0e2020-07-24 15:15:47 -04001/*
2 * Copyright (C) 2020 by Savoir-faire Linux
3 * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
Ming Rui Zhang96808872020-08-27 12:59:09 -04004 * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
Sébastien Blin6607e0e2020-07-24 15:15:47 -04005 *
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 */
Ming Rui Zhang96808872020-08-27 12:59:09 -040019
Sébastien Blin6607e0e2020-07-24 15:15:47 -040020import QtQuick 2.14
21import QtQuick.Controls 2.14
22import QtGraphicalEffects 1.12
23import net.jami.Models 1.0
24
25import "../../commoncomponents"
26
Ming Rui Zhang96808872020-08-27 12:59:09 -040027import "../../commoncomponents/js/contextmenugenerator.js" as ContextMenuGenerator
Sébastien Blin6607e0e2020-07-24 15:15:47 -040028
Ming Rui Zhang96808872020-08-27 12:59:09 -040029Item {
Sébastien Blin6607e0e2020-07-24 15:15:47 -040030 id: root
31
Sébastien Blin6607e0e2020-07-24 15:15:47 -040032 property var uri: ""
33 property var maximized: true
34 property var active: true
Ming Rui Zhang96808872020-08-27 12:59:09 -040035 property var showHangup: false
36 property var showMaximize: false
37 property var showMinimize: false
Sébastien Blin6607e0e2020-07-24 15:15:47 -040038
Ming Rui Zhang96808872020-08-27 12:59:09 -040039 function openMenu(){
40 if (showHangup)
41 ContextMenuGenerator.addMenuItem(qsTr("Hang up"),
42 "qrc:/images/icons/ic_call_end_white_24px.svg",
43 function (){
44 CallAdapter.hangupCall(uri)
45 })
46
47 if (showMaximize)
48 ContextMenuGenerator.addMenuItem(qsTr("Maximize participant"),
49 "qrc:/images/icons/open_in_full-24px.svg",
50 function (){
51 CallAdapter.maximizeParticipant(uri, active)
52 })
53 if (showMinimize)
54 ContextMenuGenerator.addMenuItem(qsTr("Minimize participant"),
55 "qrc:/images/icons/close_fullscreen-24px.svg",
56 function (){
57 CallAdapter.minimizeParticipant()
58 })
59
60 root.height = ContextMenuGenerator.getMenu().height
61 root.width = ContextMenuGenerator.getMenu().width
62 ContextMenuGenerator.getMenu().open()
Sébastien Blin6607e0e2020-07-24 15:15:47 -040063 }
64
Ming Rui Zhang96808872020-08-27 12:59:09 -040065 Component.onCompleted: {
66 ContextMenuGenerator.createBaseContextMenuObjects(root)
Sébastien Blin6607e0e2020-07-24 15:15:47 -040067 }
68}
69