Warning, /plasma/plasma-bigscreen/kcms/audio-device-chooser/ui/delegates/CompactAudioDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2019 Aditya Mehra <aix.m@outlook.com> 0003 SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 2.14 0009 import QtQuick.Layouts 1.14 0010 import QtQuick.Controls 2.14 0011 import org.kde.plasma.core 2.0 as PlasmaCore 0012 import org.kde.plasma.components 3.0 as PlasmaComponents 0013 import org.kde.kirigami 2.12 as Kirigami 0014 import org.kde.mycroft.bigscreen 1.0 as BigScreen 0015 import Qt5Compat.GraphicalEffects 0016 import org.kde.plasma.private.volume 0.1 0017 import "../code/icon.js" as Icon 0018 0019 BigScreen.AbstractDelegate { 0020 id: delegate 0021 property bool isPlayback: type.substring(0, 4) == "sink" 0022 property bool onlyOne: false 0023 readonly property var currentPort: Ports[ActivePortIndex] 0024 property string type 0025 property bool isDefaultDevice: deviceDefaultIcon.visible 0026 signal setDefault 0027 0028 property var hasVolume: HasVolume 0029 property bool volumeWritable: VolumeWritable 0030 property var muted: Muted 0031 property var vol: Volume 0032 property var pObject: PulseObject 0033 property int focusMarginWidth: listView.currentIndex == index && delegate.activeFocus ? contentLayout.width : contentLayout.width - Kirigami.Units.gridUnit 0034 0035 implicitWidth: isCurrent ? listView.cellWidth * 2 : listView.cellWidth 0036 implicitHeight: listView.height + Kirigami.Units.largeSpacing 0037 0038 Behavior on implicitWidth { 0039 NumberAnimation { 0040 duration: Kirigami.Units.longDuration 0041 easing.type: Easing.InOutQuad 0042 } 0043 } 0044 0045 Keys.onReturnPressed: { 0046 listView.currentIndex = index 0047 settingsView.currentItem.forceActiveFocus() 0048 } 0049 0050 onClicked: { 0051 listView.currentIndex = index 0052 settingsView.forceActiveFocus() 0053 } 0054 0055 contentItem: Item { 0056 id: contentItemLayout 0057 0058 Kirigami.Icon { 0059 id: deviceAudioSvgIcon 0060 width: listView.cellWidth - delegate.leftPadding - (delegate.isCurrent ? 0 : delegate.rightPadding) 0061 height: isCurrent ? width : width - Kirigami.Units.largeSpacing * 4 0062 source: Icon.name(Volume, Muted, isPlayback ? "audio-volume" : "microphone-sensitivity") 0063 Behavior on width { 0064 NumberAnimation { 0065 duration: Kirigami.Units.longDuration 0066 easing.type: Easing.InOutQuad 0067 } 0068 } 0069 } 0070 0071 ColumnLayout { 0072 width: isCurrent ? listView.cellWidth - delegate.leftPadding : listView.cellWidth - delegate.leftPadding - delegate.rightPadding 0073 anchors.right: parent.right 0074 y: delegate.isCurrent ? contentItemLayout.height / 2 - height / 2 : contentItemLayout.height - (deviceNameLabel.height + deviceDefaultRepresentationLayout.height) 0075 0076 Kirigami.Heading { 0077 id: deviceNameLabel 0078 Layout.fillWidth: true 0079 visible: text.length > 0 0080 level: 2 0081 elide: Text.ElideRight 0082 wrapMode: Text.Wrap 0083 horizontalAlignment: Text.AlignHCenter 0084 maximumLineCount: delegate.isCurrent ? 3 : 2 0085 textFormat: Text.PlainText 0086 color: Kirigami.Theme.textColor 0087 text: delegate.isCurrent ? !currentPort ? Description : i18ndc("kcm_audiodevice", "label of device items", "%1 (%2)", currentPort.description, Description) : !currentPort ? Description.split("(")[0] : i18ndc("kcm_audiodevice", "label of device items", "%1 (%2)", currentPort.description, Description).split("(")[0] 0088 } 0089 0090 RowLayout { 0091 id: deviceDefaultRepresentationLayout 0092 Layout.fillWidth: true 0093 Layout.alignment: Qt.AlignHCenter 0094 0095 Kirigami.Icon { 0096 id: deviceDefaultIcon 0097 Layout.leftMargin: Kirigami.Units.smallSpacing 0098 Layout.preferredWidth: listView.currentIndex == index && delegate.activeFocus ? PlasmaCore.Units.iconSizes.medium : PlasmaCore.Units.iconSizes.smallMedium 0099 Layout.preferredHeight: listView.currentIndex == index && delegate.activeFocus ? PlasmaCore.Units.iconSizes.medium : PlasmaCore.Units.iconSizes.smallMedium 0100 source: Qt.resolvedUrl("../images/green-tick.svg") 0101 opacity: PulseObject.default ? 1 : 0 0102 } 0103 0104 // Kirigami.Heading { 0105 // id: deviceDefaultLabel 0106 // Layout.rightMargin: Kirigami.Units.smallSpacing 0107 // level: 2 0108 // text: i18n("Default") 0109 // visible: PulseObject.default ? 1 : 0 0110 // } 0111 } 0112 } 0113 } 0114 } 0115