blob: a6a4f8043c2d2d5dbdb6e54b96a37145ff16516d [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001/*
2 * Copyright (C) 2020 by Savoir-faire Linux
3 * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
Ming Rui Zhang96808872020-08-27 12:59:09 -040018
Sébastien Blin1f915762020-08-03 13:27:42 -040019import QtQuick 2.14
20import QtQuick.Controls 2.14
21import net.jami.Models 1.0
22
23import "../../commoncomponents"
24
Sébastien Blin1f915762020-08-03 13:27:42 -040025/*
Ming Rui Zhang96808872020-08-27 12:59:09 -040026 * Menu item wrapper for video device checkable item.
Sébastien Blin1f915762020-08-03 13:27:42 -040027 */
28GeneralMenuItem {
29 id: videoCallPageContextMenuDeviceItem
30
31 property int contextMenuPreferredWidth: 250
32
Sébastien Blin1f915762020-08-03 13:27:42 -040033 TextMetrics {
34 id: textMetrics
Sébastien Blin1f915762020-08-03 13:27:42 -040035 elide: Text.ElideMiddle
36 elideWidth: contextMenuPreferredWidth
37 - videoCallPageContextMenuDeviceItem.implicitIndicatorWidth
38 text: videoCallPageContextMenuDeviceItem.itemName
39 }
40
Sébastien Blin8940f3c2020-07-23 17:03:11 -040041 itemName: textMetrics.elidedText.length !== 0 ?
42 textMetrics.elidedText :
43 qsTr("No video device")
Sébastien Blin1f915762020-08-03 13:27:42 -040044
Sébastien Blin8940f3c2020-07-23 17:03:11 -040045 indicator: null
Sébastien Blin1f915762020-08-03 13:27:42 -040046
Sébastien Blin8940f3c2020-07-23 17:03:11 -040047 iconSource: videoCallPageContextMenuDeviceItem.checked ?
48 "qrc:/images/icons/check_box-24px.svg" :
49 "qrc:/images/icons/check_box_outline_blank-24px.svg"
Sébastien Blin1f915762020-08-03 13:27:42 -040050
51 onClicked: {
52 var deviceName = videoCallPageContextMenuDeviceItem.itemName
Sébastien Blin1f915762020-08-03 13:27:42 -040053 AvAdapter.onVideoContextMenuDeviceItemClicked(deviceName)
54 }
55}