Warning, /plasma/plasma-pa/src/kcm/ui/CardListItem.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 import QtQuick
0008 import QtQuick.Controls
0009 import QtQuick.Layouts
0010 
0011 import org.kde.kirigami as Kirigami
0012 import org.kde.plasma.private.volume
0013 
0014 ColumnLayout {
0015     id: delegate
0016     width: parent.width
0017 
0018     property bool comboBoxLabelsVisible: false
0019 
0020     RowLayout {
0021         Layout.fillWidth: true
0022         spacing: Kirigami.Units.largeSpacing
0023 
0024         Kirigami.Icon {
0025             Layout.alignment: Qt.AlignHCenter
0026             width: height
0027             height: Kirigami.Units.iconSizes.medium
0028             source: IconName || "audio-card"
0029         }
0030 
0031         Label {
0032             id: nameLabel
0033             Layout.fillWidth: true
0034             text: Properties["device.description"] || Name
0035             elide: Text.ElideRight
0036 
0037             // Show tooltip on hover when text elided
0038             ToolTip {
0039                 text: parent.text
0040                 visible: parent.truncated && inputTextMouseArea.containsMouse
0041             }
0042             MouseArea {
0043                 id: inputTextMouseArea
0044                 anchors.fill: parent
0045                 hoverEnabled: true
0046             }
0047         }
0048 
0049         Label {
0050             id: profileLabel
0051             visible: comboBoxLabelsVisible && profileBox.visible
0052             text: i18ndc("kcm_pulseaudio", "@label", "Profile:")
0053         }
0054 
0055         ComboBox {
0056             id: profileBox
0057             Layout.minimumWidth: Kirigami.Units.gridUnit * 12
0058             model: Profiles.filter(function (profile) {
0059                 return profile.availability === Profile.Available;
0060             })
0061             // NOTE: model resets (i.e. profiles property changes) will reset
0062             // the currentIndex, so force it to be set on model changes, otherwise
0063             // it would eventually become 0 when it shouldn't be.
0064             onModelChanged: currentIndex = model.indexOf(Profiles[ActiveProfileIndex])
0065             textRole: "description"
0066             onActivated: index => ActiveProfileIndex = Profiles.indexOf(model[index])
0067         }
0068     }
0069 
0070     Kirigami.Separator {
0071         visible: (delegate.ListView.view.count != 0) && (delegate.ListView.view.count != (index + 1))
0072         Layout.topMargin: Kirigami.Units.smallSpacing
0073         Layout.fillWidth: true
0074     }
0075 }