Sébastien Blin | 6607e0e | 2020-07-24 15:15:47 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 by Savoir-faire Linux |
| 3 | * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> |
Ming Rui Zhang | 9680887 | 2020-08-27 12:59:09 -0400 | [diff] [blame] | 4 | * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> |
Sébastien Blin | 6607e0e | 2020-07-24 15:15:47 -0400 | [diff] [blame] | 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 | */ |
Ming Rui Zhang | 9680887 | 2020-08-27 12:59:09 -0400 | [diff] [blame] | 19 | |
Sébastien Blin | 6607e0e | 2020-07-24 15:15:47 -0400 | [diff] [blame] | 20 | import QtQuick 2.14 |
| 21 | import QtQuick.Controls 2.14 |
| 22 | import QtGraphicalEffects 1.12 |
| 23 | import net.jami.Models 1.0 |
| 24 | |
| 25 | import "../../commoncomponents" |
| 26 | |
Ming Rui Zhang | 9680887 | 2020-08-27 12:59:09 -0400 | [diff] [blame] | 27 | import "../../commoncomponents/js/contextmenugenerator.js" as ContextMenuGenerator |
Sébastien Blin | 6607e0e | 2020-07-24 15:15:47 -0400 | [diff] [blame] | 28 | |
Ming Rui Zhang | 9680887 | 2020-08-27 12:59:09 -0400 | [diff] [blame] | 29 | Item { |
Sébastien Blin | 6607e0e | 2020-07-24 15:15:47 -0400 | [diff] [blame] | 30 | id: root |
| 31 | |
Sébastien Blin | 6607e0e | 2020-07-24 15:15:47 -0400 | [diff] [blame] | 32 | property var uri: "" |
| 33 | property var maximized: true |
| 34 | property var active: true |
Ming Rui Zhang | 9680887 | 2020-08-27 12:59:09 -0400 | [diff] [blame] | 35 | property var showHangup: false |
| 36 | property var showMaximize: false |
| 37 | property var showMinimize: false |
Sébastien Blin | 6607e0e | 2020-07-24 15:15:47 -0400 | [diff] [blame] | 38 | |
Ming Rui Zhang | 9680887 | 2020-08-27 12:59:09 -0400 | [diff] [blame] | 39 | 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 Blin | 6607e0e | 2020-07-24 15:15:47 -0400 | [diff] [blame] | 63 | } |
| 64 | |
Ming Rui Zhang | 9680887 | 2020-08-27 12:59:09 -0400 | [diff] [blame] | 65 | Component.onCompleted: { |
| 66 | ContextMenuGenerator.createBaseContextMenuObjects(root) |
Sébastien Blin | 6607e0e | 2020-07-24 15:15:47 -0400 | [diff] [blame] | 67 | } |
| 68 | } |
| 69 | |