Commit 973306c7 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Remove phonon KCM

Summary:
Most of the Phonon KCM settings have been moved to plasma-pa. The remaining settings server very specific use cases that are mostl likely not worth exposing them front and center.

@sitter said he has a version of the settings to be integtated into phonon so the remaining three users can still access them

See T9091

Test Plan: builds

Reviewers: sitter

Reviewed By: sitter

Subscribers: kde-doc-english, ngraham, pino, plasma-devel, sitter

Tags: #plasma, #documentation

Differential Revision: https://phabricator.kde.org/D22616
parent fe516c6b
......@@ -192,9 +192,5 @@ if(X11_Xkb_FOUND AND XCB_XKB_FOUND)
add_subdirectory(kaccess)
endif()
install(FILES org.kde.plasmashell.metainfo.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
if (${ECM_VERSION} STRGREATER "5.58.0")
install(FILES plasma-desktop.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
else()
install(FILES plasma-desktop.categories DESTINATION ${KDE_INSTALL_CONFDIR})
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -27,6 +27,5 @@ ecm_optional_add_subdirectory(spellchecking)
ecm_optional_add_subdirectory(componentchooser)
ecm_optional_add_subdirectory(kded)
ecm_optional_add_subdirectory(solid-device-automounter)
ecm_optional_add_subdirectory(phonon)
ecm_optional_add_subdirectory(workspaceoptions)
########### install files ###############
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kcontrol/phonon)
<?xml version="1.0" ?>
<!DOCTYPE article PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN"
"dtd/kdedbx45.dtd" [
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE">
]>
<article id="phonon" lang="&language;">
<title>Audio and Video Settings</title>
<articleinfo>
<authorgroup>
<author><firstname>Matthias</firstname><surname>Kretz</surname></author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>
<date>2013-12-05</date>
<releaseinfo>&kde; 4.12</releaseinfo>
<keywordset>
<keyword>KDE</keyword>
<keyword>Systemsettings</keyword>
<keyword>hardware</keyword>
<keyword>multimedia</keyword>
<keyword>sound</keyword>
<keyword>video</keyword>
<keyword>backend</keyword>
</keywordset>
</articleinfo>
<para>
This &systemsettings; module allows you to configure the sound and video device
preference and the backends used by Phonon.
</para>
<variablelist>
<varlistentry><term><guilabel>Device Preference</guilabel> tab</term>
<listitem><para>
On the left you are presented a tree list with various categories of playback and recording.
For each category you may choose what device you wish to use.</para>
<para>The <guilabel>Audio Playback</guilabel> and <guilabel>Audio Recording</guilabel>
items define the default ordering of devices which can be overridden by
each sub items.</para>
<para>Clicking the <guibutton>Apply Device List To</guibutton> button shows a dialog
which enables you to copy the selected setting from one category to many others.</para>
<para>Highlight a category and the available devices for this category are displayed in the
list on the right. The order in this list determines the preference of the output and capture
devices. If for some reason the first device cannot be used Phonon will try to use the second, &etc;</para>
<para>Use the <guibutton>Prefer</guibutton> and <guibutton>Defer</guibutton> buttons to change the order
and the <guibutton>Test</guibutton> button to play a test sound on the selected device.
</para></listitem>
</varlistentry>
<varlistentry><term><guilabel>Audio Hardware Setup</guilabel> tab</term>
<listitem><para>
The various drop down boxes in this tab allow full control over all cards that are attached
to the system.</para>
<variablelist>
<varlistentry><term><guilabel>Hardware</guilabel></term>
<listitem><para>Select the <guilabel>Sound Card</guilabel> and an available
<guilabel>Profile</guilabel> to be used.</para>
</listitem></varlistentry>
<varlistentry><term><guilabel>Device Configuration</guilabel></term>
<listitem><para>Select the <guilabel>Sound Device</guilabel> and a <guilabel>Connector</guilabel>.</para>
</listitem></varlistentry>
<varlistentry><term><guilabel>Speaker Placement and Testing</guilabel> or <guilabel>Input Levels</guilabel></term>
<listitem>
<para>For a playback device: The buttons on this pane allow you to test each speaker separately.
</para>
<para>For a recording device: A slider shows the <guilabel>Input Levels</guilabel>
of the selected <guilabel>Connector</guilabel>.
</para>
</listitem></varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry><term><guilabel>Backend</guilabel> tab</term>
<listitem><para>
On the left side of this module a list of Phonon backends found on your system is shown.
The order here determines the order Phonon will use the backends.
Use the <guibutton>Prefer</guibutton> and <guibutton>Defer</guibutton> buttons
to change this order.</para>
</listitem>
</varlistentry>
</variablelist>
</article>
......@@ -44,7 +44,6 @@ add_subdirectory(icons)
add_subdirectory(kded)
add_subdirectory(formats)
add_subdirectory(notifications)
add_subdirectory(phonon)
add_subdirectory(runners)
add_subdirectory(spellchecking)
add_subdirectory(qtquicksettings)
......
find_package(Phonon4Qt5 4.6.60 NO_MODULE)
include_directories(BEFORE ${PHONON_INCLUDES})
add_definitions(-DPHONON_LIB_SONAME=\"${PHONON_LIB_SONAME}\")
# KI18N Translation Domain for this library
add_definitions(-DTRANSLATION_DOMAIN=\"kcm5_phonon\")
set(kcmphonon_SRCS main.cpp devicepreference.cpp backendselection.cpp)
ki18n_wrap_ui(kcmphonon_SRCS devicepreference.ui backendselection.ui)
set(kcmphonon_LIBS
KF5::ConfigWidgets
KF5::I18n
KF5::IconThemes
KF5::KCMUtils
KF5::KIOWidgets
${PHONON_LIBRARY})
ecm_qt_declare_logging_category(kcmphonon_SRCS HEADER phonon_debug.h IDENTIFIER KCM_PHONON_LOG CATEGORY_NAME org.kde.kcm.phonon)
add_library(kcm_phonon MODULE ${kcmphonon_SRCS})
target_link_libraries(kcm_phonon ${kcmphonon_LIBS} KF5::ConfigWidgets)
install(TARGETS kcm_phonon DESTINATION ${KDE_INSTALL_PLUGINDIR} )
########### install files ###############
install( FILES kcm_phonon.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install(FILES listview-background.png DESTINATION ${KDE_INSTALL_DATADIR}/kcm_phonon)
#! /usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp
find . -type d | fgrep -v '.svn' | sed -e 's,$,/,' > dirs
msh=`find . -name Messages.sh`
for dir in $msh; do
dir=`dirname $dir`
if test "$dir" != "."; then
egrep -v "^$dir" dirs > dirs.new && mv dirs.new dirs
fi
done
fgrep -v "/tests" dirs > dirs.new && mv dirs.new dirs
dirs=`cat dirs`
find $dirs -maxdepth 1 -name "*.cpp" -print > files
find $dirs -maxdepth 1 -name "*.cc" -print >> files
find $dirs -maxdepth 1 -name "*.h" -print >> files
$XGETTEXT --files-from=files -o $podir/kcm5_phonon.pot
rm -f dirs
rm -f files
/* This file is part of the KDE project
Copyright (C) 2004-2007 Matthias Kretz <kretz@kde.org>
Copyright (C) 2011-2014 Harald Sitter <sitter@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "backendselection.h"
#include <KConfig>
#include <KIconLoader>
#include <KRun>
#include <KLocalizedString>
#include "phonon_debug.h"
#include <QDir>
#include <QFileInfo>
#include <QListWidget>
#include <QPluginLoader>
#include <QSettings>
BackendDescriptor::BackendDescriptor(const QString &path)
: isValid(false)
{
QPluginLoader loader(path);
iid = loader.metaData().value(QLatin1Literal("IID")).toString();
const QJsonObject metaData = loader.metaData().value(QLatin1Literal("MetaData")).toObject();
name = metaData.value(QLatin1Literal("Name")).toString();
icon = metaData.value(QLatin1Literal("Icon")).toString();
version = metaData.value(QLatin1Literal("Version")).toString();
website = metaData.value(QLatin1Literal("Website")).toString();
preference = metaData.value(QLatin1Literal("InitialPreference")).toDouble();
pluginPath = path;
if (name.isEmpty())
name = QFileInfo(path).baseName();
if (iid.isEmpty())
return; // Not valid.
isValid = true;
}
bool BackendDescriptor::operator <(const BackendDescriptor &rhs) const
{
return this->preference < rhs.preference;
}
BackendSelection::BackendSelection(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
m_messageWidget->setVisible(false);
m_messageWidget->setCloseButtonVisible(false);
m_messageWidget->setMessageType(KMessageWidget::Information);
m_messageWidget->setText(i18nc("@info User changed Phonon backend",
"To apply the backend change you will have "
"to log out and back in again."));
m_down->setIcon(QIcon::fromTheme(QStringLiteral("go-down")));
m_up->setIcon(QIcon::fromTheme(QStringLiteral("go-up")));
m_comment->setWordWrap(true);
m_emptyPage = stackedWidget->addWidget(new QWidget());
connect(m_select, &QListWidget::itemSelectionChanged, this, &BackendSelection::selectionChanged);
connect(m_up, &QToolButton::clicked, this, &BackendSelection::up);
connect(m_down, &QToolButton::clicked, this, &BackendSelection::down);
}
void BackendSelection::load()
{
// NOTE: for phonon5 this should move into the library in some form.
m_backends.clear();
// Read already configured order.
QList<QString> iidPreference;
QSettings settings("kde.org", "libphonon");
const int size = settings.beginReadArray("Backends");
qCDebug(KCM_PHONON_LOG) << settings.fileName();
for (int i = 0; i < size; ++i) {
settings.setArrayIndex(i);
iidPreference.append(settings.value(QLatin1String("iid")).toString());
}
settings.endArray();
const QLatin1Literal suffix("/" PHONON_LIB_SONAME "_backend/");
const QStringList paths = QCoreApplication::libraryPaths();
qCDebug(KCM_PHONON_LOG) << "libpaths" << paths;
QList<struct BackendDescriptor> backendList;
foreach (const QString &path, paths) {
const QString libPath = path + suffix;
const QDir dir(libPath);
if (!dir.exists()) {
qCDebug(KCM_PHONON_LOG) << Q_FUNC_INFO << dir.absolutePath() << "does not exist";
continue;
}
const QStringList plugins(dir.entryList(QDir::Files));
for (const QString &plugin : plugins) {
BackendDescriptor bd = BackendDescriptor(libPath + plugin);
if (bd.isValid) {
int preference = iidPreference.indexOf(bd.iid);
if (preference != -1)
bd.preference = preference;
backendList.append(bd);
}
}
std::sort(backendList.begin(), backendList.end());
}
/// -------------- LOAD
m_select->clear();
foreach (const struct BackendDescriptor &bd, backendList) {
m_select->addItem(bd.name);
m_backends.insert(bd.name, bd);
}
m_select->item(0)->setSelected(true);
}
void BackendSelection::save()
{
qCDebug(KCM_PHONON_LOG) << Q_FUNC_INFO;
qCDebug(KCM_PHONON_LOG) << "~~~~~~~~~~~~~~";
QSettings settings("kde.org", "libphonon");
settings.beginWriteArray("Backends", m_select->count());
for (int i = 0; i < m_select->count(); ++i) {
settings.setArrayIndex(i);
const QListWidgetItem *item = m_select->item(i);
const BackendDescriptor backend = m_backends.value(item->text());
settings.setValue("iid", backend.iid);
}
settings.endArray();
settings.sync();
qCDebug(KCM_PHONON_LOG) << settings.fileName();
}
void BackendSelection::defaults()
{
load();
}
void BackendSelection::selectionChanged()
{
qCDebug(KCM_PHONON_LOG) << "qooooooooo";
if (m_select->selectedItems().isEmpty()) {
m_up->setEnabled(false);
m_down->setEnabled(false);
} else {
const QListWidgetItem *const item = m_select->selectedItems().first();
m_up->setEnabled(m_select->row(item) > 0);
m_down->setEnabled(m_select->row(item) < m_select->count() - 1);
BackendDescriptor backend = m_backends[item->text()];
// Have some icon other than "unknown" for backends which don't install an icon.
QIcon icon = QIcon::fromTheme(backend.icon);
if (icon.isNull()) {
QPixmap iconPixmap = KIconLoader::global()->loadIcon("preferences-desktop-sound", KIconLoader::NoGroup, 128);
m_icon->setPixmap(iconPixmap);
} else {
m_icon->setPixmap(icon.pixmap(128, 128));
}
m_name->setText(backend.name);
m_website->setText(QString("<a href=\"%1\">%1</a>").arg(backend.website));
connect(m_website, &QLabel::linkActivated, this, &BackendSelection::openWebsite, Qt::UniqueConnection);
m_version->setText(backend.version);
}
}
void BackendSelection::openWebsite(const QString &url)
{
new KRun(QUrl(url), window());
}
void BackendSelection::up()
{
QList<QListWidgetItem *> selectedList = m_select->selectedItems();
foreach (QListWidgetItem *selected, selectedList) {
const int row = m_select->row(selected);
if (row > 0) {
QListWidgetItem *taken = m_select->takeItem(row - 1);
m_select->insertItem(row, taken);
emit changed();
selectionChanged();
}
}
}
void BackendSelection::down()
{
QList<QListWidgetItem *> selectedList = m_select->selectedItems();
foreach (QListWidgetItem *selected, selectedList) {
const int row = m_select->row(selected);
if (row + 1 < m_select->count()) {
QListWidgetItem *taken = m_select->takeItem(row + 1);
m_select->insertItem(row, taken);
emit changed();
selectionChanged();
}
}
}
/* This file is part of the KDE project
Copyright (C) 2004-2007 Matthias Kretz <kretz@kde.org>
Copyright (C) 2011-2014 Harald Sitter <sitter@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef BACKENDSELECTION_H
#define BACKENDSELECTION_H
#include "ui_backendselection.h"
#include <QHash>
#include <QWidget>
struct BackendDescriptor {
explicit BackendDescriptor(const QString &path = QString());
bool isValid;
QString iid;
QString name;
QString icon;
QString version;
QString website;
int preference;
QString pluginPath;
/** Implemented for qSort(QList) */
bool operator <(const BackendDescriptor &rhs) const;
};
class BackendSelection : public QWidget, private Ui::BackendSelection
{
Q_OBJECT
public:
explicit BackendSelection(QWidget *parent = nullptr);
void load();
void save();
void defaults();
private Q_SLOTS:
void selectionChanged();
void up();
void down();
void openWebsite(const QString &url);
Q_SIGNALS:
void changed();
private:
QHash<QString, struct BackendDescriptor> m_backends;
int m_emptyPage;
};
#endif // BACKENDSELECTION_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Matthias Kretz &lt;kretz@kde.org&gt;</author>
<class>BackendSelection</class>
<widget class="QWidget" name="BackendSelection">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>510</width>
<height>362</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="0">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="3">
<widget class="QListWidget" name="m_select">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>A list of Phonon Backends found on your system. The order here determines the order Phonon will use them in.</string>
</property>
<property name="whatsThis">
<string>A list of Phonon Backends found on your system. The order here determines the order Phonon will use them in.</string>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="m_up">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Prefer</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="m_down">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Defer</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="m_icon">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_name">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">