Warning, /plasma/kpipewire/tests/main.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org>
0003
0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006
0007 import QtQuick 2.1
0008 import QtQuick.Layouts 1.1
0009 import QtQuick.Controls 2.1
0010 import org.kde.kirigami 2.15 as Kirigami
0011 import org.kde.taskmanager
0012
0013 import org.kde.pipewire 0.1 as PipeWire
0014
0015 Kirigami.ApplicationWindow
0016 {
0017 id: root
0018 width: 500
0019 height: 500
0020 visible: true
0021 property QtObject app
0022
0023 function addStream(nodeid, displayText, fd, allowDmaBuf) {
0024 if (fd == null)
0025 fd = 0;
0026 rep.model.append({nodeId: nodeid, uuid: "", display: displayText, fd: fd, allowDmaBuf: allowDmaBuf })
0027 }
0028 function removeStream(nodeid) {
0029 for(var i=0; i<rep.model.count; ++i) {
0030 if (rep.model.get(i).nodeId === nodeid) {
0031 rep.model.remove(i)
0032 break;
0033 }
0034 }
0035 }
0036
0037 Instantiator {
0038 model: TasksModel {
0039 groupMode: TasksModel.GroupDisabled
0040 }
0041 delegate: Item {
0042 property var uuid: model.WinIdList
0043 property var appId: model.AppId
0044 }
0045 onObjectAdded: (index, object) => {
0046 app.addWindow(object.uuid, object.appId)
0047 }
0048 }
0049
0050 ColumnLayout {
0051 id: pipes
0052 anchors.fill: parent
0053
0054 Button {
0055 text: "Add Virtual Monitor"
0056 onClicked: app.createVirtualMonitor()
0057 }
0058
0059 Button {
0060 text: "Add Region"
0061 onClicked: app.requestSelection()
0062 }
0063
0064 Repeater {
0065 id: rep
0066 model: ListModel {}
0067
0068 delegate: Item {
0069 Layout.fillWidth: true
0070 Layout.fillHeight: true
0071 PipeWire.PipeWireSourceItem {
0072 id: sourceItem
0073 nodeId: model.nodeId
0074 fd: model.fd
0075 anchors.fill: parent
0076 allowDmaBuf: model.allowDmaBuf
0077 }
0078
0079 RowLayout {
0080 Kirigami.Icon {
0081 id: butt
0082 source: sourceItem.usingDmaBuf ? "speedometer" : "delete"
0083 }
0084 Label {
0085 text: model.display
0086 }
0087 }
0088 }
0089 }
0090 }
0091 }