2021-06-05 03:40:54 +00:00
|
|
|
/*
|
|
|
|
|
SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
|
|
|
|
|
SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
|
|
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import QtQuick 2.0
|
|
|
|
|
|
|
|
|
|
import org.kde.plasma.private.volume 0.1
|
|
|
|
|
|
|
|
|
|
// adapted from https://invent.kde.org/plasma/plasma-pa/-/blob/master/applet/contents/ui/DeviceListItem.qml
|
|
|
|
|
ListItemBase {
|
2025-09-13 22:59:09 +00:00
|
|
|
readonly property var currentPort: model.Ports[model.ActivePortIndex]
|
|
|
|
|
readonly property var currentActivePortIndex: model.ActivePortIndex
|
|
|
|
|
readonly property var currentMuted: model.Muted
|
|
|
|
|
readonly property var activePortIndex: model.ActivePortIndex
|
2021-06-05 03:40:54 +00:00
|
|
|
|
|
|
|
|
label: {
|
|
|
|
|
if (currentPort && currentPort.description) {
|
2025-09-13 22:59:09 +00:00
|
|
|
if (onlyOne || !model.Description) {
|
2021-06-05 03:40:54 +00:00
|
|
|
return currentPort.description;
|
|
|
|
|
} else {
|
2025-09-13 22:59:09 +00:00
|
|
|
return i18nc("label of device items", "%1 (%2)", currentPort.description, model.Description);
|
2021-06-05 03:40:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
2025-09-13 22:59:09 +00:00
|
|
|
if (model.Description) {
|
|
|
|
|
return model.Description;
|
2021-06-05 03:40:54 +00:00
|
|
|
}
|
2025-09-13 22:59:09 +00:00
|
|
|
if (model.Name) {
|
|
|
|
|
return model.Name;
|
2021-06-05 03:40:54 +00:00
|
|
|
}
|
|
|
|
|
return i18n("Device name not found");
|
|
|
|
|
}
|
|
|
|
|
}
|