rpms/kdebase-runtime/F-11 kdebase-runtime-4.3.1-backend-globalconfig.patch, NONE, 1.1 kdebase-runtime.spec, 1.128, 1.129 sources, 1.37, 1.38

Than Ngo than at fedoraproject.org
Sat Dec 5 15:23:08 UTC 2009


Author: than

Update of /cvs/extras/rpms/kdebase-runtime/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25212

Modified Files:
	kdebase-runtime.spec sources 
Added Files:
	kdebase-runtime-4.3.1-backend-globalconfig.patch 
Log Message:
4.3.4


kdebase-runtime-4.3.1-backend-globalconfig.patch:
 b/phonon/kcm/CMakeLists.txt                |    2 
 b/phonon/kcm/devicepreference.cpp          |  233 ++++------------------------
 b/phonon/kcm/devicepreference.h            |    1 
 b/phonon/kded-module/CMakeLists.txt        |   14 -
 b/phonon/kded-module/audiodeviceaccess.cpp |    6 
 b/phonon/kded-module/audiodeviceaccess.h   |    5 
 b/phonon/kded-module/phononserver.cpp      |  199 ------------------------
 b/phonon/kded-module/phononserver.h        |    2 
 phonon/kcm/devicepreference.cpp            |    4 
 phonon/kcm/globalconfig.cpp                |  235 -----------------------------
 phonon/kcm/globalconfig_p.h                |   63 -------
 11 files changed, 47 insertions(+), 717 deletions(-)

--- NEW FILE kdebase-runtime-4.3.1-backend-globalconfig.patch ---
diff --git a/phonon/kcm/CMakeLists.txt b/phonon/kcm/CMakeLists.txt
index 5ca78b7..9525607 100644
--- a/phonon/kcm/CMakeLists.txt
+++ b/phonon/kcm/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_subdirectory(xine)
 
-set(kcmphonon_SRCS main.cpp devicepreference.cpp backendselection.cpp globalconfig.cpp)
+set(kcmphonon_SRCS main.cpp devicepreference.cpp backendselection.cpp)
 kde4_add_ui_files(kcmphonon_SRCS devicepreference.ui backendselection.ui)
 
 kde4_add_plugin(kcm_phonon ${kcmphonon_SRCS})
diff --git a/phonon/kcm/devicepreference.cpp b/phonon/kcm/devicepreference.cpp
index 5065f3c..71e772b 100644
--- a/phonon/kcm/devicepreference.cpp
+++ b/phonon/kcm/devicepreference.cpp
@@ -34,11 +34,12 @@
 
 #include <Phonon/AudioOutput>
 #include <Phonon/MediaObject>
+#include <phonon/backendinterface.h>
 #include <phonon/backendcapabilities.h>
+#include <phonon/globalconfig.h>
 #include <phonon/objectdescription.h>
 #include <phonon/phononnamespace.h>
-#include "qsettingsgroup_p.h"
-#include "globalconfig_p.h"
+#include "factory_p.h"
 #include <kfadewidgeteffect.h>
 
 #include <kdialog.h>
@@ -55,8 +56,6 @@
 Q_DECLARE_METATYPE(QList<int>)
 #endif
 
