Changeset View
Changeset View
Standalone View
Standalone View
src/kcm/package/contents/ui/StreamListItem.qml
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | Copyright 2014-2015 Harald Sitter <sitter@kde.org> | 2 | Copyright 2014-2015 Harald Sitter <sitter@kde.org> | ||
3 | Copyright 2019 Sefa Eyeoglu <contact@scrumplex.net> | ||||
3 | 4 | | |||
4 | This program is free software; you can redistribute it and/or | 5 | This program is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU General Public License as | 6 | modify it under the terms of the GNU General Public License as | ||
6 | published by the Free Software Foundation; either version 2 of | 7 | published by the Free Software Foundation; either version 2 of | ||
7 | the License or (at your option) version 3 or any later version | 8 | the License or (at your option) version 3 or any later version | ||
8 | accepted by the membership of KDE e.V. (or its successor approved | 9 | accepted by the membership of KDE e.V. (or its successor approved | ||
9 | by the membership of KDE e.V.), which shall act as a proxy | 10 | by the membership of KDE e.V.), which shall act as a proxy | ||
10 | defined in Section 14 of version 3 of the license. | 11 | defined in Section 14 of version 3 of the license. | ||
Show All 14 Lines | |||||
25 | import org.kde.kirigami 2.5 as Kirigami | 26 | import org.kde.kirigami 2.5 as Kirigami | ||
26 | import org.kde.plasma.private.volume 0.1 | 27 | import org.kde.plasma.private.volume 0.1 | ||
27 | 28 | | |||
28 | ColumnLayout { | 29 | ColumnLayout { | ||
29 | id: delegate | 30 | id: delegate | ||
30 | 31 | | |||
31 | property alias deviceModel: deviceComboBox.model | 32 | property alias deviceModel: deviceComboBox.model | ||
32 | readonly property bool isEventStream: Name == "sink-input-by-media-role:event" | 33 | readonly property bool isEventStream: Name == "sink-input-by-media-role:event" | ||
34 | property bool isPlayback: type.substring(0, 4) == "sink" | ||||
33 | 35 | | |||
34 | width: parent.width | 36 | width: parent.width | ||
35 | 37 | | |||
36 | RowLayout { | 38 | RowLayout { | ||
37 | Layout.fillWidth: true | 39 | Layout.fillWidth: true | ||
38 | spacing: units.smallSpacing * 2 | 40 | spacing: units.smallSpacing * 2 | ||
39 | 41 | | |||
40 | Kirigami.Icon { | 42 | Kirigami.Icon { | ||
41 | Layout.alignment: Qt.AlignHCenter | 43 | Layout.alignment: Qt.AlignHCenter | ||
42 | Layout.preferredHeight: delegateColumn.height * 0.60 | 44 | Layout.preferredHeight: delegateColumn.height * 0.75 | ||
43 | Layout.preferredWidth: Layout.preferredHeight | 45 | Layout.preferredWidth: Layout.preferredHeight | ||
44 | source: IconName || "unknown" | 46 | source: IconName || "unknown" | ||
45 | } | 47 | } | ||
46 | 48 | | |||
47 | ColumnLayout { | 49 | ColumnLayout { | ||
48 | id: delegateColumn | 50 | id: delegateColumn | ||
49 | Layout.fillWidth: true | 51 | Layout.fillWidth: true | ||
50 | 52 | | |||
Show All 15 Lines | 53 | RowLayout { | |||
66 | 68 | | |||
67 | DeviceComboBox { | 69 | DeviceComboBox { | ||
68 | id: deviceComboBox | 70 | id: deviceComboBox | ||
69 | Layout.leftMargin: units.smallSpacing | 71 | Layout.leftMargin: units.smallSpacing | ||
70 | Layout.rightMargin: units.smallSpacing | 72 | Layout.rightMargin: units.smallSpacing | ||
71 | Layout.preferredWidth: delegate.width / 3 | 73 | Layout.preferredWidth: delegate.width / 3 | ||
72 | visible: !isEventStream && count > 1 | 74 | visible: !isEventStream && count > 1 | ||
73 | } | 75 | } | ||
76 | } | ||||
74 | 77 | | |||
78 | RowLayout { | ||||
75 | MuteButton { | 79 | MuteButton { | ||
76 | muted: Muted | 80 | muted: Muted | ||
77 | onCheckedChanged: Muted = checked | 81 | onCheckedChanged: Muted = checked | ||
78 | } | 82 | } | ||
79 | } | | |||
80 | 83 | | |||
81 | VolumeSlider {} | 84 | VolumeSlider {} | ||
82 | } | 85 | } | ||
83 | } | 86 | } | ||
87 | } | ||||
84 | 88 | | |||
85 | ListItemSeperator { | 89 | ListItemSeperator { | ||
86 | view: delegate.ListView.view | 90 | view: delegate.ListView.view | ||
87 | 91 | | |||
88 | Component.onCompleted: { | 92 | Component.onCompleted: { | ||
89 | if (isEventStream) { | 93 | if (isEventStream) { | ||
90 | visible = Qt.binding(function() { | 94 | visible = Qt.binding(function() { | ||
91 | return sinkInputView.count > 0; | 95 | return sinkInputView.count > 0; | ||
92 | }); | 96 | }); | ||
93 | } | 97 | } | ||
94 | } | 98 | } | ||
95 | } | 99 | } | ||
96 | } | 100 | } |