blob: 9f80a2e18676f8a10a323d671281596b974082ba [file] [log] [blame]
Sébastien Blin1f915762020-08-03 13:27:42 -04001/*
2 * Copyright (C) 2019-2020 by Savoir-faire Linux
3 * Author: Yang Wang <yang.wang@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 <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 2.15
20import QtQuick.Window 2.15
21import QtQuick.Controls 2.15
22import QtQuick.Controls.Universal 2.12
23import QtQuick.Layouts 1.3
24import QtGraphicalEffects 1.14
25import QtQuick.Controls.Styles 1.4
26import net.jami.Models 1.0
27
28ItemDelegate {
29 id: videoCodecDelegate
30
31 property string audioCodecName : ""
32 property bool isEnabled : false
33 property int audioCodecId
34 property string samplerRate: ""
35
36 signal audioCodecStateChange(string idToSet , bool isToBeEnabled)
37
38 property int checkBoxWidth: 10
39
40 highlighted: ListView.isCurrentItem
41
42 RowLayout{
43 anchors.fill: parent
44 z: 1
45
46 spacing: 10
47
48 CheckBox{
49 id: checkBoxIsEnabled
50
51 Layout.leftMargin: 20
52
53 Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
54 Layout.fillHeight: true
55
56 Layout.minimumWidth: checkBoxWidth
57 Layout.preferredWidth: checkBoxWidth
58 Layout.maximumWidth: checkBoxWidth
59
60 tristate: false
61 checkState: isEnabled ? Qt.Checked : Qt.Unchecked
62
63 indicator.implicitWidth: checkBoxWidth
64 indicator.implicitHeight:checkBoxWidth
65
66 indicator.layer.textureSize.width: checkBoxWidth
67 indicator.layer.textureSize.height: checkBoxWidth
68
69 text: ""
70
71 nextCheckState: function() {
72 var result
73 var result_bool
74
75 if (checkState === Qt.Checked){
76 result = Qt.Unchecked
77 result_bool = false
78 } else {
79 result = Qt.Checked
80 result_bool = true
81 }
82 audioCodecStateChange(audioCodecId,result_bool)
83 return result
84 }
85 }
86
87 Label{
88 id: formatNameLabel
89
90 Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
91 horizontalAlignment: Text.AlignLeft
92 verticalAlignment: Text.AlignVCenter
93
94 Layout.fillWidth: true
95 Layout.fillHeight: true
96
97 text: audioCodecName + " " + samplerRate + " Hz"
98 font.pointSize: 8
99 font.kerning: true
100 }
101 }
102}