-using Phonon::QSettingsGroup;
-
 static const Phonon::Category captureCategories[] = {
     Phonon::NoCategory,
     Phonon::CommunicationCategory,
@@ -318,111 +317,39 @@ void DevicePreference::updateAudioOutputDevices()
 
 QList<Phonon::AudioOutputDevice> DevicePreference::availableAudioOutputDevices() const
 {
-    QList<Phonon::AudioOutputDevice> ret;
-    const QList<int> deviceIndexes = Phonon::GlobalConfig().audioOutputDeviceListFor(Phonon::NoCategory,
-            showCheckBox->isChecked()
-            ? Phonon::GlobalConfig::ShowAdvancedDevices
-            : Phonon::GlobalConfig::HideAdvancedDevices);
-    foreach (int i, deviceIndexes) {
-        ret.append(Phonon::AudioOutputDevice::fromIndex(i));
-    }
-    return ret;
+    return Phonon::BackendCapabilities::availableAudioOutputDevices();
 }
 
 QList<Phonon::AudioCaptureDevice> DevicePreference::availableAudioCaptureDevices() const
 {
-    QList<Phonon::AudioCaptureDevice> ret;
-    const QList<int> deviceIndexes = Phonon::GlobalConfig().audioCaptureDeviceListFor(Phonon::NoCategory,
-            showCheckBox->isChecked()
-            ? Phonon::GlobalConfig::ShowAdvancedDevices
-            : Phonon::GlobalConfig::HideAdvancedDevices);
-    kDebug() << deviceIndexes;
-    foreach (int i, deviceIndexes) {
-        ret.append(Phonon::AudioCaptureDevice::fromIndex(i));
-    }
-    return ret;
+    return Phonon::BackendCapabilities::availableAudioCaptureDevices();
 }
 
 void DevicePreference::load()
 {
-    QSettings phononConfig(QLatin1String("kde.org"), QLatin1String("libphonon"));
-    QSettingsGroup outputDeviceGroup(&phononConfig, QLatin1String("AudioOutputDevice"));
-    QSettingsGroup captureDeviceGroup(&phononConfig, QLatin1String("AudioCaptureDevice"));
-    QSettingsGroup generalGroup(&phononConfig, QLatin1String("General"));
-    showCheckBox->setChecked(!generalGroup.value(QLatin1String("HideAdvancedDevices"), true));
-
-    {
-        // the following call returns ordered according to NoCategory
-        const QList<Phonon::AudioOutputDevice> list = availableAudioOutputDevices();
-        m_outputModel[Phonon::NoCategory]->setModelData(list);
-
-        QHash<int, Phonon::AudioOutputDevice> hash;
-        foreach (const Phonon::AudioOutputDevice &dev, list) {
-            hash.insert(dev.index(), dev);
-        }
-        for (int i = 0; i <= Phonon::LastCategory; ++i) {
-            const QString configKey(QLatin1String("Category_") + QString::number(i));
-            if (!outputDeviceGroup.hasKey(configKey)) {
-                m_outputModel[i]->setModelData(list); // use the NoCategory order
-                continue;
-            }
-            QHash<int, Phonon::AudioOutputDevice> hashCopy(hash);
-            const QList<int> order = outputDeviceGroup.value(configKey, QList<int>());
-            QList<Phonon::AudioOutputDevice> orderedList;
-            foreach (int idx, order) {
-                if (hashCopy.contains(idx)) {
-                    orderedList << hashCopy.take(idx);
-                }
-            }
-            if (hashCopy.size() > 1) {
-                // keep the order of the original list
-                foreach (const Phonon::AudioOutputDevice &dev, list) {
-                    if (hashCopy.contains(dev.index())) {
-                        orderedList << hashCopy.take(dev.index());
-                    }
-                }
-            } else if (hashCopy.size() == 1) {
-                orderedList += hashCopy.values();
-            }
-            m_outputModel[i]->setModelData(orderedList);
-        }
-    }
-    {
-        // the following call returns ordered according to NoCategory
-        QList<Phonon::AudioCaptureDevice> list = availableAudioCaptureDevices();
-        m_captureModel[Phonon::NoCategory]->setModelData(list);
+    showCheckBox->setChecked(!Phonon::GlobalConfig().getHideAdvancedDevices());
+    loadCategoryDevices();
+}
 
-        QHash<int, Phonon::AudioCaptureDevice> hash;
-        foreach (const Phonon::AudioCaptureDevice &dev, list) {
-            hash.insert(dev.index(), dev);
+void DevicePreference::loadCategoryDevices()
+{
+    // "Load" the settings from the backend.
+    for (Phonon::Category cat = Phonon::NoCategory; cat <= Phonon::LastCategory; ++cat) {
+        QList<Phonon::AudioOutputDevice> list;
+        const QList<int> deviceIndexes = Phonon::GlobalConfig().audioOutputDeviceListFor(cat);
+        foreach (int i, deviceIndexes) {
+            list.append(Phonon::AudioOutputDevice::fromIndex(i));
         }
-        for (int i = 1; i < captureCategoriesCount; ++i) { // i == 1 to skip NoCategory
-            const Phonon::Category cat = captureCategories[i];
-            const QString configKey(QLatin1String("Category_") + QString::number(cat));
-            if (!captureDeviceGroup.hasKey(configKey)) {
-                m_captureModel[cat]->setModelData(list); // use the NoCategory order
-                continue;
-            }
-            QHash<int, Phonon::AudioCaptureDevice> hashCopy(hash);
-            const QList<int> order = captureDeviceGroup.value(configKey, QList<int>());
-            QList<Phonon::AudioCaptureDevice> orderedList;
-            foreach (int idx, order) {
-                if (hashCopy.contains(idx)) {
-                    orderedList << hashCopy.take(idx);
-                }
-            }
-            if (hashCopy.size() > 1) {
-                // keep the order of the original list
-                foreach (const Phonon::AudioCaptureDevice &dev, list) {
-                    if (hashCopy.contains(dev.index())) {
-                        orderedList << hashCopy.take(dev.index());
-                    }
-                }
-            } else if (hashCopy.size() == 1) {
-                orderedList += hashCopy.values();
-            }
-            m_captureModel[cat]->setModelData(orderedList);
+        m_outputModel[cat]->setModelData(list);
+    }
+    for (int i = 0; i < captureCategoriesCount; ++i) {
+        const Phonon::Category cat = captureCategories[i];
+        QList<Phonon::AudioCaptureDevice> list;
+        const QList<int> deviceIndexes = Phonon::GlobalConfig().audioCaptureDeviceListFor(cat);
+        foreach (int i, deviceIndexes) {
+            list.append(Phonon::AudioCaptureDevice::fromIndex(i));
         }
+        m_captureModel[cat]->setModelData(list);
     }
 
     deviceList->resizeColumnToContents(0);
@@ -430,11 +357,6 @@ void DevicePreference::load()
 
 void DevicePreference::save()
 {
-    QSettings config(QLatin1String("kde.org"), QLatin1String("libphonon"));
-    {
-        QSettingsGroup generalGroup(&config, QLatin1String("General"));
-        generalGroup.setValue(QLatin1String("HideAdvancedDevices"), !showCheckBox->isChecked());
-    }
     if (!m_removeOnApply.isEmpty()) {
         QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kded", "/modules/phononserver",
                 "org.kde.PhononServer", "removeAudioDevices");
@@ -442,34 +364,17 @@ void DevicePreference::save()
         QDBusConnection::sessionBus().send(msg);
         m_removeOnApply.clear();
     }
-    {
-        QSettingsGroup globalGroup(&config, QLatin1String("AudioOutputDevice"));
-        const QList<int> noCategoryOrder = m_outputModel.value(Phonon::NoCategory)->tupleIndexOrder();
-        globalGroup.setValue(QLatin1String("Category_") + QString::number(Phonon::NoCategory), noCategoryOrder);
-        for (int i = 0; i <= Phonon::LastCategory; ++i) {
-            Q_ASSERT(m_outputModel.value(i));
-            const QList<int> order = m_outputModel.value(i)->tupleIndexOrder();
-            if (order == noCategoryOrder) {
-                globalGroup.removeEntry(QLatin1String("Category_") + QString::number(i));
-            } else {
-                globalGroup.setValue(QLatin1String("Category_") + QString::number(i), order);
-            }
-        }
+
+    for (Phonon::Category cat = Phonon::NoCategory; cat <= Phonon::LastCategory; ++cat) {
+        Q_ASSERT(m_outputModel.value(cat));
+        const QList<int> order = m_outputModel.value(cat)->tupleIndexOrder();
+        Phonon::GlobalConfig().setAudioOutputDeviceListFor(cat, order);
     }
-    {
-        QSettingsGroup globalGroup(&config, QLatin1String("AudioCaptureDevice"));
-        const QList<int> noCategoryOrder = m_captureModel.value(Phonon::NoCategory)->tupleIndexOrder();
-        globalGroup.setValue(QLatin1String("Category_") + QString::number(Phonon::NoCategory), noCategoryOrder);
-        for (int i = 1; i < captureCategoriesCount; ++i) {
-            const Phonon::Category cat = captureCategories[i];
-            Q_ASSERT(m_captureModel.value(cat));
-            const QList<int> order = m_captureModel.value(cat)->tupleIndexOrder();
-            if (order == noCategoryOrder) {
-                globalGroup.removeEntry(QLatin1String("Category_") + QString::number(cat));
-            } else {
-                globalGroup.setValue(QLatin1String("Category_") + QString::number(cat), order);
-            }
-        }
+    for (int i = 1; i < captureCategoriesCount; ++i) {
+        const Phonon::Category cat = captureCategories[i];
+        Q_ASSERT(m_captureModel.value(cat));
+        const QList<int> order = m_captureModel.value(cat)->tupleIndexOrder();
+        Phonon::GlobalConfig().setAudioCaptureDeviceListFor(cat, order);
     }
 }
 
@@ -638,70 +543,10 @@ void DevicePreference::on_applyPreferencesButton_clicked()
 
 void DevicePreference::on_showCheckBox_toggled()
 {
-    {
-        // the following call returns ordered according to NoCategory
-        const QList<Phonon::AudioOutputDevice> list = availableAudioOutputDevices();
-        m_outputModel[Phonon::NoCategory]->setModelData(list);
-
-        QHash<int, Phonon::AudioOutputDevice> hash;
-        foreach (const Phonon::AudioOutputDevice &dev, list) {
-            hash.insert(dev.index(), dev);
-        }
-        for (int i = 0; i <= Phonon::LastCategory; ++i) {
-            QHash<int, Phonon::AudioOutputDevice> hashCopy(hash);
-            const QList<int> order = m_outputModel[i]->tupleIndexOrder();
-            QList<Phonon::AudioOutputDevice> orderedList;
-            foreach (int idx, order) {
-                if (hashCopy.contains(idx)) {
-                    orderedList << hashCopy.take(idx);
-                }
-            }
-            if (hashCopy.size() > 1) {
-                // keep the order of the original list
-                foreach (const Phonon::AudioOutputDevice &dev, list) {
-                    if (hashCopy.contains(dev.index())) {
-                        orderedList << hashCopy.take(dev.index());
-                    }
-                }
-            } else if (hashCopy.size() == 1) {
-                orderedList += hashCopy.values();
-            }
-            m_outputModel[i]->setModelData(orderedList);
-        }
-    }
-    {
-        // the following call returns ordered according to NoCategory
-        const QList<Phonon::AudioCaptureDevice> list = availableAudioCaptureDevices();
-        m_captureModel[Phonon::NoCategory]->setModelData(list);
-
-        QHash<int, Phonon::AudioCaptureDevice> hash;
-        foreach (const Phonon::AudioCaptureDevice &dev, list) {
-            hash.insert(dev.index(), dev);
-        }
-        for (int i = 1; i < captureCategoriesCount; ++i) {
-            const Phonon::Category cat = captureCategories[i];
-            QHash<int, Phonon::AudioCaptureDevice> hashCopy(hash);
-            const QList<int> order = m_captureModel[cat]->tupleIndexOrder();
-            QList<Phonon::AudioCaptureDevice> orderedList;
-            foreach (int idx, order) {
-                if (hashCopy.contains(idx)) {
-                    orderedList << hashCopy.take(idx);
-                }
-            }
-            if (hashCopy.size() > 1) {
-                // keep the order of the original list
-                foreach (const Phonon::AudioCaptureDevice &dev, list) {
-                    if (hashCopy.contains(dev.index())) {
-                        orderedList << hashCopy.take(dev.index());
-                    }
-                }
-            } else if (hashCopy.size() == 1) {
-                orderedList += hashCopy.values();
-            }
-            m_captureModel[cat]->setModelData(orderedList);
-        }
-    }
-    deviceList->resizeColumnToContents(0);
+    // In order to get the right list from the backend, we need to update the settings now
+    // before calling availableAudio{Output,Capture}Devices()
+    Phonon::GlobalConfig().hideAdvancedDevices(!showCheckBox->isChecked());
+    loadCategoryDevices();
 }
 
 void DevicePreference::on_testPlaybackButton_toggled(bool down)
diff --git a/phonon/kcm/devicepreference.h b/phonon/kcm/devicepreference.h
index 83af859..dfd60d2 100644
--- a/phonon/kcm/devicepreference.h
+++ b/phonon/kcm/devicepreference.h
@@ -64,6 +64,7 @@ class DevicePreference : public QWidget, private Ui::DevicePreference
     private:
         template<Phonon::ObjectDescriptionType T> void removeDevice(const Phonon::ObjectDescription<T> &deviceToRemove,
                 QMap<int, Phonon::ObjectDescriptionModel<T> *> *modelMap);
+        void loadCategoryDevices();
         QList<Phonon::AudioOutputDevice> availableAudioOutputDevices() const;
         QList<Phonon::AudioCaptureDevice> availableAudioCaptureDevices() const;
         QList<int> m_removeOnApply;
diff --git a/phonon/kcm/globalconfig.cpp b/phonon/kcm/globalconfig.cpp
deleted file mode 100644
index 4e3a315..0000000
--- a/phonon/kcm/globalconfig.cpp
+++ /dev/null
@@ -1,235 +0,0 @@
-/*  This file is part of the KDE project
-    Copyright (C) 2006-2008 Matthias Kretz <kretz at kde.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License version 2 as published by the Free Software Foundation.
-
-    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 "globalconfig_p.h"
-
-#include "factory_p.h"
-#include "phonon/objectdescription.h"
-#include "phonondefs_p.h"
-#include "phonon/platformplugin.h"
-#include "phonon/backendinterface.h"
-#include "qsettingsgroup_p.h"
-#include "phononnamespace_p.h"
-
-#include <QtCore/QList>
-#include <QtCore/QVariant>
-
-QT_BEGIN_NAMESPACE
-
-namespace Phonon
-{
-
-GlobalConfig::GlobalConfig(QObject *parent)
-    : QObject(parent)
-    , m_config(QLatin1String("kde.org"), QLatin1String("libphonon"))
-{
-}
-
-GlobalConfig::~GlobalConfig()
-{
-}
-
-enum WhatToFilter {
-    FilterAdvancedDevices = 1,
-    FilterHardwareDevices = 2
-};
-
-static void filter(ObjectDescriptionType type, BackendInterface *backendIface, QList<int> *list, int whatToFilter)
-{
-    QMutableListIterator<int> it(*list);
-    while (it.hasNext()) {
-        const QHash<QByteArray, QVariant> properties = backendIface->objectDescriptionProperties(type, it.next());
-        QVariant var;
-        if (whatToFilter & FilterAdvancedDevices) {
-            var = properties.value("isAdvanced");
-            if (var.isValid() && var.toBool()) {
-                it.remove();
-                continue;
-            }
-        }
-        if (whatToFilter & FilterHardwareDevices) {
-            var = properties.value("isHardwareDevice");
-            if (var.isValid() && var.toBool()) {
-                it.remove();
-                continue;
-            }
-        }
-    }
-}
-
-static QList<int> listSortedByConfig(const QSettingsGroup &backendConfig, Phonon::Category category, QList<int> &defaultList)
-{
-    if (defaultList.size() <= 1) {
-        // nothing to sort
-        return defaultList;
-    } else {
-        // make entries unique
-        QSet<int> seen;
-        QMutableListIterator<int> it(defaultList);
-        while (it.hasNext()) {
-            if (seen.contains(it.next())) {
-                it.remove();
-            } else {
-                seen.insert(it.value());
-            }
-        }
-    }
-
-    QString categoryKey = QLatin1String("Category_") + QString::number(static_cast<int>(category));
-    if (!backendConfig.hasKey(categoryKey)) {
-        // no list in config for the given category
-        categoryKey = QLatin1String("Category_") + QString::number(static_cast<int>(Phonon::NoCategory));
-        if (!backendConfig.hasKey(categoryKey)) {
-            // no list in config for NoCategory
-            return defaultList;
-        }
-    }
-
-    //Now the list from m_config
-    QList<int> deviceList = backendConfig.value(categoryKey, QList<int>());
-
-    //if there are devices in m_config that the backend doesn't report, remove them from the list
-    QMutableListIterator<int> i(deviceList);
-    while (i.hasNext()) {
-        if (0 == defaultList.removeAll(i.next())) {
-            i.remove();
-        }
-    }
-
-    //if the backend reports more devices that are not in m_config append them to the list
-    deviceList += defaultList;
-
-    return deviceList;
-}
-
-QList<int> GlobalConfig::audioOutputDeviceListFor(Phonon::Category category, HideAdvancedDevicesOverride override) const
-{
-    //The devices need to be stored independently for every backend
-    const QSettingsGroup backendConfig(&m_config, QLatin1String("AudioOutputDevice")); // + Factory::identifier());
-    const QSettingsGroup generalGroup(&m_config, QLatin1String("General"));
-    const bool hideAdvancedDevices = (override == FromSettings
-            ? generalGroup.value(QLatin1String("HideAdvancedDevices"), true)
-            : static_cast<bool>(override));
-
-    PlatformPlugin *platformPlugin = Factory::platformPlugin();
-    BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend());
-
-    QList<int> defaultList;
-    if (platformPlugin) {
-        // the platform plugin lists the audio devices for the platform
-        // this list already is in default order (as defined by the platform plugin)
-        defaultList = platformPlugin->objectDescriptionIndexes(Phonon::AudioOutputDeviceType);
-        if (hideAdvancedDevices) {
-            QMutableListIterator<int> it(defaultList);
-            while (it.hasNext()) {
-                AudioOutputDevice objDesc = AudioOutputDevice::fromIndex(it.next());
-                const QVariant var = objDesc.property("isAdvanced");
-                if (var.isValid() && var.toBool()) {
-                    it.remove();
-                }
-            }
-        }
-    }
-
-    // lookup the available devices directly from the backend (mostly for virtual devices)
-    if (backendIface) {
-        // this list already is in default order (as defined by the backend)
-        QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioOutputDeviceType);
-        if (hideAdvancedDevices || !defaultList.isEmpty()) {
-            filter(AudioOutputDeviceType, backendIface, &list,
-                    (hideAdvancedDevices ? FilterAdvancedDevices : 0)
-                    // the platform plugin already provided the hardware devices
-                    | (defaultList.isEmpty() ? 0 : FilterHardwareDevices)
-                    );
-        }
-        defaultList += list;
-    }
-
-    return listSortedByConfig(backendConfig, category, defaultList);
-}
-
-int GlobalConfig::audioOutputDeviceFor(Phonon::Category category) const
-{
-    const QList<int> ret = audioOutputDeviceListFor(category);
-    if (ret.isEmpty())
-        return -1;
-    return ret.first();
-}
-
-QList<int> GlobalConfig::audioCaptureDeviceListFor(Phonon::Category category, HideAdvancedDevicesOverride override) const
-{
-    //The devices need to be stored independently for every backend
-    const QSettingsGroup backendConfig(&m_config, QLatin1String("AudioCaptureDevice")); // + Factory::identifier());
-    const QSettingsGroup generalGroup(&m_config, QLatin1String("General"));
-    const bool hideAdvancedDevices = (override == FromSettings
-            ? generalGroup.value(QLatin1String("HideAdvancedDevices"), true)
-            : static_cast<bool>(override));
-
-    PlatformPlugin *platformPlugin = Factory::platformPlugin();
-    BackendInterface *backendIface = qobject_cast<BackendInterface *>(Factory::backend());
-
-    QList<int> defaultList;
-    if (platformPlugin) {
-        // the platform plugin lists the audio devices for the platform
-        // this list already is in default order (as defined by the platform plugin)
-        defaultList = platformPlugin->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType);
-        if (hideAdvancedDevices) {
-            QMutableListIterator<int> it(defaultList);
-            while (it.hasNext()) {
-                AudioCaptureDevice objDesc = AudioCaptureDevice::fromIndex(it.next());
-                const QVariant var = objDesc.property("isAdvanced");
-                if (var.isValid() && var.toBool()) {
-                    it.remove();
-                }
-            }
-        }
-    }
-
-    // lookup the available devices directly from the backend (mostly for virtual devices)
-    if (backendIface) {
-        // this list already is in default order (as defined by the backend)
-        QList<int> list = backendIface->objectDescriptionIndexes(Phonon::AudioCaptureDeviceType);
-        if (hideAdvancedDevices || !defaultList.isEmpty()) {
-            filter(AudioCaptureDeviceType, backendIface, &list,
-                    (hideAdvancedDevices ? FilterAdvancedDevices : 0)
-                    // the platform plugin already provided the hardware devices
-                    | (defaultList.isEmpty() ? 0 : FilterHardwareDevices)
-                  );
-        }
-        defaultList += list;
-    }
-
-    return listSortedByConfig(backendConfig, category, defaultList);
-}
-
-int GlobalConfig::audioCaptureDeviceFor(Phonon::Category category) const
-{
-    QList<int> ret = audioCaptureDeviceListFor(category);
-    if (ret.isEmpty())
-        return -1;
-    return ret.first();
-}
-
-} // namespace Phonon
-
-QT_END_NAMESPACE
-
-#include "moc_globalconfig_p.cpp"
-
-// vim: sw=4 ts=4
diff --git a/phonon/kcm/globalconfig_p.h b/phonon/kcm/globalconfig_p.h
deleted file mode 100644
index ca4dca6..0000000
--- a/phonon/kcm/globalconfig_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*  This file is part of the KDE project
-Copyright (C) 2006-2008 Matthias Kretz <kretz at kde.org>
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License version 2 as published by the Free Software Foundation.
-
-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 PHONON_GLOBALCONFIG_P_H
-#define PHONON_GLOBALCONFIG_P_H
-
-#include <QtCore/QObject>
-#include <QtCore/QSettings>
-
-#include "phonon/phononnamespace.h"
-
-QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE
-
-namespace Phonon
-{
-    class GlobalConfig : public QObject
-    {
-        Q_OBJECT
-    public:
-        GlobalConfig(QObject *parent = 0);
-        ~GlobalConfig();
-
-        enum HideAdvancedDevicesOverride {
-            ShowAdvancedDevices = 0,
-            HideAdvancedDevices = 1,
-            FromSettings = 2
-        };
-        QList<int> audioOutputDeviceListFor(Phonon::Category category, HideAdvancedDevicesOverride override = FromSettings) const;
-        int audioOutputDeviceFor(Phonon::Category category) const;
-
-        QList<int> audioCaptureDeviceListFor(Phonon::Category category, HideAdvancedDevicesOverride override = FromSettings) const;
-        int audioCaptureDeviceFor(Phonon::Category category) const;
-
-    Q_SIGNALS:
-        void audioOutputDeviceConfigChanged();
-        void audioCaptureDeviceConfigChanged();
-
-    private:
-        QSettings m_config;
-    };
-} // namespace Phonon
-
-QT_END_NAMESPACE
-QT_END_HEADER
-
-#endif // PHONON_GLOBALCONFIG_P_H
diff --git a/phonon/kded-module/CMakeLists.txt b/phonon/kded-module/CMakeLists.txt
index 17e7742..b2c5697 100644
--- a/phonon/kded-module/CMakeLists.txt
+++ b/phonon/kded-module/CMakeLists.txt
@@ -9,17 +9,7 @@ set(HAVE_CURRENT_ALSA FALSE)
 #   macro_log_feature(HAVE_CURRENT_ALSA "ALSA" "current alsa-lib is needed for dmix and virtual device listing" "http://www.alsa-project.org/" TRUE "1.0.14a")
 #endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 
-macro_optional_find_package(PulseAudio)
-macro_log_feature(PULSEAUDIO_FOUND "PulseAudio" "A cross-platform, networked sound server." "http://www.pulseaudio.org" FALSE "" "Allows audio playback via the PulseAudio soundserver when it is running")
-
-if(PULSEAUDIO_FOUND)
-   add_definitions(-DHAVE_PULSEAUDIO)
-else(PULSEAUDIO_FOUND)
-   set(PULSEAUDIO_INCLUDE_DIR "")
-   set(PULSEAUDIO_LIBRARY "")
-endif(PULSEAUDIO_FOUND)
-
-include_directories(${ALSA_INCLUDES} ${PULSEAUDIO_INCLUDE_DIR})
+include_directories(${ALSA_INCLUDES})
 
 set(kded_phonon_SRCS
    phononserver.cpp
@@ -29,7 +19,7 @@ set(kded_phonon_SRCS
    )
 
 kde4_add_plugin(kded_phononserver ${kded_phonon_SRCS})
-target_link_libraries(kded_phononserver ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${KDE4_SOLID_LIBS} ${ASOUND_LIBRARY} ${PULSEAUDIO_LIBRARY})
+target_link_libraries(kded_phononserver ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${KDE4_SOLID_LIBS} ${ASOUND_LIBRARY})
 install(TARGETS kded_phononserver  DESTINATION ${PLUGIN_INSTALL_DIR})
 
 install(FILES phononserver.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
diff --git a/phonon/kded-module/audiodeviceaccess.cpp b/phonon/kded-module/audiodeviceaccess.cpp
index 6792e72..5815502 100644
--- a/phonon/kded-module/audiodeviceaccess.cpp
+++ b/phonon/kded-module/audiodeviceaccess.cpp
@@ -44,14 +44,8 @@ const QString PS::AudioDeviceAccess::driverName() const
         return i18n("ALSA");
     case OssDriver:
         return i18n("OSS");
-    case PulseAudioDriver:
-        return i18n("PulseAudio");
     case JackdDriver:
         return i18n("Jack");
-    case EsdDriver:
-        return i18n("ESD");
-    case ArtsDriver:
-        return i18n("aRts");
     }
     return QString();
 }
diff --git a/phonon/kded-module/audiodeviceaccess.h b/phonon/kded-module/audiodeviceaccess.h
index 4513419..70a8b3f 100644
--- a/phonon/kded-module/audiodeviceaccess.h
+++ b/phonon/kded-module/audiodeviceaccess.h
@@ -33,10 +33,7 @@ class AudioDeviceAccess
             InvalidDriver = 0,
             AlsaDriver,
             OssDriver,
-            PulseAudioDriver,
-            JackdDriver,
-            EsdDriver,
-            ArtsDriver
+            JackdDriver
         };
 
         inline AudioDeviceAccess(const QStringList &deviceIds, int accessPreference,
diff --git a/phonon/kded-module/phononserver.cpp b/phonon/kded-module/phononserver.cpp
index b76e08c..5dbd17e 100644
--- a/phonon/kded-module/phononserver.cpp
+++ b/phonon/kded-module/phononserver.cpp
@@ -45,10 +45,6 @@
 #include <Solid/Device>
 #include <Solid/DeviceNotifier>
 
-#ifdef HAVE_PULSEAUDIO
-#include <pulse/pulseaudio.h>
-#endif // HAVE_PULSEAUDIO
-
 #include <../config-alsa.h>
 #ifdef HAVE_LIBASOUND2
 #include <alsa/asoundlib.h>
@@ -334,128 +330,6 @@ static void removeOssOnlyDevices(QList<PS::AudioDevice> *list)
     }
 }
 
-#ifdef HAVE_PULSEAUDIO
-class PulseDetectionUserData
-{
-    public:
-        inline PulseDetectionUserData(PhononServer *p, pa_mainloop_api *api)
-            : phononServer(p), mainloopApi(api), ready(2),
-            alsaHandleMatches(QLatin1String(".*\\s(plughw|hw|front|surround\\d\\d):(\\d+)\\s.*")),
-            captureNameMatches(QLatin1String(".*_sound_card_(\\d+)_.*_(?:playback|capture)_(\\d+)(\\.monitor)?")),
-            playbackNameMatches(QLatin1String(".*_sound_card_(\\d+)_.*_playback_(\\d+)"))
-        {}
-
-        PhononServer *const phononServer;
-        QList<QPair<PS::AudioDeviceKey, PS::AudioDeviceAccess> > sinks;
-        QList<QPair<PS::AudioDeviceKey, PS::AudioDeviceAccess> > sources;
-
-        inline void eol() { if (--ready == 0) { quit(); } }
-        inline void quit() { mainloopApi->quit(mainloopApi, 0); }
-    private:
-        pa_mainloop_api *const mainloopApi;
-        int ready;
-    public:
-        QRegExp alsaHandleMatches;
-        QRegExp captureNameMatches;
-        QRegExp playbackNameMatches;
-};
-
-static void pulseSinkInfoListCallback(pa_context *context, const pa_sink_info *i, int eol, void *userdata)
-{
-    PulseDetectionUserData *d = reinterpret_cast<PulseDetectionUserData *>(userdata);
-    if (eol) {
-        d->eol();
-        return;
-    }
-    Q_ASSERT(i);
-    kDebug(601).nospace()
-        << "name: " << i->name
-        << ", index: " << i->index
-        << ", description: " << i->description
-        << ", sample_spec: " << i->sample_spec.format << i->sample_spec.rate << i->sample_spec.channels
-        << ", channel_map: " << i->channel_map.channels << i->channel_map.map
-        << ", owner_module: " << i->owner_module
-        //<< ", volume: " << i->volume
-        << ", mute: " << i->mute
-        << ", monitor_source: " << i->monitor_source
-        << ", latency: " << i->latency
-        << ", driver: " << i->driver
-        << ", flags: " << i->flags;
-    const QString &handle = QString::fromUtf8(i->name);
-    if (d->playbackNameMatches.exactMatch(handle)) {
-        const QString &description = QString::fromUtf8(i->description);
-        const bool m = d->alsaHandleMatches.exactMatch(description);
-        const int cardNumber = m ? d->alsaHandleMatches.cap(2).toInt() : -1; // card_name_X in the name always has X == 0 ;( so we can't use d->playbackNameMatches.cap(1).toInt();
-        const int deviceNumber = d->playbackNameMatches.cap(2).toInt();
-        const PS::AudioDeviceKey key = { QString(), cardNumber, deviceNumber };
-        const PS::AudioDeviceAccess access(QStringList(QString::fromUtf8(pa_context_get_server(context)) + QLatin1Char('\n') + handle), 30, PS::AudioDeviceAccess::PulseAudioDriver, false, true);
-        d->sinks << QPair<PS::AudioDeviceKey, PS::AudioDeviceAccess>(key, access);
-    }
-}
-
-static void pulseSourceInfoListCallback(pa_context *context, const pa_source_info *i, int eol, void *userdata)
-{
-    PulseDetectionUserData *d = reinterpret_cast<PulseDetectionUserData *>(userdata);
-    if (eol) {
-        d->eol();
-        return;
-    }
-    Q_ASSERT(i);
-    kDebug(601).nospace()
-        << "name: " << i->name
-        << ", index: " << i->index
-        << ", description: " << i->description
-        << ", sample_spec: " << i->sample_spec.format << i->sample_spec.rate << i->sample_spec.channels
-        << ", channel_map: " << i->channel_map.channels << i->channel_map.map
-        << ", owner_module: " << i->owner_module
-        //<< ", volume: " << i->volume
-        << ", mute: " << i->mute
-        << ", monitor_of_sink: " << i->monitor_of_sink
-        << ", monitor_of_sink_name: " << i->monitor_of_sink_name
-        << ", latency: " << i->latency
-        << ", driver: " << i->driver
-        << ", flags: " << i->flags;
-    const QString &handle = QString::fromUtf8(i->name);
-    if (d->captureNameMatches.exactMatch(handle)) {
-        if (d->captureNameMatches.cap(3).isEmpty()) {
-            const QString &description = QString::fromUtf8(i->description);
-            const bool m = d->alsaHandleMatches.exactMatch(description);
-            const int cardNumber = m ? d->alsaHandleMatches.cap(2).toInt() : d->captureNameMatches.cap(1).toInt();
-            const int deviceNumber = d->captureNameMatches.cap(2).toInt();
-            const PS::AudioDeviceKey key = {
-                d->captureNameMatches.cap(3).isEmpty() ? QString() : handle, cardNumber, deviceNumber
-            };
-            const PS::AudioDeviceAccess access(QStringList(QString::fromUtf8(pa_context_get_server(context)) + QLatin1Char(':') + handle), 30, PS::AudioDeviceAccess::PulseAudioDriver, true, false);
-            d->sources << QPair<PS::AudioDeviceKey, PS::AudioDeviceAccess>(key, access);
-        } else {
-            const PS::AudioDeviceKey key = {
-                QString::fromUtf8(i->description), -2, -2
-            };
-            const PS::AudioDeviceAccess access(QStringList(QString::fromUtf8(pa_context_get_server(context)) + QLatin1Char(':') + handle), 30, PS::AudioDeviceAccess::PulseAudioDriver, true, false);
-            d->sources << QPair<PS::AudioDeviceKey, PS::AudioDeviceAccess>(key, access);
-        }
-    }
-}
-
-static void pulseContextStateCallback(pa_context *context, void *userdata)
-{
-    switch (pa_context_get_state(context)) {
-    case PA_CONTEXT_READY:
-        /*pa_operation *op1 =*/ pa_context_get_sink_info_list(context, &pulseSinkInfoListCallback, userdata);
-        /*pa_operation *op2 =*/ pa_context_get_source_info_list(context, &pulseSourceInfoListCallback, userdata);
-        break;
-    case PA_CONTEXT_FAILED:
-        {
-            PulseDetectionUserData *d = reinterpret_cast<PulseDetectionUserData *>(userdata);
-            d->quit();
-        }
-        break;
-    default:
-        break;
-    }
-}
-#endif // HAVE_PULSEAUDIO
-
 void PhononServer::findDevices()
 {
     QHash<PS::AudioDeviceKey, PS::AudioDevice> playbackDevices;
@@ -630,73 +504,6 @@ void PhononServer::findDevices()
     m_audioOutputDevices = playbackDevices.values();
     m_audioCaptureDevices = captureDevices.values();
 
-#ifdef HAVE_PULSEAUDIO
-    {
-        pa_mainloop *mainloop = pa_mainloop_new();
-        Q_ASSERT(mainloop);
-        pa_mainloop_api *mainloopApi = pa_mainloop_get_api(mainloop);
-        PulseDetectionUserData userData(this, mainloopApi);
-        // XXX I don't want to show up in the client list. All I want to know is the list of sources
-        // and sinks...
-        pa_context *context = pa_context_new(mainloopApi, "KDE");
-        // XXX stupid cast. report a bug about a missing enum value
-        if (pa_context_connect(context, NULL, static_cast<pa_context_flags_t>(0), 0) >= 0) {
-            pa_context_set_state_callback(context, &pulseContextStateCallback, &userData);
-            pa_mainloop_run(mainloop, NULL);
-            pa_context_disconnect(context);
-        }
-        pa_mainloop_free(mainloop);
-        kDebug(601) << "pulse sources:" << userData.sources;
-        kDebug(601) << "pulse sinks:  " << userData.sinks;
-        QMutableListIterator<PS::AudioDevice> it(m_audioOutputDevices);
-        typedef QPair<PS::AudioDeviceKey, PS::AudioDeviceAccess> MyPair;
-        static int uniqueDeviceNumber = -2;
-        foreach (const MyPair &pair, userData.sinks) {
-            it.toFront();
-            bool needNewDeviceObject = true;
-            while (it.hasNext()) {
-                PS::AudioDevice &dev = it.next();
-                if (dev.key() == pair.first) {
-                    dev.addAccess(pair.second);
-                    needNewDeviceObject = false;
-                    continue;
-                }
-            }
-            if (needNewDeviceObject) {
-                const PS::AudioDeviceKey key = {
-                    pair.second.deviceIds().first() + QLatin1String("playback"),
-                    -1, --uniqueDeviceNumber
-                };
-                PS::AudioDevice dev(pair.first.uniqueId, QLatin1String("audio-backend-pulseaudio"), key, 0, true);
-                dev.addAccess(pair.second);
-                m_audioOutputDevices.append(dev);
-            }
-        }
-        it = m_audioCaptureDevices;
-        foreach (const MyPair &pair, userData.sources) {
-            it.toFront();
-            bool needNewDeviceObject = true;
-            while (it.hasNext()) {
-                PS::AudioDevice &dev = it.next();
-                if (dev.key() == pair.first) {
-                    dev.addAccess(pair.second);
-                    needNewDeviceObject = false;
-                    continue;
-                }
-            }
-            if (needNewDeviceObject) {
-                const PS::AudioDeviceKey key = {
-                    pair.second.deviceIds().first() + QLatin1String("capture"),
-                    -1, --uniqueDeviceNumber
-                };
-                PS::AudioDevice dev(pair.first.uniqueId, QLatin1String("audio-backend-pulseaudio"), key, 0, true);
-                dev.addAccess(pair.second);
-                m_audioCaptureDevices.append(dev);
-            }
-        }
-    }
-#endif // HAVE_PULSEAUDIO
-
     if (haveAlsaDevices) {
         // go through the lists and check for devices that have only OSS and remove them since
         // they're very likely bogus (Solid tells us a device can do capture and playback, even
@@ -855,14 +662,8 @@ static inline QByteArray nameForDriver(PS::AudioDeviceAccess::AudioDriver d)
         return "alsa";
     case PS::AudioDeviceAccess::OssDriver:
         return "oss";
-    case PS::AudioDeviceAccess::PulseAudioDriver:
-        return "pulseaudio";
     case PS::AudioDeviceAccess::JackdDriver:
         return "jackd";
-    case PS::AudioDeviceAccess::EsdDriver:
-        return "esd";
-    case PS::AudioDeviceAccess::ArtsDriver:
-        return "arts";
     case PS::AudioDeviceAccess::InvalidDriver:
         break;
     }
diff --git a/phonon/kded-module/phononserver.h b/phonon/kded-module/phononserver.h
index 2583863..fc04560 100644
--- a/phonon/kded-module/phononserver.h
+++ b/phonon/kded-module/phononserver.h
@@ -51,7 +51,7 @@ class PhononServer : public KDEDModule
     private slots:
         void deviceAdded(const QString &udi);
         void deviceRemoved(const QString &udi);
-        // TODO add callbacks for Pulse, Jack changes and whatever else, if somehow possible
+        // TODO add callbacks for Jack changes and whatever else, if somehow possible (Pulse handled by libphonon)
 
         void alsaConfigChanged();
 
commit 8757fd4431c1fdabf00c0a39f5640e96f7a41726
Author: cguthrie <cguthrie at 283d02a7-25f6-0310-bc7c-ecb5cbfe19da>
Date:   Fri Nov 20 09:15:57 2009 +0000

    phonon: Fix phonon API due to change in r1051728
    
    git-svn-id: svn+ssh://svn.kde.org/home/kde/trunk/KDE/kdebase/runtime@1051798 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

diff --git a/phonon/kcm/devicepreference.cpp b/phonon/kcm/devicepreference.cpp
index 71e772b..0554269 100644
--- a/phonon/kcm/devicepreference.cpp
+++ b/phonon/kcm/devicepreference.cpp
@@ -327,7 +327,7 @@ QList<Phonon::AudioCaptureDevice> DevicePreference::availableAudioCaptureDevices
 
 void DevicePreference::load()
 {
-    showCheckBox->setChecked(!Phonon::GlobalConfig().getHideAdvancedDevices());
+    showCheckBox->setChecked(!Phonon::GlobalConfig().hideAdvancedDevices());
     loadCategoryDevices();
 }
 
@@ -545,7 +545,7 @@ void DevicePreference::on_showCheckBox_toggled()
 {
     // In order to get the right list from the backend, we need to update the settings now
     // before calling availableAudio{Output,Capture}Devices()
-    Phonon::GlobalConfig().hideAdvancedDevices(!showCheckBox->isChecked());
+    Phonon::GlobalConfig().setHideAdvancedDevices(!showCheckBox->isChecked());
     loadCategoryDevices();
 }
 


Index: kdebase-runtime.spec
===================================================================
RCS file: /cvs/extras/rpms/kdebase-runtime/F-11/kdebase-runtime.spec,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -p -r1.128 -r1.129
--- kdebase-runtime.spec	15 Nov 2009 00:46:33 -0000	1.128
+++ kdebase-runtime.spec	5 Dec 2009 15:23:08 -0000	1.129
@@ -1,11 +1,15 @@
+
 %if 0%{?fedora}
 %define flags 1
+%if 0%{?fedora} > 11
+%define phonon_pa_patch 1
+%endif
 %endif
 
 Name:          kdebase-runtime
 Summary:       K Desktop Environment - Runtime
-Version:       4.3.3
-Release:       5%{?dist}
+Version:       4.3.4
+Release:       2%{?dist}
 
 # http://techbase.kde.org/Policies/Licensing_Policy
 License:       LGPLv2+
@@ -24,6 +28,8 @@ Patch4:        kdebase-runtime-4.3.0-nep
 Patch5:        kdebase-runtime-4.3.1-manpath.patch
 # add OnlyShowIn=KDE  to Desktop/Home.desktop (like trash.desktop)
 Patch6:        kdebase-runtime-4.3.3-home_onlyshowin_kde.patch
+# http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/kdebase4-runtime/current/SOURCES/kdebase-runtime-4.3.1-backend-globalconfig.patch
+Patch7:        kdebase-runtime-4.3.1-backend-globalconfig.patch
 
 ## Upstream patches
 
@@ -52,6 +58,12 @@ Requires: htdig
 # beware of bootstrapping, there be dragons
 Requires: oxygen-icon-theme >= %{version}
 
+%if 0%{?phonon_pa_patch}
+%define phonon_ver 4.3.50
+BuildRequires: phonon-devel >= %{phonon_ver}
+Requires: phonon >= %{phonon_ver}
+%endif
+
 BuildRequires: kde-filesystem
 BuildRequires: alsa-lib-devel
 BuildRequires: bzip2-devel
@@ -103,7 +115,11 @@ BuildArch: noarch
 %prep
 %setup -q -n kdebase-runtime-%{version}
 
+%if 0%{?phonon_pa_patch} 
+%patch7 -p1 -b .backend-globalconfig
+%else
 %patch0 -p1 -b .pulseaudio
+%endif
 %patch1 -p1 -b .searchproviders-shortcuts
 %patch2 -p1 -b .knetattach
 %patch3 -p1 -b .iconthemes-inherit
@@ -227,6 +243,12 @@ fi
 
 
 %changelog
+* Thu Dec 03 2009 Rex Dieter <rdieter at fedoraproject.org> - 4.3.4-2
+- phonon/pulseaudio patch from mandriva, kudos to coling (f12)
+
+* Tue Dec 01 2009 Than Ngo <than at redhat.com> - 4.3.4-1
+- 4.3.4
+
 * Sat Nov 14 2009 Rex Dieter <rdieter at fedoraproject.org> - 4.3.3-5
 - disable manpath patch for now, does more harm than good (#532071)
 


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/kdebase-runtime/F-11/sources,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -p -r1.37 -r1.38
--- sources	9 Nov 2009 13:19:29 -0000	1.37
+++ sources	5 Dec 2009 15:23:08 -0000	1.38
@@ -1 +1 @@
-88bf28d42d326c16abceaf3f1c6bffde  kdebase-runtime-4.3.3.tar.bz2
+6f5beaaf4ff8f7441113d3236ab6316f  kdebase-runtime-4.3.4.tar.bz2




More information about the fedora-extras-commits mailing list