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