diff --git a/src/kcm/package/contents/ui/Advanced.qml b/src/kcm/package/contents/ui/Advanced.qml new file mode 100644 --- /dev/null +++ b/src/kcm/package/contents/ui/Advanced.qml @@ -0,0 +1,78 @@ +/* + Copyright 2014-2015 Harald Sitter + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License or (at your option) version 3 or any later version + accepted by the membership of KDE e.V. (or its successor approved + by the membership of KDE e.V.), which shall act as a proxy + defined in Section 14 of version 3 of the license. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.3 + +import org.kde.plasma.private.volume 0.1 + +ScrollView { + id: scrollView + + ColumnLayout { + width: scrollView.viewport.width + + Header { + Layout.fillWidth: true + enabled: 0 < view.count + text: i18n("Device Profiles") + disabledText: i18nc("@label", "No Device Profiles Available") + } + + ListView { + id: view + Layout.fillWidth: true + Layout.preferredHeight: contentHeight + Layout.margins: units.gridUnit / 2 + interactive: false + spacing: units.smallSpacing * 2 + model: CardModel {} + delegate: CardListItem {} + } + + Header { + Layout.fillWidth: true + text: i18n("Advanced Output Configuration") + } + ModuleManager { + id: moduleManager + } + CheckBox { + Layout.fillWidth: true + Layout.topMargin: units.smallSpacing + Layout.leftMargin: units.gridUnit / 2 + Layout.rightMargin: units.gridUnit / 2 + width: parent.width + text: i18n("Add virtual output device for simultaneous output on all local sound cards") + checked: moduleManager.combineSinks + onCheckedChanged: moduleManager.combineSinks = checked; + } + CheckBox { + Layout.fillWidth: true + Layout.leftMargin: units.gridUnit / 2 + Layout.rightMargin: units.gridUnit / 2 + text: i18n("Automatically switch all running streams when a new output becomes available") + checked: moduleManager.switchOnConnect + onCheckedChanged: moduleManager.switchOnConnect = checked; + } + + } +} diff --git a/src/kcm/package/contents/ui/Applications.qml b/src/kcm/package/contents/ui/Applications.qml new file mode 100644 --- /dev/null +++ b/src/kcm/package/contents/ui/Applications.qml @@ -0,0 +1,99 @@ +/* + Copyright 2014-2015 Harald Sitter + Copyright 2016 David Rosca + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License or (at your option) version 3 or any later version + accepted by the membership of KDE e.V. (or its successor approved + by the membership of KDE e.V.), which shall act as a proxy + defined in Section 14 of version 3 of the license. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.3 + +import org.kde.plasma.private.volume 0.1 + +ScrollView { + id: scrollView + anchors.fill: parent + + ColumnLayout { + width: scrollView.viewport.width + + property bool appsPlayingAudio: eventStreamView.visible || sinkInputView.visible + + Header { + enabled: parent.appsPlayingAudio + text: i18n("Playback") + disabledText: i18nc("@label", "No Applications Playing Audio") + } + + ListView { + id: eventStreamView + Layout.fillWidth: true + Layout.minimumHeight: contentHeight + Layout.maximumHeight: contentHeight + Layout.margins: units.gridUnit / 2 + interactive: false + visible: count > 0 + spacing: units.largeSpacing + model: PulseObjectFilterModel { + filters: [ { role: "Name", value: "sink-input-by-media-role:event" } ] + sourceModel: StreamRestoreModel {} + } + delegate: StreamListItem { + deviceModel: sinkModel + } + } + + ListView { + id: sinkInputView + Layout.fillWidth: true + Layout.minimumHeight: contentHeight + Layout.maximumHeight: contentHeight + Layout.margins: units.gridUnit / 2 + interactive: false + visible: count > 0 + spacing: units.largeSpacing + model: PulseObjectFilterModel { + filters: [ { role: "VirtualStream", value: false } ] + sourceModel: SinkInputModel {} + } + delegate: StreamListItem { + deviceModel: sinkModel + } + } + + Header { + Layout.fillWidth: true + enabled: capturestreams.count > 0 + text: i18n("Capture") + disabledText: i18nc("@label", "No Applications Recording Audio") + } + + ListView { + id: capturestreams + model: PulseObjectFilterModel { + filters: [ { role: "VirtualStream", value: false } ] + sourceModel: SourceOutputModel {} + } + + delegate: StreamListItem { + deviceModel: sourceModel + } + } + + } +} diff --git a/src/kcm/package/contents/ui/CardView.qml b/src/kcm/package/contents/ui/CardView.qml deleted file mode 100644 --- a/src/kcm/package/contents/ui/CardView.qml +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright 2014-2015 Harald Sitter - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.3 - -import org.kde.plasma.private.volume 0.1 - -ColumnLayout { - property alias model: view.model - property alias emptyText: view.emptyText - PulseView { - id: view - Layout.fillHeight: true - Layout.fillWidth: true - delegate: CardListItem {} - } - ModuleManager { - id: moduleManager - } - CheckBox { - text: i18n("Add virtual output device for simultaneous output on all local sound cards") - checked: moduleManager.combineSinks - onCheckedChanged: moduleManager.combineSinks = checked; - } - CheckBox { - text: i18n("Automatically switch all running streams when a new output becomes available") - checked: moduleManager.switchOnConnect - onCheckedChanged: moduleManager.switchOnConnect = checked; - } - -} diff --git a/src/kcm/package/contents/ui/DeviceView.qml b/src/kcm/package/contents/ui/DeviceView.qml deleted file mode 100644 --- a/src/kcm/package/contents/ui/DeviceView.qml +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright 2014-2015 Harald Sitter - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -import QtQuick 2.0 - -PulseView { - delegate: DeviceListItem {} -} diff --git a/src/kcm/package/contents/ui/Devices.qml b/src/kcm/package/contents/ui/Devices.qml new file mode 100644 --- /dev/null +++ b/src/kcm/package/contents/ui/Devices.qml @@ -0,0 +1,66 @@ +/* + Copyright 2014-2015 Harald Sitter + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License or (at your option) version 3 or any later version + accepted by the membership of KDE e.V. (or its successor approved + by the membership of KDE e.V.), which shall act as a proxy + defined in Section 14 of version 3 of the license. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +import QtQuick 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.3 + +ScrollView { + id: scrollView + + ColumnLayout { + width: scrollView.viewport.width + + Header { + Layout.fillWidth: true + enabled: 0 < sinks.count + text: i18n("Outputs") + disabledText: i18nc("@label", "No Output Devices Available") + } + + ListView { + id: sinks + Layout.fillWidth: true + Layout.preferredHeight: contentHeight + Layout.margins: units.gridUnit / 2 + interactive: false + spacing: units.smallSpacing * 2 + model: sinkModel + delegate: DeviceListItem {} + } + + Header { + Layout.fillWidth: true + enabled: sources.count > 0 + text: i18n("Inputs") + disabledText: i18nc("@label", "No Input Devices Available") + } + + ListView { + id: sources + Layout.fillWidth: true + Layout.preferredHeight: contentHeight + Layout.margins: units.gridUnit / 2 + interactive: false + model: sourceModel + delegate: DeviceListItem {} + } + } +} diff --git a/src/kcm/package/contents/ui/SourceOutputView.qml b/src/kcm/package/contents/ui/Header.qml rename from src/kcm/package/contents/ui/SourceOutputView.qml rename to src/kcm/package/contents/ui/Header.qml --- a/src/kcm/package/contents/ui/SourceOutputView.qml +++ b/src/kcm/package/contents/ui/Header.qml @@ -1,6 +1,5 @@ /* Copyright 2014-2015 Harald Sitter - Copyright 2016 David Rosca This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -20,10 +19,31 @@ */ import QtQuick 2.0 +import QtQuick.Layouts 1.1 import QtQuick.Controls 1.3 -PulseView { - delegate: StreamListItem { - deviceModel: sourceModel +import org.kde.plasma.components 2.0 as PlasmaComponents + +ColumnLayout { + property alias text: heading.text + property alias disabledText: disabledLabel.text + + Item { + Layout.fillWidth: true + Layout.topMargin: units.smallSpacing + height: units.gridUnit * 1.5 + + PlasmaComponents.Label { + id: heading + anchors.centerIn: parent + font.weight: Font.DemiBold + } + } + + Label { + id: disabledLabel + Layout.alignment: Qt.AlignCenter + visible: text != "" && !parent.enabled + font.italic: true } } diff --git a/src/kcm/package/contents/ui/PulseView.qml b/src/kcm/package/contents/ui/PulseView.qml deleted file mode 100644 --- a/src/kcm/package/contents/ui/PulseView.qml +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright 2014-2015 Harald Sitter - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import QtQuick.Layouts 1.0 - -import org.kde.kquickcontrolsaddons 2.0 -import org.kde.plasma.core 2.0 as PlasmaCore /* for units.gridUnit */ - -Item { - property alias model: view.model - property alias delegate: view.delegate - property alias emptyText: emptyLabel.text - - ScrollView { - anchors.fill: parent - anchors.margins: units.gridUnit / 2 - - ListView { - id: view - visible: count > 0 - spacing: units.largeSpacing - } - } - - - Item { - visible: !view.visible - width: parent.width - height: parent.height - - ColumnLayout { - anchors.centerIn: parent - - QIconItem { - Layout.preferredWidth: units.iconSizes.large - Layout.preferredHeight: units.iconSizes.large - Layout.alignment: Qt.AlignHCenter - icon: 'dialog-information' - } - - Label { - id: emptyLabel - Layout.alignment: Qt.AlignHCenter - } - } - } -} diff --git a/src/kcm/package/contents/ui/SinkInputView.qml b/src/kcm/package/contents/ui/SinkInputView.qml deleted file mode 100644 --- a/src/kcm/package/contents/ui/SinkInputView.qml +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright 2014-2015 Harald Sitter - Copyright 2016 David Rosca - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License or (at your option) version 3 or any later version - accepted by the membership of KDE e.V. (or its successor approved - by the membership of KDE e.V.), which shall act as a proxy - defined in Section 14 of version 3 of the license. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -import QtQuick 2.0 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.3 - -import org.kde.plasma.private.volume 0.1 - -Item { - property alias emptyText: pulseView.emptyText - property alias model: sinkInputView.model - - ScrollView { - id: scrollView - anchors.fill: parent - - ColumnLayout { - width: scrollView.viewport.width - - ListView { - id: eventStreamView - Layout.fillWidth: true - Layout.minimumHeight: contentHeight - Layout.maximumHeight: contentHeight - Layout.margins: units.gridUnit / 2 - model: PulseObjectFilterModel { - filters: [ { role: "Name", value: "sink-input-by-media-role:event" } ] - sourceModel: StreamRestoreModel {} - } - delegate: StreamListItem { - deviceModel: sinkModel - } - boundsBehavior: Flickable.StopAtBounds; - visible: count > 0 - spacing: units.largeSpacing - } - - ListView { - id: sinkInputView - Layout.fillWidth: true - Layout.minimumHeight: contentHeight - Layout.maximumHeight: contentHeight - Layout.margins: units.gridUnit / 2 - boundsBehavior: Flickable.StopAtBounds; - visible: count > 0 - spacing: units.largeSpacing - delegate: StreamListItem { - deviceModel: sinkModel - } - } - } - } - - PulseView { - id: pulseView - anchors.fill: parent - visible: !eventStreamView.visible && !sinkInputView.visible - } -} diff --git a/src/kcm/package/contents/ui/main.qml b/src/kcm/package/contents/ui/main.qml --- a/src/kcm/package/contents/ui/main.qml +++ b/src/kcm/package/contents/ui/main.qml @@ -31,49 +31,20 @@ property QtObject sourceModel: SourceModel { } implicitWidth: units.gridUnit * 30 - implicitHeight: units.gridUnit * 20 + implicitHeight: units.gridUnit * 30 ConfigModule.quickHelp: i18n("This module allows to set up the Pulseaudio sound subsystem.") Tab { - title: i18nc("@title:tab", "Applications") - SinkInputView { - model: PulseObjectFilterModel { - filters: [ { role: "VirtualStream", value: false } ] - sourceModel: SinkInputModel {} - } - emptyText: i18nc("@label", "No Applications Playing Audio") - } - } - Tab { - title: i18nc("@title:tab", "Recording") - SourceOutputView { - model: PulseObjectFilterModel { - filters: [ { role: "VirtualStream", value: false } ] - sourceModel: SourceOutputModel {} - } - emptyText: i18nc("@label", "No Applications Recording Audio") - } + title: i18nc("@title:tab", "Devices") + Devices {} } Tab { - title: i18nc("@title:tab", "Output Devices") - DeviceView { - model: sinkModel - emptyText: i18nc("@label", "No Output Devices Available") - } - } - Tab { - title: i18nc("@title:tab", "Input Devices") - DeviceView { - model: sourceModel - emptyText: i18nc("@label", "No Input Devices Available") - } + title: i18nc("@title:tab", "Applications") + Applications {} } Tab { - title: i18nc("@title:tab", "Configuration") - CardView { - model: CardModel {} - emptyText: i18nc("@label", "No Additional Configuration Available") - } + title: i18nc("@title:tab", "Advanced") + Advanced {} } }