diff --git a/CMakeLists.txt b/CMakeLists.txt index bd098c00..76f1b716 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,7 +252,6 @@ macro_optional_add_subdirectory(kstyles) # imported from kde-runtime and other sub-projects macro_optional_add_subdirectory(kdesu) -macro_optional_add_subdirectory(phonon) macro_optional_add_subdirectory(menu) macro_optional_add_subdirectory(kwalletd) macro_optional_add_subdirectory(kwalletmanager) diff --git a/kcontrol/access/CMakeLists.txt b/kcontrol/access/CMakeLists.txt index 49e43038..f4cb65ae 100644 --- a/kcontrol/access/CMakeLists.txt +++ b/kcontrol/access/CMakeLists.txt @@ -4,7 +4,6 @@ kde4_add_plugin(kcm_access kcmaccess.cpp) target_link_libraries(kcm_access ${KDE4_KIO_LIBS} - ${KDE4_PHONON_LIBS} ${KDE4_KNOTIFYCONFIG_LIBS} ${X11_LIBRARIES} ) @@ -26,8 +25,8 @@ add_executable(kaccess ${kaccess_SRCS}) target_link_libraries(kaccess ${KDE4_KDEUI_LIBS} - ${KDE4_PHONON_LIBS} ${X11_LIBRARIES} + kmediaplayer ) install( diff --git a/kcontrol/access/kaccess.cpp b/kcontrol/access/kaccess.cpp index c0d19764..9d56dc72 100644 --- a/kcontrol/access/kaccess.cpp +++ b/kcontrol/access/kaccess.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -472,14 +472,13 @@ void KAccessApp::xkbBellNotify(XkbBellNotifyEvent *event) flush(); } - // ask Phonon to ring a nice bell + // ring a nice bell if (_artsBell) { - if (!_player) { // as creating the player is expensive, delay the creation - _player = Phonon::createPlayer(Phonon::AccessibilityCategory); - _player->setParent(this); - _player->setCurrentSource(KUrl(_currentPlayerSource)); + // as creating the player is expensive, delay the creation + if (!_player) { + _player = new KAudioPlayer(this); } - _player->play(); + _player->load(_currentPlayerSource); } } diff --git a/kcontrol/access/kaccess.h b/kcontrol/access/kaccess.h index 07c3f19b..dc5891d6 100644 --- a/kcontrol/access/kaccess.h +++ b/kcontrol/access/kaccess.h @@ -1,18 +1,15 @@ #ifndef __K_ACCESS_H__ #define __K_ACCESS_H__ - #include #include -//Added by qt3to4: #include -#include - +#include #include #include - -#include +#include // so that it can define Status +#include #include #define explicit int_explicit // avoid compiler name clash in XKBlib.h @@ -73,7 +70,7 @@ private: QWidget *overlay; - Phonon::MediaObject *_player; + KAudioPlayer *_player; QString _currentPlayerSource; WId _activeWindow; diff --git a/kcontrol/access/main.cpp b/kcontrol/access/main.cpp index 5ecd5e1d..03e5c684 100644 --- a/kcontrol/access/main.cpp +++ b/kcontrol/access/main.cpp @@ -1,4 +1,3 @@ - #include "kaccess.h" #include #include diff --git a/knotify/CMakeLists.txt b/knotify/CMakeLists.txt index 023b8992..370b9c4e 100644 --- a/knotify/CMakeLists.txt +++ b/knotify/CMakeLists.txt @@ -2,16 +2,16 @@ add_subdirectory( sounds ) ########### next target ############### set(knotify_SRCS -main.cpp -knotify.cpp -notifybysound.cpp -notifybypopup.cpp -notifybylogfile.cpp -notifybytaskbar.cpp -notifybyexecute.cpp -notifybyktts.cpp -imageconverter.cpp -ksolidnotify.cpp + main.cpp + knotify.cpp + notifybysound.cpp + notifybypopup.cpp + notifybylogfile.cpp + notifybytaskbar.cpp + notifybyexecute.cpp + notifybyktts.cpp + imageconverter.cpp + ksolidnotify.cpp ) set(knotifyplugin_SRCS @@ -32,7 +32,7 @@ add_executable( knotify ${knotify_SRCS}) add_library( knotifyplugin SHARED ${knotifyplugin_SRCS}) -target_link_libraries( knotify ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${KDE4_SOLID_LIBS} knotifyplugin) +target_link_libraries( knotify ${KDE4_KDEUI_LIBS} ${KDE4_SOLID_LIBS} knotifyplugin kmediaplayer) target_link_libraries( knotifyplugin ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS}) diff --git a/knotify/notifybysound.cpp b/knotify/notifybysound.cpp index c5314a24..14711d89 100644 --- a/knotify/notifybysound.cpp +++ b/knotify/notifybysound.cpp @@ -45,59 +45,32 @@ #include #include #include - -// Phonon headers -#include -#include -#include - -struct Player -{ - Player() - : media(new Phonon::MediaObject), - output(new Phonon::AudioOutput(Phonon::NotificationCategory)) - { - Phonon::createPath(media, output); - } - - inline void play(const QString &file) { media->setCurrentSource(KUrl(file)); media->enqueue(Phonon::MediaSource()); media->play(); } - inline void stop() { media->stop(); } - inline void setVolume(float volume) { output->setVolume(volume); } - - ~Player() - { - output->deleteLater(); - media->deleteLater(); - } - - Phonon::MediaObject *const media; - Phonon::AudioOutput *const output; -}; +#include class PlayerPool { public: PlayerPool() : m_idlePlayer(0), m_changeVolume(false), m_volume(1.0) {} - Player *getPlayer(); - void returnPlayer(Player *); + KAudioPlayer *getPlayer(); + void returnPlayer(KAudioPlayer *); void clear(); void setChangeVolume(bool b); void setVolume(float volume); private: - Player *m_idlePlayer; - QList m_playersInUse; + KAudioPlayer *m_idlePlayer; + QList m_playersInUse; bool m_changeVolume; float m_volume; }; -Player *PlayerPool::getPlayer() +KAudioPlayer *PlayerPool::getPlayer() { - Player *p = 0; + KAudioPlayer *p = 0; if (!m_idlePlayer) { - p = new Player; + p = new KAudioPlayer(); } else { p = m_idlePlayer; m_idlePlayer = 0; @@ -109,7 +82,7 @@ Player *PlayerPool::getPlayer() return p; } -void PlayerPool::returnPlayer(Player *p) +void PlayerPool::returnPlayer(KAudioPlayer *p) { m_playersInUse.removeAll(p); if (m_idlePlayer) { @@ -129,7 +102,7 @@ void PlayerPool::setChangeVolume(bool b) { m_changeVolume = b; if (m_changeVolume) { - foreach (Player *p, m_playersInUse) { + foreach (KAudioPlayer *p, m_playersInUse) { p->setVolume(m_volume); } } @@ -139,7 +112,7 @@ void PlayerPool::setVolume(float v) { m_volume = v; if (m_changeVolume) { - foreach (Player *p, m_playersInUse) { + foreach (KAudioPlayer *p, m_playersInUse) { p->setVolume(v); } } @@ -152,7 +125,7 @@ class NotifyBySound::Private QString externalPlayer; QHash processes; - QHash playerObjects; + QHash playerObjects; QSignalMapper *signalmapper; PlayerPool playerPool; QBasicTimer poolTimer; @@ -252,10 +225,10 @@ void NotifyBySound::notify( int eventId, KNotifyConfig * config ) if(d->playerMode == Private::UsePhonon) { - Player *player = d->playerPool.getPlayer(); - connect(player->media, SIGNAL(finished()), d->signalmapper, SLOT(map())); - d->signalmapper->setMapping(player->media, eventId); - player->play(soundFile); + KAudioPlayer *player = d->playerPool.getPlayer(); + connect(player, SIGNAL(finished()), d->signalmapper, SLOT(map())); + d->signalmapper->setMapping(player, eventId); + player->load(soundFile); d->playerObjects.insert(eventId, player); } else if (d->playerMode == Private::ExternalPlayer && !d->externalPlayer.isEmpty()) @@ -295,8 +268,8 @@ void NotifyBySound::slotSoundFinished(int id) kDebug() << id; if(d->playerObjects.contains(id)) { - Player *player=d->playerObjects.take(id); - disconnect(player->media, SIGNAL(finished()), d->signalmapper, SLOT(map())); + KAudioPlayer *player=d->playerObjects.take(id); + disconnect(player, SIGNAL(finished()), d->signalmapper, SLOT(map())); d->playerPool.returnPlayer(player); //d->poolTimer.start(1000, this); } @@ -321,7 +294,7 @@ void NotifyBySound::closeNow() const int id = d->closeQueue.dequeue(); if(d->playerObjects.contains(id)) { - Player *p = d->playerObjects.take(id); + KAudioPlayer *p = d->playerObjects.take(id); p->stop(); d->playerPool.returnPlayer(p); //d->poolTimer.start(1000, this); diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index d2c4c75a..bc276b36 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -470,11 +470,11 @@ void KSMServer::completeShutdownOrCheckpoint() discardSession(); if ( state == Shutdown ) { - KNotification *n = KNotification::event( "exitkde" , QString() , QPixmap() , 0l , KNotification::DefaultEvent ); // KDE says good bye + // KDE says good bye + KNotification *n = KNotification::event( "exitkde" , QString() , QPixmap() , 0l , KNotification::DefaultEvent ); connect(n, SIGNAL(closed()) , this, SLOT(logoutSoundFinished()) ); // https://bugs.kde.org/show_bug.cgi?id=228005 - // if sound is not working for some reason (e.g. no phonon - // backends are installed) the closed() signal never happens + // if sound is not working for some reason the closed() signal never happens // and logoutSoundFinished() never gets called. Add this timer to make // sure the shutdown procedure continues even if sound system is broken. QTimer::singleShot(5000, this, SLOT(logoutSoundTimeout())); diff --git a/phonon/CMakeLists.txt b/phonon/CMakeLists.txt deleted file mode 100644 index 3f0ce0db..00000000 --- a/phonon/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -# If you want to build kdebase without any multimedia support -# define the cmake variable KDEBASE_DISABLE_MULTIMEDIA, i.e, -# % cmake -DKDEBASE_DISABLE_MULTIMEDIA=ON -# -project(PHONON-KDE-RUNTIME) - -add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) - -include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES}) - -option(KDEBASE_DISABLE_MULTIMEDIA "Disable multimedia support (default: off)" OFF) - -if(KDEBASE_DISABLE_MULTIMEDIA) - message(STATUS "NOTICE: Multimedia support DISABLED (KDEBASE_DISABLE_MULTIMEDIA == ON)") -else(KDEBASE_DISABLE_MULTIMEDIA) - # TODO: even phonon 4.8.3 identifies itself as "4.4.0" in its namespace - # header, the version detection should query the .pc files first! - set(PHONON_MIN_VERSION "4.4.0") - if("${PHONON_VERSION}" VERSION_LESS "${PHONON_MIN_VERSION}") - # Katie has decent version but does not set PHONON_VERSION at all - if(NOT KATIE_PHONON_FOUND) - message(FATAL_ERROR "The installed Phonon is too old. Found version ${PHONON_VERSION}. Required is ${PHONON_MIN_VERSION}") - endif() - endif() - - find_package(Alsa) - option(WITH_ALSA "Use ALSA, if found" ON) - if(NOT WITH_ALSA) - set(ALSA_FOUND FALSE) - set(ASOUND_LIBRARY NOTFOUND) - set(HAVE_LIBASOUND2 FALSE) - set(ALSA_INCLUDES NOTFOUND) - endif(NOT WITH_ALSA) - - alsa_configure_file(${CMAKE_CURRENT_BINARY_DIR}/config-alsa.h) - - set(HAVE_CURRENT_ALSA FALSE) - if(ALSA_FOUND) - include_directories(${ALSA_INCLUDES}) - alsa_version_string(ALSA_VERSION_STR) - if(ALSA_VERSION_STR) - if(ALSA_VERSION_STR MATCHES "^1\\.(0\\.(1[4-9]|[2-9][0-9]+)|[1-9][0-9]*\\.)") - add_definitions(-DHAS_LIBASOUND_DEVICE_NAME_HINT) - set(HAVE_CURRENT_ALSA TRUE) - endif(ALSA_VERSION_STR MATCHES "^1\\.(0\\.(1[4-9]|[2-9][0-9]+)|[1-9][0-9]*\\.)") - endif(ALSA_VERSION_STR) - endif(ALSA_FOUND) - add_feature_info("Dmix and virtual device listing" HAVE_CURRENT_ALSA - "The ALSA library (http://www.alsa-project.org) is needed for building - some additional Phonon features" - ) - - add_subdirectory(kded-module) - add_subdirectory(platform_kde) - macro_optional_add_subdirectory(kcm) -endif(KDEBASE_DISABLE_MULTIMEDIA) diff --git a/phonon/kcm/CMakeLists.txt b/phonon/kcm/CMakeLists.txt deleted file mode 100644 index 8a4794b7..00000000 --- a/phonon/kcm/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -macro_optional_find_package(PulseAudio 0.9.16) -set_package_properties(PulseAudio PROPERTIES DESCRIPTION "PulseAudio Audio Server" - URL "http://www.pulseaudio.org/" - TYPE OPTIONAL - PURPOSE "libpulse is needed for audio setup GUI" - ) - -find_package(GLIB2) -set_package_properties(GLIB2 PROPERTIES DESCRIPTION "Low-level core library for data structure handling, portability wrappers, etc." - URL "http://www.gtk.org" - TYPE OPTIONAL - ) - -pkg_check_modules(CANBERRA libcanberra) -add_feature_info ("Audio setup GUI" CANBERRA_FOUND - "libcanberra is needed for audio setup GUI - * http://0pointer.de/lennart/projects/libcanberra" - ) - -set(kcmphonon_SRCS main.cpp devicepreference.cpp backendselection.cpp devicepreference.ui backendselection.ui) -set(kcmphonon_LIBS ${KDE4_PHONON_LIBS} ${KDE4_KCMUTILS_LIBS} ${KDE4_KIO_LIBS}) - -if(GLIB2_FOUND AND PULSEAUDIO_FOUND AND CANBERRA_FOUND) - add_definitions(-DHAVE_PULSEAUDIO) - - set(kcmphonon_SRCS ${kcmphonon_SRCS} audiosetup.cpp testspeakerwidget.cpp audiosetup.ui) - - include_directories(${GLIB2_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR} ${CANBERRA_INCLUDE_DIRS}) - - set(kcmphonon_LIBS ${kcmphonon_LIBS} ${GLIB2_LIBRARIES} ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY} ${CANBERRA_LIBRARIES}) -endif(GLIB2_FOUND AND PULSEAUDIO_FOUND AND CANBERRA_FOUND) - -kde4_add_plugin(kcm_phonon ${kcmphonon_SRCS}) -target_link_libraries(kcm_phonon ${kcmphonon_LIBS}) - -install(TARGETS kcm_phonon DESTINATION ${PLUGIN_INSTALL_DIR} ) - -########### install files ############### -install( FILES kcm_phonon.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) -install(FILES listview-background.png DESTINATION ${DATA_INSTALL_DIR}/kcm_phonon) diff --git a/phonon/kcm/Messages.sh b/phonon/kcm/Messages.sh deleted file mode 100644 index 15a3c4b9..00000000 --- a/phonon/kcm/Messages.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/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/kcm_phonon.pot -rm -f dirs -rm -f files diff --git a/phonon/kcm/audiosetup.cpp b/phonon/kcm/audiosetup.cpp deleted file mode 100644 index db2c3a85..00000000 --- a/phonon/kcm/audiosetup.cpp +++ /dev/null @@ -1,890 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2010 Colin Guthrie - Copyright (C) 2011 Harald Sitter - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 - as published by the Free Software Foundation. - - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -#include "audiosetup.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "testspeakerwidget.h" - -#define SS_DEFAULT_ICON "audio-card" - -#define THAT(userdata) Q_ASSERT(userdata); AudioSetup *ss = static_cast(userdata) - -static pa_glib_mainloop *s_mainloop = NULL; -static pa_context *s_context = NULL; - -QMap s_Cards; -QMap s_Sinks; -QMap s_Sources; - -static void card_cb(pa_context *c, const pa_card_info *i, int eol, void *userdata) { - Q_ASSERT(c); - THAT(userdata); - - if (eol < 0) { - if (pa_context_errno(c) == PA_ERR_NOENTITY) - return; - - kDebug() << "Card callback failure"; - return; - } - - if (eol > 0) { - ss->updateFromPulse(); - return; - } - - Q_ASSERT(i); - ss->updateCard(i); -} - -static void sink_cb(pa_context *c, const pa_sink_info *i, int eol, void *userdata) { - Q_ASSERT(c); - THAT(userdata); - - if (eol < 0) { - if (pa_context_errno(c) == PA_ERR_NOENTITY) - return; - kDebug() << "Sink callback failure"; - return; - } - - if (eol > 0) { - ss->updateIndependantDevices(); - ss->updateFromPulse(); - return; - } - - Q_ASSERT(i); - ss->updateSink(i); -} - -static void source_cb(pa_context *c, const pa_source_info *i, int eol, void *userdata) { - Q_ASSERT(c); - THAT(userdata); - - if (eol < 0) { - if (pa_context_errno(c) == PA_ERR_NOENTITY) - return; - - kDebug() << "Source callback failure"; - return; - } - - if (eol > 0) { - ss->updateIndependantDevices(); - ss->updateFromPulse(); - return; - } - - Q_ASSERT(i); - ss->updateSource(i); -} - -static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index, void *userdata) { - Q_ASSERT(c); - THAT(userdata); - - switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) { - case PA_SUBSCRIPTION_EVENT_CARD: - if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { - ss->removeCard(index); - } else { - pa_operation *operation = - pa_context_get_card_info_by_index(c, index, card_cb, ss); - if (!operation) { - kDebug() << "pa_context_get_card_info_by_index() failed"; - return; - } - pa_operation_unref(operation); - } - break; - - case PA_SUBSCRIPTION_EVENT_SINK: - if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { - ss->removeSink(index); - } else { - pa_operation *operation = - pa_context_get_sink_info_by_index(c, index, sink_cb, ss); - if (!operation) { - kDebug() << "pa_context_get_sink_info_by_index() failed"; - return; - } - pa_operation_unref(operation); - } - break; - - case PA_SUBSCRIPTION_EVENT_SOURCE: - if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { - ss->removeSource(index); - } else { - pa_operation *o; - if (!(o = pa_context_get_source_info_by_index(c, index, source_cb, ss))) { - kDebug() << "pa_context_get_source_info_by_index() failed"; - return; - } - pa_operation_unref(o); - } - break; - } -} - -static void context_state_callback(pa_context *c, void *userdata) -{ - Q_ASSERT(c); - THAT(userdata); - - kDebug() << "context_state_callback" << pa_context_get_state(c); - pa_context_state_t state = pa_context_get_state(c); - if (state == PA_CONTEXT_READY) { - // Attempt to load things up - pa_operation *o; - - pa_context_set_subscribe_callback(c, subscribe_cb, ss); - - if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t) - (PA_SUBSCRIPTION_MASK_CARD| - PA_SUBSCRIPTION_MASK_SINK| - PA_SUBSCRIPTION_MASK_SOURCE), NULL, NULL))) { - kDebug() << "pa_context_subscribe() failed"; - return; - } - pa_operation_unref(o); - - if (!(o = pa_context_get_card_info_list(c, card_cb, ss))) { - kDebug() << "pa_context_get_card_info_list() failed"; - return; - } - pa_operation_unref(o); - - if (!(o = pa_context_get_sink_info_list(c, sink_cb, ss))) { - kDebug() << "pa_context_get_sink_info_list() failed"; - return; - } - pa_operation_unref(o); - - if (!(o = pa_context_get_source_info_list(c, source_cb, ss))) { - kDebug() << "pa_context_get_source_info_list() failed"; - return; - } - pa_operation_unref(o); - - ss->load(); - - } else if (!PA_CONTEXT_IS_GOOD(state)) { - // If this is our probe phase, exit our context immediately - if (s_context != c) - pa_context_disconnect(c); - else { - kWarning() << "PulseAudio context lost. Scheduling reconnect in eventloop."; - pa_context_unref(s_context); - s_context = 0; - QMetaObject::invokeMethod(ss, "connectToDaemon", Qt::QueuedConnection); - } - } -} - -static void suspended_callback(pa_stream *s, void *userdata) { - THAT(userdata); - - if (pa_stream_is_suspended(s)) - ss->updateVUMeter(-1); -} - -static void read_callback(pa_stream *s, size_t length, void *userdata) { - THAT(userdata); - - const void *data; - int v; - if (pa_stream_peek(s, &data, &length) < 0) { - kDebug() << "Failed to read data from stream"; - return; - } - - Q_ASSERT(length > 0); - Q_ASSERT(length % sizeof(float) == 0); - - v = ((const float*) data)[length / sizeof(float) -1] * 100; - - pa_stream_drop(s); - - if (v < 0) - v = 0; - if (v > 100) - v = 100; - - ss->updateVUMeter(v); -} - - -AudioSetup::AudioSetup(QWidget *parent) - : QWidget(parent) - , m_OutstandingRequests(3) - , m_Canberra(0) - , m_VUStream(0) - , m_VURealValue(0) -{ - setupUi(this); - - cardLabel->setEnabled(false); - cardBox->setEnabled(false); - profileLabel->setVisible(false); - profileBox->setVisible(false); - - deviceLabel->setEnabled(false); - deviceBox->setEnabled(false); - portLabel->setVisible(false); - portBox->setVisible(false); - - for (int i = 0; i < 5; ++i) - placementGrid->setColumnStretch(i, 1); - for (int i = 0; i < 3; ++i) - placementGrid->setRowStretch(i, 1); - - m_icon = new QLabel(this); - m_icon->setPixmap(QPixmap(KUser().faceIconPath())); - if (m_icon->pixmap()->isNull()) - m_icon->setPixmap(KIcon("system-users").pixmap(KIconLoader::SizeHuge, KIconLoader::SizeHuge)); - placementGrid->addWidget(m_icon, 1, 2, Qt::AlignCenter); - - update(); - connect(cardBox, SIGNAL(currentIndexChanged(int)), SLOT(cardChanged())); - connect(profileBox, SIGNAL(currentIndexChanged(int)), SLOT(profileChanged())); - connect(deviceBox, SIGNAL(currentIndexChanged(int)), SLOT(deviceChanged())); - connect(portBox, SIGNAL(currentIndexChanged(int)), SLOT(portChanged())); - - m_VUTimer = new QTimer(this); - m_VUTimer->setInterval(10); - connect(m_VUTimer, SIGNAL(timeout()), this, SLOT(reallyUpdateVUMeter())); - - // We require a glib event loop - const QByteArray eventDispatcher( - QAbstractEventDispatcher::instance()->metaObject()->className()); - if (!eventDispatcher.contains("EventDispatcherGlib")) { - kDebug() << "Disabling PulseAudio integration for lack of GLib event loop."; - return; - } - - int ret = ca_context_create(&m_Canberra); - if (ret < 0) { - kDebug() << "Disabling PulseAudio integration. Canberra context failed."; - return; - } - - s_mainloop = pa_glib_mainloop_new(NULL); - if (!s_mainloop) { - kDebug() << "Disabling PulseAudio integration for lack of working GLib event loop."; - ca_context_destroy(m_Canberra); - m_Canberra = 0; - return; - } - - connectToDaemon(); -} - -AudioSetup::~AudioSetup() -{ - if (m_Canberra) - ca_context_destroy(m_Canberra); - if (s_context) { - pa_context_unref(s_context); - s_context = 0; - } - if (s_mainloop) { - pa_glib_mainloop_free(s_mainloop); - s_mainloop = 0; - } - s_Cards.clear(); - s_Sinks.clear(); - s_Sources.clear(); -} - -void AudioSetup::load() -{ -} - -void AudioSetup::save() -{ -} - -void AudioSetup::defaults() -{ -} - -void AudioSetup::updateCard(const pa_card_info *pInfo) -{ - cardInfo info; - info.index = pInfo->index; - - const char *description = pa_proplist_gets(pInfo->proplist, PA_PROP_DEVICE_DESCRIPTION); - if(description) - info.name = QString::fromUtf8(description); - else - info.name = QString::fromUtf8(pInfo->name); - - const char *icon = pa_proplist_gets(pInfo->proplist, PA_PROP_DEVICE_ICON_NAME); - if (icon) - info.icon = QString::fromUtf8(icon); - else - info.icon = QString::fromUtf8(SS_DEFAULT_ICON); - - for (quint32 i = 0; i < pInfo->n_profiles; ++i) { - const pa_card_profile_info *profile = &(pInfo->profiles[i]); - const quint32 priority = profile->priority; - const QPair name(profile->name ? QString::fromUtf8(profile->name) : QString(), - profile->description ? QString::fromUtf8(profile->description) : QString()); - info.profiles.insertMulti(priority, name); - } - - if (pInfo->active_profile) - info.activeProfile = pInfo->active_profile->name; - - cardBox->blockSignals(true); - if (s_Cards.contains(pInfo->index)) { - int idx = cardBox->findData(pInfo->index); - if (idx >= 0) { - cardBox->setItemIcon(idx, KIcon(info.icon)); - cardBox->setItemText(idx, info.name); - } - } else { - cardBox->addItem(KIcon(info.icon), info.name, pInfo->index); - } - cardBox->blockSignals(false); - - s_Cards[pInfo->index] = info; - - cardChanged(); - kDebug() << "Got info about card" << info.name; -} - -void AudioSetup::removeCard(uint32_t index) -{ - s_Cards.remove(index); - updateFromPulse(); - const int idx = cardBox->findData(index); - if (idx >= 0) - cardBox->removeItem(idx); -} - -void AudioSetup::updateSink(const pa_sink_info* i) -{ - deviceInfo info; - info.index = i->index; - info.cardIndex = i->card; - info.name = QString::fromUtf8(i->description); - - const char *icon = pa_proplist_gets(i->proplist, PA_PROP_DEVICE_ICON_NAME); - info.icon = icon ? icon : SS_DEFAULT_ICON; - - info.channelMap = i->channel_map; - - for (uint32_t j = 0; j < i->n_ports; ++j) - info.ports[i->ports[j]->priority] = QPair(i->ports[j]->name, QString::fromUtf8(i->ports[j]->description)); - if (i->active_port) - info.activePort = i->active_port->name; - - s_Sinks[i->index] = info; - - // Need to update the currently displayed port if this sink is the currently displayed one. - if (info.ports.size()) { - int idx = deviceBox->currentIndex(); - if (idx >= 0) { - qint64 index = deviceBox->itemData(idx).toInt(); - if (index >= 0 && index == i->index) { - portBox->blockSignals(true); - portBox->setCurrentIndex(portBox->findData(info.activePort)); - portBox->blockSignals(false); - } - } - } - - kDebug() << "Got info about sink" << info.name; -} - -void AudioSetup::removeSink(uint32_t index) -{ - s_Sinks.remove(index); - updateIndependantDevices(); - updateFromPulse(); - int idx = deviceBox->findData(index); - if (idx >= 0) - deviceBox->removeItem(idx); -} - -void AudioSetup::updateSource(const pa_source_info* i) -{ - if (i->monitor_of_sink != PA_INVALID_INDEX) - return; - - deviceInfo info; - info.index = i->index; - info.cardIndex = i->card; - info.name = QString::fromUtf8(i->description); - - const char* icon = pa_proplist_gets(i->proplist, PA_PROP_DEVICE_ICON_NAME); - info.icon = icon ? icon : SS_DEFAULT_ICON; - - info.channelMap = i->channel_map; - - for (uint32_t j = 0; j < i->n_ports; ++j) - info.ports[i->ports[j]->priority] = QPair(i->ports[j]->name, QString::fromUtf8(i->ports[j]->description)); - if (i->active_port) - info.activePort = i->active_port->name; - - s_Sources[i->index] = info; - - // Need to update the currently displayed port if this source is the currently displayed one. - if (false && info.ports.size()) { - int idx = deviceBox->currentIndex(); - if (idx >= 0) { - qint64 index = deviceBox->itemData(idx).toInt(); - if (index < 0 && ((-1*index) - 1) == i->index) { - portBox->blockSignals(true); - portBox->setCurrentIndex(portBox->findData(info.activePort)); - portBox->blockSignals(false); - } - } - } - - kDebug() << "Got info about source" << info.name; -} - -void AudioSetup::removeSource(uint32_t index) -{ - s_Sources.remove(index); - updateIndependantDevices(); - updateFromPulse(); - int idx = deviceBox->findData(index); - if (false && idx >= 0) - deviceBox->removeItem(idx); -} - -void AudioSetup::updateFromPulse() -{ - bool setupReady = false; - if (m_OutstandingRequests > 0) { - if (0 == --m_OutstandingRequests) { - // Work out which seclector to pick by default (we want to choose a real Card if possible) - if (s_Cards.size() != cardBox->count()) - cardBox->setCurrentIndex(1); - setupReady = true; - } - } - - if (!m_OutstandingRequests) { - if (!s_Cards.size() && !s_Sinks.size()) { - cardLabel->setEnabled(false); - cardBox->setEnabled(false); - profileLabel->setVisible(false); - profileBox->setVisible(false); - - deviceLabel->setEnabled(false); - deviceBox->setEnabled(false); - portLabel->setVisible(false); - portBox->setVisible(false); - } - if (s_Cards.size() && !cardBox->isEnabled()) { - cardLabel->setEnabled(true); - cardBox->setEnabled(true); - cardChanged(); - } - if (s_Sinks.size() && !deviceBox->isEnabled()) { - deviceLabel->setEnabled(true); - deviceBox->setEnabled(true); - deviceChanged(); - } - - if (setupReady) { - emit ready(); - } - } -} - -void AudioSetup::cardChanged() -{ - int idx = cardBox->currentIndex(); - if (idx < 0) { - profileLabel->setVisible(false); - profileBox->setVisible(false); - return; - } - - uint32_t card_index = cardBox->itemData(idx).toUInt(); - Q_ASSERT(PA_INVALID_INDEX == card_index || s_Cards.contains(card_index)); - bool show_profiles = (PA_INVALID_INDEX != card_index && s_Cards[card_index].profiles.size()); - if (show_profiles) { - cardInfo &card_info = s_Cards[card_index]; - profileBox->blockSignals(true); - profileBox->clear(); - QMap >::const_iterator it; - for (it = card_info.profiles.constBegin(); it != card_info.profiles.constEnd(); ++it) - profileBox->insertItem(0, it.value().second, it.value().first); - profileBox->setCurrentIndex(profileBox->findData(card_info.activeProfile)); - profileBox->blockSignals(false); - } - profileLabel->setVisible(show_profiles); - profileBox->setVisible(show_profiles); - - deviceBox->blockSignals(true); - deviceBox->clear(); - QMap::const_iterator it; - for (it = s_Sinks.constBegin(); it != s_Sinks.constEnd(); ++it) { - if (it->cardIndex == card_index) - deviceBox->addItem(KIcon(it->icon), i18n("Playback (%1)", it->name), it->index); - } - for (it = s_Sources.constBegin(); it != s_Sources.constEnd(); ++it) { - if (it->cardIndex == card_index) - deviceBox->addItem(KIcon(it->icon), i18n("Recording (%1)", it->name), ((-1*it->index) - 1)); - } - deviceBox->blockSignals(false); - - deviceGroupBox->setEnabled(!!deviceBox->count()); - - deviceChanged(); - - kDebug() << "Doing update" << cardBox->currentIndex(); - - emit changed(); -} - -void AudioSetup::profileChanged() -{ - quint32 card_index = cardBox->itemData(cardBox->currentIndex()).toUInt(); - Q_ASSERT(PA_INVALID_INDEX != card_index); - - QString profile = profileBox->itemData(profileBox->currentIndex()).toString(); - kDebug() << "Changing profile to" << profile; - - Q_ASSERT(s_Cards[card_index].profiles.size()); - - pa_operation *operation = - pa_context_set_card_profile_by_index(s_context, - card_index, - qPrintable(profile), - NULL, - NULL); - if (!operation) - kDebug() << "pa_context_set_card_profile_by_name() failed"; - else - pa_operation_unref(operation); - - emit changed(); -} - -void AudioSetup::updateIndependantDevices() -{ - // Should we display the "Independent Devices" drop down? - // Count all the sinks without cards - bool showID = false; - QMap::const_iterator it; - for (it = s_Sinks.constBegin(); it != s_Sinks.constEnd(); ++it) { - if (PA_INVALID_INDEX == it->cardIndex) { - showID = true; - break; - } - } - - bool haveID = (PA_INVALID_INDEX == cardBox->itemData(0).toUInt()); - - kDebug() << QString("Want ID: %1; Have ID: %2").arg(showID?"Yes":"No").arg(haveID?"Yes":"No"); - - cardBox->blockSignals(true); - if (haveID && !showID) - cardBox->removeItem(0); - else if (!haveID && showID) - cardBox->insertItem(0, KIcon(SS_DEFAULT_ICON), i18n("Independent Devices"), PA_INVALID_INDEX); - cardBox->blockSignals(false); -} - -void AudioSetup::updateVUMeter(int vol) -{ - if (vol < 0) { - inputLevels->setEnabled(false); - inputLevels->setValue(0); - m_VURealValue = 0; - } else { - inputLevels->setEnabled(true); - if (vol > inputLevels->value()) - inputLevels->setValue(vol); - m_VURealValue = vol; - } -} - -void AudioSetup::reallyUpdateVUMeter() -{ - int val = inputLevels->value(); - if (val > m_VURealValue) - inputLevels->setValue(val-1); -} - -bool AudioSetup::connectToDaemon() -{ - pa_mainloop_api *api = pa_glib_mainloop_get_api(s_mainloop); - - s_context = pa_context_new(api, i18n("KDE Audio Hardware Setup").toUtf8().constData()); - if (pa_context_connect(s_context, NULL, PA_CONTEXT_NOFAIL, 0) < 0) { - kDebug() << "Disabling PulseAudio integration. Context connection failed: " << pa_strerror(pa_context_errno(s_context)); - pa_context_unref(s_context); - s_context = 0; - pa_glib_mainloop_free(s_mainloop); - s_mainloop = 0; - ca_context_destroy(m_Canberra); - m_Canberra = 0; - setEnabled(false); - return false; - } - - pa_context_set_state_callback(s_context, &context_state_callback, this); - setEnabled(true); - return true; -} - -static deviceInfo &getDeviceInfo(qint64 index) -{ - if (index >= 0) { - Q_ASSERT(s_Sinks.contains(index)); - return s_Sinks[index]; - } - - index = (-1 * index) - 1; - Q_ASSERT(s_Sources.contains(index)); - return s_Sources[index]; -} - -void AudioSetup::deviceChanged() -{ - int idx = deviceBox->currentIndex(); - if (idx < 0) { - portLabel->setVisible(false); - portBox->setVisible(false); - _updatePlacementTester(); - return; - } - qint64 index = deviceBox->itemData(idx).toInt(); - deviceInfo &device_info = getDeviceInfo(index); - - kDebug() << QString("Updating ports for device '%1' (%2 ports available)") - .arg(device_info.name) - .arg(device_info.ports.size()); - - bool showPorts = !!device_info.ports.size(); - if (showPorts) { - portBox->blockSignals(true); - portBox->clear(); - QMap >::const_iterator it; - for (it = device_info.ports.constBegin(); it != device_info.ports.constEnd(); ++it) - portBox->insertItem(0, it.value().second, it.value().first); - portBox->setCurrentIndex(portBox->findData(device_info.activePort)); - portBox->blockSignals(false); - } - portLabel->setVisible(showPorts); - portBox->setVisible(showPorts); - - if (deviceBox->currentIndex() >= 0) { - if (index < 0) - _createMonitorStreamForSource((-1*index) - 1); - else if (m_VUStream) { - pa_stream_disconnect(m_VUStream); - m_VUStream = NULL; - } - - _updatePlacementTester(); - } - - emit changed(); -} - -void AudioSetup::portChanged() -{ - qint64 index = deviceBox->itemData(deviceBox->currentIndex()).toInt(); - - QString port = portBox->itemData(portBox->currentIndex()).toString(); - kDebug() << "Changing port to" << port; - -#ifndef QT_NO_DEBUG - deviceInfo &device_info = getDeviceInfo(index); - Q_ASSERT(device_info.ports.size()); -#endif /* QT_NO_DEBUG */ - - pa_operation *o; - if (index >= 0) { - if (!(o = pa_context_set_sink_port_by_index(s_context, (uint32_t)index, port.toAscii().constData(), NULL, NULL))) - kDebug() << "pa_context_set_sink_port_by_index() failed"; - else - pa_operation_unref(o); - } else { - if (!(o = pa_context_set_source_port_by_index(s_context, (uint32_t)((-1*index) - 1), port.toAscii().constData(), NULL, NULL))) - kDebug() << "pa_context_set_source_port_by_index() failed"; - else - pa_operation_unref(o); - } - - emit changed(); -} - -void AudioSetup::_updatePlacementTester() -{ - static const int position_table[] = { - /* Position, X, Y */ - PA_CHANNEL_POSITION_FRONT_LEFT, 0, 0, - PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, 1, 0, - PA_CHANNEL_POSITION_FRONT_CENTER, 2, 0, - PA_CHANNEL_POSITION_MONO, 2, 0, - PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, 3, 0, - PA_CHANNEL_POSITION_FRONT_RIGHT, 4, 0, - PA_CHANNEL_POSITION_SIDE_LEFT, 0, 1, - PA_CHANNEL_POSITION_SIDE_RIGHT, 4, 1, - PA_CHANNEL_POSITION_REAR_LEFT, 0, 2, - PA_CHANNEL_POSITION_REAR_CENTER, 2, 2, - PA_CHANNEL_POSITION_REAR_RIGHT, 4, 2, - PA_CHANNEL_POSITION_LFE, 3, 2 - }; - - QLayoutItem* w; - while ((w = placementGrid->takeAt(0))) { - if (w->widget() != m_icon) { - if (w->widget()) - delete w->widget(); - delete w; - } - } - placementGrid->addWidget(m_icon, 1, 2, Qt::AlignCenter); - int idx = deviceBox->currentIndex(); - if (idx < 0) - return; - - qint64 index = deviceBox->itemData(idx).toInt(); - deviceInfo& sink_info = getDeviceInfo(index); - - if (index < 0) { - playbackOrCaptureStack->setCurrentIndex(1); - m_VUTimer->start(); - return; - } - - playbackOrCaptureStack->setCurrentIndex(0); - m_VUTimer->stop(); - - for (int i = 0; i < 36; i += 3) { - pa_channel_position_t pos = (pa_channel_position_t)position_table[i]; - // Check to see if we have this item in our current channel map. - bool have = false; - for (uint32_t j = 0; j < sink_info.channelMap.channels; ++j) { - if (sink_info.channelMap.map[j] == pos) { - have = true; - break; - } - } - if (!have) { - continue; - } - - KPushButton *btn = new TestSpeakerWidget(pos, m_Canberra, this); - placementGrid->addWidget(btn, position_table[i+2], position_table[i+1], Qt::AlignCenter); - } -} - -void AudioSetup::_createMonitorStreamForSource(uint32_t source_idx) -{ - if (m_VUStream) { - pa_stream_disconnect(m_VUStream); - m_VUStream = NULL; - } - - char t[16]; - pa_buffer_attr attr; - pa_sample_spec ss; - - ss.channels = 1; - ss.format = PA_SAMPLE_FLOAT32; - ss.rate = 25; - - memset(&attr, 0, sizeof(attr)); - attr.fragsize = sizeof(float); - attr.maxlength = static_cast(-1); - - snprintf(t, sizeof(t), "%u", source_idx); - - m_VUStream = pa_stream_new(s_context, "Peak detect", &ss, NULL); - if (!m_VUStream) { - kDebug() << "Failed to create monitoring stream"; - return; - } - - pa_stream_set_read_callback(m_VUStream, read_callback, this); - pa_stream_set_suspended_callback(m_VUStream, suspended_callback, this); - - if (pa_stream_connect_record(m_VUStream, t, &attr, (pa_stream_flags_t) (PA_STREAM_DONT_MOVE|PA_STREAM_PEAK_DETECT|PA_STREAM_ADJUST_LATENCY)) < 0) { - kDebug() << "Failed to connect monitoring stream"; - pa_stream_unref(m_VUStream); - m_VUStream = NULL; - } -} - -quint32 AudioSetup::getCurrentSinkIndex() -{ - int idx = deviceBox->currentIndex(); - if (idx < 0) - return PA_INVALID_INDEX; - - qint64 index = deviceBox->itemData(idx).toInt(); - if (index >= 0) - return static_cast(index); - - return PA_INVALID_INDEX; -} - -QDebug operator<<(QDebug dbg, const pa_context_state_t &state) -{ - QString name; - switch (state) { - case PA_CONTEXT_UNCONNECTED: name = QLatin1String("Unconnected"); - case PA_CONTEXT_CONNECTING: name = QLatin1String("Connecting"); - case PA_CONTEXT_AUTHORIZING: name = QLatin1String("Authorizing"); - case PA_CONTEXT_SETTING_NAME: name = QLatin1String("Setting Name"); - case PA_CONTEXT_READY: name = QLatin1String("Ready"); - case PA_CONTEXT_FAILED: name = QLatin1String("Failed"); - case PA_CONTEXT_TERMINATED: name = QLatin1String("Terminated"); - } - - if (name.isEmpty()) - name = QString("Unknown state(%0)").arg(state); - - dbg.nospace() << name; - return dbg; -} - -#include "moc_audiosetup.cpp" diff --git a/phonon/kcm/audiosetup.h b/phonon/kcm/audiosetup.h deleted file mode 100644 index 7c87099d..00000000 --- a/phonon/kcm/audiosetup.h +++ /dev/null @@ -1,99 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2010 Colin Guthrie - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 - as published by the Free Software Foundation. - - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - -*/ - -#ifndef PHONON_AUDIOSETUP_H -#define PHONON_AUDIOSETUP_H - -#include -#include - -#include "ui_audiosetup.h" -#include - -class QTimer; - -struct pa_glib_mainloop; - -typedef struct { - quint32 index; - QString name; - QString icon; - QMap > profiles; - QString activeProfile; -} cardInfo; - -typedef struct { - quint32 index; - quint32 cardIndex; - QString name; - QString icon; - pa_channel_map channelMap; - QMap > ports; - QString activePort; -} deviceInfo; - -class AudioSetup : public QWidget, private Ui::AudioSetup -{ - Q_OBJECT - - public: - explicit AudioSetup(QWidget *parent = 0); - ~AudioSetup(); - - void load(); - void save(); - void defaults(); - uint32_t getCurrentSinkIndex(); - void updateCard(const pa_card_info*); - void removeCard(uint32_t idx); - void updateSink(const pa_sink_info*); - void removeSink(uint32_t idx); - void updateSource(const pa_source_info*); - void removeSource(uint32_t idx); - void updateFromPulse(); - void updateIndependantDevices(); - void updateVUMeter(int vol); - - public Q_SLOTS: - void cardChanged(); - void profileChanged(); - void deviceChanged(); - void portChanged(); - void reallyUpdateVUMeter(); - bool connectToDaemon(); - - Q_SIGNALS: - void changed(); - void ready(); - - private: - void _updatePlacementTester(); - void _createMonitorStreamForSource(uint32_t); - - QLabel *m_icon; - int m_OutstandingRequests; - ca_context* m_Canberra; - pa_stream* m_VUStream; - int m_VURealValue; - QTimer* m_VUTimer; -}; - -QDebug operator<<(QDebug dbg, const pa_context_state_t &state); - -#endif // PHONON_AUDIOSETUP_H diff --git a/phonon/kcm/audiosetup.ui b/phonon/kcm/audiosetup.ui deleted file mode 100644 index 51f3b76c..00000000 --- a/phonon/kcm/audiosetup.ui +++ /dev/null @@ -1,224 +0,0 @@ - - - Colin Guthrie - AudioSetup - - - - 0 - 0 - 654 - 480 - - - - - - - Hardware - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - - - - Profile - - - profileBox - - - - - - - Sound Card - - - cardBox - - - - - - - - - - Device Configuration - - - - - - - 0 - 0 - - - - - - - - Connector - - - portBox - - - - - - - - 0 - 0 - - - - - - - - Sound Device - - - deviceBox - - - - - - - - - - - 0 - 0 - - - - 1 - - - - true - - - - 0 - 0 - - - - - - - - 0 - 0 - - - - Speaker Placement and Testing - - - - - - - - - - - - - - 0 - 0 - - - - - - - true - - - - 0 - 0 - - - - - 0 - 26 - - - - Input Levels - - - - - - - 0 - 0 - - - - - 16777215 - 10 - - - - 50 - - - false - - - - - - - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
-
- - -
diff --git a/phonon/kcm/backendselection.cpp b/phonon/kcm/backendselection.cpp deleted file mode 100644 index cfab7e5f..00000000 --- a/phonon/kcm/backendselection.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004-2007 Matthias Kretz - Copyright (C) 2011 Harald Sitter - - 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 -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -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(KIcon("go-down")); - m_up->setIcon(KIcon("go-up")); - m_comment->setWordWrap(true); - - m_emptyPage = stackedWidget->addWidget(new QWidget()); - - connect(m_select, SIGNAL(itemSelectionChanged()), - SLOT(selectionChanged())); - //connect(m_website, SIGNAL(leftClickedUrl(const QString &)), - //kapp, SLOT(invokeBrowser(const QString &))); - connect(m_up, SIGNAL(clicked()), SLOT(up())); - connect(m_down, SIGNAL(clicked()), SLOT(down())); -} - -void BackendSelection::load() -{ - const KService::List offers = KServiceTypeTrader::self()->query("PhononBackend", - "Type == 'Service' and [X-KDE-PhononBackendInfo-InterfaceVersion] == 1"); - // the offers are already sorted for preference - loadServices(offers); - foreach (KCModuleProxy *proxy, m_kcms) { - if (proxy) { - proxy->load(); - } - } -} - -void BackendSelection::showBackendKcm(const KService::Ptr &backendService) -{ - const QString parentComponent = backendService->library(); - if (!m_kcms.contains(parentComponent)) { - const KService::List offers = KServiceTypeTrader::self()->query("KCModule", - QString("'%1' in [X-KDE-ParentComponents]").arg(parentComponent)); - if (offers.isEmpty()) { - m_kcms.insert(parentComponent, 0); - } else { - KCModuleProxy *proxy = new KCModuleProxy(offers.first()); - connect(proxy, SIGNAL(changed(bool)), SIGNAL(changed())); - m_kcms.insert(parentComponent, proxy); - stackedWidget->addWidget(proxy); - } - } - QWidget *w = m_kcms.value(parentComponent); - if (w) { - stackedWidget->show(); - stackedWidget->setCurrentWidget(w); - } else { - stackedWidget->hide(); - stackedWidget->setCurrentIndex(m_emptyPage); - } -} - -void BackendSelection::loadServices(const KService::List &offers) -{ - m_services.clear(); - m_select->clear(); - - KService::List::const_iterator it = offers.begin(); - const KService::List::const_iterator end = offers.end(); - for (; it != end; ++it) - { - KService::Ptr service = *it; - m_select->addItem(service->name()); - m_services[service->name()] = service; - } - m_select->setItemSelected(m_select->item(0), true); -} - -void BackendSelection::save() -{ - // save embedded KCMs - foreach (KCModuleProxy *proxy, m_kcms) { - if (proxy) { - proxy->save(); - } - } - - // save to servicetype profile - KService::List services; - unsigned int count = m_select->count(); - for (unsigned int i = 0; i < count; ++i) { - QListWidgetItem *item = m_select->item(i); - KService::Ptr service = m_services[item->text()]; - services.append(service); - } - - // get the currently used list - const KService::List offers = KServiceTypeTrader::self()->query("PhononBackend", - "Type == 'Service' and [X-KDE-PhononBackendInfo-InterfaceVersion] == 1"); - - // we have to compare the lists manually as KService::Ptr::operator== is not what we want for - // comparison - if (offers.size() == services.size()) { - bool equal = true; - for (int i = 0; i < offers.size(); ++i) { - if (offers[i]->entryPath() != services[i]->entryPath()) { - equal = false; - break; - } - } - if (equal) { - return; - } - } - - if (offers != services) { - KServiceTypeProfile::writeServiceTypeProfile("PhononBackend", services); - - // If the user changed the backend order, show a message that they need to - // log out and back in again to apply the change. This is because runtime - // backend switching was considered not worth the effort to actually - // maintain it (across backends). - m_messageWidget->animatedShow(); - } -} - -void BackendSelection::defaults() -{ - foreach (KCModuleProxy *proxy, m_kcms) { - if (proxy) { - proxy->defaults(); - } - } - - loadServices(KServiceTypeTrader::self()->defaultOffers("PhononBackend")); -} - -void BackendSelection::selectionChanged() -{ - KService::Ptr service; - 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); - service = m_services[item->text()]; - Q_ASSERT(service); - - // Have some icon other than "unknown" for backends which don't install an icon. - QPixmap iconPixmap = KIconLoader::global()->loadIcon(service->icon(), KIconLoader::NoGroup, 128, - KIconLoader::DefaultState, QStringList(), 0L, - true /* return null */); - if (iconPixmap.isNull()) - iconPixmap = KIconLoader::global()->loadIcon("preferences-desktop-sound", KIconLoader::NoGroup, 128); - - m_icon->setPixmap(iconPixmap); - m_comment->setText(service->comment()); - const QString website = service->property("X-KDE-PhononBackendInfo-Website").toString(); - m_website->setText(QString("%1").arg(website)); - connect(m_website, SIGNAL(linkActivated(QString)), SLOT(openWebsite(QString)), Qt::UniqueConnection); - m_version->setText(service->property("X-KDE-PhononBackendInfo-Version").toString()); - showBackendKcm(service); - } -} - -void BackendSelection::openWebsite(const QString &url) -{ - new KRun(KUrl(url), window()); -} - -void BackendSelection::up() -{ - QList 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 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(); - } - } -} - -#include "moc_backendselection.cpp" - -// vim: sw=4 ts=4 diff --git a/phonon/kcm/backendselection.h b/phonon/kcm/backendselection.h deleted file mode 100644 index a2a19c2e..00000000 --- a/phonon/kcm/backendselection.h +++ /dev/null @@ -1,60 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004-2007 Matthias Kretz - - 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 -#include - - -#include -class KCModuleProxy; - -class BackendSelection : public QWidget, private Ui::BackendSelection -{ - Q_OBJECT - public: - explicit BackendSelection(QWidget *parent = 0); - - 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: - void showBackendKcm(const KService::Ptr &backendService); - void loadServices(const KService::List &offers); - QHash m_services; - QHash m_kcms; - int m_emptyPage; -}; - -// vim: sw=4 ts=4 tw=80 -#endif // BACKENDSELECTION_H diff --git a/phonon/kcm/backendselection.ui b/phonon/kcm/backendselection.ui deleted file mode 100644 index 9fde543c..00000000 --- a/phonon/kcm/backendselection.ui +++ /dev/null @@ -1,221 +0,0 @@ - - - Matthias Kretz <kretz@kde.org> - BackendSelection - - - - 0 - 0 - 510 - 325 - - - - - 9 - - - 6 - - - - - 0 - - - 6 - - - - - - 0 - 0 - - - - A list of Phonon Backends found on your system. The order here determines the order Phonon will use them in. - - - A list of Phonon Backends found on your system. The order here determines the order Phonon will use them in. - - - true - - - QAbstractItemView::InternalMove - - - - - - - false - - - Prefer - - - Qt::ToolButtonTextBesideIcon - - - - - - - false - - - Defer - - - Qt::ToolButtonTextBesideIcon - - - - - - - Qt::Horizontal - - - - 81 - 20 - - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 9 - - - - - - - - Qt::AlignVCenter - - - - - - - - - - - - - - - - - Qt::AlignVCenter - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - - - - 0 - 0 - - - - - - - - - - - - - - KMessageWidget - QWidget -
KMessageWidget
- 1 -
-
- - -
diff --git a/phonon/kcm/devicepreference.cpp b/phonon/kcm/devicepreference.cpp deleted file mode 100644 index be4fc557..00000000 --- a/phonon/kcm/devicepreference.cpp +++ /dev/null @@ -1,1015 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2006-2008 Matthias Kretz - Copyright (C) 2011 Casian Andrei - - 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 "devicepreference.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "factory_p.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef METATYPE_QLIST_INT_DEFINED -#define METATYPE_QLIST_INT_DEFINED -// Want this exactly once, see phonondefs_p.h kcm/devicepreference.cpp -Q_DECLARE_METATYPE(QList) -#endif - -namespace Phonon -{ - -/* - * Lists of categories for every device type - */ -static const Category audioOutCategories[] = { - NoCategory, - NotificationCategory, - MusicCategory, - VideoCategory, - CommunicationCategory, - GameCategory, - AccessibilityCategory, -}; - -static const CaptureCategory audioCapCategories[] = { - NoCaptureCategory, - CommunicationCaptureCategory, - RecordingCaptureCategory, - ControlCaptureCategory -}; - -static const CaptureCategory videoCapCategories[] = { - NoCaptureCategory, - CommunicationCaptureCategory, - RecordingCaptureCategory, -}; - -static const int audioOutCategoriesCount = sizeof(audioOutCategories) / sizeof(Category); -static const int audioCapCategoriesCount = sizeof(audioCapCategories) / sizeof(CaptureCategory); -static const int videoCapCategoriesCount = sizeof(videoCapCategories) / sizeof(CaptureCategory); - -void operator++(Category &c) -{ - c = static_cast(1 + static_cast(c)); - //Q_ASSERT(c <= LastCategory); -} - -class CategoryItem : public QStandardItem { - public: - CategoryItem(Category cat) - : QStandardItem(), - m_cat(cat), - m_odtype(AudioOutputDeviceType) - { - if (cat == NoCategory) { - setText(i18n("Audio Playback")); - } else { - setText(categoryToString(cat)); - } - } - - CategoryItem(CaptureCategory cat, ObjectDescriptionType t = AudioCaptureDeviceType) - : QStandardItem(), - m_capcat(cat), - m_odtype(t) - { - if (cat == NoCaptureCategory) { - switch(t) { - case AudioCaptureDeviceType: - setText(i18n("Audio Recording")); - break; - case VideoCaptureDeviceType: - setText(i18n("Video Recording")); - break; - default: - setText(i18n("Invalid")); - } - } else { - setText(categoryToString(cat)); - } - } - - int type() const { return 1001; } - Category category() const { return m_cat; } - CaptureCategory captureCategory() const { return m_capcat; } - ObjectDescriptionType odtype() const { return m_odtype; } - - private: - Category m_cat; - CaptureCategory m_capcat; - ObjectDescriptionType m_odtype; -}; - -/** - * Need this to change the colors of the ListView if the Palette changed. With CSS set this won't - * change automatically - */ -void DevicePreference::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); - if (e->type() == QEvent::PaletteChange) { - deviceList->setStyleSheet(deviceList->styleSheet()); - } -} - -DevicePreference::DevicePreference(QWidget *parent) - : QWidget(parent), - m_headerModel(0, 1, 0), - m_media(NULL), m_audioOutput(NULL), m_videoWidget(NULL) -{ - setupUi(this); - - // Setup the buttons - testPlaybackButton->setIcon(KIcon("media-playback-start")); - testPlaybackButton->setEnabled(false); - testPlaybackButton->setToolTip(i18n("Test the selected device")); - deferButton->setIcon(KIcon("go-down")); - preferButton->setIcon(KIcon("go-up")); - - // Configure the device list - deviceList->setDragDropMode(QAbstractItemView::InternalMove); - deviceList->setStyleSheet(QString("QTreeView {" - "background-color: palette(base);" - "background-image: url(%1);" - "background-position: bottom left;" - "background-attachment: fixed;" - "background-repeat: no-repeat;" - "background-clip: padding;" - "}") - .arg(KStandardDirs::locate("data", "kcm_phonon/listview-background.png"))); - deviceList->setAlternatingRowColors(false); - - // The root item for the categories - QStandardItem *parentItem = m_categoryModel.invisibleRootItem(); - - // Audio Output Parent - QStandardItem *aOutputItem = new CategoryItem(NoCategory); - m_audioOutputModel[NoCategory] = new AudioOutputDeviceModel(this); - aOutputItem->setEditable(false); - aOutputItem->setToolTip(i18n("Defines the default ordering of devices which can be overridden by individual categories.")); - parentItem->appendRow(aOutputItem); - - // Audio Capture Parent - QStandardItem *aCaptureItem = new CategoryItem(NoCaptureCategory, AudioCaptureDeviceType); - m_audioCaptureModel[NoCaptureCategory] = new AudioCaptureDeviceModel(this); - aCaptureItem->setEditable(false); - aCaptureItem->setToolTip(i18n("Defines the default ordering of devices which can be overridden by individual categories.")); - parentItem->appendRow(aCaptureItem); - - // Video Capture Parent - QStandardItem *vCaptureItem = new CategoryItem(NoCaptureCategory, VideoCaptureDeviceType); - m_videoCaptureModel[NoCaptureCategory] = new VideoCaptureDeviceModel(this); - vCaptureItem->setEditable(false); - vCaptureItem->setToolTip(i18n("Defines the default ordering of devices which can be overridden by individual categories.")); - parentItem->appendRow(vCaptureItem); - - // Audio Output Children - parentItem = aOutputItem; - for (int i = 1; i < audioOutCategoriesCount; ++i) { // i == 1 to skip NoCategory - m_audioOutputModel[audioOutCategories[i]] = new AudioOutputDeviceModel(this); - QStandardItem *item = new CategoryItem(audioOutCategories[i]); - item->setEditable(false); - parentItem->appendRow(item); - } - - // Audio Capture Children - parentItem = aCaptureItem; - for (int i = 1; i < audioCapCategoriesCount; ++i) { // i == 1 to skip NoCategory - m_audioCaptureModel[audioCapCategories[i]] = new AudioCaptureDeviceModel(this); - QStandardItem *item = new CategoryItem(audioCapCategories[i], AudioCaptureDeviceType); - item->setEditable(false); - parentItem->appendRow(item); - } - - // Video Capture Children - parentItem = vCaptureItem; - for (int i = 1; i < videoCapCategoriesCount; ++i) { // i == 1 to skip NoCategory - m_videoCaptureModel[videoCapCategories[i]] = new VideoCaptureDeviceModel(this); - QStandardItem *item = new CategoryItem(videoCapCategories[i], VideoCaptureDeviceType); - item->setEditable(false); - parentItem->appendRow(item); - } - - // Configure the category tree - categoryTree->setModel(&m_categoryModel); - if (categoryTree->header()) { - categoryTree->header()->hide(); - } - categoryTree->expandAll(); - - connect(categoryTree->selectionModel(), - SIGNAL(currentChanged(const QModelIndex &,const QModelIndex &)), - SLOT(updateDeviceList())); - - // Connect all model data change signals to the changed slot - for (int i = -1; i <= LastCategory; ++i) { - connect(m_audioOutputModel[i], SIGNAL(rowsInserted(QModelIndex, int, int)), this, SIGNAL(changed())); - connect(m_audioOutputModel[i], SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SIGNAL(changed())); - connect(m_audioOutputModel[i], SIGNAL(layoutChanged()), this, SIGNAL(changed())); - connect(m_audioOutputModel[i], SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SIGNAL(changed())); - if (m_audioCaptureModel.contains(i)) { - connect(m_audioCaptureModel[i], SIGNAL(rowsInserted(QModelIndex, int, int)), this, SIGNAL(changed())); - connect(m_audioCaptureModel[i], SIGNAL(rowsRemoved(QModelIndex , int, int)), this, SIGNAL(changed())); - connect(m_audioCaptureModel[i], SIGNAL(layoutChanged()), this, SIGNAL(changed())); - connect(m_audioCaptureModel[i], SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SIGNAL(changed())); - } - if (m_videoCaptureModel.contains(i)) { - connect(m_videoCaptureModel[i], SIGNAL(rowsInserted(QModelIndex, int, int)), this, SIGNAL(changed())); - connect(m_videoCaptureModel[i], SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SIGNAL(changed())); - connect(m_videoCaptureModel[i], SIGNAL(layoutChanged()), this, SIGNAL(changed())); - connect(m_videoCaptureModel[i], SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SIGNAL(changed())); - } - } - - connect(showAdvancedDevicesCheckBox, SIGNAL(stateChanged (int)), this, SIGNAL(changed())); - - // Connect the signals from Phonon that notify changes in the device lists - connect(BackendCapabilities::notifier(), SIGNAL(availableAudioOutputDevicesChanged()), SLOT(updateAudioOutputDevices())); - connect(BackendCapabilities::notifier(), SIGNAL(availableAudioCaptureDevicesChanged()), SLOT(updateAudioCaptureDevices())); - connect(BackendCapabilities::notifier(), SIGNAL(availableVideoCaptureDevicesChanged()), SLOT(updateVideoCaptureDevices())); - connect(BackendCapabilities::notifier(), SIGNAL(capabilitiesChanged()), SLOT(updateAudioOutputDevices())); - connect(BackendCapabilities::notifier(), SIGNAL(capabilitiesChanged()), SLOT(updateAudioCaptureDevices())); - connect(BackendCapabilities::notifier(), SIGNAL(capabilitiesChanged()), SLOT(updateVideoCaptureDevices())); - - if (!categoryTree->currentIndex().isValid()) { - categoryTree->setCurrentIndex(m_categoryModel.index(0, 0).child(1, 0)); - } -} - -DevicePreference::~DevicePreference() -{ - // Ensure that the video widget is destroyed, if it remains active - delete m_videoWidget; -} - -void DevicePreference::updateDeviceList() -{ - KFadeWidgetEffect *animation = new KFadeWidgetEffect(deviceList); - - // Temporarily disconnect the device list selection model - if (deviceList->selectionModel()) { - disconnect(deviceList->selectionModel(), - SIGNAL(currentRowChanged(const QModelIndex &,const QModelIndex &)), - this, SLOT(updateButtonsEnabled())); - } - - // Get the current selected category item - QStandardItem *currentItem = m_categoryModel.itemFromIndex(categoryTree->currentIndex()); - if (currentItem && currentItem->type() == 1001) { - CategoryItem *catItem = static_cast(currentItem); - bool cap = catItem->odtype() != AudioOutputDeviceType; - const Category cat = catItem->category(); - const CaptureCategory capcat = catItem->captureCategory(); - - // Update the device list, by setting it's model to the one for the corresponding category - switch (catItem->odtype()) { - case AudioOutputDeviceType: - deviceList->setModel(m_audioOutputModel[cat]); - break; - case AudioCaptureDeviceType: - deviceList->setModel(m_audioCaptureModel[capcat]); - break; - case VideoCaptureDeviceType: - deviceList->setModel(m_videoCaptureModel[capcat]); - break; - default: ; - } - - // Update the header - if (cap ? capcat == NoCaptureCategory : cat == NoCategory) { - switch (catItem->odtype()) { - case AudioOutputDeviceType: - m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Default Audio Playback Device Preference"), Qt::DisplayRole); - break; - case AudioCaptureDeviceType: - m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Default Audio Recording Device Preference"), Qt::DisplayRole); - break; - case VideoCaptureDeviceType: - m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Default Video Recording Device Preference"), Qt::DisplayRole); - break; - default: ; - } - } else { - switch (catItem->odtype()) { - case AudioOutputDeviceType: - m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Audio Playback Device Preference for the '%1' Category", - categoryToString(cat)), Qt::DisplayRole); - break; - case AudioCaptureDeviceType: - m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Audio Recording Device Preference for the '%1' Category", - categoryToString(capcat)), Qt::DisplayRole); - break; - case VideoCaptureDeviceType: - m_headerModel.setHeaderData(0, Qt::Horizontal, i18n("Video Recording Device Preference for the '%1' Category ", - categoryToString(capcat)), Qt::DisplayRole); - break; - default: ; - } - } - } else { - // No valid category selected - m_headerModel.setHeaderData(0, Qt::Horizontal, QString(), Qt::DisplayRole); - deviceList->setModel(0); - } - - // Update the header, the buttons enabled state - deviceList->header()->setModel(&m_headerModel); - updateButtonsEnabled(); - - // Reconnect the device list selection model - if (deviceList->selectionModel()) { - connect(deviceList->selectionModel(), - SIGNAL(currentRowChanged(const QModelIndex &,const QModelIndex &)), - this, SLOT(updateButtonsEnabled())); - } - - deviceList->resizeColumnToContents(0); - animation->start(); -} - -void DevicePreference::updateAudioCaptureDevices() -{ - const QList list = availableAudioCaptureDevices(); - QHash hash; - foreach (const AudioCaptureDevice &dev, list) { - hash.insert(dev.index(), dev); - } - - for (int catIndex = 0; catIndex < audioCapCategoriesCount; ++ catIndex) { - const int i = audioCapCategories[catIndex]; - AudioCaptureDeviceModel *model = m_audioCaptureModel.value(i); - Q_ASSERT(model); - - QHash hashCopy(hash); - QList orderedList; - - if (model->rowCount() > 0) { - QList order = model->tupleIndexOrder(); - 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 AudioCaptureDevice &dev, list) { - if (hashCopy.contains(dev.index())) { - orderedList << hashCopy.take(dev.index()); - } - } - } else if (hashCopy.size() == 1) { - orderedList += hashCopy.values(); - } - - model->setModelData(orderedList); - } else { - model->setModelData(list); - } - } - - deviceList->resizeColumnToContents(0); -} - -void DevicePreference::updateVideoCaptureDevices() -{ - const QList list = availableVideoCaptureDevices(); - QHash hash; - foreach (const VideoCaptureDevice &dev, list) { - hash.insert(dev.index(), dev); - } - - for (int catIndex = 0; catIndex < videoCapCategoriesCount; ++ catIndex) { - const int i = videoCapCategories[catIndex]; - VideoCaptureDeviceModel *model = m_videoCaptureModel.value(i); - Q_ASSERT(model); - - QHash hashCopy(hash); - QList orderedList; - - if (model->rowCount() > 0) { - QList order = model->tupleIndexOrder(); - 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 VideoCaptureDevice &dev, list) { - if (hashCopy.contains(dev.index())) { - orderedList << hashCopy.take(dev.index()); - } - } - } else if (hashCopy.size() == 1) { - orderedList += hashCopy.values(); - } - - model->setModelData(orderedList); - } else { - model->setModelData(list); - } - } - - deviceList->resizeColumnToContents(0); -} - -void DevicePreference::updateAudioOutputDevices() -{ - const QList list = availableAudioOutputDevices(); - QHash hash; - foreach (const AudioOutputDevice &dev, list) { - hash.insert(dev.index(), dev); - } - - for (int catIndex = 0; catIndex < audioOutCategoriesCount; ++ catIndex) { - const int i = audioOutCategories[catIndex]; - AudioOutputDeviceModel *model = m_audioOutputModel.value(i); - Q_ASSERT(model); - - QHash hashCopy(hash); - QList orderedList; - - if (model->rowCount() > 0) { - QList order = model->tupleIndexOrder(); - 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 AudioOutputDevice &dev, list) { - if (hashCopy.contains(dev.index())) { - orderedList << hashCopy.take(dev.index()); - } - } - } else if (hashCopy.size() == 1) { - orderedList += hashCopy.values(); - } - - model->setModelData(orderedList); - } else { - model->setModelData(list); - } - } - - deviceList->resizeColumnToContents(0); -} - -QList DevicePreference::availableAudioOutputDevices() const -{ - return BackendCapabilities::availableAudioOutputDevices(); -} - -QList DevicePreference::availableAudioCaptureDevices() const -{ -#ifndef PHONON_NO_AUDIOCAPTURE - return BackendCapabilities::availableAudioCaptureDevices(); -#else - return QList(); -#endif -} - -QList DevicePreference::availableVideoCaptureDevices() const -{ -#ifndef PHONON_NO_VIDEOCAPTURE - return BackendCapabilities::availableVideoCaptureDevices(); -#else - return QList(); -#endif -} - -void DevicePreference::load() -{ - showAdvancedDevicesCheckBox->setChecked(!GlobalConfig().hideAdvancedDevices()); - loadCategoryDevices(); -} - -void DevicePreference::loadCategoryDevices() -{ - // "Load" the settings from the backend. - for (int i = 0; i < audioOutCategoriesCount; ++ i) { - const Category cat = audioOutCategories[i]; - QList list; - const QList deviceIndexes = GlobalConfig().audioOutputDeviceListFor(cat); - foreach (int i, deviceIndexes) { - list.append(AudioOutputDevice::fromIndex(i)); - } - - m_audioOutputModel[cat]->setModelData(list); - } - -#ifndef PHONON_NO_AUDIOCAPTURE - for (int i = 0; i < audioCapCategoriesCount; ++ i) { - const CaptureCategory cat = audioCapCategories[i]; - QList list; - const QList deviceIndexes = GlobalConfig().audioCaptureDeviceListFor(cat); - foreach (int i, deviceIndexes) { - list.append(AudioCaptureDevice::fromIndex(i)); - } - - m_audioCaptureModel[cat]->setModelData(list); - } -#endif - -#ifndef PHONON_NO_VIDEOCAPTURE - for (int i = 0; i < videoCapCategoriesCount; ++ i) { - const CaptureCategory cat = videoCapCategories[i]; - QList list; - const QList deviceIndexes = GlobalConfig().videoCaptureDeviceListFor(cat); - foreach (int i, deviceIndexes) { - list.append(VideoCaptureDevice::fromIndex(i)); - } - - m_videoCaptureModel[cat]->setModelData(list); - } -#endif - - deviceList->resizeColumnToContents(0); -} - -void DevicePreference::save() -{ - for (int i = 0; i < audioOutCategoriesCount; ++i) { - const Category cat = audioOutCategories[i]; - Q_ASSERT(m_audioOutputModel.value(cat)); - const QList order = m_audioOutputModel.value(cat)->tupleIndexOrder(); - GlobalConfig().setAudioOutputDeviceListFor(cat, order); - } - -#ifndef PHONON_NO_AUDIOCAPTURE - for (int i = 0; i < audioCapCategoriesCount; ++i) { - const CaptureCategory cat = audioCapCategories[i]; - Q_ASSERT(m_audioCaptureModel.value(cat)); - const QList order = m_audioCaptureModel.value(cat)->tupleIndexOrder(); - GlobalConfig().setAudioCaptureDeviceListFor(cat, order); - } -#endif - -#ifndef PHONON_NO_VIDEOCAPTURE - for (int i = 0; i < videoCapCategoriesCount; ++i) { - const CaptureCategory cat = videoCapCategories[i]; - Q_ASSERT(m_videoCaptureModel.value(cat)); - const QList order = m_videoCaptureModel.value(cat)->tupleIndexOrder(); - GlobalConfig().setVideoCaptureDeviceListFor(cat, order); - } -#endif -} - -void DevicePreference::defaults() -{ - { - const QList list = availableAudioOutputDevices(); - for (int i = 0; i < audioOutCategoriesCount; ++i) { - m_audioOutputModel[audioOutCategories[i]]->setModelData(list); - } - } - { - const QList list = availableAudioCaptureDevices(); - for (int i = 0; i < audioCapCategoriesCount; ++i) { - m_audioCaptureModel[audioCapCategories[i]]->setModelData(list); - } - } - { - const QList list = availableVideoCaptureDevices(); - for (int i = 0; i < videoCapCategoriesCount; ++i) { - m_videoCaptureModel[videoCapCategories[i]]->setModelData(list); - } - } - - /* - * Save this list (that contains even hidden devices) to GlobaConfig, and then - * load them back. All devices that should be hidden will be hidden - */ - save(); - loadCategoryDevices(); - - deviceList->resizeColumnToContents(0); -} - -void DevicePreference::pulseAudioEnabled() -{ - showAdvancedDevicesContainer->removeItem(showAdvancedDevicesSpacer); - delete showAdvancedDevicesSpacer; - showAdvancedDevicesCheckBox->setVisible(false); -} - -void DevicePreference::on_preferButton_clicked() -{ - QAbstractItemModel *model = deviceList->model(); - { - AudioOutputDeviceModel *deviceModel = qobject_cast(model); - if (deviceModel) { - deviceModel->moveUp(deviceList->currentIndex()); - updateButtonsEnabled(); - emit changed(); - } - } - { - AudioCaptureDeviceModel *deviceModel = qobject_cast(model); - if (deviceModel) { - deviceModel->moveUp(deviceList->currentIndex()); - updateButtonsEnabled(); - emit changed(); - } - } - { - VideoCaptureDeviceModel *deviceModel = qobject_cast(model); - if (deviceModel) { - deviceModel->moveUp(deviceList->currentIndex()); - updateButtonsEnabled(); - emit changed(); - } - } -} - -void DevicePreference::on_deferButton_clicked() -{ - QAbstractItemModel *model = deviceList->model(); - { - AudioOutputDeviceModel *deviceModel = qobject_cast(model); - if (deviceModel) { - deviceModel->moveDown(deviceList->currentIndex()); - updateButtonsEnabled(); - emit changed(); - } - } - { - AudioCaptureDeviceModel *deviceModel = qobject_cast(model); - if (deviceModel) { - deviceModel->moveDown(deviceList->currentIndex()); - updateButtonsEnabled(); - emit changed(); - } - } - { - VideoCaptureDeviceModel *deviceModel = qobject_cast(model); - if (deviceModel) { - deviceModel->moveDown(deviceList->currentIndex()); - updateButtonsEnabled(); - emit changed(); - } - } -} - - -DevicePreference::DeviceType DevicePreference::shownModelType() const -{ - const QStandardItem *item = m_categoryModel.itemFromIndex(categoryTree->currentIndex()); - if (!item) - return dtInvalidDevice; - Q_ASSERT(item->type() == 1001); - - const CategoryItem *catItem = static_cast(item); - if (!catItem) - return dtInvalidDevice; - - switch (catItem->odtype()) { - case AudioOutputDeviceType: - return dtAudioOutput; - case AudioCaptureDeviceType: - return dtAudioCapture; - case VideoCaptureDeviceType: - return dtVideoCapture; - default: - return dtInvalidDevice; - } -} - -void DevicePreference::on_applyPreferencesButton_clicked() -{ - const QModelIndex idx = categoryTree->currentIndex(); - const QStandardItem *item = m_categoryModel.itemFromIndex(idx); - if (!item) - return; - Q_ASSERT(item->type() == 1001); - - const CategoryItem *catItem = static_cast(item); - - QList aoPreferredList; - QList acPreferredList; - QList vcPreferredList; - const Category *categoryList = NULL; - const CaptureCategory *capCategoryList = NULL; - int categoryListCount; - int catIndex; - bool cap = false; - - switch (catItem->odtype()) { - case AudioOutputDeviceType: - aoPreferredList = m_audioOutputModel.value(catItem->category())->modelData(); - categoryList = audioOutCategories; - categoryListCount = audioOutCategoriesCount; - cap = false; - break; - - case AudioCaptureDeviceType: - acPreferredList = m_audioCaptureModel.value(catItem->captureCategory())->modelData(); - capCategoryList = audioCapCategories; - categoryListCount = audioCapCategoriesCount; - cap = true; - break; - - case VideoCaptureDeviceType: - vcPreferredList = m_videoCaptureModel.value(catItem->captureCategory())->modelData(); - capCategoryList = videoCapCategories; - categoryListCount = videoCapCategoriesCount; - cap = true; - break; - - default: - return; - } - - QPointer dialog = new KDialog(this); - dialog->setButtons(KDialog::Ok | KDialog::Cancel); - dialog->setDefaultButton(KDialog::Ok); - - QWidget *mainWidget = new QWidget(dialog); - dialog->setMainWidget(mainWidget); - - QLabel *label = new QLabel(mainWidget); - label->setText(i18n("Apply the currently shown device preference list to the following other " - "audio playback categories:")); - label->setWordWrap(true); - - KListWidget *list = new KListWidget(mainWidget); - - for (catIndex = 0; catIndex < categoryListCount; catIndex ++) { - Category cat = cap ? NoCategory : categoryList[catIndex]; - CaptureCategory capcat = cap ? capCategoryList[catIndex] : NoCaptureCategory; - - QListWidgetItem *item = NULL; - if (cap) { - if (capcat == NoCaptureCategory) { - item = new QListWidgetItem(i18n("Default/Unspecified Category"), list, capcat); - } else { - item = new QListWidgetItem(categoryToString(capcat), list, capcat); - } - } else { - if (cat == NoCategory) { - item = new QListWidgetItem(i18n("Default/Unspecified Category"), list, cat); - } else { - item = new QListWidgetItem(categoryToString(cat), list, cat); - } - } - - item->setCheckState(Qt::Checked); - if (cat == catItem->category()) { - item->setFlags(item->flags() & ~Qt::ItemIsEnabled); - } - } - - QVBoxLayout *layout = new QVBoxLayout(mainWidget); - layout->setMargin(0); - layout->addWidget(label); - layout->addWidget(list); - - switch (dialog->exec()) { - case QDialog::Accepted: - for (catIndex = 0; catIndex < categoryListCount; catIndex ++) { - Category cat = cap ? NoCategory : categoryList[catIndex]; - CaptureCategory capcat = cap ? capCategoryList[catIndex] : NoCaptureCategory; - - if (cap ? capcat != catItem->captureCategory() : cat != catItem->category()) { - QListWidgetItem *item = list->item(catIndex); - Q_ASSERT(item->type() == cap ? (int) capcat : (int) cat); - if (item->checkState() == Qt::Checked) { - switch (catItem->odtype()) { - case AudioOutputDeviceType: - m_audioOutputModel.value(cat)->setModelData(aoPreferredList); - break; - - case AudioCaptureDeviceType: - m_audioCaptureModel.value(capcat)->setModelData(acPreferredList); - break; - - case VideoCaptureDeviceType: - m_videoCaptureModel.value(capcat)->setModelData(vcPreferredList); - break; - - default: ; - } - } - } - } - - emit changed(); - break; - - case QDialog::Rejected: - // nothing to do - break; - } - - delete dialog; -} - -void DevicePreference::on_showAdvancedDevicesCheckBox_toggled() -{ - // In order to get the right list from the backend, we need to update the settings now - // before calling availableAudio{Output,Capture}Devices() - GlobalConfig().setHideAdvancedDevices(!showAdvancedDevicesCheckBox->isChecked()); - loadCategoryDevices(); -} - -void DevicePreference::on_testPlaybackButton_toggled(bool down) -{ - if (down) { - QModelIndex idx = deviceList->currentIndex(); - if (!idx.isValid()) { - return; - } - - // Shouldn't happen, but better to be on the safe side - if (m_testingType != dtInvalidDevice) { - delete m_media; - m_media = NULL; - delete m_audioOutput; - m_audioOutput = NULL; - delete m_videoWidget; - m_videoWidget = NULL; - } - - // Setup the Phonon objects according to the testing type - m_testingType = shownModelType(); - switch (m_testingType) { - case dtAudioOutput: { - // Create an audio output with the selected device - m_media = new MediaObject(this); - const AudioOutputDeviceModel *model = static_cast(idx.model()); - const AudioOutputDevice &device = model->modelData(idx); - m_audioOutput = new AudioOutput(this); - if (!m_audioOutput->setOutputDevice(device)) { - KMessageBox::error(this, i18n("Failed to set the selected audio output device")); - break; - } - - // Just to be very sure that nothing messes our test sound up - m_audioOutput->setVolume(1.0); - m_audioOutput->setMuted(false); - - createPath(m_media, m_audioOutput); - - m_media->setCurrentSource(KUrl(KStandardDirs::locate("sound", "KDE-Sys-Log-In.ogg"))); - connect(m_media, SIGNAL(finished()), testPlaybackButton, SLOT(toggle())); - - break; - } - -#ifndef PHONON_NO_AUDIOCAPTURE - case dtAudioCapture: { - // Create a media object and an audio output - m_media = new MediaObject(this); - m_audioOutput = new AudioOutput(NoCategory, this); - - // Just to be very sure that nothing messes our test sound up - m_audioOutput->setVolume(1.0); - m_audioOutput->setMuted(false); - - // Try to create a path - if (!createPath(m_media, m_audioOutput).isValid()) { - KMessageBox::error(this, i18n("Your backend may not support audio recording")); - break; - } - - // Determine the selected device - const AudioCaptureDeviceModel *model = static_cast(idx.model()); - const AudioCaptureDevice &device = model->modelData(idx); - m_media->setCurrentSource(device); - - break; - } -#endif - -#ifndef PHONON_NO_VIDEOCAPTURE - case dtVideoCapture: { - // Create a media object and a video output - m_media = new MediaObject(this); - m_videoWidget = new VideoWidget(NULL); - - // Try to create a path - if (!createPath(m_media, m_videoWidget).isValid()) { - KMessageBox::error(this, i18n("Your backend may not support video recording")); - break; - } - - // Determine the selected device - const VideoCaptureDeviceModel *model = static_cast(idx.model()); - const VideoCaptureDevice &device = model->modelData(idx); - m_media->setCurrentSource(device); - - // Set up the testing video widget - m_videoWidget->setWindowTitle(i18n("Testing %1", device.name())); - m_videoWidget->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint); - if (device.property("icon").canConvert(QVariant::String)) - m_videoWidget->setWindowIcon(KIcon(device.property("icon").toString())); - m_videoWidget->move(QCursor::pos() - QPoint(250, 295)); - m_videoWidget->resize(320, 240); - m_videoWidget->show(); - - break; - } -#endif - - default: - return; - } - - m_media->play(); - } else { - // Uninitialize the Phonon objects according to the testing type - switch (m_testingType) { - case dtAudioOutput: - disconnect(m_media, SIGNAL(finished()), testPlaybackButton, SLOT(toggle())); - delete m_media; - delete m_audioOutput; - break; - - case dtAudioCapture: - delete m_media; - delete m_audioOutput; - break; - - case dtVideoCapture: - delete m_media; - delete m_videoWidget; - break; - - default: - return; - } - - m_media = NULL; - m_videoWidget = NULL; - m_audioOutput = NULL; - m_testingType = dtInvalidDevice; - } -} - -void DevicePreference::updateButtonsEnabled() -{ - if (deviceList->model()) { - QModelIndex idx = deviceList->currentIndex(); - preferButton->setEnabled(idx.isValid() && idx.row() > 0); - deferButton->setEnabled(idx.isValid() && idx.row() < deviceList->model()->rowCount() - 1); - testPlaybackButton->setEnabled(idx.isValid() && (idx.flags() & Qt::ItemIsEnabled)); - } else { - preferButton->setEnabled(false); - deferButton->setEnabled(false); - testPlaybackButton->setEnabled(false); - } -} - -} // Phonon namespace - -#include "moc_devicepreference.cpp" -// vim: sw=4 ts=4 diff --git a/phonon/kcm/devicepreference.h b/phonon/kcm/devicepreference.h deleted file mode 100644 index 6818363c..00000000 --- a/phonon/kcm/devicepreference.h +++ /dev/null @@ -1,95 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2006-2008 Matthias Kretz - Copyright (C) 2011 Casian Andrei - - 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 DEVICEPREFERENCE_H_STUPID_UIC -#define DEVICEPREFERENCE_H_STUPID_UIC - -#include "ui_devicepreference.h" -#include -#include -#include -#include -#include - -namespace Phonon -{ -class MediaObject; -class AudioOutput; -class VideoWidget; - -class DevicePreference : public QWidget, private Ui::DevicePreference -{ - Q_OBJECT - public: - explicit DevicePreference(QWidget *parent = 0); - virtual ~DevicePreference(); - - void load(); - void save(); - void defaults(); - void pulseAudioEnabled(); - - Q_SIGNALS: - void changed(); - - protected: - void changeEvent(QEvent *); - - private Q_SLOTS: - void on_preferButton_clicked(); - void on_deferButton_clicked(); - void on_showAdvancedDevicesCheckBox_toggled(); - void on_applyPreferencesButton_clicked(); - void on_testPlaybackButton_toggled(bool down); - void updateButtonsEnabled(); - void updateDeviceList(); - void updateAudioOutputDevices(); - void updateAudioCaptureDevices(); - void updateVideoCaptureDevices(); - - private: - enum DeviceType {dtInvalidDevice, dtAudioOutput, dtAudioCapture, dtVideoCapture}; - - private: - template void removeDevice(const ObjectDescription &deviceToRemove, - QMap *> *modelMap); - void loadCategoryDevices(); - QList availableAudioOutputDevices() const; - QList availableAudioCaptureDevices() const; - QList availableVideoCaptureDevices() const; - DeviceType shownModelType() const; - - private: - QMap m_audioOutputModel; - QMap m_audioCaptureModel; - QMap m_videoCaptureModel; - QStandardItemModel m_categoryModel; - QStandardItemModel m_headerModel; - DeviceType m_testingType; - - MediaObject *m_media; - AudioOutput *m_audioOutput; - VideoWidget *m_videoWidget; -}; - -} // namespace Phonon - -#endif // DEVICEPREFERENCE_H_STUPID_UIC diff --git a/phonon/kcm/devicepreference.ui b/phonon/kcm/devicepreference.ui deleted file mode 100644 index c70a7a1d..00000000 --- a/phonon/kcm/devicepreference.ui +++ /dev/null @@ -1,222 +0,0 @@ - - - Matthias Kretz <kretz@kde.org> - DevicePreference - - - - 0 - 0 - 600 - 400 - - - - - - - - - - 0 - 0 - - - - Qt::CustomContextMenu - - - Various categories of media use cases. For each category, you may choose what device you prefer to be used by the Phonon applications. - - - Various categories of media use cases. For each category, you may choose what device you prefer to be used by the Phonon applications. - - - false - - - - - - - 0 - - - - - Show advanced devices - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 0 - 20 - - - - - - - - - - 0 - - - - - Use the currently shown device list for more categories. - - - Use the currently shown device list for more categories. - - - Apply Device List To... - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 0 - 20 - - - - - - - - - - - - true - - - Devices found on your system, suitable for the selected category. Choose the device that you wish to be used by the applications. - - - The order determines the preference of the devices. If for some reason the first device cannot be used Phonon will try to use the second, and so on. - - - Qt::ScrollBarAsNeeded - - - true - - - QAbstractItemView::InternalMove - - - QAbstractItemView::SelectRows - - - - 32 - 32 - - - - Qt::ElideNone - - - QAbstractItemView::ScrollPerPixel - - - QAbstractItemView::ScrollPerPixel - - - false - - - false - - - - - - - - - Qt::Horizontal - - - - 16 - 29 - - - - - - - - Test - - - true - - - Qt::ToolButtonTextBesideIcon - - - - - - - false - - - prefer the selected device - - - Prefer - - - Qt::ToolButtonTextBesideIcon - - - - - - - false - - - no preference for the selected device - - - Defer - - - Qt::ToolButtonTextBesideIcon - - - - - - - - - kdialog.h - - - - diff --git a/phonon/kcm/factory_p.h b/phonon/kcm/factory_p.h deleted file mode 100644 index 106bd396..00000000 --- a/phonon/kcm/factory_p.h +++ /dev/null @@ -1,197 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2004-2007 Matthias Kretz - - 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_FACTORY_P_H -#define PHONON_FACTORY_P_H - -#include - -#include -#include - -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - - -namespace Phonon -{ - class PlatformPlugin; - class MediaNodePrivate; - -/** - * \internal - * \brief Factory to access the preferred Backend. - * - * This class is used internally to get the backend's implementation. - * It keeps track of the objects that were created. When a - * request for a backend change comes, it asks all frontend objects to delete - * their backend objects and then checks whether they were all deleted. Only - * then the old backend is unloaded and the new backend is loaded. - * - * \author Matthias Kretz - */ -namespace Factory -{ - /** - * Emits signals for Phonon::Factory. - */ - class Sender : public QObject - { - Q_OBJECT - Q_SIGNALS: - /** - * Emitted after the backend has successfully been changed. - */ - void backendChanged(); - - /** - * \copydoc BackendCapabilities::Notifier::availableAudioOutputDevicesChanged - */ - void availableAudioOutputDevicesChanged(); - }; - - /** - * Returns a pointer to the object emitting the signals. - * - * \see Sender::backendChanged() - */ - PHONON_EXPORT Sender *sender(); - - /** - * Create a new backend object for a MediaObject. - * - * \return a pointer to the MediaObject the backend provides. - */ - QObject *createMediaObject(QObject *parent = 0); - /** - * Create a new backend object for a Effect. - * - * \return a pointer to the Effect the backend provides. - */ - QObject *createEffect(int effectId, QObject *parent = 0); - /** - * Create a new backend object for a VolumeFaderEffect. - * - * \return a pointer to the VolumeFaderEffect the backend provides. - */ - QObject *createVolumeFaderEffect(QObject *parent = 0); - /** - * Create a new backend object for a AudioOutput. - * - * \return a pointer to the AudioOutput the backend provides. - */ - QObject *createAudioOutput(QObject *parent = 0); - /** - * Create a new backend object for a AudioDataOutput. - * - * \return a pointer to the AudioDataOutput the backend provides. - */ - PHONON_EXPORT QObject *createAudioDataOutput(QObject *parent = 0); - /** - * Create a new backend object for a Visualization. - * - * \return a pointer to the Visualization the backend provides. - */ - PHONON_EXPORT QObject *createVisualization(QObject *parent = 0); - /** - * Create a new backend object for a VideoDataOutput. - * - * \return a pointer to the VideoDataOutput the backend provides. - */ - PHONON_EXPORT QObject *createVideoDataOutput(QObject *parent = 0); - /** - * Create a new backend object for a VideoWidget. - * - * \return a pointer to the VideoWidget the backend provides. - */ - QObject *createVideoWidget(QObject *parent = 0); - - /** - * \return a pointer to the backend interface. - */ - PHONON_EXPORT QObject *backend(bool createWhenNull = true); - - /** - * Unique identifier for the Backend. Can be used in configuration files - * for example. - */ - QString identifier(); - - /** - * Get the name of the Backend. It's the name from the .desktop file. - */ - PHONON_EXPORT QString backendName(); - - /** - * Get the comment of the Backend. It's the comment from the .desktop file. - */ - QString backendComment(); - - /** - * Get the version of the Backend. It's the version from the .desktop file. - * - * The version is especially interesting if there are several versions - * available for binary incompatible versions of the backend's media - * framework. - */ - QString backendVersion(); - - /** - * Get the icon (name) of the Backend. It's the icon from the .desktop file. - */ - QString backendIcon(); - - /** - * Get the website of the Backend. It's the website from the .desktop file. - */ - QString backendWebsite(); - - /** - * registers the backend object - */ - PHONON_EXPORT QObject *registerQObject(QObject *o); - - bool isMimeTypeAvailable(const QString &mimeType); - - PHONON_EXPORT void registerFrontendObject(MediaNodePrivate *); - PHONON_EXPORT void deregisterFrontendObject(MediaNodePrivate *); - - PHONON_EXPORT void setBackend(QObject *); - //PHONON_EXPORT void createBackend(const QString &library, const QString &version = QString()); - - PHONON_EXPORT PlatformPlugin *platformPlugin(); - -//X It is probably better if we can get away with internal handling of -//X freeing the soundcard device when it's not needed anymore and -//X providing an IPC method to stop all MediaObjects -> free all -//X devices -//X /** -//X * \internal -//X * This is called when the application needs to free the soundcard -//X * device(s). -//X */ -//X void freeSoundcardDevices(); -} // namespace Factory -} // namespace Phonon - -QT_END_NAMESPACE -QT_END_HEADER - -#endif // PHONON_FACTORY_P_H -// vim: sw=4 ts=4 diff --git a/phonon/kcm/kcm_phonon.desktop b/phonon/kcm/kcm_phonon.desktop deleted file mode 100644 index 94a182b5..00000000 --- a/phonon/kcm/kcm_phonon.desktop +++ /dev/null @@ -1,170 +0,0 @@ -[Desktop Entry] -Exec=kcmshell4 kcm_phonon -Icon=preferences-desktop-sound -Type=Service -X-KDE-ServiceTypes=KCModule - -X-KDE-Library=kcm_phonon -X-KDE-FactoryName=kcm_phonon -X-KDE-ParentApp=kcontrol -X-KDE-System-Settings-Parent-Category=audio-and-video -X-DocPath=kcontrol/phonon/index.html - -Name=Audio and Video Settings -Name[ar]=ضبط الفيديو والصوت -Name[bg]=Настройки на звук и видео -Name[bs]=Postavka zvuka i videa -Name[ca]=Configuració de l'àudio i del vídeo -Name[ca@valencia]=Configuració de l'àudio i del vídeo -Name[cs]=Nastavení zvuku a videa -Name[da]=Lyd- og videoindstillinger -Name[de]=Audio- und Videoeinstellungen -Name[el]=Ρυθμίσεις ήχου και βίντεο -Name[en_GB]=Audio and Video Settings -Name[es]=Preferencias de audio y vídeo -Name[et]=Heli- ja videoseadistused -Name[eu]=Audio eta bideo ezarpenak -Name[fa]=تنظیمات صوتی و ویدیویی -Name[fi]=Ääni- ja videoasetukset -Name[fr]=Configuration du son et de la vidéo -Name[gl]=Configuración do son e vídeo -Name[hi]=आवाज तथा वीडियो सेटिंग -Name[hu]=Hang- és videóbeállítások -Name[ia]=Preferentias de Audio e Video -Name[id]=Pengaturan Audio dan Video -Name[is]=Stillingar hljóð- og myndmerkja -Name[it]=Impostazioni audio e video -Name[ja]=音と映像の設定 -Name[kk]=Аудио мен Видео баптауы -Name[ko]=오디오 및 비디오 설정 -Name[lt]=Audio ir Video nustatymai -Name[nb]=Lyd- og videoinnstillinger -Name[nds]=Video- un Klang-Instellen -Name[nl]=Audio- en video-instellingen -Name[nn]=Lyd- og filminnstillingar -Name[pa]=ਆਡੀਓ ਅਤੇ ਵਿਡੀਓ ਸੈਟਿੰਗ -Name[pl]=Ustawienia dźwięku i obrazu -Name[pt]=Configuração do Áudio e Vídeo -Name[pt_BR]=Configurações de áudio e vídeo -Name[ro]=Configurări audio și video -Name[ru]=Настройка видео и аудио -Name[sk]=Nastavenia zvuku a videa -Name[sl]=Nastavitve zvoka in videa -Name[sr]=Аудио и видео поставке -Name[sr@ijekavian]=Аудио и видео поставке -Name[sr@ijekavianlatin]=Audio i video postavke -Name[sr@latin]=Audio i video postavke -Name[sv]=Ljud- och videoinställningar -Name[tr]=Ses ve Video Ayarları -Name[ug]=ئۈن ۋە سىن تەڭشەكلىرى -Name[uk]=Параметри звуку та відео -Name[wa]=Apontiaedjes odio et videyo -Name[x-test]=xxAudio and Video Settingsxx -Name[zh_CN]=音频和视频设置 -Name[zh_TW]=音效與影像設定 -Comment=Settings for the Phonon multimedia framework -Comment[ar]=ضبط إطار وسائط متعدد فنون -Comment[bg]=Настройки на мултимедийната среда Phonon -Comment[bs]=Postavke za Phonon multimedijalno okruženje -Comment[ca]=Arranjament per l'entorn de treball multimèdia Phonon -Comment[ca@valencia]=Arranjament per l'entorn de treball multimèdia Phonon -Comment[cs]=Nastavení pro multimediální framework Phonon -Comment[da]=Indstilling af multimedieframeworket Phonon -Comment[de]=Einstellungen für das Phonon-Multimedia-Framework -Comment[el]=Ρυθμίσεις για το πλαίσιο εργασίας πολυμέσων Phonon -Comment[en_GB]=Settings for the Phonon multimedia framework -Comment[es]=Preferencias para la infraestructura multimedia Phonon -Comment[et]=Phononi multimeediaraamistiku seadistused -Comment[eu]=Phonon multimedia azpiegituraren ezarpenak -Comment[fi]=Phonon-multimediakehyksen asetukset -Comment[fr]=Configuration de l'ensemble multimédia Phonon -Comment[gl]=Configuración do framework multimedia de Phonon -Comment[hu]=A Phonon multimédia keretrendszer beállításai -Comment[ia]=Preferentias pro le schema de multimedia de Phonon -Comment[id]=Pengaturan kerangka kerja multimedia Phonon -Comment[is]=Stillingar Phonon margmiðlunarkerfisins -Comment[it]=Impostazioni dell'infrastruttura multimediale Phonon -Comment[kk]=Phonon мультимедиа құрылым баптауы -Comment[ko]=Phonon 멀티미디어 프레임워크 설정 -Comment[nb]=Innstillinger for Phonon multimedia-rammeverk -Comment[nds]=Instellen för dat Multimediarahmenwark Phonon -Comment[nl]=Instellingen voor het Phonon multimedia-framework -Comment[nn]=Innstillingar for Phonon multimedia-rammeverk -Comment[pa]=ਫਨੋਨ ਮਲਟੀਮੀਡਿਆ ਫਰੇਮਵਰਕ ਲਈ ਸੈਟਿੰਗ -Comment[pl]=Ustawienia modułu Phonon -Comment[pt]=Configuração da plataforma multimédia do Phonon -Comment[pt_BR]=Configurações da plataforma multimídia Phonon -Comment[ro]=Configurări pentru platforma multimedia Phonon -Comment[ru]=Настройка мультимедийной платформы Phonon -Comment[sk]=Nastavenia pre multimediálny framework Phonon -Comment[sl]=Nastavitve predstavnostnega ogrodja Phonon -Comment[sr]=Поставке за мултимедијски радни оквир Фонон -Comment[sr@ijekavian]=Поставке за мултимедијски радни оквир Фонон -Comment[sr@ijekavianlatin]=Postavke za multimedijski radni okvir Phonon -Comment[sr@latin]=Postavke za multimedijski radni okvir Phonon -Comment[sv]=Inställningar av Phonon multimediaramverk -Comment[tr]=Phonon çoklu ortam çalışma çerçevesi için ayarlar -Comment[ug]=فونون(Phonon) كۆپ ۋاسىتە قۇرۇلمىسىنىڭ تەڭشەكلىرى -Comment[uk]=Параметри роботи мультимедійної оболонки Phonon -Comment[wa]=Apontiaedjes po l' evironmint multimedia Phonon -Comment[x-test]=xxSettings for the Phonon multimedia frameworkxx -Comment[zh_CN]=Phonen 多媒体框架的设置 -Comment[zh_TW]=Phonon 多媒體框架的設定 -X-KDE-Keywords=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine -X-KDE-Keywords[ar]=صوت,فنون,سمعي,فيديو,خَرْج,جهاز,تنبه,موسيقى,تواصل,وسائط,إن إم إم,عزف,Xine -X-KDE-Keywords[bg]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,Звук,Видео,Изход,Устройство,Уведомление,Музика,Общуване,Медия -X-KDE-Keywords[bn]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine -X-KDE-Keywords[bs]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,zvuk,izlaz,uređaj,informacija,muzika,komunikacija,mediji -X-KDE-Keywords[ca]=So,Phonon,Àudio,Vídeo,Sortida,Dispositiu,Notificació,Música,Comunicació,Suport,NMM,GStreamer,Xine -X-KDE-Keywords[ca@valencia]=So,Phonon,Àudio,Vídeo,Eixida,Dispositiu,Notificació,Música,Comunicació,Suport,NMM,GStreamer,Xine -X-KDE-Keywords[cs]=Zvuk,Phonon,Audio,Video,Výstup,Zařízení,Upozornění,Hudba,Komunikace,Média,NMM,GStreamer,Xine -X-KDE-Keywords[da]=Lyd,Phonon,Audio,Video,Output,Enhed,Bekendtgørelse,Musik,Kommunikation,Medie,NMM,GStreamer,Xine,VLC -X-KDE-Keywords[de]=Klänge,Sound,Phonon,Audio,Video,Ausgabe,Gerät,Benachrichtigung,Notification,Musik,Kommunikation,Media,NMM,GStreamer,Xine -X-KDE-Keywords[el]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine -X-KDE-Keywords[en_GB]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine -X-KDE-Keywords[eo]=Sono,Phonon,Sono,Video,Eligo,Aparato,Atentigo,Muziko,Komunikado,Aŭdvido,NMM,GStreamer,Xine -X-KDE-Keywords[es]=Sonido,Phonom,Audio,Video,Salida,Dispositivo,Notificación,Música,Comunicación,Media,NMM,GStreamer,Xine -X-KDE-Keywords[et]=heli,Phonon,audio,video,väljund,seade,märguanne,muusika,suhtlemine,meedia,NMM,GStreamer,Xine -X-KDE-Keywords[eu]=Soinua,Phonon,Audioa,Bideoa,Irteera,Gailua,Jakinarazpena,Musika,Komunikazioa,Media,NMM,GStreamer,Xine -X-KDE-Keywords[fi]=Ääni,Phonon,Audio,Video,Ulostulo,Lähtö,Tuloste,Laite,Huomautukset,Huomautus,Ilmoitukset,Ilmoitus,Musiikki,Viestintä,Media,NMM,GStreamer,Xine -X-KDE-Keywords[fr]=Son, Phonon, audio, vidéo, sortie, périphérique, notification, musique, communication, média, NMM, GStreamer, Xine -X-KDE-Keywords[ga]=Fuaim,Phonon,Fís,Aschur,Gléas,Fógairt,Fógra,Ceol,Cumarsáid,Meán,Meáin,NMM,GStreamer,Xine -X-KDE-Keywords[gl]=Son,Phonon,Audio,Vídeo,Saída,Dispositivo,Notificación,Música,Comunicación,Medio,NMM,GStreamer,Xine -X-KDE-Keywords[hi]=ध्वनि, फ़ोनॉन, श्रव्य, वीडियो, आउटपुट, डिवाइस, अधिसूचना, संगीत, संचार,मीडिया, NMM, GStreamer, Xine -X-KDE-Keywords[hu]=Hang,Phonon,Hang,Videó,Kimenet,Eszköz,Értesítés,Zene,Kommunikáció,Média,NMM,GStreamer,Xine -X-KDE-Keywords[ia]=Sono,Phonon,Audio,Video,Exito,Dispositivo,Notification,Musica,Communication,Medios,NMM,GStreamer,Xine -X-KDE-Keywords[id]=Suara,Phonon,Audio,Video,Keluaran,Divais,Notifikasi,Musik,Komunikasi,Media,NMM,GStreamer,Xine -X-KDE-Keywords[is]=Hljóð,Phonon,Audio,Vídeó,Úttak,Tæki,Tilkynningar,Tónlist,Samskipti,Miðlar,NMM,GStreamer,Xine -X-KDE-Keywords[it]=suono,Phonon,audio,video,output,dispositivo,notifica,music,comunicazione,media,NMM,GStreamer,Xine -X-KDE-Keywords[ja]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine -X-KDE-Keywords[kk]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine -X-KDE-Keywords[km]=សំឡេង Phonon អូឌីយ៉ូ វីដេអូ លទ្ធផល ឧបករណ៍ ការ​ជូនដំណឹង តន្ត្រី ការ​ទាក់ទង មេឌៀ NMM GStreamer Xine -X-KDE-Keywords[ko]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,소리,오디오,비디오,동영상,출력,장치,알림,음악,접근성,미디어 -X-KDE-Keywords[lv]=skaņa,phonon,audio,video,izvade,ierīce,paziņojums,mūzika,saziņa,mēdiji,NMM,GStreamer,Xine -X-KDE-Keywords[mr]=Sound,फोनॉन,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine -X-KDE-Keywords[nb]=Lyd,Phonon,Audio,Video,Utgang,Enhet,Varsling,Musikk,Kommunikasjon,Media,NMM,GStreamer,Xine -X-KDE-Keywords[nds]=Klang,Phonon,Audio,Video,Utgaav,Reedschap,Bescheed,Musik,Kommunikatschoon,Mediendatei,NMM,GStreamer,Xine -X-KDE-Keywords[nl]=Geluid,Phonon,audio,video,uitvoer,apparaat,melding,muziek,communicatie,medium,NMM,GStreamer,Xine -X-KDE-Keywords[nn]=Lyd,Phonon,Audio,Video,Film,Utdata,Eining,Varsling,Musikk,Kommunikasjon,Media,NMM,GStreamer,Xine -X-KDE-Keywords[pa]=ਸਾਊਂਡ,ਫੋਨੋਨ,ਆਡੀਓ,ਵਿਡੀਓ,ਵੀਡਿਓ,ਆਉਟਪੁੱਟ,ਜੰਤਰ,ਨੋਟੀਫਿਕੇਸ਼ਨ,ਸੂਚਨਾ,ਸੰਗੀਤ,ਮਿਊਜ਼ਕ,ਕਮਿਊਨੀਕੇਸ਼ਨ,ਸੰਚਾਰ, ਮੀਡਿਆ,NMM,ਜੀਸਟਰੀਮਰ,ਜ਼ਾਇਨ -X-KDE-Keywords[pl]=Dźwięk,Phonon,Audio,Video,Wyjście,Urządzenie,Powiadomienia,Muzyka,Komunikacja,Multimedia,NMM,GStreamer,Xine -X-KDE-Keywords[pt]=Som,Phonon,Áudio,Vídeo,Saída,Dispositivo,Notificação,Música,Comunicações,Multimédia,NMM,GStreamer,Xine -X-KDE-Keywords[pt_BR]=Som,Phonon,Áudio,Vídeo,Saída,Dispositivo,Notificação,Música,Comunicações,Multimídia,NMM,GStreamer,Xine -X-KDE-Keywords[ro]=sunet,phonon,audio,video,ieșire,dispozitiv,notificare,muzică,comunicare,media,NMM,GStreamer,Xine -X-KDE-Keywords[ru]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,звук,аудио,видео,вывод,устройство,уведомления,музыка,связь,общение,медиа -X-KDE-Keywords[sk]=Zvuk,Phonon,Audio,Video,Output,Zariadenie,Notifikácia,Hudba,Komunikácia,Mádia,NMM,GStreamer,Xine -X-KDE-Keywords[sl]=zvok,phonon,audio,video,predvajanje,naprava,naprave,obvestila,glasba,komunikacija,igre,snemanje,predstavnost,nmm,gstreamer,xine,vlc -X-KDE-Keywords[sr]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,звук,Фонон,аудио,видео,излаз,уређај,обавештење,музика,комуникација,медија,НММ,Гстример,Ксин -X-KDE-Keywords[sr@ijekavian]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,звук,Фонон,аудио,видео,излаз,уређај,обавештење,музика,комуникација,медија,НММ,Гстример,Ксин -X-KDE-Keywords[sr@ijekavianlatin]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,zvuk,Phonon,audio,video,izlaz,uređaj,obaveštenje,muzika,komunikacija,medija,NMM,GStreamer,Xine -X-KDE-Keywords[sr@latin]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,zvuk,Phonon,audio,video,izlaz,uređaj,obaveštenje,muzika,komunikacija,medija,NMM,GStreamer,Xine -X-KDE-Keywords[sv]=Ljud,Phonon,Video,Utgång,Enhet,Underrättelse,Musik,Kommunikation,Media,NMM,GStreamer,Xine -X-KDE-Keywords[tg]=Овоз,Phonon,Аудио,Видео,Барориш,Дастгоҳ,Огоҳӣ,Мусиқӣ,Паёмнависӣ,Медиа,NMM,GStreamer,Xine -X-KDE-Keywords[tr]=Ses,Phonon,Ses,Video,Çıkış,Aygıt,Bildirim,Müzik,İletişim,Ortam,NMM,GStreamer,Xine -X-KDE-Keywords[ug]=ئاۋاز،Phonon،ئۈن،سىن،چىقىرىش،ئۈسكۈنە،ئۇقتۇرۇش،مۇزىكا،ئالاقە،ۋاسىتە،NMM،GStreamer،Xine -X-KDE-Keywords[uk]=Sound;Phonon;Audio;Video;Output;Device;Notification;Music;Communication;Media;NMM;GStreamer;Xine;звук;фонон;аудіо;відео;виведення;показ;відтворення;пристрій;сповіщення;музика;спілкування;мультимедіа -X-KDE-Keywords[vi]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,âm thanh,phim ảnh,thiết bị,thông báo,nhạc,giao tiếp, phương tiện -X-KDE-Keywords[wa]=Son,Phonon,Odio,Videyo,rexhowe,éndjin,notifiaedje,muzike,comunicåcion,media,NMM,GStreamer,Xine -X-KDE-Keywords[x-test]=xxSound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xinexx -X-KDE-Keywords[zh_CN]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine,声音,音效,视频,输出,设备,提醒,音乐,通信,媒体 -X-KDE-Keywords[zh_TW]=Sound,Phonon,Audio,Video,Output,Device,Notification,Music,Communication,Media,NMM,GStreamer,Xine diff --git a/phonon/kcm/listview-background.png b/phonon/kcm/listview-background.png deleted file mode 100644 index 33c35e5b..00000000 Binary files a/phonon/kcm/listview-background.png and /dev/null differ diff --git a/phonon/kcm/main.cpp b/phonon/kcm/main.cpp deleted file mode 100644 index e85d411b..00000000 --- a/phonon/kcm/main.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2006-2007 Matthias Kretz - Copyright (C) 2010 Colin Guthrie - - 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 "main.h" - -#include - -#include -#include -#include -#include -#include - -#include "devicepreference.h" -#include "backendselection.h" - -#ifdef HAVE_PULSEAUDIO -# include "audiosetup.h" -#endif - -K_PLUGIN_FACTORY(PhononKcmFactory, registerPlugin();) -K_EXPORT_PLUGIN(PhononKcmFactory("kcm_phonon")) - -PhononKcm::PhononKcm(QWidget *parent, const QVariantList &args) - : KCModule(PhononKcmFactory::componentData(), parent, args) -{ - KAboutData *about = new KAboutData( - "kcm_phonon", 0, ki18n("Phonon Configuration Module"), - KDE_VERSION_STRING, KLocalizedString(), KAboutData::License_GPL, - ki18n("Copyright 2006 Matthias Kretz")); - about->addAuthor(ki18n("Matthias Kretz"), KLocalizedString(), "kretz@kde.org"); - about->addAuthor(ki18n("Colin Guthrie"), KLocalizedString(), "colin@mageia.org"); - setAboutData(about); - - setLayout(new QHBoxLayout); - layout()->setMargin(0); - layout()->setSpacing(0); - - m_tabs = new KTabWidget(this); - layout()->addWidget(m_tabs); - - m_devicePreferenceWidget = new Phonon::DevicePreference(this); - m_tabs->addTab(m_devicePreferenceWidget, i18n("Device Preference")); - m_backendSelection = new BackendSelection(this); - m_tabs->addTab(m_backendSelection, i18n("Backend")); - - load(); - connect(m_backendSelection, SIGNAL(changed()), SLOT(changed())); - connect(m_devicePreferenceWidget, SIGNAL(changed()), SLOT(changed())); - - setButtons( KCModule::Default|KCModule::Apply|KCModule::Help ); - -#ifdef HAVE_PULSEAUDIO - m_speakerSetup = new AudioSetup(this); - m_speakerSetup->setVisible(false); - connect(m_speakerSetup, SIGNAL(ready()), SLOT(speakerSetupReady())); -#endif -} - -void PhononKcm::load() -{ - m_devicePreferenceWidget->load(); - m_backendSelection->load(); -} - -void PhononKcm::save() -{ - m_devicePreferenceWidget->save(); - m_backendSelection->save(); -} - -void PhononKcm::defaults() -{ - m_devicePreferenceWidget->defaults(); - m_backendSelection->defaults(); -} - -#ifdef HAVE_PULSEAUDIO -void PhononKcm::speakerSetupReady() -{ - m_tabs->insertTab(1, m_speakerSetup, i18n("Audio Hardware Setup")); - m_devicePreferenceWidget->pulseAudioEnabled(); - connect(m_speakerSetup, SIGNAL(changed()), SLOT(changed())); -} -#endif - -#include "moc_main.cpp" -// vim: ts=4 diff --git a/phonon/kcm/main.h b/phonon/kcm/main.h deleted file mode 100644 index 277adfe6..00000000 --- a/phonon/kcm/main.h +++ /dev/null @@ -1,59 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2006-2007 Matthias Kretz - - 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 MAIN_H -#define MAIN_H - -#include -namespace Phonon { -class DevicePreference; -} -class BackendSelection; - -#ifdef HAVE_PULSEAUDIO -class AudioSetup; -#endif -class KTabWidget; - -class PhononKcm : public KCModule -{ - Q_OBJECT - public: - PhononKcm(QWidget *parent, const QVariantList &); - - void load(); - void save(); - void defaults(); - -#ifdef HAVE_PULSEAUDIO - private Q_SLOTS: - void speakerSetupReady(); -#endif - - private: - KTabWidget* m_tabs; - Phonon::DevicePreference *m_devicePreferenceWidget; - BackendSelection *m_backendSelection; -#ifdef HAVE_PULSEAUDIO - AudioSetup* m_speakerSetup; -#endif -}; - -#endif // MAIN_H diff --git a/phonon/kcm/medianode_p.h b/phonon/kcm/medianode_p.h deleted file mode 100644 index 47b55e02..00000000 --- a/phonon/kcm/medianode_p.h +++ /dev/null @@ -1,142 +0,0 @@ -/* This file is part of the KDE project -Copyright (C) 2007 Matthias Kretz - -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_MEDIANODE_P_H -#define PHONON_MEDIANODE_P_H - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QObject; - -namespace Phonon -{ - class MediaNode; - class MediaNodeDestructionHandler; - - class PHONON_EXPORT MediaNodePrivate - { - Q_DECLARE_PUBLIC(MediaNode) - - friend class AudioOutputPrivate; - friend class FactoryPrivate; - - protected: - enum CastId { - MediaNodePrivateType, - AbstractAudioOutputPrivateType, - AudioOutputType - }; - public: - /** - * Returns the backend object. If the object does not exist it tries to - * create it before returning. - * - * \return the Iface object, might return \c 0 - */ - QObject *backendObject(); - - const CastId castId; - - protected: - MediaNodePrivate(CastId _castId = MediaNodePrivateType); - - virtual ~MediaNodePrivate(); - - /** - * \internal - * This method cleanly deletes the Iface object. It is called on - * destruction and before a backend change. - */ - void deleteBackendObject(); - - virtual bool aboutToDeleteBackendObject() = 0; - - /** - * \internal - * Creates the Iface object belonging to this class. For most cases the - * implementation is - * \code - * Q_Q(ClassName); - * m_iface = Factory::createClassName(this); - * return m_iface; - * \endcode - * - * This function should not be called except from slotCreateIface. - * - * \see slotCreateIface - */ - virtual void createBackendObject() = 0; - - public: - /** - * \internal - * This class has its own destroyed signal since some cleanup calls - * need the pointer to the backend object intact. The - * QObject::destroyed signals comes after the backend object was - * deleted. - * - * As this class cannot derive from QObject a simple handler - * interface is used. - */ - void addDestructionHandler(MediaNodeDestructionHandler *handler); - - /** - * \internal - * This class has its own destroyed signal since some cleanup calls - * need the pointer to the backend object intact. The - * QObject::destroyed signals comes after the backend object was - * deleted. - * - * As this class cannot derive from QObject a simple handler - * interface is used. - */ - void removeDestructionHandler(MediaNodeDestructionHandler *handler); - - void addOutputPath(const Path &); - void addInputPath(const Path &); - void removeOutputPath(const Path &); - void removeInputPath(const Path &); - - const QObject *qObject() const { return const_cast(this)->qObject(); } - virtual QObject *qObject() = 0; - - protected: - MediaNode *q_ptr; - public: - QObject *m_backendObject; - protected: - QList outputPaths; - QList inputPaths; - - private: - QList handlers; - Q_DISABLE_COPY(MediaNodePrivate) - }; - -} // namespace Phonon - -QT_END_NAMESPACE - -#endif // PHONON_MEDIANODE_P_H diff --git a/phonon/kcm/phonondefs_p.h b/phonon/kcm/phonondefs_p.h deleted file mode 100644 index 4eeb91be..00000000 --- a/phonon/kcm/phonondefs_p.h +++ /dev/null @@ -1,366 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2006-2007 Matthias Kretz - - 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 PHONONDEFS_P_H -#define PHONONDEFS_P_H - -#include -#include "medianode_p.h" - -#define K_D(Class) Class##Private *const d = k_func() - -#define PHONON_CONCAT_HELPER_INTERNAL(x, y) x ## y -#define PHONON_CONCAT_HELPER(x, y) PHONON_CONCAT_HELPER_INTERNAL(x, y) - -#define PHONON_PRIVATECLASS \ -protected: \ - virtual bool aboutToDeleteBackendObject(); \ - virtual void createBackendObject(); \ - /** - * \internal - * After construction of the Iface object this method is called - * throughout the complete class hierarchy in order to set up the - * properties that were already set on the public interface. - * - * An example implementation could look like this: - * \code - * ParentClassPrivate::setupBackendObject(); - * m_iface->setPropertyA(d->propertyA); - * m_iface->setPropertyB(d->propertyB); - * \endcode - */ \ - void setupBackendObject(); - -#define PHONON_PRIVATEABSTRACTCLASS \ -protected: \ - virtual bool aboutToDeleteBackendObject(); \ - /** - * \internal - * After construction of the Iface object this method is called - * throughout the complete class hierarchy in order to set up the - * properties that were already set on the public interface. - * - * An example implementation could look like this: - * \code - * ParentClassPrivate::setupBackendObject(); - * m_iface->setPropertyA(d->propertyA); - * m_iface->setPropertyB(d->propertyB); - * \endcode - */ \ - void setupBackendObject(); - -#define PHONON_ABSTRACTBASE_IMPL \ -PHONON_CLASSNAME::PHONON_CLASSNAME(PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private) &dd, QObject *parent) \ - : QObject(parent), \ - MediaNode(dd) \ -{ \ -} - -#define PHONON_OBJECT_IMPL \ -PHONON_CLASSNAME::PHONON_CLASSNAME(QObject *parent) \ - : QObject(parent), \ - MediaNode(*new PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private)()) \ -{ \ -} \ -void PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private)::createBackendObject() \ -{ \ - if (m_backendObject) \ - return; \ - Q_Q(PHONON_CLASSNAME); \ - m_backendObject = Factory::PHONON_CONCAT_HELPER(create, PHONON_CLASSNAME)(q); \ - if (m_backendObject) { \ - setupBackendObject(); \ - } \ -} - -#define PHONON_HEIR_IMPL(parentclass) \ -PHONON_CLASSNAME::PHONON_CLASSNAME(QObject *parent) \ - : parentclass(*new PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private), parent) \ -{ \ -} \ -void PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private)::createBackendObject() \ -{ \ - if (m_backendObject) \ - return; \ - Q_Q(PHONON_CLASSNAME); \ - m_backendObject = Factory::PHONON_CONCAT_HELPER(create, PHONON_CLASSNAME)(q); \ - if (m_backendObject) { \ - setupBackendObject(); \ - } \ -} - -#define BACKEND_GET(returnType, returnVar, methodName) \ -QMetaObject::invokeMethod(d->m_backendObject, methodName, Qt::DirectConnection, Q_RETURN_ARG(returnType, returnVar)) -#define BACKEND_GET1(returnType, returnVar, methodName, varType1, var1) \ -QMetaObject::invokeMethod(d->m_backendObject, methodName, Qt::DirectConnection, Q_RETURN_ARG(returnType, returnVar), Q_ARG(varType1, var1)) -#define BACKEND_GET2(returnType, returnVar, methodName, varType1, var1, varType2, var2) \ -QMetaObject::invokeMethod(d->m_backendObject, methodName, Qt::DirectConnection, Q_RETURN_ARG(returnType, returnVar), Q_ARG(varType1, var1), Q_ARG(varType2, var2)) -#define BACKEND_CALL(methodName) \ -QMetaObject::invokeMethod(d->m_backendObject, methodName, Qt::DirectConnection) -#define BACKEND_CALL1(methodName, varType1, var1) \ -QMetaObject::invokeMethod(d->m_backendObject, methodName, Qt::DirectConnection, Q_ARG(varType1, var1)) -#define BACKEND_CALL2(methodName, varType1, var1, varType2, var2) \ -QMetaObject::invokeMethod(d->m_backendObject, methodName, Qt::DirectConnection, Q_ARG(varType1, var1), Q_ARG(varType2, var2)) - -#define pBACKEND_GET(returnType, returnVar, methodName) \ -QMetaObject::invokeMethod(m_backendObject, methodName, Qt::DirectConnection, Q_RETURN_ARG(returnType, returnVar)) -#define pBACKEND_GET1(returnType, returnVar, methodName, varType1, var1) \ -QMetaObject::invokeMethod(m_backendObject, methodName, Qt::DirectConnection, Q_RETURN_ARG(returnType, returnVar), Q_ARG(varType1, var1)) -#define pBACKEND_GET2(returnType, returnVar, methodName, varType1, var1, varType2, var2) \ -QMetaObject::invokeMethod(m_backendObject, methodName, Qt::DirectConnection, Q_RETURN_ARG(returnType, returnVar), Q_ARG(varType1, var1), Q_ARG(varType2, var2)) -#define pBACKEND_CALL(methodName) \ -QMetaObject::invokeMethod(m_backendObject, methodName, Qt::DirectConnection) -#define pBACKEND_CALL1(methodName, varType1, var1) \ -QMetaObject::invokeMethod(m_backendObject, methodName, Qt::DirectConnection, Q_ARG(varType1, var1)) -#define pBACKEND_CALL2(methodName, varType1, var1, varType2, var2) \ -QMetaObject::invokeMethod(m_backendObject, methodName, Qt::DirectConnection, Q_ARG(varType1, var1), Q_ARG(varType2, var2)) - -QT_BEGIN_NAMESPACE - -namespace Phonon -{ - namespace - { - class NoIface; - - /// All template arguments are valid - template struct IsValid { enum { Result = true }; }; - /// except NoIface - template<> struct IsValid { enum { Result = false }; }; - - template inline T my_cast(QObject *o) { return qobject_cast(o); } - template inline T my_cast(const QObject *o) { return qobject_cast(o); } - - template<> inline NoIface *my_cast(QObject *) { return 0; } - template<> inline NoIface *my_cast(const QObject *) { return 0; } - } // anonymous namespace - - /** - * \internal - * - * \brief Helper class to cast the backend object to the correct version of the interface. - * - * Additions to the backend interfaces cannot be done by adding virtual methods as that would - * break the binary interface. So the old class is renamed and a new class with the old name - * inheriting the old class is added, containing all the new virtual methods. - * Example: - * \code - class FooInterface - { - public: - virtual ~FooInterface() {} - virtual oldMethod() = 0; - }; - Q_DECLARE_INTERFACE(FooInterface, "FooInterface0.phonon.kde.org") - * \endcode - * becomes - * \code - class FooInterface0 - { - public: - virtual ~FooInterface0() {} - virtual oldMethod() = 0; - }; - class FooInterface : public FooInterface0 - { - public: - virtual newMethod() = 0; - }; - Q_DECLARE_INTERFACE(FooInterface0, "FooInterface0.phonon.kde.org") - Q_DECLARE_INTERFACE(FooInterface, "FooInterface1.phonon.kde.org") - * \endcode - * - * With this, backends compiled against the old header can be qobject_casted to FooInterface0, - * but not to FooInterface. On the other hand backends compiled against the new header (they first - * need to implement newMethod) can only be qobject_casted to FooInterface but not to - * FooInterface0. (The qobject_cast relies on the string in Q_DECLARE_INTERFACE and not the - * class name which is why it behaves that way.) - * - * Now, in order to call oldMethod, the code needs to try to cast to both FooInterface and - * FooInterface0 (new backends will work with the former, old backends with the latter) and then - * if one of them in non-zero call oldMethod on it. - * - * To call newMethod only a cast to FooInterface needs to be done. - * - * The Iface class does all this for you for up to three (for now) interface revisions. Just - * create an object like this: - * \code - Iface iface0(d); - if (iface0) { - iface0->oldMethod(); - } - Iface iface(d); - if (iface) { - iface->newMethod(); - } - * \endcode - * - * This becomes a bit more convenient if you add macros like this: - * \code - #define IFACES1 FooInterface - #define IFACES0 FooInterface0, IFACES1 - * \endcode - * which you can use like this: - * \code - Iface iface0(d); - if (iface0) { - iface0->oldMethod(); - } - Iface iface(d); - if (iface) { - iface->newMethod(); - } - * \endcode - * With the next revision you can then change the macros to - * \code - #define IFACES2 FooInterface - #define IFACES1 FooInterface1, IFACES2 - #define IFACES0 FooInterface0, IFACES1 - * \endcode - * - * \author Matthias Kretz - */ - template - class Iface - { - public: - static inline T0 *cast(MediaNodePrivate *const d) - { - if (IsValid::Result) { - T0 *ret; - if (IsValid::Result) { - ret = reinterpret_cast(my_cast(d->m_backendObject)); - if (ret) return ret; - } - ret = reinterpret_cast(my_cast(d->m_backendObject)); - if (ret) return ret; - } - return qobject_cast(d->m_backendObject); - } - - static inline const T0 *cast(const MediaNodePrivate *const d) - { - if (IsValid::Result) { - const T0 *ret; - if (IsValid::Result) { - ret = reinterpret_cast(my_cast(d->m_backendObject)); - if (ret) return ret; - } - ret = reinterpret_cast(my_cast(d->m_backendObject)); - if (ret) return ret; - } - return qobject_cast(d->m_backendObject); - } - - inline Iface(MediaNodePrivate *const d) : iface(cast(d)) {} - inline operator T0 *() { return iface; } - inline operator const T0 *() const { return iface; } - inline T0 *operator->() { Q_ASSERT(iface); return iface; } - inline const T0 *operator->() const { Q_ASSERT(iface); return iface; } - private: - T0 *const iface; - }; - - template - class ConstIface - { - public: - inline ConstIface(const MediaNodePrivate *const d) : iface(Iface::cast(d)) {} - inline operator const T0 *() const { return iface; } - inline const T0 *operator->() const { Q_ASSERT(iface); return iface; } - private: - const T0 *const iface; - }; -} // namespace Phonon - -QT_END_NAMESPACE - -#define INTERFACE_CALL(function) \ -Iface::cast(d)->function - -#define pINTERFACE_CALL(function) \ -Iface::cast(this)->function - -#define PHONON_GETTER(rettype, name, retdefault) \ -rettype PHONON_CLASSNAME::name() const \ -{ \ - const PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private) *d = k_func(); \ - if (!d->m_backendObject) \ - return retdefault; \ - rettype ret; \ - BACKEND_GET(rettype, ret, #name); \ - return ret; \ -} - -#define PHONON_INTERFACE_GETTER(rettype, name, retdefault) \ -rettype PHONON_CLASSNAME::name() const \ -{ \ - const PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private) *d = k_func(); \ - if (!d->m_backendObject) \ - return retdefault; \ - return Iface::cast(d)->name(); \ -} - -#define PHONON_GETTER1(rettype, name, retdefault, argtype1, argvar1) \ -rettype PHONON_CLASSNAME::name(argtype1 argvar1) const \ -{ \ - const PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private) *d = k_func(); \ - if (!d->m_backendObject) \ - return retdefault; \ - rettype ret; \ - BACKEND_GET1(rettype, ret, #name, const QObject *, argvar1->k_ptr->backendObject()); \ - return ret; \ -} - -#define PHONON_INTERFACE_GETTER1(rettype, name, retdefault, argtype1, argvar1) \ -rettype PHONON_CLASSNAME::name(argtype1 argvar1) const \ -{ \ - const PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private) *d = k_func(); \ - if (!d->m_backendObject) \ - return retdefault; \ - return Iface::cast(d)->name(argvar1->k_ptr->backendObject()); \ -} - -#define PHONON_SETTER(functionname, privatevar, argtype1) \ -void PHONON_CLASSNAME::functionname(argtype1 x) \ -{ \ - PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private) *d = k_func(); \ - d->privatevar = x; \ - if (k_ptr->backendObject()) { \ - BACKEND_CALL1(#functionname, argtype1, x); \ - } \ -} - -#define PHONON_INTERFACE_SETTER(functionname, privatevar, argtype1) \ -void PHONON_CLASSNAME::functionname(argtype1 x) \ -{ \ - PHONON_CONCAT_HELPER(PHONON_CLASSNAME, Private) *d = k_func(); \ - d->privatevar = x; \ - if (k_ptr->backendObject()) { \ - Iface::cast(d)->functionname(x); \ - } \ -} - -#ifndef METATYPE_QLIST_INT_DEFINED -#define METATYPE_QLIST_INT_DEFINED -// Want this exactly once, see phonondefs_p.h kcm/outputdevicechoice.cpp -Q_DECLARE_METATYPE(QList) -#endif - -#endif // PHONONDEFS_P_H diff --git a/phonon/kcm/phononnamespace_p.h b/phonon/kcm/phononnamespace_p.h deleted file mode 100644 index 7d5318c6..00000000 --- a/phonon/kcm/phononnamespace_p.h +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2005-2006 Matthias Kretz - - 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 PHONONNAMESPACE_P_H -#define PHONONNAMESPACE_P_H - -#include - -QT_BEGIN_NAMESPACE - -namespace Phonon -{ - struct GlobalData - { - GlobalData(); - - bool showDebugOutput; - - static GlobalData *instance(); - }; -} - -QT_END_NAMESPACE - -#if defined(QT_NO_DEBUG) -#define pDebug if (false) qDebug -#else -#define pDebug if (!Phonon::GlobalData::instance()->showDebugOutput) {} else qDebug -#endif -#define pWarning() qDebug() << "WARNING:" -#define pError() qDebug() << "ERROR:" -#define pFatal(message) qDebug() << "FATAL ERROR:" << message; ::abort() - -// vim: sw=4 ts=4 tw=80 -#endif // PHONONNAMESPACE_P_H diff --git a/phonon/kcm/qsettingsgroup_p.h b/phonon/kcm/qsettingsgroup_p.h deleted file mode 100644 index b093225c..00000000 --- a/phonon/kcm/qsettingsgroup_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz - - 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 PHONON_QSETTINGSGROUP_P_H -#define PHONON_QSETTINGSGROUP_P_H - -#include -#include -#include - -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE - -namespace Phonon -{ -class QSettingsGroup -{ - public: - inline QSettingsGroup(QSettings *settings, const QString &name) - : m_mutableSettings(settings), - m_settings(settings), - m_group(name + QLatin1Char('/')) - { - } - - inline QSettingsGroup(const QSettings *settings, const QString &name) - : m_mutableSettings(0), - m_settings(settings), - m_group(name + QLatin1Char('/')) - { - } - - template - inline T value(const QString &key, const T &def) const - { - return qvariant_cast(value(key, qVariantFromValue(def))); - } - - inline QVariant value(const QString &key, const QVariant &def) const - { - return m_settings->value(m_group + key, def); - } - - template - inline void setValue(const QString &key, const T &value) - { - Q_ASSERT(m_mutableSettings); - m_mutableSettings->setValue(m_group + key, qVariantFromValue(value)); - } - - inline void removeEntry(const QString &key) - { - Q_ASSERT(m_mutableSettings); - m_mutableSettings->remove(m_group + key); - } - - bool hasKey(const QString &key) const - { - return m_settings->contains(m_group + key); - } - - private: - QSettings *const m_mutableSettings; - const QSettings *const m_settings; - QString m_group; -}; -} // namespace Phonon - -QT_END_NAMESPACE -QT_END_HEADER - -#endif // PHONON_QSETTINGSGROUP_P_H diff --git a/phonon/kcm/testspeakerwidget.cpp b/phonon/kcm/testspeakerwidget.cpp deleted file mode 100644 index 3c76c363..00000000 --- a/phonon/kcm/testspeakerwidget.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2010 Colin Guthrie - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 - as published by the Free Software Foundation. - - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - -*/ - -#include "testspeakerwidget.h" -#include "audiosetup.h" -#include - -#include - -static uint32_t s_CurrentIndex = PA_INVALID_INDEX; -static TestSpeakerWidget *s_CurrentWidget = NULL; - -static void finish_cb(ca_context *, uint32_t id, int, void *) -{ - Q_ASSERT(id == 0); - Q_UNUSED(id); // Suppress compiler warning if QT_NO_DEBUG - // Mustn't access QWidgets from a foreign thread, so queue a slot call. - QMetaObject::invokeMethod(s_CurrentWidget, "onFinish", Qt::QueuedConnection); -} - -TestSpeakerWidget::TestSpeakerWidget(const pa_channel_position_t pos, ca_context *canberra, AudioSetup* ss) - : KPushButton(KIcon("preferences-desktop-sound"), "Test", ss) - , m_Ss(ss) - , m_Pos(pos) - , m_Canberra(canberra) -{ - setCheckable(true); - setText(_positionName()); - connect(this, SIGNAL(toggled(bool)), SLOT(toggled(bool))); -} - -TestSpeakerWidget::~TestSpeakerWidget() -{ - if (this == s_CurrentWidget) - s_CurrentWidget = NULL; -} - -void TestSpeakerWidget::toggled(bool state) -{ - if (s_CurrentIndex != PA_INVALID_INDEX) { - ca_context_cancel(m_Canberra, s_CurrentIndex); - s_CurrentIndex = PA_INVALID_INDEX; - } - if (s_CurrentWidget) { - if (this != s_CurrentWidget && state) - s_CurrentWidget->setChecked(false); - s_CurrentWidget = NULL; - } - if (!state) - return; - - uint32_t sink_index = m_Ss->getCurrentSinkIndex(); - char dev[64]; - snprintf(dev, sizeof(dev), "%lu", (unsigned long) sink_index); - ca_context_change_device(m_Canberra, dev); - - const char* sound_name = _positionSoundName(); - ca_proplist* proplist; - ca_proplist_create(&proplist); - - ca_proplist_sets(proplist, CA_PROP_MEDIA_ROLE, "test"); - ca_proplist_sets(proplist, CA_PROP_MEDIA_NAME, _positionName().toAscii().constData()); - ca_proplist_sets(proplist, CA_PROP_CANBERRA_FORCE_CHANNEL, _positionAsString()); - ca_proplist_sets(proplist, CA_PROP_CANBERRA_ENABLE, "1"); - - ca_proplist_sets(proplist, CA_PROP_EVENT_ID, sound_name); - s_CurrentIndex = 0; - s_CurrentWidget = this; - if (ca_context_play_full(m_Canberra, s_CurrentIndex, proplist, finish_cb, NULL) < 0) { - // Try a different sound name. - ca_proplist_sets(proplist, CA_PROP_EVENT_ID, "audio-test-signal"); - if (ca_context_play_full(m_Canberra, s_CurrentIndex, proplist, finish_cb, NULL) < 0) { - // Finaly try this... if this doesn't work, then stuff it. - ca_proplist_sets(proplist, CA_PROP_EVENT_ID, "bell-window-system"); - if (ca_context_play_full(m_Canberra, s_CurrentIndex, proplist, finish_cb, NULL) < 0) { - s_CurrentIndex = PA_INVALID_INDEX; - s_CurrentWidget = NULL; - setChecked(false); - } - } - } - - ca_context_change_device(m_Canberra, NULL); - ca_proplist_destroy(proplist); -} - -void TestSpeakerWidget::onFinish() -{ - if (s_CurrentWidget && s_CurrentWidget->isChecked()) { - s_CurrentIndex = PA_INVALID_INDEX; - s_CurrentWidget->setChecked(false); - s_CurrentWidget = NULL; - } -} - -const char* TestSpeakerWidget::_positionAsString() -{ - switch (m_Pos) - { - case PA_CHANNEL_POSITION_FRONT_LEFT: - return "front-left"; - - case PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER: - return "front-left-of-center"; - - case PA_CHANNEL_POSITION_FRONT_CENTER: - return "front-center"; - - case PA_CHANNEL_POSITION_MONO: - return "mono"; - - case PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER: - return "front-right-of-center"; - - case PA_CHANNEL_POSITION_FRONT_RIGHT: - return "front-right"; - - case PA_CHANNEL_POSITION_SIDE_LEFT: - return "side-left"; - - case PA_CHANNEL_POSITION_SIDE_RIGHT: - return "side-right"; - - case PA_CHANNEL_POSITION_REAR_LEFT: - return "rear-left"; - - case PA_CHANNEL_POSITION_REAR_CENTER: - return "rear-center"; - - case PA_CHANNEL_POSITION_REAR_RIGHT: - return "rear-right"; - - case PA_CHANNEL_POSITION_LFE: - return "lfe"; - - default: - break; - } - return "invalid"; -} - -QString TestSpeakerWidget::_positionName() -{ - switch (m_Pos) - { - case PA_CHANNEL_POSITION_FRONT_LEFT: - return i18n("Front Left"); - - case PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER: - return i18n("Front Left of Center"); - - case PA_CHANNEL_POSITION_FRONT_CENTER: - return i18n("Front Center"); - - case PA_CHANNEL_POSITION_MONO: - return i18n("Mono"); - - case PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER: - return i18n("Front Right of Center"); - - case PA_CHANNEL_POSITION_FRONT_RIGHT: - return i18n("Front Right"); - - case PA_CHANNEL_POSITION_SIDE_LEFT: - return i18n("Side Left"); - - case PA_CHANNEL_POSITION_SIDE_RIGHT: - return i18n("Side Right"); - - case PA_CHANNEL_POSITION_REAR_LEFT: - return i18n("Rear Left"); - - case PA_CHANNEL_POSITION_REAR_CENTER: - return i18n("Rear Center"); - - case PA_CHANNEL_POSITION_REAR_RIGHT: - return i18n("Rear Right"); - - case PA_CHANNEL_POSITION_LFE: - return i18n("Subwoofer"); - - default: - break; - } - return i18n("Unknown Channel"); -} - -const char* TestSpeakerWidget::_positionSoundName() -{ - switch (m_Pos) - { - case PA_CHANNEL_POSITION_FRONT_LEFT: - return "audio-channel-front-left"; - - case PA_CHANNEL_POSITION_FRONT_RIGHT: - return "audio-channel-front-right"; - - case PA_CHANNEL_POSITION_FRONT_CENTER: - return "audio-channel-front-center"; - - case PA_CHANNEL_POSITION_REAR_LEFT: - return "audio-channel-rear-left"; - - case PA_CHANNEL_POSITION_REAR_RIGHT: - return "audio-channel-rear-right"; - - case PA_CHANNEL_POSITION_REAR_CENTER: - return "audio-channel-rear-center"; - - case PA_CHANNEL_POSITION_LFE: - return "audio-channel-lfe"; - - case PA_CHANNEL_POSITION_SIDE_LEFT: - return "audio-channel-side-left"; - - case PA_CHANNEL_POSITION_SIDE_RIGHT: - return "audio-channel-side-right"; - default: - break; - } - return NULL; -} - - -#include "moc_testspeakerwidget.cpp" -// vim: sw=4 sts=4 et tw=100 diff --git a/phonon/kcm/testspeakerwidget.h b/phonon/kcm/testspeakerwidget.h deleted file mode 100644 index 21e3b81a..00000000 --- a/phonon/kcm/testspeakerwidget.h +++ /dev/null @@ -1,54 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2010 Colin Guthrie - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 - as published by the Free Software Foundation. - - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - -*/ - -#ifndef PHONON_TESTSPEAKERWIDGET_H -#define PHONON_TESTSPEAKERWIDGET_H - -#include - -#include -#include - - -class AudioSetup; - -class TestSpeakerWidget: public KPushButton -{ - Q_OBJECT - public: - TestSpeakerWidget(const pa_channel_position_t pos, ca_context *canberra, AudioSetup* ss); - ~TestSpeakerWidget(); - - public slots: - void onFinish(); - - private slots: - void toggled(bool); - - private: - QString _positionName(); - const char* _positionAsString(); - const char* _positionSoundName(); - - AudioSetup* m_Ss; - pa_channel_position_t m_Pos; - ca_context* m_Canberra; -}; - -#endif // PHONON_TESTSPEAKERWIDGET_H diff --git a/phonon/kded-module/CMakeLists.txt b/phonon/kded-module/CMakeLists.txt deleted file mode 100644 index 8cf3630f..00000000 --- a/phonon/kded-module/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -set(kded_phonon_SRCS - phononserver.cpp - deviceinfo.cpp - deviceaccess.cpp - hardwaredatabase.cpp -) - -kde4_add_plugin(kded_phononserver ${kded_phonon_SRCS}) - -target_link_libraries(kded_phononserver ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${KDE4_SOLID_LIBS}) - -if(ALSA_FOUND) - target_link_libraries(kded_phononserver ${ASOUND_LIBRARY}) -endif(ALSA_FOUND) - -install(TARGETS kded_phononserver DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES phononserver.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded) -install(FILES hardwaredatabase DESTINATION ${DATA_INSTALL_DIR}/libphonon) diff --git a/phonon/kded-module/Messages.sh b/phonon/kded-module/Messages.sh deleted file mode 100644 index 41d8cdf4..00000000 --- a/phonon/kded-module/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -$XGETTEXT *.cpp -o $podir/phononserver.pot diff --git a/phonon/kded-module/TODO b/phonon/kded-module/TODO deleted file mode 100644 index 6a621844..00000000 --- a/phonon/kded-module/TODO +++ /dev/null @@ -1 +0,0 @@ -- List all available audio devices and keep the list updated when devices are (un)plugged. Make that list available over dbus. diff --git a/phonon/kded-module/deviceaccess.cpp b/phonon/kded-module/deviceaccess.cpp deleted file mode 100644 index 07d4f8f9..00000000 --- a/phonon/kded-module/deviceaccess.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2008 Matthias Kretz - - 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 "deviceaccess.h" -#include - -namespace PS -{ - -DeviceAccess::DeviceAccess(const QStringList& deviceIds, int accessPreference, - DeviceAccess::DeviceDriverType driver, - bool capture, - bool playback): - m_deviceIds(deviceIds), - m_accessPreference(accessPreference), - m_driver(driver), - m_capture(capture), - m_playback(playback) -{ -} - -bool DeviceAccess::operator<(const DeviceAccess& rhs) const -{ - return m_accessPreference > rhs.m_accessPreference; -} - -bool DeviceAccess::operator==(const DeviceAccess& rhs) const -{ - return m_deviceIds == rhs.m_deviceIds && m_capture == rhs.m_capture - && m_playback == rhs.m_playback; -} - -bool DeviceAccess::operator!=(const DeviceAccess& rhs) const -{ - return !operator==(rhs); -} - -DeviceAccess::DeviceDriverType DeviceAccess::driver() const -{ - return m_driver; -} - -const QString DeviceAccess::driverName() const -{ - if (!m_preferredName.isEmpty()) - return m_preferredName; - - switch (m_driver) { - case InvalidDriver: - return i18n("Invalid Driver"); - case AlsaDriver: - return i18n("ALSA"); - case OssDriver: - return i18n("OSS"); - case JackdDriver: - return i18n("Jack"); - case Video4LinuxDriver: - return i18n("Video 4 Linux"); - } - return QString(); -} - -void DeviceAccess::setPreferredDriverName(const QString& name) -{ - m_preferredName = name; -} - -const QStringList& DeviceAccess::deviceIds() const -{ - return m_deviceIds; -} - -int DeviceAccess::accessPreference() const -{ - return m_accessPreference; -} - -bool DeviceAccess::isCapture() const -{ - return m_capture; -} - -bool DeviceAccess::isPlayback() const -{ - return m_playback; -} - -QDebug operator<<(QDebug &s, const DeviceAccess &a) -{ - s.nospace() << "deviceIds: " << a.m_deviceIds - << "; accessPreference: " << a.m_accessPreference - << "; driver type" << (int) a.driver() - << "; driver" << a.driverName(); - if (a.m_capture) { - s.nospace() << " capture"; - } - if (a.m_playback) { - s.nospace() << " playback"; - } - return s; -} - -} // namespace PS diff --git a/phonon/kded-module/deviceaccess.h b/phonon/kded-module/deviceaccess.h deleted file mode 100644 index 6240b76d..00000000 --- a/phonon/kded-module/deviceaccess.h +++ /dev/null @@ -1,99 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2008 Matthias Kretz - - 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 DEVICEACCESS_H -#define DEVICEACCESS_H - -#include -#include - -namespace PS -{ - -/** - * \brief Describes an access to a device - * - * Contains information about the driver, device id, and preference. - * It also specifies if it is about playback or capture. - */ -class DeviceAccess -{ - public: - //! What driver to be used for this access - enum DeviceDriverType { - InvalidDriver = 0, - AlsaDriver, - OssDriver, - JackdDriver, - Video4LinuxDriver - }; - - //! Constructs a device access object using the given information - DeviceAccess(const QStringList &deviceIds, int accessPreference, - DeviceDriverType driver, bool capture, bool playback); - - //! Compares to another access by using the preference - bool operator<(const DeviceAccess &rhs) const; - - bool operator==(const DeviceAccess &rhs) const; - bool operator!=(const DeviceAccess &rhs) const; - - //! Which driver does the access belong to - DeviceDriverType driver() const; - - /*! - * Returns the name of the driver - * - * If setPreferredDriverName() has not been called with a non-empty name, - * it returns the name obtained from the driver type. - */ - const QString driverName() const; - - //! Sets the driver name - void setPreferredDriverName(const QString &name); - - //! Device identifiers, used to identify the access, driver specific - const QStringList &deviceIds() const; - - //! Returns the preference for this access - int accessPreference() const; - - //! True when the access can be used for capture - bool isCapture() const; - - //! True when the access can be used for playback - bool isPlayback() const; - - private: - friend QDebug operator<<(QDebug &, const DeviceAccess &); - - QStringList m_deviceIds; - int m_accessPreference; - DeviceDriverType m_driver : 16; - QString m_preferredName; - bool m_capture : 8; - bool m_playback : 8; -}; - -QDebug operator<<(QDebug &s, const DeviceAccess &a); - -} // namespace PS - -#endif // DEVICEACCESS_H diff --git a/phonon/kded-module/deviceinfo.cpp b/phonon/kded-module/deviceinfo.cpp deleted file mode 100644 index 0c78e503..00000000 --- a/phonon/kded-module/deviceinfo.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2008 Matthias Kretz - - 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 "deviceinfo.h" -#include "hardwaredatabase.h" - -#include -#include -#include - -namespace PS -{ - -bool DeviceKey::operator==(const DeviceKey& rhs) const -{ - if (uniqueId.isNull() || rhs.uniqueId.isNull()) { - return cardNumber == rhs.cardNumber && deviceNumber == rhs.deviceNumber; - } - - return - uniqueId == rhs.uniqueId && - cardNumber == rhs.cardNumber && - deviceNumber == rhs.deviceNumber; -} - -DeviceInfo::DeviceInfo() - : m_index(0), m_initialPreference(0), m_isAvailable(false), m_isAdvanced(true), - m_dbNameOverrideFound(false) -{ - m_type = Unspecified; -} - -DeviceInfo::DeviceInfo(Type t, const QString &cardName, const QString &icon, - const DeviceKey &key, int pref, bool adv) : - m_type(t), - m_cardName(cardName), - m_icon(icon), - m_key(key), - m_index(0), - m_initialPreference(pref), - m_isAvailable(false), - m_isAdvanced(adv), - m_dbNameOverrideFound(false) -{ - applyHardwareDatabaseOverrides(); -} - -bool DeviceInfo::operator<(const DeviceInfo& rhs) const -{ - return m_initialPreference > rhs.m_initialPreference; -} - -bool DeviceInfo::operator==(const DeviceInfo& rhs) const -{ - return m_key == rhs.m_key; -} - -const QString& DeviceInfo::name() const -{ - return m_cardName; -} - -void DeviceInfo::setPreferredName(const QString& name) -{ - if (!m_dbNameOverrideFound) { - m_cardName = name; - } -} - -int DeviceInfo::index() const -{ - return m_index; -} - -const QString DeviceInfo::description() const -{ - if (!m_isAvailable) { - return i18n("This device is currently not available (either it is unplugged or the " - "driver is not loaded)."); - } - - QString list; - foreach (const DeviceAccess &a, m_accessList) { - foreach (const QString &id, a.deviceIds()) { - list += i18nc("The first argument is name of the driver/sound subsystem. " - "The second argument is the device identifier", "
  • %1: %2
  • ", - a.driverName(), id); - } - } - - return i18n("This will try the following devices and use the first that works: " - "
      %1
    ", list); -} - -const QString& DeviceInfo::icon() const -{ - return m_icon; -} - -bool DeviceInfo::isAvailable() const -{ - return m_isAvailable; -} - -bool DeviceInfo::isAdvanced() const -{ - return m_isAdvanced; -} - -int DeviceInfo::initialPreference() const -{ - return m_initialPreference; -} - -int DeviceInfo::deviceNumber() const -{ - return m_key.deviceNumber; -} - -const QList< DeviceAccess >& DeviceInfo::accessList() const -{ - return m_accessList; -} - -const DeviceKey& DeviceInfo::key() const -{ - return m_key; -} - -void DeviceInfo::addAccess(const DeviceAccess &access) -{ - m_isAvailable |= !access.deviceIds().isEmpty(); - - m_accessList << access; - qSort(m_accessList); // FIXME: do sorted insert -} - -void DeviceInfo::applyHardwareDatabaseOverrides() -{ - // now let's take a look at the hardware database whether we have to override something - kDebug(601) << "looking for" << m_key.uniqueId; - if (HardwareDatabase::contains(m_key.uniqueId)) { - const HardwareDatabase::Entry &e = HardwareDatabase::entryFor(m_key.uniqueId); - kDebug(601) << " found it:" << e.name << e.iconName << e.initialPreference << e.isAdvanced; - - if (!e.name.isEmpty()) { - m_dbNameOverrideFound = true; - m_cardName = e.name; - } - - if (!e.iconName.isEmpty()) { - m_icon = e.iconName; - } - - if (e.isAdvanced != 2) { - m_isAdvanced = e.isAdvanced; - } - - m_initialPreference = e.initialPreference; - } -} - -const QString DeviceInfo::prefixForConfigGroup() const -{ - QString groupPrefix; - if (m_type == Audio) { - groupPrefix = "AudioDevice_"; - } - if (m_type == Video) { - groupPrefix = "VideoDevice_"; - } - - return groupPrefix; -} - -void DeviceInfo::removeFromCache(const KSharedConfigPtr &config) const -{ - if (m_type == Unspecified) - return; - - KConfigGroup cGroup(config, prefixForConfigGroup().toLatin1() + m_key.uniqueId); - cGroup.writeEntry("deleted", true); -} - -void DeviceInfo::syncWithCache(const KSharedConfigPtr &config) -{ - if (m_type == Unspecified) { - kWarning(601) << "Device info for" << name() << "has unspecified type, unable to sync with cache"; - return; - } - - KConfigGroup cGroup(config, prefixForConfigGroup().toLatin1() + m_key.uniqueId); - if (cGroup.exists()) { - m_index = cGroup.readEntry("index", 0); - } - - if (m_index >= 0) { - KConfigGroup globalGroup(config, "Globals"); - m_index = -globalGroup.readEntry("nextIndex", 1); - globalGroup.writeEntry("nextIndex", 1 - m_index); - Q_ASSERT(m_index < 0); - - cGroup.writeEntry("index", m_index); - } - - cGroup.writeEntry("cardName", m_cardName); - cGroup.writeEntry("iconName", m_icon); - cGroup.writeEntry("initialPreference", m_initialPreference); - cGroup.writeEntry("isAdvanced", m_isAdvanced); - cGroup.writeEntry("deviceNumber", m_key.deviceNumber); - cGroup.writeEntry("deleted", false); - - bool hotpluggable = false; - - // HACK #1: only internal soundcards should get the icon audio-card. All others, we assume, are - // hotpluggable - hotpluggable |= m_icon != QLatin1String("audio-card"); - - // HACK #2: Solid currently offers audio-card icon for some hotpluggable stuff, so #1 is unreliable - hotpluggable |= (bool) m_cardName.contains("usb", Qt::CaseInsensitive); - hotpluggable |= (bool) m_cardName.contains("headset", Qt::CaseInsensitive); - hotpluggable |= (bool) m_cardName.contains("headphone", Qt::CaseInsensitive); - - cGroup.writeEntry("hotpluggable", hotpluggable); -} - -} // namespace PS diff --git a/phonon/kded-module/deviceinfo.h b/phonon/kded-module/deviceinfo.h deleted file mode 100644 index 2e70572f..00000000 --- a/phonon/kded-module/deviceinfo.h +++ /dev/null @@ -1,198 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2008 Matthias Kretz - - 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 DEVICEINFO_H -#define DEVICEINFO_H - -#include "deviceaccess.h" - -#include -#include -#include -#include - -#include - -namespace PS -{ - -/** - * \brief Identifies a certain device. - * - * Unique ID, card number and device number are used. - * - * Can be hashed. Can be compared to another. - */ -struct DeviceKey -{ - QString uniqueId; - int cardNumber; - int deviceNumber; - - bool operator==(const DeviceKey &rhs) const; -}; - -/** - * \brief Stores information about a device, audio or video - * - * The following information is contained in this class: - * \li Device access list - * \li Device index - * \li Preferred name for the user to see - * \li Description - * \li Icon - * \li Initial preference - * \li Key - * \li Availability - * \li Advanced status - * \li Device number - * - * After the device is constructed, the hardware database is searched for overrides. - * - * There are methods to allow syncing with a config cache. - * - * Can be passed to QDebug(). - * - * Can be hashed. - */ -class DeviceInfo -{ - public: - enum Type { - Unspecified, - Audio, - Video - }; - - //! Constructs an empty device info object - DeviceInfo(); - - //! Constructs a device info object from the information given - DeviceInfo(Type t, const QString &cardName, const QString &icon, const DeviceKey &key, - int pref, bool adv); - - //! Adds the specified access to the list - void addAccess(const PS::DeviceAccess &access); - - //! Compare to another device info using the initial device preference - bool operator<(const DeviceInfo &rhs) const; - - //! Compare if two device info are identical by using the device key - bool operator==(const DeviceInfo &rhs) const; - - //! Returns the user visible name of the device - const QString &name() const; - - //! Sets the name of the device that will be visible to the user - void setPreferredName(const QString &name); - - //! Valid indexes are negative - int index() const; - - //! User visible string to describe the device in detail - const QString description() const; - - //! The icon used to portray the device - const QString &icon() const; - - //! Returns if the device is available for use - bool isAvailable() const; - - //! Returns if the device is advanced - bool isAdvanced() const; - - //! The number for the initial preference for the device, before it's changed by the user - int initialPreference() const; - - //! Number that identifies the device for it's card - int deviceNumber() const; - - //! A list of accesses for the device, describing how it's possible to access it - const QList &accessList() const; - - //! Key for the device, to distinguish it from any others - const DeviceKey &key() const; - - //! Mark the device as deleted, in the specified configuration - void removeFromCache(const KSharedConfigPtr &config) const; - - //! Write the device information to the specified configuration - void syncWithCache(const KSharedConfigPtr &config); - - private: - friend uint qHash(const DeviceInfo &); - friend QDebug operator<<(QDebug &, const DeviceInfo &); - - void applyHardwareDatabaseOverrides(); - const QString prefixForConfigGroup() const; - - private: - Type m_type; - QString m_cardName; - QString m_icon; - - QList m_accessList; - DeviceKey m_key; - - int m_index; - int m_initialPreference; - bool m_isAvailable : 1; - bool m_isAdvanced : 1; - bool m_dbNameOverrideFound : 1; -}; - -inline QDebug operator<<(QDebug &s, const PS::DeviceKey &k) -{ - s.nospace() << "\n uniqueId: " << k.uniqueId - << ", card: " << k.cardNumber - << ", device: " << k.deviceNumber; - return s; -} - -inline QDebug operator<<(QDebug &s, const PS::DeviceInfo &a) -{ - s.nospace() << "\n- " << a.m_cardName - << ", icon: " << a.m_icon - << a.m_key - << "\n index: " << a.m_index - << ", initialPreference: " << a.m_initialPreference - << ", available: " << a.m_isAvailable - << ", advanced: " << a.m_isAdvanced - << ", DB name override: " << a.m_dbNameOverrideFound - << "\n description: " << a.description() - << "\n access: " << a.m_accessList; - return s; -} - -inline uint qHash(const DeviceKey &k) -{ - return ::qHash(k.uniqueId) + k.cardNumber + 101 * k.deviceNumber; -} - -inline uint qHash(const DeviceInfo &a) -{ - return qHash(a.m_key); -} - -} // namespace PS - - -#endif // DEVICEINFO_H - diff --git a/phonon/kded-module/hardwaredatabase b/phonon/kded-module/hardwaredatabase deleted file mode 100644 index e353eea8..00000000 --- a/phonon/kded-module/hardwaredatabase +++ /dev/null @@ -1,384 +0,0 @@ -# Group names can be found in $KDEHOME/share/config/phonondevicesrc, you only need to remove the -# AudioCaptureDevice_/AudioOutputDevice_/AudioIODevice_ prefix -# -# The numbers in the group name are -# vendor id:product id:subsystem vendor id:subsystem product id:device number -# or for USB only -# vendor id:product id:device number -# -# The last string is either playback or capture -# -# Every entry may have a name, icon, isAdvancedDevice and initialPreference entry. - -# Creative SB Audigy 2 ZS -[pci:1102:0004:1102:2002:4:playback] -name=Creative SB Audigy 2 ZS p16v -initialPreference=0 - -[pci:1102:0004:1102:2002:3:playback] -name=Creative SB Audigy 2 ZS Multichannel Playback -initialPreference=10 - -[pci:1102:0004:1102:2002:2:playback] -name=Creative SB Audigy 2 ZS PT Playback -initialPreference=10 - -[pci:1102:0004:1102:2002:0:playback] -name=Creative SB Audigy 2 ZS Standard Playback -initialPreference=37 - -[pci:1102:0004:1102:2002:4:capture] -name=Creative SB Audigy 2 ZS p16v -initialPreference=0 - -[pci:1102:0004:1102:2002:2:capture] -name=Creative SB Audigy 2 ZS Multichannel Capture -initialPreference=10 - -[pci:1102:0004:1102:2002:1:capture] -name=Creative SB Audigy 2 ZS Mic Capture -initialPreference=35 - -[pci:1102:0004:1102:2002:0:capture] -name=Creative SB Audigy 2 ZS ADC Capture -initialPreference=36 - -#NVidia CK804 Analog Devices AD1981B -[pci:10de:0059:10f1:2895:2:playback] -name=NVidia CK804 AD1981B S/PDIF -initialPreference=15 - -[pci:10de:0059:10f1:2895:1:capture] -name=NVidia CK804 AD1981B MIC ADC -initialPreference=25 - -[pci:10de:0059:10f1:2895:0:playback] -name=NVidia CK804 AD1981B -initialPreference=36 - -[pci:10de:0059:10f1:2895:0:capture] -name=NVidia CK804 AD1981B -initialPreference=36 - -#HDA Intel Realtek ALC861 -[pci:8086:27d8:1584:c024:0:capture] -name=Realtek ALC861 -initialPreference=36 - -[pci:8086:27d8:1584:c024:0:playback] -name=Realtek ALC861 -initialPreference=36 - -[pci:8086:27d8:1584:c024:1:playback] -name=Realtek ALC861 S/PDIF -initialPreference=15 - -#Intel ICH 82801CA-ICH3 with AD1881A -[pci:8086:2485:1014:051f:0:playback] -name=Analog Devices AD1881A -initialPreference=36 - -[pci:8086:2485:1014:051f:1:capture] -name=Analog Devices AD1881A MIC ADC -initialPreference=25 - -[pci:8086:2485:1014:051f:0:capture] -name=Analog Devices AD1881A -initialPreference=36 - -#Intel ICH6 AD1981B -[pci:8086:266e:144d:c01a:4:playback] -name=Analog Devices AD1981B S/PDIF -initialPreference=15 - -[pci:8086:266e:144d:c01a:0:playback] -name=Analog Devices AD1981B -initialPreference=36 - -[pci:8086:266e:144d:c01a:3:capture] -name=Analog Devices AD1981B ADC2 -initialPreference=25 - -[pci:8086:266e:144d:c01a:2:capture] -name=Analog Devices AD1981B MIC2 ADC -initialPreference=25 - -[pci:8086:266e:144d:c01a:1:capture] -name=Analog Devices AD1981B MIC ADC -initialPreference=25 - -[pci:8086:266e:144d:c01a:0:capture] -name=Analog Devices AD1981B -initialPreference=36 - -# Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller Samsung Electronics Co Ltd HDA Intel AD198x Analog -[pci:8086:27d8:144d:c024:0:capture] -name=HDA Intel (AD1986A) -initialPreference=36 - -[pci:8086:27d8:144d:c024:0:playback] -name=HDA Intel (AD1986A) -initialPreference=36 - -# Logitech USB Audio Interface Logitech Logitech USB Headset USB Audio -[usb:046d:0a02:0:capture] -name=Logitech Premium Stereo USB Headset 350 -initialPreference=26 - -[usb:046d:0a02:0:playback] -name=Logitech Premium Stereo USB Headset 350 -initialPreference=26 - -# HDA NVidia Analog Devices AD1988 -[pci:10de:03f0:1043:8234:1:playback] -name=Analog Devices AD1988 S/PDIF -initialPreference=15 - -[pci:10de:03f0:1043:8234:0:playback] -name=Analog Devices AD1988 -initialPreference=36 - -[pci:10de:03f0:1043:8234:0:capture] -name=Analog Devices AD1988 -initialPreference=36 - -# Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC Fujitsu Siemens Computer GmbH I82801DBICH4 Intel 82801DB-ICH4 -[pci:8086:24c5:1734:1033:3:capture] -name=Cirrus Logic CS4299 rev 4 ADC2 -initialPreference=35 - -[pci:8086:24c5:1734:1033:4:playback] -name=Cirrus Logic CS4299 rev 4 S/PDIF -initialPreference=15 - -[pci:8086:24c5:1734:1033:2:capture] -name=Cirrus Logic CS4299 rev 4 MIC2 ADC -initialPreference=35 - -[pci:8086:24c5:1734:1033:1:capture] -name=Cirrus Logic CS4299 rev 4 MIC ADC -initialPreference=35 - -[pci:8086:24c5:1734:1033:0:capture] -name=Cirrus Logic CS4299 rev 4 -initialPreference=36 - -[pci:8086:24c5:1734:1033:0:playback] -name=Cirrus Logic CS4299 rev 4 -initialPreference=36 - -# Creative Labs SB Live! EMU10k1 Creative Labs SBLive! Platinum [CT4760P] (rev.8, serial:0x80401102) -[pci:1102:0002:1102:8040:0:capture] -name=SBLive! Platinum (rev.8) ADC Capture -initialPreference=36 - -[pci:1102:0002:1102:8040:0:playback] -name=SBLive! Platinum (rev.8) Standard PCM Playback -initialPreference=36 - -[pci:1102:0002:1102:8040:1:capture] -name=SBLive! Platinum (rev.8) Mic Capture -initialPreference=35 - -[pci:1102:0002:1102:8040:2:capture] -name=SBLive! Platinum (rev.8) Multichannel Capture -initialPreference=10 - -[pci:1102:0002:1102:8040:2:playback] -name=SBLive! Platinum (rev.8) PT Playback -initialPreference=10 - -[pci:1102:0002:1102:8040:3:playback] -name=SBLive! Platinum (rev.8) Multichannel Playback -initialPreference=10 - -# Intel Corporation 82801EB/ER (ICH5/ICH5R) AC ASRock Incorporation Intel ICH5 with ALC850 Intel ICH5 -[pci:8086:24d5:1849:0850:0:capture] -name=Realtek ALC850 -initialPreference=36 - -[pci:8086:24d5:1849:0850:0:playback] -name=Realtek ALC850 -initialPreference=36 - -[pci:8086:24d5:1849:0850:3:capture] -name=Realtek ALC850 ADC2 -initialPreference=35 - -[pci:8086:24d5:1849:0850:4:playback] -name=Realtek ALC850 S/PDIF -initialPreference=15 - -[pci:8086:24d5:1849:0850:1:capture] -name=Realtek ALC850 MIC ADC -initialPreference=35 - -[pci:8086:24d5:1849:0850:2:capture] -name=Realtek ALC850 MIC2 ADC -initialPreference=35 - -# Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC IBM Intel ICH6 with AD1981B -[pci:8086:266e:1014:0567:0:capture] -name=Intel ICH6 with AD1981B -initialPreference=36 - -[pci:8086:266e:1014:0567:1:capture] -name=Intel ICH6 with AD1981B MIC ADC -initialPreference=35 - -[pci:8086:266e:1014:0567:2:capture] -name=Intel ICH6 with AD1981B MIC2 ADC -initialPreference=35 - -[pci:8086:266e:1014:0567:3:capture] -name=Intel ICH6 with AD1981B ADC2 -initialPreference=35 - -[pci:8086:266e:1014:0567:0:playback] -name=Intel ICH6 with AD1981B -initialPreference=36 - -[pci:8086:266e:1014:0567:4:playback] -name=Intel ICH6 with AD1981B S/PDIF -initialPreference=15 - -# ATI Technologies Inc SB450 HDA Audio HDA ATI SB AD198x Analog -[pci:1002:437b:30b0:103c:0:capture] -name=ATI SB450 HDA Audio (AD1981) -initialPreference=36 - -[pci:1002:437b:30b0:103c:0:playback] -name=ATI SB450 HDA Audio (AD1981) -initialPreference=36 - -# Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller HDA Intel AD198x Analog -[pci:8086:27d8:1631:c022:0:capture] -name=HDA Intel (AD1986A) -initialPreference=36 - -[pci:8086:27d8:1631:c022:0:playback] -name=HDA Intel (AD1986A) -initialPreference=36 - -[pci:8086:27d8:1631:c022:1:playback] -name=HDA Intel S/PDIF (AD1986A) -initialPreference=15 - -# Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller Dell HDA Intel STAC92xx Analog -[pci:8086:27d8:1028:01d8:0:capture] -name=HDA Intel (SigmaTel STAC9200) -initialPreference=36 - -[pci:8086:27d8:1028:01d8:0:playback] -name=HDA Intel (SigmaTel STAC9200) -initialPreference=36 - -[pci:8086:27d8:1028:01d8:1:capture] -name=HDA Intel S/PDIF (SigmaTel STAC9200) -initialPreference=15 - -[pci:8086:27d8:1028:01d8:1:playback] -name=HDA Intel S/PDIF (SigmaTel STAC9200) -initialPreference=15 - -# nVidia Corporation CK804 AC ASUSTeK Computer Inc. NVidia CK804 with ALC850 -[pci:10de:0059:1043:812a:0:capture] -name=NVidia CK804 with ALC850 -initialPreference=36 - -[pci:10de:0059:1043:812a:0:playback] -name=NVidia CK804 with ALC850 -initialPreference=36 - -[pci:10de:0059:1043:812a:2:playback] -name=NVidia CK804 with ALC850 S/PDIF -initialPreference=15 - -[pci:10de:0059:1043:812a:1:capture] -name=NVidia CK804 with ALC850 MIC ADC -initialPreference=25 - -# Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC Samsung Electronics Co Ltd Intel 82801DB-ICH4 with STAC9752,53 Intel 82801DB-ICH4 -[pci:8086:24c5:144d:c009:3:capture] -name=Intel AC97 ADC2 (SigmaTel STAC9752,53) -initialPreference=25 - -[pci:8086:24c5:144d:c009:4:playback] -name=Intel AC97 S/PDIF (SigmaTel STAC9752,53) -initialPreference=15 - -[pci:8086:24c5:144d:c009:2:capture] -name=Intel AC97 MIC2 ADC (SigmaTel STAC9752,53) -initialPreference=25 - -[pci:8086:24c5:144d:c009:1:capture] -name=Intel AC97 MIC ADC (SigmaTel STAC9752,53) -initialPreference=25 - -[pci:8086:24c5:144d:c009:0:capture] -name=Intel AC97 (SigmaTel STAC9752,53) -initialPreference=36 - -[pci:8086:24c5:144d:c009:0:playback] -name=Intel AC97 (SigmaTel STAC9752,53) -initialPreference=36 - -# Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller Intel Corporation HDA Intel STAC92xx -[pci:8086:27d8:8086:a201:0:capture] -name=HDA Intel (SigmaTel STAC9227) -initialPreference=36 - -[pci:8086:27d8:8086:a201:0:playback] -name=HDA Intel (SigmaTel STAC9227) -initialPreference=36 - -[pci:8086:27d8:8086:a201:1:capture] -name=HDA Intel S/PDIF (SigmaTel STAC9227) -initialPreference=15 - -[pci:8086:27d8:8086:a201:1:playback] -name=HDA Intel S/PDIF (SigmaTel STAC9227) -initialPreference=15 - -# Intel Corporation 82801I (ICH9 Family) HD Audio Controller ASUSTeK Computer Inc. HDA Intel ALC883Analog -[pci:8086:293e:1043:829f:0:capture] -name=HDA Intel (Realtek ALC883) -initialPreference=36 - -[pci:8086:293e:1043:829f:0:playback] -name=HDA Intel (Realtek ALC883) -initialPreference=36 - -[pci:8086:293e:1043:829f:1:playback] -name=HDA Intel S/PDIF (Realtek ALC883) -initialPreference=15 - -[pci:8086:293e:1043:829f:2:capture] -name=HDA Intel Unknown Device (Realtek ALC883) -initialPreference=10 - -# Creative Labs SB Live! EMU10k1 Creative Labs SBLive! Value [CT4832] (rev.8, serial:0x80271102) -[pci:1102:0002:1102:8027:0:capture] -name=SBLive! Value (rev.8) ADC Capture -initialPreference=36 - -[pci:1102:0002:1102:8027:0:playback] -name=SBLive! Value (rev.8) Standard PCM Playback -initialPreference=36 - -[pci:1102:0002:1102:8027:1:capture] -name=SBLive! Value (rev.8) Mic -initialPreference=25 - -[pci:1102:0002:1102:8027:2:capture] -name=SBLive! Value (rev.8) Multichannel Capture -initialPreference=10 - -[pci:1102:0002:1102:8027:2:playback] -name=SBLive! Value (rev.8) PPlayback -initialPreference=10 - -[pci:1102:0002:1102:8027:3:playback] -name=SBLive! Value (rev.8) Multichannel Playback -initialPreference=10 - diff --git a/phonon/kded-module/hardwaredatabase.cpp b/phonon/kded-module/hardwaredatabase.cpp deleted file mode 100644 index bb034890..00000000 --- a/phonon/kded-module/hardwaredatabase.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz - - 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 or version 3 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 "hardwaredatabase.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static const char CACHE_MAGIC[] = "PHwdbC"; -static const quint32 CACHE_VERSION = 2; -static const quint32 HEADER_LENGTH = 14; - -namespace PS -{ -namespace HardwareDatabase -{ - -class HardwareDatabasePrivate : public QObject -{ - public: - HardwareDatabasePrivate(); - void createCache(const QString &dbFileName, const QString &cacheFileName); - bool validCacheHeader(QDataStream &cacheStream); - Entry *readEntry(const QString &uniqueId); - - QCache entryCache; - - private: - QWeakPointer m_cacheFile; - QString m_fileName; -}; - -K_GLOBAL_STATIC(HardwareDatabasePrivate, s_globalDB) - -HardwareDatabasePrivate::HardwareDatabasePrivate() - : m_cacheFile() -{ - const QString dbFileName = KStandardDirs::locate("data", QLatin1String("libphonon/hardwaredatabase")); - if (dbFileName.isEmpty()) { - // no database, we're useless - return; - } - const QString cacheFileName = - KGlobal::mainComponent().dirs()->saveLocation("cache", QLatin1String("libphonon/")) - + QLatin1String("hardwaredatabase"); - const QFileInfo dbFileInfo(dbFileName); - const QFileInfo cacheFileInfo(cacheFileName); - if (!cacheFileInfo.exists() || cacheFileInfo.lastModified() < dbFileInfo.lastModified()) { - // update cache file - createCache(dbFileName, cacheFileName); - } else { - m_cacheFile = new QFile(cacheFileName); - m_cacheFile.data()->open(QIODevice::ReadOnly); - m_cacheFile.data()->deleteLater(); - QDataStream cacheStream(m_cacheFile.data()); - if (!validCacheHeader(cacheStream)) { - m_cacheFile.data()->close(); - delete m_cacheFile.data(); - createCache(dbFileName, cacheFileName); - } - } - m_fileName = cacheFileName; -} - -struct BucketEntry -{ - BucketEntry() {} - BucketEntry(const uint &a, const quint32 &b) : hash(a), offset(b) {} - uint hash; - quint32 offset; -}; - -QDataStream &operator<<(QDataStream &s, const BucketEntry &e) -{ - return s << e.hash << e.offset; -} - -QDataStream &operator>>(QDataStream &s, BucketEntry &e) -{ - return s >> e.hash >> e.offset; -} - -void HardwareDatabasePrivate::createCache(const QString &dbFileName, const QString &cacheFileName) -{ - KSaveFile cacheFile(cacheFileName); - QString name; - QString iconName; - int pref; - quint8 isAdvanced; - - const KConfig dbFile(dbFileName, KConfig::CascadeConfig); - const bool opened = cacheFile.open(); // QIODevice::WriteOnly - Q_ASSERT(opened); Q_UNUSED(opened); - QDataStream cacheStream(&cacheFile); - cacheStream.writeRawData(CACHE_MAGIC, 6); - cacheStream << CACHE_VERSION << cacheStream.version() << quint32(0) << quint32(0); - QStringList allIds = dbFile.groupList(); - QHash offsets; - offsets.reserve(allIds.count()); - foreach (const QString &uniqueId, allIds) { - offsets.insertMulti(qHash(uniqueId), cacheFile.pos()); - const KConfigGroup group = dbFile.group(uniqueId); - name = group.readEntry("name", QString()); - iconName = group.readEntry("icon", QString()); - pref = group.readEntry("initialPreference", 0); - if (group.hasKey("isAdvancedDevice")) { - isAdvanced = group.readEntry("isAdvancedDevice", false) ? 1 : 0; - } else { - isAdvanced = 2; - } - cacheStream << uniqueId << name << iconName << pref << isAdvanced; - } - //offsets.squeeze(); - const quint32 hashTableBuckets = offsets.capacity(); - const quint32 hashTableOffset = cacheFile.pos(); - QVector > bucketContents(hashTableBuckets); - { - QHashIterator it(offsets); - while (it.hasNext()) { - it.next(); - const uint &h = it.key(); - bucketContents[h % hashTableBuckets] << BucketEntry(h, it.value()); - } - offsets.clear(); - } - for (quint32 i = 0; i < hashTableBuckets; ++i) { - cacheStream << quint32(0); - } - QVarLengthArray bucketOffsets(hashTableBuckets); - for (quint32 i = 0; i < hashTableBuckets; ++i) { - if (bucketContents[i].isEmpty()) { - bucketOffsets[i] = 0; - } else { - bucketOffsets[i] = cacheFile.pos(); - cacheStream << bucketContents[i]; - } - } - bucketContents.clear(); - cacheFile.seek(hashTableOffset); - for (quint32 i = 0; i < hashTableBuckets; ++i) { - cacheStream << bucketOffsets[i]; - } - cacheFile.seek(HEADER_LENGTH); - cacheStream << hashTableOffset << hashTableBuckets; - cacheFile.close(); -} - -bool HardwareDatabasePrivate::validCacheHeader(QDataStream &cacheStream) -{ - char magic[6]; - quint32 version; - int datastreamVersion; - const int read = cacheStream.readRawData(magic, 6); - cacheStream >> version >> datastreamVersion; - return (read == 6 && 0 == strncmp(magic, CACHE_MAGIC, 6) && version == CACHE_VERSION && datastreamVersion == cacheStream.version()); -} - -Entry *HardwareDatabasePrivate::readEntry(const QString &uniqueId) -{ - QDataStream cacheStream; - if (m_cacheFile) { - if (m_cacheFile.data()->seek(HEADER_LENGTH)) { - cacheStream.setDevice(m_cacheFile.data()); - } else { - delete m_cacheFile.data(); - } - } - if (!m_cacheFile) { - m_cacheFile = new QFile(m_fileName); - m_cacheFile.data()->open(QIODevice::ReadOnly); - m_cacheFile.data()->deleteLater(); - cacheStream.setDevice(m_cacheFile.data()); - if (!validCacheHeader(cacheStream)) { - return 0; - } - } - quint32 hashTableOffset; - quint32 hashTableBuckets; - cacheStream >> hashTableOffset >> hashTableBuckets; - const uint h = qHash(uniqueId); - m_cacheFile.data()->seek(hashTableOffset + (h % hashTableBuckets) * sizeof(quint32)); - quint32 offset; - cacheStream >> offset; - //kDebug(601) << hashTableOffset << hashTableBuckets << uniqueId << h << offset; - if (0 == offset) { - return 0; - } - m_cacheFile.data()->seek(offset); - QList bucket; - cacheStream >> bucket; - - QString readUdi; - QString name; - QString iconName; - int pref; - quint8 isAdvanced; - - foreach (const BucketEntry &entry, bucket) { - if (entry.hash == h) { - m_cacheFile.data()->seek(entry.offset); - cacheStream >> readUdi; - if (readUdi == uniqueId) { - cacheStream >> name >> iconName >> pref >> isAdvanced; - Entry *e = new Entry(name, iconName, pref, isAdvanced); - s_globalDB->entryCache.insert(uniqueId, e); - return e; - } - } - } - - return 0; -} - -bool contains(const QString &uniqueId) -{ - return (s_globalDB->entryCache[uniqueId] || s_globalDB->readEntry(uniqueId)); -} - -Entry entryFor(const QString &uniqueId) -{ - Entry *e = s_globalDB->entryCache[uniqueId]; - if (e) { - return *e; - } - e = s_globalDB->readEntry(uniqueId); - if (e) { - return *e; - } - return Entry(); -} - -} // namespace HardwareDatabase -} // namespace PS diff --git a/phonon/kded-module/hardwaredatabase.h b/phonon/kded-module/hardwaredatabase.h deleted file mode 100644 index 89a562ee..00000000 --- a/phonon/kded-module/hardwaredatabase.h +++ /dev/null @@ -1,92 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz - - 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 or version 3 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 PS_HARDWAREDATABASE_H -#define PS_HARDWAREDATABASE_H - -#include - -namespace PS -{ - -/** - * The HardwareDatabase is used for Phonon to provide more information about devices than are - * provided through the underlying sound-system. - * This data is provided through the file `kde4-config --install data`/libphonon/hardwaredatabase. - * It uses a KConfig parsable format. - * - * The implementation here reads in all of that data and converts it to a cache that can be read in - * much faster, and must only be read where needed. - * - * Hardware is identified by a \c udi of the form - * ::::::[playback|capture] - * Since USB devices don't have the subsystem ids they are not used there. - */ -namespace HardwareDatabase -{ - class Entry; - class HardwareDatabasePrivate; - - /** - * Returns whether the hardware database has extra information about the given device. - */ - bool contains(const QString &udi); - - /** - * Returns the information in the hardware database for the given device. - */ - Entry entryFor(const QString &udi); - - class Entry - { - public: - /** - * The name to display to users. - */ - const QString name; - - /** - * Icon to use for this device. - */ - const QString iconName; - - /** - * Tells the initial preference in the device list. This determines default ordering of - * devices and can be used to make sure a default setup uses the correct audio devices. - */ - const int initialPreference; - - /** - * Whether this device should be shown as an advanced devices (terrible concept, I - * know :( ) - */ - const int isAdvanced; - - private: - friend class HardwareDatabasePrivate; - friend Entry entryFor(const QString &); - inline Entry(const QString &_name, const QString &_iconName, int _initialPreference, int _isAdvanced) - : name(_name), iconName(_iconName), initialPreference(_initialPreference), isAdvanced(_isAdvanced) {} - inline Entry() : initialPreference(0), isAdvanced(0) {} - }; -} // namespace HardwareDatabase - -} // namespace PS -#endif // PS_HARDWAREDATABASE_H diff --git a/phonon/kded-module/phononserver.cpp b/phonon/kded-module/phononserver.cpp deleted file mode 100644 index 31b51da8..00000000 --- a/phonon/kded-module/phononserver.cpp +++ /dev/null @@ -1,1187 +0,0 @@ -/* - Copyright (C) 2008 Matthias Kretz - Copyright (C) 2013 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. - - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. -*/ - -#include "phononserver.h" -#include "deviceinfo.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef QT_KATIE -#include -#endif -#include -#include -#include -#include -#include -#include // FIXME to Solid/Video, when it appears - -#include <../config-alsa.h> -#ifdef HAVE_LIBASOUND2 -#include -#endif // HAVE_LIBASOUND2 - -K_PLUGIN_FACTORY(PhononServerFactory, - registerPlugin(); - ) -K_EXPORT_PLUGIN(PhononServerFactory("phononserver")) - -using namespace Phonon; - - -PhononServer::PhononServer(QObject *parent, const QList &) - : KDEDModule(parent), - m_config(KSharedConfig::openConfig("phonondevicesrc", KConfig::SimpleConfig)) -{ - findDevices(); - connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceAdded(QString)), SLOT(deviceAdded(QString))); - connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceRemoved(QString)), SLOT(deviceRemoved(QString))); -} - -PhononServer::~PhononServer() -{ -} - -static QString uniqueId(const Solid::Device &device, int deviceNumber) -{ - Q_UNUSED(deviceNumber); - return device.udi(); -#if 0 - const Solid::GenericInterface *genericIface = device.as(); - Q_ASSERT(genericIface); - const QString &subsystem = genericIface->propertyExists(QLatin1String("info.subsystem")) ? - genericIface->property(QLatin1String("info.subsystem")).toString() : - genericIface->property(QLatin1String("linux.subsystem")).toString(); - if (subsystem == "pci") { - const QVariant vendor_id = genericIface->property("pci.vendor_id"); - if (vendor_id.isValid()) { - const QVariant product_id = genericIface->property("pci.product_id"); - if (product_id.isValid()) { - const QVariant subsys_vendor_id = genericIface->property("pci.subsys_vendor_id"); - if (subsys_vendor_id.isValid()) { - const QVariant subsys_product_id = genericIface->property("pci.subsys_product_id"); - if (subsys_product_id.isValid()) { - return QString("pci:%1:%2:%3:%4:%5") - .arg(vendor_id.toInt(), 4, 16, QLatin1Char('0')) - .arg(product_id.toInt(), 4, 16, QLatin1Char('0')) - .arg(subsys_vendor_id.toInt(), 4, 16, QLatin1Char('0')) - .arg(subsys_product_id.toInt(), 4, 16, QLatin1Char('0')) - .arg(deviceNumber); - } - } - } - } - } else if (subsystem == "usb" || subsystem == "usb_device") { - const QVariant vendor_id = genericIface->property("usb.vendor_id"); - if (vendor_id.isValid()) { - const QVariant product_id = genericIface->property("usb.product_id"); - if (product_id.isValid()) { - return QString("usb:%1:%2:%3") - .arg(vendor_id.toInt(), 4, 16, QLatin1Char('0')) - .arg(product_id.toInt(), 4, 16, QLatin1Char('0')) - .arg(deviceNumber); - } - } - } else { - // not the right device, need to look at the parent (but not at the top-level device in the - // device tree - that would be too far up the hierarchy) - if (device.parent().isValid() && device.parent().parent().isValid()) { - return uniqueId(device.parent(), deviceNumber); - } - } - return QString(); -#endif -} - -static void renameDevices(QList *devicelist) -{ - QHash cardNames; - foreach (const PS::DeviceInfo &dev, *devicelist) { - ++cardNames[dev.name()]; - } - - // Now look for duplicate names and rename those by appending the device number - QMutableListIterator it(*devicelist); - while (it.hasNext()) { - PS::DeviceInfo &dev = it.next(); - if (dev.deviceNumber() > 0 && cardNames.value(dev.name()) > 1) { - dev.setPreferredName(dev.name() + QLatin1String(" #") + QString::number(dev.deviceNumber())); - } - } -} - -struct DeviceHint -{ - QString name; - QString description; -}; - -static inline QDebug operator<<(QDebug &d, const DeviceHint &h) -{ - d.nospace() << h.name << " (" << h.description << ")"; - return d; -} - -void PhononServer::findVirtualDevices() -{ -#ifdef HAVE_LIBASOUND2 - QList deviceHints; - QHash playbackDevices; - QHash captureDevices; - - // update config to the changes on disc - snd_config_update_free_global(); - snd_config_update(); - - void **hints; - //snd_config_update(); - if (snd_device_name_hint(-1, "pcm", &hints) < 0) { - kDebug(601) << "snd_device_name_hint failed for 'pcm'"; - return; - } - - for (void **cStrings = hints; *cStrings; ++cStrings) { - DeviceHint nextHint; - char *x = snd_device_name_get_hint(*cStrings, "NAME"); - nextHint.name = QString::fromUtf8(x); - free(x); - - if (nextHint.name.isEmpty() || nextHint.name == "null") - continue; - - if (nextHint.name.startsWith(QLatin1String("front:")) || - nextHint.name.startsWith(QLatin1String("rear:")) || - nextHint.name.startsWith(QLatin1String("center_lfe:")) || - nextHint.name.startsWith(QLatin1String("surround40:")) || - nextHint.name.startsWith(QLatin1String("surround41:")) || - nextHint.name.startsWith(QLatin1String("surround50:")) || - nextHint.name.startsWith(QLatin1String("surround51:")) || - nextHint.name.startsWith(QLatin1String("surround71:"))) { - continue; - } - - x = snd_device_name_get_hint(*cStrings, "DESC"); - nextHint.description = QString::fromUtf8(x); - free(x); - - deviceHints << nextHint; - } - snd_device_name_free_hint(hints); - kDebug(601) << deviceHints; - - snd_config_update_free_global(); - snd_config_update(); - Q_ASSERT(snd_config); - foreach (const DeviceHint &deviceHint, deviceHints) { - const QString &alsaDeviceName = deviceHint.name; - const QString &description = deviceHint.description; - QString uniqueId = description; - //const QString &udi = alsaDeviceName; - bool isAdvanced = false; - - // Try to determine the card name - const QStringList &lines = description.split('\n'); - QString cardName = lines.first(); - - if (cardName.isEmpty()) { - int cardNameStart = alsaDeviceName.indexOf("CARD="); - int cardNameEnd; - - if (cardNameStart >= 0) { - cardNameStart += 5; - cardNameEnd = alsaDeviceName.indexOf(',', cardNameStart); - if (cardNameEnd < 0) - cardNameEnd = alsaDeviceName.count(); - - cardName = alsaDeviceName.mid(cardNameStart, cardNameEnd - cardNameStart); - } else { - cardName = i18nc("unknown sound card", "Unknown"); - } - } - - // Put a non-empty unique id if the description is empty - if (uniqueId.isEmpty()) { - uniqueId = cardName; - } - - // Add a description to the card name, if it exists - if (lines.size() > 1) { - cardName = i18nc("%1 is the sound card name, %2 is the description in case it exists", "%1 (%2)", cardName, lines[1]); - } - - bool playbackDevice = false; - bool captureDevice = false; - { - snd_pcm_t *pcm; - const QByteArray &deviceNameEnc = alsaDeviceName.toUtf8(); - if (0 == snd_pcm_open(&pcm, deviceNameEnc.constData(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK /*open mode: non-blocking, sync */)) { - playbackDevice = true; - snd_pcm_close(pcm); - } - if (0 == snd_pcm_open(&pcm, deviceNameEnc.constData(), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK /*open mode: non-blocking, sync */)) { - captureDevice = true; - snd_pcm_close(pcm); - } - } - - if (alsaDeviceName.startsWith(QLatin1String("front:")) || - alsaDeviceName.startsWith(QLatin1String("rear:")) || - alsaDeviceName.startsWith(QLatin1String("center_lfe:")) || - alsaDeviceName.startsWith(QLatin1String("surround40:")) || - alsaDeviceName.startsWith(QLatin1String("surround41:")) || - alsaDeviceName.startsWith(QLatin1String("surround50:")) || - alsaDeviceName.startsWith(QLatin1String("surround51:")) || - alsaDeviceName.startsWith(QLatin1String("surround71:")) || - alsaDeviceName.startsWith(QLatin1String("iec958:"))) { - isAdvanced = true; - } - - if (alsaDeviceName.startsWith(QLatin1String("front")) || - alsaDeviceName.startsWith(QLatin1String("center")) || - alsaDeviceName.startsWith(QLatin1String("rear")) || - alsaDeviceName.startsWith(QLatin1String("surround"))) { - captureDevice = false; - } - - QString iconName(QLatin1String("audio-card")); - int initialPreference = 30; - if (description.contains("headset", Qt::CaseInsensitive) || - description.contains("headphone", Qt::CaseInsensitive)) { - // it's a headset - if (description.contains("usb", Qt::CaseInsensitive)) { - iconName = QLatin1String("audio-headset-usb"); - initialPreference -= 10; - } else { - iconName = QLatin1String("audio-headset"); - initialPreference -= 10; - } - } else { - if (description.contains("usb", Qt::CaseInsensitive)) { - // it's an external USB device - iconName = QLatin1String("audio-card-usb"); - initialPreference -= 10; - } - } - - const PS::DeviceAccess access(QStringList(alsaDeviceName), 0, PS::DeviceAccess::AlsaDriver, - captureDevice, playbackDevice); - //dev.setUseCache(false); - if (playbackDevice) { - const PS::DeviceKey key = { uniqueId + QLatin1String("_playback"), -1, -1 }; - - if (playbackDevices.contains(key)) { - playbackDevices[key].addAccess(access); - } else { - PS::DeviceInfo dev(PS::DeviceInfo::Audio, cardName, iconName, key, initialPreference, isAdvanced); - dev.addAccess(access); - playbackDevices.insert(key, dev); - } - } - if (captureDevice) { - const PS::DeviceKey key = { uniqueId + QLatin1String("_capture"), -1, -1 }; - - if (captureDevices.contains(key)) { - captureDevices[key].addAccess(access); - } else { - PS::DeviceInfo dev(PS::DeviceInfo::Audio, cardName, iconName, key, initialPreference, isAdvanced); - dev.addAccess(access); - captureDevices.insert(key, dev); - } - } else { - if (!playbackDevice) { - kDebug(601) << deviceHint.name << " doesn't work."; - } - } - } - - m_audioOutputDevices << playbackDevices.values(); - m_audioCaptureDevices << captureDevices.values(); - - const QString etcFile(QLatin1String("/etc/asound.conf")); - const QString homeFile(QDir::homePath() + QLatin1String("/.asoundrc")); - const bool etcExists = QFile::exists(etcFile); - const bool homeExists = QFile::exists(homeFile); - if (etcExists || homeExists) { - static QFileSystemWatcher *watcher = 0; - if (!watcher) { - watcher = new QFileSystemWatcher(this); - connect(watcher, SIGNAL(fileChanged(QString)), SLOT(alsaConfigChanged())); - } - // QFileSystemWatcher stops monitoring after a file got removed. Many editors save files by - // writing to a temp file and moving it over the other one. QFileSystemWatcher seems to - // interpret that as removing and stops watching a file after it got modified by an editor. - if (etcExists && !watcher->files().contains(etcFile)) { - kDebug(601) << "setup QFileSystemWatcher for" << etcFile; - watcher->addPath(etcFile); - } - if (homeExists && !watcher->files().contains(homeFile)) { - kDebug(601) << "setup QFileSystemWatcher for" << homeFile; - watcher->addPath(homeFile); - } - } -#endif // HAVE_LIBASOUND2 -} - -void PhononServer::alsaConfigChanged() -{ - kDebug(601); - m_updateDevicesTimer.start(50, this); -} - -static void removeOssOnlyDevices(QList *list) -{ - QMutableListIterator it(*list); - while (it.hasNext()) { - const PS::DeviceInfo &dev = it.next(); - if (dev.isAvailable()) { - bool onlyOss = true; - foreach (const PS::DeviceAccess &a, dev.accessList()) { - if (a.driver() != PS::DeviceAccess::OssDriver) { - onlyOss = false; - break; - } - } - if (onlyOss) { - it.remove(); - } - } - } -} - -void PhononServer::findDevices() -{ -#ifndef QT_KATIE - if (Phonon::PulseSupport *pulse = Phonon::PulseSupport::getInstance()) { - // NOTE: This is relying on internal behavior.... - // enable internally simply sets a bool that is later && with the - // actually PA activity. - // Should this function ever start doing more, this will break horribly. - pulse->enable(); - if (pulse->isActive()) { - kDebug(601) << "Not looking for devices as Phonon::PulseSupport is active."; - return; - } - } -#endif - - // Fetch the full list of audio and video devices from Solid - const QList &solidAudioDevices = - Solid::Device::listFromQuery("AudioInterface.deviceType & 'AudioInput|AudioOutput'"); - const QList &solidVideoDevices = - Solid::Device::listFromType(Solid::DeviceInterface::Video); - - kDebug(601) << "Solid offers" << solidAudioDevices.count() << "audio devices"; - kDebug(601) << "Solid offers" << solidVideoDevices.count() << "video devices"; - - // Collections of PhononServer devices, to be extracted from the ones from Solid - QHash audioPlaybackDevices; - QHash audioCaptureDevices; - QHash videoCaptureDevices; - - QHash > listOfCardNumsPerUniqueId; - QStringList deviceIds; - int accessPreference; - PS::DeviceAccess::DeviceDriverType driver; - bool valid = true; - bool isAdvanced = false; - bool preferCardName = false; - - /* - * Process audio devices - */ - bool haveAlsaDevices = false; - foreach (const Solid::Device &hwDevice, solidAudioDevices) { - const Solid::AudioInterface *audioIface = hwDevice.as(); - - deviceIds.clear(); - accessPreference = 0; - driver = PS::DeviceAccess::InvalidDriver; - valid = true; - isAdvanced = false; - preferCardName = false; - int cardNum = -1; - int deviceNum = -1; - - kDebug(601) << "looking at device:" << audioIface->name() << audioIface->driverHandle(); - - bool capture = audioIface->deviceType() & Solid::AudioInterface::AudioInput; - bool playback = audioIface->deviceType() & Solid::AudioInterface::AudioOutput; - - switch (audioIface->driver()) { - case Solid::AudioInterface::UnknownAudioDriver: - valid = false; - break; - - case Solid::AudioInterface::Alsa: - if (audioIface->driverHandle().type() != QVariant::List) { - valid = false; - } else { - haveAlsaDevices = true; - // ALSA has better naming of the device than the corresponding OSS entry in HAL - preferCardName = true; - - const QList handles = audioIface->driverHandle().toList(); - if (handles.size() < 1) { - valid = false; - } else { - driver = PS::DeviceAccess::AlsaDriver; - accessPreference += 10; - - bool ok; - cardNum = handles.first().toInt(&ok); - if (!ok) { - cardNum = -1; - } - const QString &cardStr = handles.first().toString(); - // the first is either an int (card number) or a QString (card id) - QString x_phononId = QLatin1String("x-phonon:CARD=") + cardStr; - QString fallbackId = QLatin1String("plughw:CARD=") + cardStr; - if (handles.size() > 1 && handles.at(1).isValid()) { - deviceNum = handles.at(1).toInt(); - const QString deviceStr = handles.at(1).toString(); - if (deviceNum == 0) { - // prefer DEV=0 devices over DEV>0 - accessPreference += 1; - } else { - isAdvanced = true; - } - x_phononId += ",DEV=" + deviceStr; - fallbackId += ",DEV=" + deviceStr; - if (handles.size() > 2 && handles.at(2).isValid()) { - x_phononId += ",SUBDEV=" + handles.at(2).toString(); - fallbackId += ",SUBDEV=" + handles.at(2).toString(); - } - } - deviceIds << x_phononId << fallbackId; - } - } - break; - - case Solid::AudioInterface::OpenSoundSystem: - if (audioIface->driverHandle().type() != QVariant::String) { - valid = false; - } else { - const Solid::GenericInterface *genericIface = - hwDevice.as(); - Q_ASSERT(genericIface); - cardNum = genericIface->property("oss.card").toInt(); - deviceNum = genericIface->property("oss.device").toInt(); - driver = PS::DeviceAccess::OssDriver; - deviceIds << audioIface->driverHandle().toString(); - } - break; - } - - if (!valid || audioIface->soundcardType() == Solid::AudioInterface::Modem) { - continue; - } - - m_udisOfDevices.append(hwDevice.udi()); - - const PS::DeviceAccess devAccess(deviceIds, accessPreference, driver, capture, playback); - int initialPreference = 36 - deviceNum; - - QString uniqueIdPrefix = uniqueId(hwDevice, deviceNum); - // "fix" cards that have the same identifiers, i.e. there's no way for the computer to tell - // them apart. - // We see that there's a problematic case if the same uniqueIdPrefix has been used for a - // different cardNum before. In that case we need to append another number to the - // uniqueIdPrefix. The first different cardNum gets a :i1, the second :i2, and so on. - QList &cardsForUniqueId = listOfCardNumsPerUniqueId[uniqueIdPrefix]; - if (cardsForUniqueId.isEmpty()) { - cardsForUniqueId << cardNum; - } else if (!cardsForUniqueId.contains(cardNum)) { - cardsForUniqueId << cardNum; - uniqueIdPrefix += QString(":i%1").arg(cardsForUniqueId.size() - 1); - } else if (cardsForUniqueId.size() > 1) { - const int listIndex = cardsForUniqueId.indexOf(cardNum); - if (listIndex > 0) { - uniqueIdPrefix += QString(":i%1").arg(listIndex); - } - } - - const PS::DeviceKey pkey = { - uniqueIdPrefix + QLatin1String(":playback"), cardNum, deviceNum - }; - const bool needNewPlaybackDevice = playback && !audioPlaybackDevices.contains(pkey); - - const PS::DeviceKey ckey = { - uniqueIdPrefix + QLatin1String(":capture"), cardNum, deviceNum - }; - const bool needNewCaptureDevice = capture && !audioCaptureDevices.contains(ckey); - - if (needNewPlaybackDevice || needNewCaptureDevice) { - const QString &icon = hwDevice.icon(); - - // Adjust the device preference according to the soudcard type - switch (audioIface->soundcardType()) { - case Solid::AudioInterface::InternalSoundcard: - break; - case Solid::AudioInterface::UsbSoundcard: - initialPreference -= 10; - break; - case Solid::AudioInterface::FirewireSoundcard: - initialPreference -= 15; - break; - case Solid::AudioInterface::Headset: - initialPreference -= 10; - break; - case Solid::AudioInterface::Modem: - initialPreference -= 1000; - kWarning(601) << "Modem devices should never show up!"; - break; - } - - if (needNewPlaybackDevice) { - PS::DeviceInfo dev(PS::DeviceInfo::Audio, audioIface->name(), icon, pkey, initialPreference, isAdvanced); - dev.addAccess(devAccess); - audioPlaybackDevices.insert(pkey, dev); - } - - if (needNewCaptureDevice) { - PS::DeviceInfo dev(PS::DeviceInfo::Audio, audioIface->name(), icon, ckey, initialPreference, isAdvanced); - dev.addAccess(devAccess); - audioCaptureDevices.insert(ckey, dev); - } - } - - if (!needNewPlaybackDevice && playback) { - PS::DeviceInfo &dev = audioPlaybackDevices[pkey]; - if (preferCardName) { - dev.setPreferredName(audioIface->name()); - } - dev.addAccess(devAccess); - } - - if (!needNewCaptureDevice && capture) { - PS::DeviceInfo &dev = audioCaptureDevices[ckey]; - if (preferCardName) { - dev.setPreferredName(audioIface->name()); - } - dev.addAccess(devAccess); - } - } - - m_audioOutputDevices = audioPlaybackDevices.values(); - m_audioCaptureDevices = audioCaptureDevices.values(); - - 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 - // though it doesn't actually know that). - removeOssOnlyDevices(&m_audioOutputDevices); - removeOssOnlyDevices(&m_audioCaptureDevices); - } - - /* - * Process video devices - */ - foreach (const Solid::Device &hwDevice, solidVideoDevices) { - const Solid::Video *videoDevice = hwDevice.as(); - const Solid::Block *blockDevice = hwDevice.as(); - - if (!videoDevice || !blockDevice) - continue; - - if (videoDevice->supportedDrivers().isEmpty()) { - continue; - } - - kDebug(601) << "Solid video device:" << hwDevice.product() << hwDevice.description(); - foreach (const QString & driverName, videoDevice->supportedDrivers()) { - kDebug(601) << "- driver" << driverName << ":" << videoDevice->driverHandle(driverName); - } - - // Iterate through the supported drivers to create different access objects for each one - foreach (const QString & driverName, videoDevice->supportedDrivers()) { - deviceIds.clear(); - accessPreference = 0; - driver = PS::DeviceAccess::InvalidDriver; - isAdvanced = false; - - QVariant handle = videoDevice->driverHandle(driverName); - - if (handle.isValid()) { - kDebug(601) << driverName << "valid handle, type" << handle.typeName(); - } else { - kDebug(601) << driverName << "no driver handle"; - } - - if (hwDevice.udi().contains(QLatin1String("video4linux"))) { - driver = PS::DeviceAccess::Video4LinuxDriver; - deviceIds << blockDevice->device(); - } - accessPreference += 20; - - if (handle.isValid()) - deviceIds << handle.toString(); - - /* - * TODO Check v4l docs or something to see if there's anything - * else to do here - */ - - m_udisOfDevices.append(hwDevice.udi()); - - PS::DeviceAccess devAccess(deviceIds, accessPreference, driver, true, false); - devAccess.setPreferredDriverName(QString("%1 (%2)").arg(devAccess.driverName(), driverName)); - int initialPreference = 50; - - const PS::DeviceKey key = { uniqueId(hwDevice, -1), -1, -1 }; - const bool needNewDevice = !videoCaptureDevices.contains(key); - - if (needNewDevice) { - const QString &icon = hwDevice.icon(); - - // TODO Tweak initial preference using info from Solid - - // Create a new video capture device - PS::DeviceInfo dev(PS::DeviceInfo::Video, hwDevice.product(), icon, key, initialPreference, isAdvanced); - dev.addAccess(devAccess); - videoCaptureDevices.insert(key, dev); - } else { - PS::DeviceInfo &dev = videoCaptureDevices[key]; - dev.addAccess(devAccess); - } - } - } - - m_videoCaptureDevices = videoCaptureDevices.values(); - - /* Now that we know about the hardware let's see what virtual devices we can find in - * ~/.asoundrc and /etc/asound.conf - */ - findVirtualDevices(); - - QSet alreadyFoundCards; - foreach (const PS::DeviceInfo &dev, m_audioOutputDevices) { - alreadyFoundCards.insert(QLatin1String("AudioDevice_") + dev.key().uniqueId); - } - - foreach (const PS::DeviceInfo &dev, m_audioCaptureDevices) { - alreadyFoundCards.insert(QLatin1String("AudioDevice_") + dev.key().uniqueId); - } - - foreach (const PS::DeviceInfo &dev, m_videoCaptureDevices) { - alreadyFoundCards.insert(QLatin1String("VideoDevice_") + dev.key().uniqueId); - } - - // now look in the config file for disconnected devices - const QStringList &groupList = m_config->groupList(); - QStringList askToRemoveAudio; - QStringList askToRemoveVideo; - QList askToRemoveAudioIndexes; - QList askToRemoveVideoIndexes; - - kDebug(601) << "groups:" << groupList; - kDebug(601) << "already found devices:" << alreadyFoundCards; - - foreach (const QString &groupName, groupList) { - if (alreadyFoundCards.contains(groupName)) { - continue; - } - - kDebug(601) << "group not found:" << groupName; - - const bool isAudio = groupName.startsWith(QLatin1String("AudioDevice_")); - const bool isVideo = groupName.startsWith(QLatin1String("VideoDevice_")); - const bool isPlayback = isAudio && groupName.endsWith(QLatin1String("playback")); - const bool isCapture = isAudio && groupName.endsWith(QLatin1String("capture")); - - if (!isAudio && !isVideo) { - continue; - } - - if (isAudio && (!isPlayback && !isCapture)) { - // this entry shouldn't be here - m_config->deleteGroup(groupName); - } - - const KConfigGroup cGroup(m_config, groupName); - if (cGroup.readEntry("deleted", false)) { - continue; - } - - const QString &cardName = cGroup.readEntry("cardName", QString()); - const QString &iconName = cGroup.readEntry("iconName", QString()); - const bool hotpluggable = cGroup.readEntry("hotpluggable", true); - const int initialPreference = cGroup.readEntry("initialPreference", 0); - const int isAdvanced = cGroup.readEntry("isAdvanced", true); - const int deviceNumber = cGroup.readEntry("deviceNumber", -1); - const PS::DeviceKey key = { groupName.mid(12), -1, deviceNumber }; - const PS::DeviceInfo dev(PS::DeviceInfo::Audio, cardName, iconName, key, initialPreference, isAdvanced); - - if (!hotpluggable) { - const QSettings phononSettings(QLatin1String("kde.org"), QLatin1String("libphonon")); - if (isAdvanced && phononSettings.value(QLatin1String("General/HideAdvancedDevices"), true).toBool()) { - dev.removeFromCache(m_config); - continue; - } else { - if (isAudio) { - askToRemoveAudio << (isPlayback ? i18n("Output: %1", cardName) : i18n("Capture: %1", cardName)); - askToRemoveAudioIndexes << cGroup.readEntry("index", 0); - } - - if (isVideo) { - askToRemoveVideo << i18n("Video: %1", cardName); - askToRemoveVideoIndexes << cGroup.readEntry("index", 0); - } - } - } - - if (isPlayback) { - m_audioOutputDevices << dev; - } - - if (isCapture) { - m_audioCaptureDevices << dev; - } - - if (isVideo) { - m_videoCaptureDevices << dev; - } - - alreadyFoundCards.insert(groupName); - } - - if (!askToRemoveAudio.isEmpty()) { - qSort(askToRemoveAudio); - QMetaObject::invokeMethod(this, "askToRemoveDevices", Qt::QueuedConnection, - Q_ARG(QStringList, askToRemoveAudio), - Q_ARG(int, AudioOutputDeviceType | AudioCaptureDeviceType), - Q_ARG(QList, askToRemoveAudioIndexes)); - } - - if (!askToRemoveVideo.isEmpty()) { - qSort(askToRemoveVideo); - QMetaObject::invokeMethod(this, "askToRemoveDevices", Qt::QueuedConnection, - Q_ARG(QStringList, askToRemoveVideo), - Q_ARG(int, VideoCaptureDeviceType), - Q_ARG(QList, askToRemoveVideoIndexes)); - } - - renameDevices(&m_audioOutputDevices); - renameDevices(&m_audioCaptureDevices); - renameDevices(&m_videoCaptureDevices); - - qSort(m_audioOutputDevices); - qSort(m_audioCaptureDevices); - qSort(m_videoCaptureDevices); - - QMutableListIterator it(m_audioOutputDevices); - while (it.hasNext()) { - it.next().syncWithCache(m_config); - } - - it = m_audioCaptureDevices; - while (it.hasNext()) { - it.next().syncWithCache(m_config); - } - - it = m_videoCaptureDevices; - while (it.hasNext()) { - it.next().syncWithCache(m_config); - } - - m_config->sync(); - - kDebug(601) << "Audio Playback Devices:" << m_audioOutputDevices; - kDebug(601) << "Audio Capture Devices:" << m_audioCaptureDevices; - kDebug(601) << "Video Capture Devices:" << m_videoCaptureDevices; -} - -QByteArray PhononServer::audioDevicesIndexes(int type) -{ - QByteArray *v; - - switch (type) { - case AudioOutputDeviceType: - v = &m_audioOutputDevicesIndexesCache; - break; - case AudioCaptureDeviceType: - v = &m_audioCaptureDevicesIndexesCache; - break; - default: - return QByteArray(); - } - - if (v->isEmpty()) { - updateDevicesCache(); - } - - return *v; -} - -QByteArray PhononServer::videoDevicesIndexes(int type) -{ - if (type != VideoCaptureDeviceType) - return QByteArray(); - - if (m_videoCaptureDevicesIndexesCache.isEmpty()) { - updateDevicesCache(); - } - - return m_videoCaptureDevicesIndexesCache; -} - -QByteArray PhononServer::audioDevicesProperties(int index) -{ - if (m_audioOutputDevicesIndexesCache.isEmpty() || m_audioCaptureDevicesIndexesCache.isEmpty()) { - updateDevicesCache(); - } - - if (m_audioDevicesPropertiesCache.contains(index)) { - return m_audioDevicesPropertiesCache.value(index); - } - - return QByteArray(); -} - -QByteArray PhononServer::videoDevicesProperties(int index) -{ - if (m_videoCaptureDevicesIndexesCache.isEmpty()) { - updateDevicesCache(); - } - - if (m_videoDevicesPropertiesCache.contains(index)) { - return m_videoDevicesPropertiesCache.value(index); - } - - return QByteArray(); -} - -bool PhononServer::isAudioDeviceRemovable(int index) const -{ - if (!m_audioDevicesPropertiesCache.contains(index)) { - return false; - } - - const QList &deviceList = m_audioOutputDevices + m_audioCaptureDevices; - foreach (const PS::DeviceInfo &dev, deviceList) { - if (dev.index() == index) { - return !dev.isAvailable(); - } - } - - return false; -} - -bool PhononServer::isVideoDeviceRemovable(int index) const -{ - if (!m_videoDevicesPropertiesCache.contains(index)) { - return false; - } - - foreach (const PS::DeviceInfo &dev, m_videoCaptureDevices) { - if (dev.index() == index) { - return !dev.isAvailable(); - } - } - - return false; -} - -void PhononServer::removeAudioDevices(const QList &indexes) -{ - const QList &deviceList = m_audioOutputDevices + m_audioCaptureDevices; - foreach (int index, indexes) { - foreach (const PS::DeviceInfo &dev, deviceList) { - if (dev.index() == index) { - if (!dev.isAvailable()) { - dev.removeFromCache(m_config); - } - break; - } - } - } - - m_config->sync(); - m_updateDevicesTimer.start(50, this); -} - -void PhononServer::removeVideoDevices(const QList< int >& indexes) -{ - foreach (int index, indexes) { - foreach (const PS::DeviceInfo &dev, m_videoCaptureDevices) { - if (dev.index() == index) { - if (!dev.isAvailable()) { - dev.removeFromCache(m_config); - } - break; - } - } - } - - m_config->sync(); - m_updateDevicesTimer.start(50, this); -} - -static inline QByteArray nameForDriver(PS::DeviceAccess::DeviceDriverType d) -{ - switch (d) { - case PS::DeviceAccess::AlsaDriver: - return "alsa"; - case PS::DeviceAccess::OssDriver: - return "oss"; - case PS::DeviceAccess::JackdDriver: - return "jackd"; - case PS::DeviceAccess::Video4LinuxDriver: - return "v4l2"; - case PS::DeviceAccess::InvalidDriver: - break; - } - Q_ASSERT_X(false, "nameForDriver", "unknown driver"); - return ""; -} - -template -inline static QByteArray streamToByteArray(const T &data) -{ - QByteArray r; - QDataStream stream(&r, QIODevice::WriteOnly); - stream << data; - return r; -} - -inline static void insertGenericProperties(const PS::DeviceInfo &dev, QHash &p) -{ - p.insert("name", dev.name()); - p.insert("description", dev.description()); - p.insert("available", dev.isAvailable()); - p.insert("initialPreference", dev.initialPreference()); - p.insert("isAdvanced", dev.isAdvanced()); - p.insert("icon", dev.icon()); - p.insert("discovererIcon", "kde"); -} - -inline static void insertDALProperty(const PS::DeviceInfo &dev, QHash &p) -{ - DeviceAccessList deviceAccessList; - foreach (const PS::DeviceAccess &access, dev.accessList()) { - const QByteArray &driver = nameForDriver(access.driver()); - foreach (const QString &deviceId, access.deviceIds()) { - deviceAccessList << DeviceAccess(driver, deviceId); - } - } - - p.insert("deviceAccessList", QVariant::fromValue(deviceAccessList)); -} - -void PhononServer::updateDevicesCache() -{ - QList indexList; - foreach (const PS::DeviceInfo &dev, m_audioOutputDevices) { - QHash properties; - insertGenericProperties(dev, properties); - - DeviceAccessList deviceAccessList; - bool first = true; - QStringList oldDeviceIds; - PS::DeviceAccess::DeviceDriverType driverId = PS::DeviceAccess::InvalidDriver; - foreach (const PS::DeviceAccess &access, dev.accessList()) { - const QByteArray &driver = nameForDriver(access.driver()); - if (first) { - driverId = access.driver(); - // Phonon 4.2 compatibility - properties.insert("driver", driver); - first = false; - } - foreach (const QString &deviceId, access.deviceIds()) { - if (access.driver() == driverId) { - oldDeviceIds << deviceId; - } - deviceAccessList << DeviceAccess(driver, deviceId); - } - } - - properties.insert("deviceAccessList", QVariant::fromValue(deviceAccessList)); - - // Phonon 4.2 compatibility - properties.insert("deviceIds", oldDeviceIds); - - indexList << dev.index(); - m_audioDevicesPropertiesCache.insert(dev.index(), streamToByteArray(properties)); - } - m_audioOutputDevicesIndexesCache = streamToByteArray(indexList); - - indexList.clear(); - foreach (const PS::DeviceInfo &dev, m_audioCaptureDevices) { - QHash properties; - insertGenericProperties(dev, properties); - insertDALProperty(dev, properties); - - indexList << dev.index(); - m_audioDevicesPropertiesCache.insert(dev.index(), streamToByteArray(properties)); - } - m_audioCaptureDevicesIndexesCache = streamToByteArray(indexList); - - indexList.clear(); - foreach (const PS::DeviceInfo &dev, m_videoCaptureDevices) { - QHash properties; - insertGenericProperties(dev, properties); - insertDALProperty(dev, properties); - - indexList << dev.index(); - m_videoDevicesPropertiesCache.insert(dev.index(), streamToByteArray(properties)); - } - m_videoCaptureDevicesIndexesCache = streamToByteArray(indexList); -} - -void PhononServer::deviceAdded(const QString &udi) -{ - kDebug(601) << udi; - m_updateDevicesTimer.start(50, this); -} - -void PhononServer::timerEvent(QTimerEvent *e) -{ - if (e->timerId() == m_updateDevicesTimer.timerId()) { - m_updateDevicesTimer.stop(); - m_audioOutputDevices.clear(); - m_audioCaptureDevices.clear(); - m_videoCaptureDevices.clear(); - m_udisOfDevices.clear(); - findDevices(); - m_audioOutputDevicesIndexesCache.clear(); - m_audioCaptureDevicesIndexesCache.clear(); - m_videoCaptureDevicesIndexesCache.clear(); - - QDBusMessage signal = QDBusMessage::createSignal("/modules/phononserver", "org.kde.PhononServer", "devicesChanged"); - QDBusConnection::sessionBus().send(signal); - } -} - -void PhononServer::deviceRemoved(const QString &udi) -{ - kDebug(601) << udi; - if (m_udisOfDevices.contains(udi)) { - m_updateDevicesTimer.start(50, this); - } -} - -void PhononServer::askToRemoveDevices(const QStringList &devList, int type, const QList< int >& indexes) -{ - bool areAudio = type & (AudioOutputDeviceType | AudioCaptureDeviceType); - bool areVideo = type & VideoCaptureDeviceType; - - if (!areAudio && !areVideo) - return; - - const QString &dontEverAsk = QLatin1String("phonon_always_forget_devices"); - const QString &dontAskAgainName = QLatin1String("phonon_forget_devices_") + - devList.join(QLatin1String("_")); - - // Please note that dontEverAsk overrides the device specific lists - // i.e. if it is set we always return - KMessageBox::ButtonCode result; - if (!KMessageBox::shouldBeShownYesNo(dontEverAsk, result) || - !KMessageBox::shouldBeShownYesNo(dontAskAgainName, result)) { - if (result == KMessageBox::Yes) { - if (areAudio) { - kDebug(601) << "removeAudioDevices" << indexes; - removeAudioDevices(indexes); - } - - if (areVideo) { - kDebug(601) << "removeVideoDevices" << indexes; - removeVideoDevices(indexes); - } - } - return; - } - - class MyDialog: public KDialog - { - public: - MyDialog() : KDialog(0, Qt::Dialog) {} - - protected: - virtual void slotButtonClicked(int button) - { - if (button == KDialog::User1) { - kDebug(601) << "start kcm_phonon"; - KProcess::startDetached(QLatin1String("kcmshell4"), QStringList(QLatin1String("kcm_phonon"))); - reject(); - } else { - KDialog::slotButtonClicked(button); - } - } - } *dialog = new MyDialog; - dialog->setPlainCaption(areAudio ? i18n("Removed Sound Devices") : i18n("Removed Video Devices")); - dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::User1); - KIcon icon(areAudio ? "audio-card" : "camera-web"); - dialog->setWindowIcon(icon); - dialog->setModal(false); - KGuiItem yes(KStandardGuiItem::yes()); - yes.setToolTip(areAudio ? i18n("Forget about the sound devices.") : i18n("Forget about the video devices")); - dialog->setButtonGuiItem(KDialog::Yes, yes); - dialog->setButtonGuiItem(KDialog::No, KStandardGuiItem::no()); - dialog->setButtonGuiItem(KDialog::User1, KGuiItem(i18nc("short string for a button, it opens " - "the Phonon page of System Settings", "Manage Devices"), - KIcon("preferences-system"), - i18n("Open the System Settings page for device configuration where you can " - "manually remove disconnected devices from the cache."))); - dialog->setEscapeButton(KDialog::No); - dialog->setDefaultButton(KDialog::User1); - - bool checkboxResult = false; - int res = KMessageBox::createKMessageBox(dialog, icon, - i18n("

    KDE detected that one or more internal devices were removed.

    " - "

    Do you want KDE to permanently forget about these devices?

    " - "

    This is the list of devices KDE thinks can be removed:

    • %1

    ", - devList.join(QLatin1String("
  • "))), - QStringList(), - i18n("Do not ask again for these devices"), - &checkboxResult, KMessageBox::Notify); - - result = (res == KDialog::Yes ? KMessageBox::Yes : KMessageBox::No); - if (result == KMessageBox::Yes) { - if (areAudio) { - kDebug(601) << "removeAudioDevices" << indexes; - removeAudioDevices(indexes); - } - - if (areVideo) { - kDebug(601) << "removeVideoDevices" << indexes; - removeVideoDevices(indexes); - } - } - - if (checkboxResult) { - KMessageBox::saveDontShowAgainYesNo(dontAskAgainName, result); - } -} diff --git a/phonon/kded-module/phononserver.desktop b/phonon/kded-module/phononserver.desktop deleted file mode 100644 index b48d9615..00000000 --- a/phonon/kded-module/phononserver.desktop +++ /dev/null @@ -1,141 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=phononserver -X-KDE-DBus-ModuleName=phononserver -X-KDE-Kded-autoload=false -X-KDE-Kded-load-on-demand=true -Name=Sound Policy -Name[ar]=سياسة الصوت -Name[ast]=Política de soníu -Name[bg]=Звукова политика -Name[bn]=সাউণ্ড পলিসি -Name[bs]=Smjernice zvuka -Name[ca]=Política de so -Name[ca@valencia]=Política de so -Name[cs]=Chování zvuku -Name[da]=Lydpolitik -Name[de]=Audioregelungen -Name[el]=Πολιτική ήχου -Name[en_GB]=Sound Policy -Name[eo]=Politiko de sono -Name[es]=Política de sonido -Name[et]=Helireeglid -Name[eu]=Soinu-politika -Name[fa]=سیاست صوتی -Name[fi]=Äänikäytäntö -Name[fr]=Politique des sons -Name[ga]=Polasaí Fuaime -Name[gl]=Política de son -Name[gu]=ધ્વનિ નિતી -Name[he]=מדיניות שמע -Name[hi]=ध्वनि पोलिसी -Name[hr]=Pravila za zvuk -Name[hu]=Hangrendszer irányelv -Name[ia]=Politica de Sono -Name[id]=Kebijakan Suara -Name[is]=Stjórnun hljóðmeðhöndlunar -Name[it]=Gestione del suono -Name[ja]=サウンドポリシー -Name[kk]=Дыбыс ережелері -Name[km]=​គោលនយោបាយ​សំឡេង -Name[kn]=ಧ್ವನಿ ಕಾರ್ಯನೀತಿ (ಪಾಲಿಸಿ) -Name[ko]=소리 정책 -Name[lt]=Garso nuostatų tipas -Name[lv]=Skaņu politika -Name[ml]=ശബ്ദ നയം -Name[mr]=आवाज धोरण -Name[nb]=Lydpraksis -Name[nds]=Klangregeln -Name[nl]=Beleid voor geluid -Name[nn]=Lydpraksis -Name[pa]=ਸਾਊਂਡ ਪਾਲਸੀ -Name[pl]=Zarządzanie dźwiękiem -Name[pt]=Política de Som -Name[pt_BR]=Política de som -Name[ro]=Politică de sunet -Name[ru]=Звуковой сервер -Name[si]=ශ්‍රව්‍ය ප්‍රතිපත්තිය -Name[sk]=Politika zvuku -Name[sl]=Pravilnik za zvok -Name[sr]=Смернице звука -Name[sr@ijekavian]=Смјернице звука -Name[sr@ijekavianlatin]=Smjernice zvuka -Name[sr@latin]=Smernice zvuka -Name[sv]=Ljudpolicy -Name[tg]=Идоракунии овозҳо -Name[th]=ข้อกำหนดระบบเสียง -Name[tr]=Ses Politikası -Name[ug]=ئاۋاز تەدبىرى -Name[uk]=Правила доступу до звукових пристроїв -Name[vi]=Chế độ âm thanh -Name[wa]=Politike do son -Name[x-test]=xxSound Policyxx -Name[zh_CN]=声音策略 -Name[zh_TW]=音效政策 -Comment=Provides sound system policy to applications -Comment[ar]=يوفر سياسة نظام الصوت للبرامج -Comment[ast]=Ufre les polítiques de soníu del sistema a les aplicaciones -Comment[bg]=Предоставяне на правила за звукова системата на приложенията -Comment[bs]=Ispostavlja programima smjernice zvučnog sistema -Comment[ca]=Proporciona la política del sistema de so a les aplicacions -Comment[ca@valencia]=Proporciona la política del sistema de so a les aplicacions -Comment[cs]=Poskytuje aplikacím systémové zásady pro zvuk -Comment[da]=Giver lydsystem-politik til programmer -Comment[de]=Audiosystemregeln den Anwendungen zur Verfügung stellen -Comment[el]=Παρέχει την πολιτική ήχου του συστήματος στις εφαρμογές -Comment[en_GB]=Provides sound system policy to applications -Comment[eo]=Ĝi provizas sisteman politikon de sono al aplikaĵoj -Comment[es]=Proporciona políticas de sonido del sistema a las aplicaciones -Comment[et]=Helisüsteemi reeglite edastamine rakendustele -Comment[eu]=Soinu-sistemaren politika adierazten die aplikazioei -Comment[fi]=Tarjoaa äänijärjestelmäkäytännön sovelluksille -Comment[fr]=Fournit une politique de système sonore aux applications -Comment[ga]=Soláthraíonn sé polasaí fuaime d'fheidhmchláir -Comment[gl]=Fornece a política so sistema de son aos programas -Comment[gu]=કાર્યક્રમોને ધ્વનિ સિસ્ટમ નિતી પૂરી પાડે છે -Comment[he]=מספק מדיניות מערכת השמע עבור יישומים -Comment[hi]=अनुप्रयोगों के लिए ध्वनि प्रणाली नीति उपलब्ध कराता है -Comment[hr]=Omogućuje aplikacijama pristup pravilima zvučnog sustava -Comment[hu]=Hangrendszer irányelv biztosítása alkalmazásokhoz -Comment[ia]=Il forni le politica de sono del systema a le applicationes -Comment[id]=Menyediakan kebijakan sistem suara untuk aplikasi -Comment[is]=Þjónn sem stýrir hljóðmeðhöndlun forrita -Comment[it]=Dà le linee guida di sistema per il suono alle applicazioni -Comment[ja]=アプリケーションにサウンドシステムポリシーを提供します -Comment[kk]=Қолданбаларға арналған дыбыс шығару ережелері -Comment[km]=ផ្ដល់​គោលការណ៍​ប្រព័ន្ធ​សំឡេង​ឲ្យ​កម្មវិធី -Comment[kn]=ಧ್ವನಿ ವ್ಯವಸ್ಥೆಯ ಕಾರ್ಯನೀತಿಯನ್ನು ಅನ್ವಯಗಳಿಗೆ ಒದಗಿಸುತ್ತದೆ. -Comment[ko]=프로그램에 소리 정책을 알려 줍니다 -Comment[lt]=Nurodo programoms garso nuostatų tipą -Comment[lv]=Nodrošina skaņas sistēmas politiku priekš programmām -Comment[mr]=अनुप्रयोगास आवाज प्रणाली धोरण आखुन देतो -Comment[nb]=Forsyner programmer med systemets lydpraksis -Comment[nds]=Stellt Klangregeln för Programmen praat. -Comment[nl]=Levert het systeembeleid aan applicaties voor het geluid -Comment[nn]=Gjev programma lydpraksis -Comment[pa]=ਐਪਲੀਕੇਸ਼ਨਾਂ ਨੂੰ ਸਾਊਂਡ ਸਿਸਟਮ ਪਾਲਸੀ ਦਿੰਦਾ ਹੈ -Comment[pl]=Sposób udostępniania systemu dźwięku programom -Comment[pt]=Fornece uma política do sistema de som para as aplicações -Comment[pt_BR]=Fornece uma política do sistema de som para os aplicativos -Comment[ro]=Oferă applicațiilor politica sistemului de sunet -Comment[ru]=Правила доступа к звуковой системе для приложений -Comment[si]=යෙදුම් වලට ශ්‍රව්‍ය පද්ධති ප්‍රතිපත්ති සපයයි -Comment[sk]=Poskytuje systémovú politiku zvuku aplikáciám -Comment[sl]=Programom omogoča dostop do sistemskih pravilnikov za zvok -Comment[sr]=Испоставља програмима смернице звучног система -Comment[sr@ijekavian]=Испоставља програмима смјернице звучног система -Comment[sr@ijekavianlatin]=Ispostavlja programima smjernice zvučnog sistema -Comment[sr@latin]=Ispostavlja programima smernice zvučnog sistema -Comment[sv]=Tillhandahåller systemets ljudpolicy till program -Comment[tg]=Имконоти овози системаро дар барномаҳо идора мекунад -Comment[th]=กำหนดข้อนโยบายของระบบเสียงให้กับโปรแกรมต่าง ๆ -Comment[tr]=Uygulamalara ses sistemi politikası sunar -Comment[ug]=پروگراممىغا ئاۋاز سىستېما تەدبىرى بىلەن تەمىنلەيدۇ -Comment[uk]=Права доступу до звукової системи для програм -Comment[vi]=Cung cấp chế độ âm thanh hệ thống cho các ứng dụng -Comment[wa]=Dene åzès programes li politike do son do sistinme -Comment[x-test]=xxProvides sound system policy to applicationsxx -Comment[zh_CN]=为应用程序提供系统声音策略 -Comment[zh_TW]=提供音效系統政策給應用程式 - diff --git a/phonon/kded-module/phononserver.h b/phonon/kded-module/phononserver.h deleted file mode 100644 index a3a0bc1c..00000000 --- a/phonon/kded-module/phononserver.h +++ /dev/null @@ -1,88 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2008 Matthias Kretz - - 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. - - 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, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - -*/ - -#ifndef PHONONSERVER_H -#define PHONONSERVER_H - -#include "deviceinfo.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -class PhononServer : public KDEDModule -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.PhononServer") - public: - PhononServer(QObject *parent, const QList &args); - ~PhononServer(); - - public slots: - Q_SCRIPTABLE QByteArray audioDevicesIndexes(int type); - Q_SCRIPTABLE QByteArray videoDevicesIndexes(int type); - Q_SCRIPTABLE QByteArray audioDevicesProperties(int index); - Q_SCRIPTABLE QByteArray videoDevicesProperties(int index); - Q_SCRIPTABLE bool isAudioDeviceRemovable(int index) const; - Q_SCRIPTABLE bool isVideoDeviceRemovable(int index) const; - Q_SCRIPTABLE void removeAudioDevices(const QList &indexes); - Q_SCRIPTABLE void removeVideoDevices(const QList &indexes); - - protected: - void timerEvent(QTimerEvent *e); - - private slots: - void deviceAdded(const QString &udi); - void deviceRemoved(const QString &udi); - // TODO add callbacks for Jack changes and whatever else, if somehow possible (Pulse handled by libphonon) - - void alsaConfigChanged(); - - void askToRemoveDevices(const QStringList &devList, int type, const QList &indexes); - - private: - void findDevices(); - void findVirtualDevices(); - void updateDevicesCache(); - - KSharedConfigPtr m_config; - QBasicTimer m_updateDevicesTimer; - - // cache - QByteArray m_audioOutputDevicesIndexesCache; - QByteArray m_audioCaptureDevicesIndexesCache; - QByteArray m_videoCaptureDevicesIndexesCache; - QHash m_audioDevicesPropertiesCache; - QHash m_videoDevicesPropertiesCache; - - // devices ordered by preference - QList m_audioOutputDevices; - QList m_audioCaptureDevices; - QList m_videoCaptureDevices; - - QStringList m_udisOfDevices; -}; - -#endif // PHONONSERVER_H diff --git a/phonon/org.kde.Phonon.ServiceRegistry.xml b/phonon/org.kde.Phonon.ServiceRegistry.xml deleted file mode 100644 index 49eef565..00000000 --- a/phonon/org.kde.Phonon.ServiceRegistry.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/phonon/platform_kde/CMakeLists.txt b/phonon/platform_kde/CMakeLists.txt deleted file mode 100644 index 91cf1ea9..00000000 --- a/phonon/platform_kde/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -include_directories(${KDE4_KIO_INCLUDES}) - -set(kde_PART_SRCS - kdeplatformplugin.cpp - kiomediastream.cpp - devicelisting.cpp -) - -if(ALSA_FOUND) - qt4_add_resources(kde_PART_SRCS resources.qrc) -endif() - -kde4_add_plugin(kde ${kde_PART_SRCS}) -target_link_libraries(kde ${KDE4_PHONON_LIBS} ${KDE4_KIO_LIBS}) - -if(ALSA_FOUND) - target_link_libraries(kde ${ASOUND_LIBRARY}) -endif() - -set_target_properties(kde PROPERTIES - INSTALL_RPATH_USE_LINK_PATH TRUE - SKIP_BUILD_RPATH TRUE - BUILD_WITH_INSTALL_RPATH TRUE - INSTALL_RPATH ${LIB_INSTALL_DIR} -) - -install( - TARGETS kde - DESTINATION ${PLUGIN_INSTALL_DIR}/kde4/plugins/phonon_platform -) -install( - FILES phonon.notifyrc - DESTINATION ${DATA_INSTALL_DIR}/phonon -) -install( - FILES phononbackend.desktop - DESTINATION ${SERVICETYPES_INSTALL_DIR} -) diff --git a/phonon/platform_kde/Messages.sh b/phonon/platform_kde/Messages.sh deleted file mode 100644 index 11146870..00000000 --- a/phonon/platform_kde/Messages.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -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/phonon_kde.pot -rm -f dirs -rm -f files diff --git a/phonon/platform_kde/devicelisting.cpp b/phonon/platform_kde/devicelisting.cpp deleted file mode 100644 index 8644ef28..00000000 --- a/phonon/platform_kde/devicelisting.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2006-2008 Matthias Kretz - - 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 "devicelisting.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include <../config-alsa.h> -#ifdef HAVE_ALSA_ASOUNDLIB_H -#include -#endif // HAVE_ALSA_ASOUNDLIB_H - -static void installAlsaPhononDeviceHandle() -{ -#ifdef HAVE_LIBASOUND2 - // after recreating the global configuration we can go and install custom configuration - snd_config_update_free_global(); - snd_config_update(); - Q_ASSERT(snd_config); - - // x-phonon: device - QFile phononDefinition(":/phonon/phonondevice.alsa"); - phononDefinition.open(QIODevice::ReadOnly); - const QByteArray &phononDefinitionData = phononDefinition.readAll(); - - snd_input_t *sndInput = 0; - if (0 == snd_input_buffer_open(&sndInput, phononDefinitionData.constData(), phononDefinitionData.size())) { - Q_ASSERT(sndInput); - snd_config_load(snd_config, sndInput); - snd_input_close(sndInput); - } - -#if 0 - // phonon_softvol: device - QFile softvolDefinition(":/phonon/softvol.alsa"); - softvolDefinition.open(QIODevice::ReadOnly); - const QByteArray softvolDefinitionData = softvolDefinition.readAll(); - - sndInput = 0; - if (0 == snd_input_buffer_open(&sndInput, softvolDefinitionData.constData(), softvolDefinitionData.size())) { - Q_ASSERT(sndInput); - snd_config_load(snd_config, sndInput); - snd_input_close(sndInput); - } -#endif -#endif // HAVE_LIBASOUND2 -} - -namespace Phonon -{ - -QList DeviceListing::objectDescriptionIndexes(ObjectDescriptionType type) -{ - QList r; - QDBusReply reply; - - if (type == AudioOutputDeviceType || type == AudioCaptureDeviceType) { - reply = m_phononServer.call(QLatin1String("audioDevicesIndexes"), static_cast(type)); - if (!reply.isValid()) { - kError(600) << reply.error(); - return r; - } - } else - if (type == VideoCaptureDeviceType) { - reply = m_phononServer.call(QLatin1String("videoDevicesIndexes"), static_cast(type)); - if (!reply.isValid()) { - kError(600) << reply.error(); - return r; - } - } else - return r; - - QDataStream stream(reply.value()); - stream >> r; - return r; -} - -QHash DeviceListing::objectDescriptionProperties(ObjectDescriptionType type, int index) -{ - QHash r; - QDBusReply reply; - - if (type == AudioOutputDeviceType || type == AudioCaptureDeviceType) { - reply = m_phononServer.call(QLatin1String("audioDevicesProperties"), index); - if (!reply.isValid()) { - kError(600) << reply.error(); - return r; - } - } else - if (type == VideoCaptureDeviceType) { - reply = m_phononServer.call(QLatin1String("videoDevicesProperties"), index); - if (!reply.isValid()) { - kError(600) << reply.error(); - return r; - } - } else - return r; - - QDataStream stream(reply.value()); - stream >> r; - return r; -} - -DeviceListing::DeviceListing() - : m_phononServer( - QLatin1String("org.kde.kded"), - QLatin1String("/modules/phononserver"), - QLatin1String("org.kde.PhononServer")) -{ - KSharedConfigPtr config; - config = KSharedConfig::openConfig("phonon_platform_kde"); - installAlsaPhononDeviceHandle(); - - QDBusConnection::sessionBus().connect(QLatin1String("org.kde.kded"), QLatin1String("/modules/phononserver"), QLatin1String("org.kde.PhononServer"), - QLatin1String("devicesChanged"), QString(), this, SLOT(devicesChanged())); -} - -DeviceListing::~DeviceListing() -{ -} - -void DeviceListing::devicesChanged() -{ - kDebug(600); - m_signalTimer.start(0, this); -} - -void DeviceListing::timerEvent(QTimerEvent *e) -{ - if (e->timerId() == m_signalTimer.timerId()) { - m_signalTimer.stop(); - kDebug(600) << "emitting objectDescriptionChanged for all devices"; - emit objectDescriptionChanged(AudioOutputDeviceType); - emit objectDescriptionChanged(AudioCaptureDeviceType); - emit objectDescriptionChanged(VideoCaptureDeviceType); - } -} - -} // namespace Phonon diff --git a/phonon/platform_kde/devicelisting.h b/phonon/platform_kde/devicelisting.h deleted file mode 100644 index c74f6c20..00000000 --- a/phonon/platform_kde/devicelisting.h +++ /dev/null @@ -1,61 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2008 Matthias Kretz - - 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 DEVICELISTING_H -#define DEVICELISTING_H - -#include -#include -#include -#include -#include -#include -#include - -namespace Phonon -{ - -class DeviceListing : public QObject -{ - Q_OBJECT - public: - DeviceListing(); - ~DeviceListing(); - - QList objectDescriptionIndexes(ObjectDescriptionType type); - QHash objectDescriptionProperties(ObjectDescriptionType type, int index); - - signals: - void objectDescriptionChanged(ObjectDescriptionType); - - protected: - void timerEvent(QTimerEvent *e); - - private slots: - void devicesChanged(); - - private: - QBasicTimer m_signalTimer; - QDBusInterface m_phononServer; -}; - -} // namespace Phonon - -#endif // DEVICELISTING_H diff --git a/phonon/platform_kde/kdeplatformplugin.cpp b/phonon/platform_kde/kdeplatformplugin.cpp deleted file mode 100644 index 069b9fd5..00000000 --- a/phonon/platform_kde/kdeplatformplugin.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007-2008 Matthias Kretz - - 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 "kdeplatformplugin.h" -#include "kiomediastream.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "devicelisting.h" - -namespace Phonon -{ - -K_GLOBAL_STATIC_WITH_ARGS(KComponentData, mainComponentData, (QCoreApplication::applicationName().isEmpty() ? "Qt Application" : QCoreApplication::applicationName().toUtf8())) -K_GLOBAL_STATIC_WITH_ARGS(KComponentData, phononComponentData, ("phonon")) - -static void ensureMainComponentData() -{ - if (!KGlobal::hasMainComponent()) { - // a pure Qt application does not have a KComponentData object, - // we'll give it one. - *mainComponentData; - qAddPostRoutine(mainComponentData.destroy); - Q_ASSERT(KGlobal::hasMainComponent()); - } -} - -static const KComponentData &componentData() -{ - ensureMainComponentData(); - return *phononComponentData; -} - -KdePlatformPlugin::KdePlatformPlugin() - : m_devList(0) -{ - ensureMainComponentData(); - KGlobal::locale()->insertCatalog(QLatin1String("phonon_kde")); -} - -KdePlatformPlugin::~KdePlatformPlugin() -{ - delete m_devList; -} - -AbstractMediaStream *KdePlatformPlugin::createMediaStream(const QUrl &url, QObject *parent) -{ - return new KioMediaStream(url, parent); -} - -QIcon KdePlatformPlugin::icon(const QString &name) const -{ - return KIcon(name); -} - -void KdePlatformPlugin::notification(const char *notificationName, const QString &text, - const QStringList &actions, QObject *receiver, - const char *actionSlot) const -{ - KNotification *notification = new KNotification(notificationName); - notification->setComponentData(componentData()); - notification->setText(text); - //notification->setPixmap(...); - notification->addContext(QLatin1String("Application"), KGlobal::mainComponent().componentName()); - if (!actions.isEmpty() && receiver && actionSlot) { - notification->setActions(actions); - QObject::connect(notification, SIGNAL(activated(unsigned int)), receiver, actionSlot); - } - notification->sendEvent(); -} - -QString KdePlatformPlugin::applicationName() const -{ - ensureMainComponentData(); - const KAboutData *ad = KGlobal::mainComponent().aboutData(); - if (ad) { - const QString programName = ad->programName(); - if (programName.isEmpty()) { - return KGlobal::mainComponent().componentName(); - } - return programName; - } - return KGlobal::mainComponent().componentName(); -} - -QObject *KdePlatformPlugin::createBackend(KService::Ptr newService) -{ - QString errorReason; - QObject *backend = newService->createInstance(0, QVariantList(), &errorReason); - if (!backend) { - const QLatin1String suffix("/phonon_backend/"); - const QStringList libFilter(newService->library() + QLatin1String(".*")); - foreach (const QString &libPathBase, QCoreApplication::libraryPaths()) { - const QString libPath = libPathBase + suffix; - const QDir dir(libPath); - foreach (const QString &pluginName, dir.entryList(libFilter, QDir::Files)) { - QPluginLoader pluginLoader(libPath + pluginName); - backend = pluginLoader.instance(); - if (backend) { - break; - } - } - if (backend) { - break; - } - } - } - if (!backend) { - kError(600) << "Can not create backend object from factory for " << - newService->name() << ", " << newService->library() << ":\n" << errorReason; - - return 0; - - // keep the translated text below for reuse later - KMessageBox::error(0, - i18n("Unable to use the %1 Multimedia Backend:
    %2
    ", - newService->name(), errorReason)); - } - - kDebug() << "using backend: " << newService->name(); - // Backends can have own l10n, try loading their catalog based on the library name. - KGlobal::locale()->insertCatalog(newService->library()); - return backend; -} - -QObject *KdePlatformPlugin::createBackend() -{ - // Within this process, display the warning about missing backends - // only once. - static bool has_shown = false; - ensureMainComponentData(); - const KService::List offers = KServiceTypeTrader::self()->query("PhononBackend", - "Type == 'Service' and [X-KDE-PhononBackendInfo-InterfaceVersion] == 1"); - if (offers.isEmpty()) { - if (!has_shown) { -#if defined(HAVE_KDE4_MULTIMEDIA) - KMessageBox::error(0, i18n("Unable to find a Multimedia Backend")); -#endif - has_shown = true; - } - return 0; - } - // Flag the warning as not shown, since if the next time the - // list of backends is suddenly empty again the user should be - // told. - has_shown = false; - - KService::List::const_iterator it = offers.begin(); - const KService::List::const_iterator end = offers.end(); - while (it != end) { - QObject *backend = createBackend(*it); - if (backend) { - return backend; - } - ++it; - } - return 0; -} - -QObject *KdePlatformPlugin::createBackend(const QString &library, const QString &version) -{ - ensureMainComponentData(); - QString additionalConstraints = QLatin1String(" and Library == '") + library + QLatin1Char('\''); - if (!version.isEmpty()) { - additionalConstraints += QLatin1String(" and [X-KDE-PhononBackendInfo-Version] == '") - + version + QLatin1Char('\''); - } - const KService::List offers = KServiceTypeTrader::self()->query(QLatin1String("PhononBackend"), - QString("Type == 'Service' and [X-KDE-PhononBackendInfo-InterfaceVersion] == 1%1") - .arg(additionalConstraints)); - if (offers.isEmpty()) { - KMessageBox::error(0, i18n("Unable to find the requested Multimedia Backend")); - return 0; - } - - KService::List::const_iterator it = offers.begin(); - const KService::List::const_iterator end = offers.end(); - while (it != end) { - QObject *backend = createBackend(*it); - if (backend) { - return backend; - } - ++it; - } - return 0; -} - -bool KdePlatformPlugin::isMimeTypeAvailable(const QString &mimeType) const -{ - ensureMainComponentData(); - const KService::List offers = KServiceTypeTrader::self()->query("PhononBackend", - "Type == 'Service' and [X-KDE-PhononBackendInfo-InterfaceVersion] == 1"); - if (!offers.isEmpty()) { - return offers.first()->hasMimeType(mimeType); - } - return false; -} - -void KdePlatformPlugin::saveVolume(const QString &outputName, qreal volume) -{ - ensureMainComponentData(); - KConfigGroup config(KGlobal::config(), "Phonon::AudioOutput"); - config.writeEntry(outputName + "_Volume", volume); -} - -qreal KdePlatformPlugin::loadVolume(const QString &outputName) const -{ - ensureMainComponentData(); - KConfigGroup config(KGlobal::config(), "Phonon::AudioOutput"); - return config.readEntry(outputName + "_Volume", 1.0); -} - -void KdePlatformPlugin::ensureDeviceListingObject() const -{ - if (!m_devList) { - m_devList = new DeviceListing; - connect(m_devList, SIGNAL(objectDescriptionChanged(ObjectDescriptionType)), - SIGNAL(objectDescriptionChanged(ObjectDescriptionType))); - } -} - -QList KdePlatformPlugin::objectDescriptionIndexes(ObjectDescriptionType type) const -{ - switch (type) { - case AudioOutputDeviceType: - case AudioCaptureDeviceType: - case VideoCaptureDeviceType: - ensureDeviceListingObject(); - return m_devList->objectDescriptionIndexes(type); - default: - return QList(); - } -} - -QHash KdePlatformPlugin::objectDescriptionProperties(ObjectDescriptionType type, int index) const -{ - switch (type) { - case AudioOutputDeviceType: - case AudioCaptureDeviceType: - case VideoCaptureDeviceType: - ensureDeviceListingObject(); - return m_devList->objectDescriptionProperties(type, index); - default: - return QHash(); - } -} - -DeviceAccessList KdePlatformPlugin::deviceAccessListFor(const AudioOutputDevice &d) const -{ - return deviceAccessListFor(d.property("deviceAccessList"), d.property("driver"), d.property("deviceIds")); -} - -DeviceAccessList KdePlatformPlugin::deviceAccessListFor(const AudioCaptureDevice &d) const -{ - return deviceAccessListFor(d.property("deviceAccessList"), d.property("driver"), d.property("deviceIds")); -} - -DeviceAccessList KdePlatformPlugin::deviceAccessListFor(const VideoCaptureDevice &d) const -{ - return deviceAccessListFor(d.property("deviceAccessList"), d.property("driver"), d.property("deviceIds")); -} - -DeviceAccessList KdePlatformPlugin::deviceAccessListFor( - const QVariant &dalVariant, - const QVariant &driverVariant, - const QVariant &deviceIdsVariant) const -{ - if (dalVariant.isValid()) { - return qvariant_cast(dalVariant); - } - - DeviceAccessList ret; - if (driverVariant.isValid()) { - const QByteArray &driver = driverVariant.toByteArray(); - const QStringList &deviceIds = deviceIdsVariant.toStringList(); - foreach (const QString &deviceId, deviceIds) { - ret << QPair(driver, deviceId); - } - } - return ret; -} - - -} // namespace Phonon - -Q_EXPORT_PLUGIN2(phonon_platform_kde, Phonon::KdePlatformPlugin) - -#include "moc_kdeplatformplugin.cpp" -// vim: sw=4 sts=4 et tw=100 diff --git a/phonon/platform_kde/kdeplatformplugin.h b/phonon/platform_kde/kdeplatformplugin.h deleted file mode 100644 index f710a2ed..00000000 --- a/phonon/platform_kde/kdeplatformplugin.h +++ /dev/null @@ -1,75 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz - - 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_KDEPLATFORMPLUGIN_H -#define PHONON_KDEPLATFORMPLUGIN_H - -#include -#include -#include -#include - -namespace Phonon -{ - -class DeviceListing; - -class KdePlatformPlugin : public QObject, public PlatformPlugin -{ - Q_INTERFACES(Phonon::PlatformPlugin) - Q_OBJECT - public: - KdePlatformPlugin(); - ~KdePlatformPlugin(); - - AbstractMediaStream *createMediaStream(const QUrl &url, QObject *parent); - - QIcon icon(const QString &name) const; - void notification(const char *notificationName, const QString &text, - const QStringList &actions, QObject *receiver, - const char *actionSlot) const; - QString applicationName() const; - QObject *createBackend(); - QObject *createBackend(const QString &library, const QString &version); - bool isMimeTypeAvailable(const QString &mimeType) const; - void saveVolume(const QString &outputName, qreal volume); - qreal loadVolume(const QString &outputName) const; - - virtual QList objectDescriptionIndexes(ObjectDescriptionType type) const; - virtual QHash objectDescriptionProperties(ObjectDescriptionType type, int index) const; - - virtual DeviceAccessList deviceAccessListFor(const AudioOutputDevice &) const; - virtual DeviceAccessList deviceAccessListFor(const AudioCaptureDevice &) const; - virtual DeviceAccessList deviceAccessListFor(const VideoCaptureDevice &) const; - - signals: - void objectDescriptionChanged(ObjectDescriptionType); - - private: - QObject *createBackend(KService::Ptr newService); - void ensureDeviceListingObject() const; - - DeviceAccessList deviceAccessListFor(const QVariant&, const QVariant&, const QVariant&) const; - - mutable DeviceListing *m_devList; -}; - -} // namespace Phonon - -#endif // PHONON_KDEPLATFORMPLUGIN_H diff --git a/phonon/platform_kde/kiomediastream.cpp b/phonon/platform_kde/kiomediastream.cpp deleted file mode 100644 index 465d96fd..00000000 --- a/phonon/platform_kde/kiomediastream.cpp +++ /dev/null @@ -1,268 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz - - 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 "kiomediastream.h" -#include "kiomediastream_p.h" -#include -#include -#include -#include -#include - -namespace Phonon -{ - -KioMediaStream::KioMediaStream(const QUrl &url, QObject *parent) - : AbstractMediaStream(parent), - d_ptr(new KioMediaStreamPrivate(url)) -{ - d_ptr->q_ptr = this; - kDebug(600); - reset(); -} - -void KioMediaStream::reset() -{ - kDebug(600); - Q_D(KioMediaStream); - if (d->kiojob) { - d->kiojob->disconnect(this); - d->kiojob->kill(); - - d->endOfDataSent = false; - d->seeking = false; - d->reading = false; - d->open = false; - d->seekPosition = 0; - } - - if (KProtocolManager::supportsOpening(d->url)) { - d->kiojob = KIO::open(d->url, QIODevice::ReadOnly); - Q_ASSERT(d->kiojob); - d->open = false; - setStreamSeekable(true); - connect(d->kiojob, SIGNAL(open(KIO::Job*)), this, SLOT(_k_bytestreamFileJobOpen(KIO::Job*))); - connect(d->kiojob, SIGNAL(position(KIO::Job*, KIO::filesize_t)), - this, SLOT(_k_bytestreamSeekDone(KIO::Job*, KIO::filesize_t))); - } else { - d->kiojob = KIO::get(d->url, KIO::NoReload, KIO::HideProgressInfo); - Q_ASSERT(d->kiojob); - setStreamSeekable(false); - connect(d->kiojob, SIGNAL(totalSize(KJob*, qulonglong)), - this, SLOT(_k_bytestreamTotalSize(KJob*, qulonglong))); - d->kiojob->suspend(); - } - - d->kiojob->addMetaData("UserAgent", QLatin1String("KDE Phonon")); - connect(d->kiojob, SIGNAL(data(KIO::Job*, QByteArray)), - this, SLOT(_k_bytestreamData(KIO::Job*, QByteArray))); - connect(d->kiojob, SIGNAL(result(KJob*)), this, SLOT(_k_bytestreamResult(KJob*))); -} - -KioMediaStream::~KioMediaStream() -{ - kDebug(600); - Q_D(KioMediaStream); - if (d->kiojob) { - d->kiojob->disconnect(this); - KIO::FileJob *filejob = qobject_cast(d->kiojob); - if (filejob) { - filejob->close(); - } - d->kiojob->kill(); - } - delete d_ptr; -} - -void KioMediaStream::needData() -{ - Q_D(KioMediaStream); - if (!d->kiojob) { - // no job => job is finished and endOfData was already sent - return; - } - KIO::FileJob *filejob = qobject_cast(d->kiojob); - if (filejob) { - // while d->seeking the backend won't get any data - if (d->seeking || !d->open) { - d->reading = true; - } else if (!d->reading) { - d->reading = true; - QMetaObject::invokeMethod(this, "_k_read", Qt::QueuedConnection); - //filejob->read(32768); - } - } else { - // KIO::TransferJob - d->kiojob->resume(); - } -} - -void KioMediaStream::enoughData() -{ - Q_D(KioMediaStream); - kDebug(600); - // Don't suspend when using a FileJob. The FileJob is controlled by calls to - // FileJob::read() - if (d->kiojob && !qobject_cast(d->kiojob)) { - if (!d->kiojob->isSuspended()) { - d->kiojob->suspend(); - } - } else { - d->reading = false; - } -} - -void KioMediaStream::seekStream(qint64 position) -{ - Q_D(KioMediaStream); - if (!d->kiojob || d->endOfDataSent) { - // no job => job is finished and endOfData was already sent - kDebug(600) << "no job/job finished -> recreate it"; - reset(); - } - Q_ASSERT(d->kiojob); - kDebug(600) << position << " = " << qulonglong(position); - d->seeking = true; - d->seekPosition = position; - if (d->open) { - KIO::FileJob *filejob = qobject_cast(d->kiojob); - filejob->seek(position); - } -} - -void KioMediaStreamPrivate::_k_bytestreamData(KIO::Job *, const QByteArray &data) -{ - Q_Q(KioMediaStream); - Q_ASSERT(kiojob); - if (q->streamSize() == 0) { - q->setStreamSize(-1); - } - if (seeking) { - // seek doesn't block, so don't send data to the backend until it signals us - // that the seek is done - kDebug(600) << "seeking: do nothing"; - return; - } - - if (data.isEmpty()) { - reading = false; - if (!endOfDataSent) { - kDebug(600) << "empty data: stopping the stream"; - endOfDataSent = true; - q->endOfData(); - } - return; - } - - //kDebug(600) << "calling writeData on the Backend ByteStream " << data.size(); - q->writeData(data); - if (reading) { - Q_ASSERT(qobject_cast(kiojob)); - QMetaObject::invokeMethod(q, "_k_read", Qt::QueuedConnection); - } -} - -void KioMediaStreamPrivate::_k_bytestreamResult(KJob *job) -{ - Q_Q(KioMediaStream); - Q_ASSERT(kiojob == job); - if (job->error()) { - QString kioErrorString = job->errorString(); - kDebug(600) << "KIO Job error: " << kioErrorString; - QObject::disconnect(kiojob, SIGNAL(data(KIO::Job *,const QByteArray &)), - q, SLOT(_k_bytestreamData(KIO::Job *,const QByteArray &))); - QObject::disconnect(kiojob, SIGNAL(result(KJob *)), - q, SLOT(_k_bytestreamResult(KJob *))); - KIO::FileJob *filejob = qobject_cast(kiojob); - if (filejob) { - QObject::disconnect(kiojob, SIGNAL(open(KIO::Job *)), - q, SLOT(_k_bytestreamFileJobOpen(KIO::Job *))); - QObject::disconnect(kiojob, SIGNAL(position(KIO::Job *, KIO::filesize_t)), - q, SLOT(_k_bytestreamSeekDone(KIO::Job *, KIO::filesize_t))); - } else { - QObject::disconnect(kiojob, SIGNAL(totalSize(KJob *, qulonglong)), - q, SLOT(_k_bytestreamTotalSize(KJob *,qulonglong))); - } - // go to ErrorState - NormalError - q->error(NormalError, kioErrorString); - } else if (seeking) { - open = false; - kiojob = 0; - endOfDataSent = false; - reading = false; - q->reset(); - return; - } - open = false; - kiojob = 0; - kDebug(600) << "KIO Job is done (will delete itself) and d->kiojob reset to 0"; - endOfDataSent = true; - q->endOfData(); - reading = false; -} - -void KioMediaStreamPrivate::_k_bytestreamTotalSize(KJob *, qulonglong size) -{ - Q_Q(KioMediaStream); - kDebug(600) << size; - q->setStreamSize(size > 0 ? size : -1); -} - -void KioMediaStreamPrivate::_k_bytestreamFileJobOpen(KIO::Job *) -{ - Q_Q(KioMediaStream); - Q_ASSERT(kiojob); - open = true; - endOfDataSent = false; - KIO::FileJob *filejob = static_cast(kiojob); - kDebug(600) << filejob->size(); - q->setStreamSize(filejob->size() > 0 ? filejob->size() : -1); - - if (seeking) { - filejob->seek(seekPosition); - } else if (reading) { - //filejob->read(32768); - QMetaObject::invokeMethod(q, "_k_read", Qt::QueuedConnection); - } -} - -void KioMediaStreamPrivate::_k_bytestreamSeekDone(KIO::Job *, KIO::filesize_t offset) -{ - Q_ASSERT(kiojob); - kDebug(600) << offset; - seeking = false; - endOfDataSent = false; - if (reading) { - Q_Q(KioMediaStream); - Q_ASSERT(qobject_cast(kiojob)); - QMetaObject::invokeMethod(q, "_k_read", Qt::QueuedConnection); - } -} - -void KioMediaStreamPrivate::_k_read() -{ - KIO::FileJob *filejob = qobject_cast(kiojob); - Q_ASSERT(filejob); - filejob->read(32768); -} - -} // namespace Phonon - -#include "moc_kiomediastream.cpp" -// vim: sw=4 sts=4 et tw=100 diff --git a/phonon/platform_kde/kiomediastream.h b/phonon/platform_kde/kiomediastream.h deleted file mode 100644 index fcc41283..00000000 --- a/phonon/platform_kde/kiomediastream.h +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz - - 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_KIOMEDIASTREAM_H -#define PHONON_KIOMEDIASTREAM_H - -#include - -class QUrl; - -namespace Phonon -{ - -class KioMediaStreamPrivate; - -class KioMediaStream : public AbstractMediaStream -{ - Q_OBJECT - Q_DECLARE_PRIVATE(KioMediaStream) - public: - explicit KioMediaStream(const QUrl &url, QObject *parent = 0); - ~KioMediaStream(); - - protected: - void reset(); - void needData(); - void enoughData(); - void seekStream(qint64); - - KioMediaStreamPrivate *d_ptr; - - private: - Q_PRIVATE_SLOT(d_func(), void _k_bytestreamData(KIO::Job *, const QByteArray &)) - Q_PRIVATE_SLOT(d_func(), void _k_bytestreamResult(KJob *)) - Q_PRIVATE_SLOT(d_func(), void _k_bytestreamTotalSize(KJob *, qulonglong)) - Q_PRIVATE_SLOT(d_func(), void _k_bytestreamFileJobOpen(KIO::Job *)) - Q_PRIVATE_SLOT(d_func(), void _k_bytestreamSeekDone(KIO::Job *, KIO::filesize_t)) - Q_PRIVATE_SLOT(d_func(), void _k_read()) -}; - -} // namespace Phonon -#endif // PHONON_KIOMEDIASTREAM_H diff --git a/phonon/platform_kde/kiomediastream_p.h b/phonon/platform_kde/kiomediastream_p.h deleted file mode 100644 index b7d507c1..00000000 --- a/phonon/platform_kde/kiomediastream_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz - - 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 KIOMEDIASTREAM_P_H -#define KIOMEDIASTREAM_P_H - -#include "kiomediastream.h" -#include -#include - -namespace Phonon -{ - -class KioMediaStreamPrivate -{ - Q_DECLARE_PUBLIC(KioMediaStream) - protected: - KioMediaStream *q_ptr; - - KioMediaStreamPrivate(const KUrl &u) - : url(u), - endOfDataSent(false), - seeking(false), - reading(false), - open(false), - seekPosition(0), - kiojob(0) - { - } - - ~KioMediaStreamPrivate() - { - if (kiojob) { - kiojob->kill(); - kiojob = 0; - } - } - - void _k_bytestreamNeedData(); - void _k_bytestreamEnoughData(); - void _k_bytestreamData(KIO::Job *, const QByteArray &); - void _k_bytestreamResult(KJob *); - void _k_bytestreamTotalSize(KJob *, qulonglong); - void _k_bytestreamSeekStream(qint64); - void _k_bytestreamFileJobOpen(KIO::Job *); - void _k_bytestreamSeekDone(KIO::Job *, KIO::filesize_t); - void _k_read(); - - KUrl url; - bool endOfDataSent; - bool seeking; - bool reading; - bool open; - qint64 seekPosition; - KIO::SimpleJob *kiojob; -}; - -} // namespace Phonon - -#endif // KIOMEDIASTREAM_P_H -// vim: sw=4 sts=4 et tw=100 diff --git a/phonon/platform_kde/phonon.notifyrc b/phonon/platform_kde/phonon.notifyrc deleted file mode 100644 index 2d97fa54..00000000 --- a/phonon/platform_kde/phonon.notifyrc +++ /dev/null @@ -1,289 +0,0 @@ -[Global] -IconName=preferences-desktop-sound -Comment=Multimedia System -Comment[ar]=نظام الوسائط المتعددة -Comment[ast]=Sistema multimedia -Comment[bg]=Мултимедийна система -Comment[bn]=মাল্টিমিডিয়া সিস্টেম -Comment[bs]=Multimedijalni sistem -Comment[ca]=Sistema multimèdia -Comment[ca@valencia]=Sistema multimèdia -Comment[cs]=Multimediální systém -Comment[da]=Multimediesystem -Comment[de]=Multimediasystem -Comment[el]=Σύστημα Πολυμέσων -Comment[en_GB]=Multimedia System -Comment[eo]=Aŭdvida sistemo -Comment[es]=Sistema multimedia -Comment[et]=Multimeediasüsteem -Comment[eu]=Multimedia-sistema -Comment[fa]=سامانه چند رسانه‌ای -Comment[fi]=Multimediajärjestelmä -Comment[fr]=Système multimédia -Comment[ga]=Córas Ilmheán -Comment[gl]=Sistema multimedia -Comment[gu]=મલ્ટિમીડિઆ સિસ્ટમ -Comment[he]=מערכת מולטימדיה -Comment[hi]=मल्टीमीडिया तंत्र -Comment[hr]=Multimedijalni sustav -Comment[hu]=Multimédia rendszer -Comment[ia]=Systema de Multimedia -Comment[id]=Sistem Multimedia -Comment[is]=Margmiðlunarkerfi -Comment[it]=Sistema multimediale -Comment[ja]=メディアシステム -Comment[kk]=Мультимедиа жүйесі -Comment[km]=ប្រព័ន្ធ​ពហុមេឌៀ -Comment[kn]=ಬಹುಮಾಧ್ಯಮ ವ್ಯವಸ್ಥೆ -Comment[ko]=멀티미디어 시스템 -Comment[lt]=Multimedijos sistema -Comment[lv]=Multivides sistēma -Comment[ml]=മള്‍ട്ടിമീഡിയ സംവിധാനം -Comment[mr]=मल्टीमीडिया प्रणाली -Comment[nb]=Multimediasystem -Comment[nds]=Multimediasysteem -Comment[nl]=Multimedia-systeem -Comment[nn]=Multimediesystem -Comment[pa]=ਮਲਟੀਮੀਡਿਆ ਸਿਸਟਮ -Comment[pl]=System multimedialny -Comment[pt]=Sistema Multimédia -Comment[pt_BR]=Sistema multimídia -Comment[ro]=Sistem multimedia -Comment[ru]=Мультимедийная подсистема -Comment[si]=බහුමාධ්‍ය පද්ධතිය -Comment[sk]=Multimediálny systém -Comment[sl]=Predstavnostni sistem -Comment[sr]=Мултимедијални систем -Comment[sr@ijekavian]=Мултимедијални систем -Comment[sr@ijekavianlatin]=Multimedijalni sistem -Comment[sr@latin]=Multimedijalni sistem -Comment[sv]=Multimediasystem -Comment[tg]=Системаи мултимедиавӣ -Comment[th]=ระบบสื่อประสม -Comment[tr]=Çoklu Ortam Sistemi -Comment[ug]=كۆپ ۋاسىتە سىستېما -Comment[uk]=Мультимедійна система -Comment[vi]=Hệ thống đa phương tiện -Comment[wa]=Sistinme multimedia -Comment[x-test]=xxMultimedia Systemxx -Comment[zh_CN]=多媒体系统 -Comment[zh_TW]=多媒體系統 - -[Context/Application] -Name=Application -Name[ar]=تطبيق -Name[as]=অনুপ্ৰয়োগ -Name[ast]=Aplicación -Name[be@latin]=Aplikacyja -Name[bg]=Програма -Name[bn]=অ্যাপলিকেশন -Name[bn_IN]=অ্যাপ্লিকেশন -Name[bs]=Program -Name[ca]=Aplicació -Name[ca@valencia]=Aplicació -Name[cs]=Aplikace -Name[csb]=Programa -Name[da]=Program -Name[de]=Programm -Name[el]=Εφαρμογή -Name[en_GB]=Application -Name[eo]=Aplikaĵo -Name[es]=Aplicación -Name[et]=Rakendus -Name[eu]=Aplikazioa -Name[fa]=برنامه -Name[fi]=Sovellus -Name[fr]=Application -Name[fy]=Applikaasje -Name[ga]=Feidhmchlár -Name[gl]=Programa -Name[gu]=કાર્યક્રમ -Name[he]=יישום -Name[hi]=अनुप्रयोग -Name[hne]=अनुपरयोग -Name[hr]=Aplikacija -Name[hsb]=Aplikacija -Name[hu]=Alkalmazás -Name[ia]=Application -Name[id]=Aplikasi -Name[is]=Forrit -Name[it]=Applicazione -Name[ja]=アプリケーション -Name[kk]=Қолданба -Name[km]=កម្មវិធី -Name[kn]=ಅನ್ವಯ -Name[ko]=프로그램 -Name[ku]=Sepan -Name[lt]=Programa -Name[lv]=Programma -Name[mai]=अनुप्रयोग -Name[mk]=Апликација -Name[ml]=പ്രയോഗം -Name[mr]=अनुप्रयोग -Name[nb]=Program -Name[nds]=Programm -Name[nl]=Programma -Name[nn]=Program -Name[or]=ପ୍ରୟୋଗ -Name[pa]=ਐਪਲੀਕੇਸ਼ਨ -Name[pl]=Program -Name[pt]=Aplicação -Name[pt_BR]=Aplicativo -Name[ro]=Aplicație -Name[ru]=Приложение -Name[si]=යෙදුම් -Name[sk]=Aplikácia -Name[sl]=Program -Name[sr]=Програм -Name[sr@ijekavian]=Програм -Name[sr@ijekavianlatin]=Program -Name[sr@latin]=Program -Name[sv]=Program -Name[ta]=பயன்பாடுகள் -Name[te]=అనువర్తనము -Name[tg]=Барнома -Name[th]=โปรแกรม -Name[tr]=Uygulama -Name[ug]=پروگرامما -Name[uk]=Програма -Name[uz]=Dastur -Name[uz@cyrillic]=Дастур -Name[vi]=Ứng dụng -Name[wa]=Programe -Name[x-test]=xxApplicationxx -Name[zh_CN]=应用程序 -Name[zh_TW]=應用程式 -#Comment=The name of the group of the contact - -[Event/AudioDeviceFallback] -Name=Audio Output Device Changed -Name[ar]=تغيير في جهاز خرج الصوت -Name[ast]=Cambeos en preseos de salida d'audiu -Name[bg]=Изходното звуково устройство беше променено -Name[bn]=অডিও আউটপুট ডিভাইস পরিবর্তিত -Name[bs]=Promijenjen uređaj audio izlaza -Name[ca]=Ha canviat el dispositiu de sortida de l'àudio -Name[ca@valencia]=Ha canviat el dispositiu d'eixida de l'àudio -Name[cs]=Zvukové výstupní zařízení změněno -Name[da]=Enhed til lyd-output skiftet -Name[de]=Audioausgabegerät geändert -Name[el]=Η συσκευή εξόδου ήχου άλλαξε -Name[en_GB]=Audio Output Device Changed -Name[eo]=Aparato de soneligo ŝanĝita -Name[es]=Cambios en dispositivos de salida de audio -Name[et]=Heli väljundseade on muutunud -Name[eu]=Audio-irteerako gailua aldatu egin da -Name[fi]=Äänen ulostulolaite vaihtui -Name[fr]=Le périphérique de sortie audio a changé -Name[ga]=Athraíodh an Gléas Aschurtha Fuaime -Name[gl]=Cambio de dispositivo de saída de son -Name[gu]=ધ્વનિ આઉટપુટ ઉપકરણ બદલાયેલ છે -Name[he]=התקן פלט שמע שונה -Name[hi]=ऑडियो आउटपुट युक्ति परिवर्तित -Name[hr]=Promijenjen je uređaj za izlaz zvuka -Name[hu]=A hangkimeneti eszköz megváltozott -Name[ia]=Dispositivo de egresso de sono modificate -Name[id]=Divais Keluaran Audio Berubah -Name[is]=Skipt um úttakstæki fyrir hljóð -Name[it]=Il dispositivo di uscita dell'audio è cambiato -Name[ja]=オーディオ出力デバイスが変更されました -Name[kk]=Аудио шығыс құрылғысы өзгерген -Name[km]=បាន​ផ្លាស់ប្ដូរ​ឧបករណ៍​បញ្ចូល​អូឌីយ៉ូ -Name[ko]=오디오 출력 장치가 변경됨 -Name[lt]=Pakeistas garso atgaminimo įrenginys -Name[lv]=Izmainījās audio izvades ierīce -Name[mr]=आवाज आउटपुट देणारे साधन बदलले -Name[nb]=Utgangsenhet for lyd er endret -Name[nds]=Klangutgaavreedschap ännert -Name[nl]=Geluiduitvoerapparaat gewijzigd -Name[nn]=Uteining for lyd endra -Name[pa]=ਆਡੀਓ ਆਉਟਪੁੱਟ ਜੰਤਰ ਬਦਲਿਆ -Name[pl]=Zmieniono urządzenie wyjściowe dźwięku -Name[pt]=O Dispositivo de Saída de Áudio Mudou -Name[pt_BR]=O dispositivo de saída de áudio foi alterado -Name[ro]=Dispozitivul de ieșire a sunetului a fost schimbat -Name[ru]=Изменено устройство вывода звука -Name[si]=ශ්‍රව්‍ය ප්‍රථිදාන උපකරණය වෙනස් විය -Name[sk]=Zvukové výstupné zariadenie zmenené -Name[sl]=Naprava za predvajanje zvoka se je spremenila -Name[sr]=Промењен уређај аудио излаза -Name[sr@ijekavian]=Промењен уређај аудио излаза -Name[sr@ijekavianlatin]=Promenjen uređaj audio izlaza -Name[sr@latin]=Promenjen uređaj audio izlaza -Name[sv]=Ljudutenhet ändrades -Name[tg]=Дастгоҳи хуруҷи аудио иваз шуд -Name[th]=อุปกรณ์ส่งออกเสียงมีการเปลี่ยนแปลง -Name[tr]=Ses Çıktı Aygıtı Değişti -Name[ug]=ئۈن چىقىرىش ئۈسكۈنىسى ئۆزگەردى -Name[uk]=Змінено пристрій відтворення звуку -Name[vi]=Thiết bị xuất âm thanh đã thay đổi -Name[wa]=L' éndjin d' rexhowe odio a candjî -Name[x-test]=xxAudio Output Device Changedxx -Name[zh_CN]=音频输出设备已更改 -Name[zh_TW]=音效輸出裝置已變更 -Comment=Notification when audio output device has automatically changed -Comment[ar]=التنبيه حال تغيير تلقائي لجهاز إخراج الصوت -Comment[ast]=Notificación de cambeos automáticos nos preseos de salida d'audio -Comment[bg]=Уведомяване при автоматична промяна на изходното звуково устройство -Comment[bs]=Obavještenje o automatskoj promijeni uređaja za audio izlaz -Comment[ca]=Notificació quan canviï automàticament el dispositiu de sortida de l'àudio -Comment[ca@valencia]=Notificació quan canvie automàticament el dispositiu d'eixida de l'àudio -Comment[cs]=Upozornění při automatické změně výstupního audio zařízení -Comment[da]=Bekendtgørelse når enhed til lyd-output automatisk skiftes -Comment[de]=Benachrichtigung, wenn das Audioausgabegerät automatisch geändert worden ist -Comment[el]=Ειδοποίηση όταν η συσκευή εξόδου ήχου έχει αυτόματα αλλάξει -Comment[en_GB]=Notification when audio output device has automatically changed -Comment[eo]=Atentigo kiam aparato de soneligo estas aŭtomate ŝanĝita -Comment[es]=Notificación de cambios automáticos en los dispositivos de salida de audio -Comment[et]=Märguanne, kui heli väljundseadet on automaatselt muudetud -Comment[eu]=Audio-irteerako gailua automatikoki aldatzen denean azaltzen den jakinarazpena -Comment[fi]=Ilmoitus äänen ulostulolaitteen automaattisesta vaihtumisesta -Comment[fr]=Notification lorsque le périphérique de sortie audio a changé automatiquement -Comment[ga]=Fógra nuair a athraítear an gléas aschurtha fuaime go huathoibríoch -Comment[gl]=A notificación para cando se cambia automaticamente de dispositivo de saída de son -Comment[gu]=જ્યારે ધ્વનિ આઉટપુટ ઉપકરણ આપમેળે બદલાય ત્યારે નોંધણી -Comment[he]=הודעה כאשר התקן פלט שמע השתנה אוטומטית -Comment[hi]=अधिसूचना जब ऑडियो आउटपुट युक्ति स्वचालित रूप से बदल गया है -Comment[hr]=Obavijest prilikom automatske promijene izlaznog audio uređaja -Comment[hu]=Értesítés a hangkimeneti eszköz automatikus megváltozásakor -Comment[ia]=Notification quando un dispositivo de egresso de sono ha modificate automaticamente -Comment[id]=Notifikasi ketika divais keluaran audio telah berubah secara otomatis -Comment[is]=Tilkynning þegar skipt hefur verið sjálfvirkt um úttakstæki fyrir hljóð -Comment[it]=Notifica di quando il dispositivo di uscita audio è stato cambiato automaticamente -Comment[ja]=オーディオ出力デバイスが自動的に変更された時の通知 -Comment[kk]=Аудио шығыс құрылғысы автоматты түрде өзгергенде құлақтандыру -Comment[km]=ជូន​ដំណឹង នៅ​ពេល​ឧបករណ៍​បញ្ចេញ​អូឌីយ៉ូ​បាន​ផ្លាស់ប្ដូរ​ដោយ​ស្វ័យ​ប្រវត្តិ -Comment[ko]=오디오 출력 장치가 자동으로 변경되었을 때의 알림 -Comment[lt]=Pranešimai pakeitus garso atgaminimo įrenginį -Comment[lv]=Paziņojums, kad automātiski izmainās audio izvades ierīce -Comment[mr]=आवाज आउटपुट देणारे साधन स्वयंचलितरित्या बदलले जाईल तेव्हाची सूचना -Comment[nb]=Varsling når utgangsenhet for lyd er endret automatisk -Comment[nds]=Bescheed, wenn sik de Klangutgaavreedschap automaatsch ännert hett -Comment[nl]=Melding als geluiduitvoerapparaat automatisch is gewijzigd -Comment[nn]=Varsling når uteining for lyd vart automatisk endra -Comment[pa]=ਜਦੋਂ ਆਡੀਓ ਆਉਟਪੁੱਤ ਜੰਤਰ ਆਟੋਮੈਟਿਕ ਹੀ ਬਦਲਿਆ ਜਾਵੇ ਤਾਂ ਨੋਟੀਫਿਕੇਸ਼ਨ ਦਿਉ -Comment[pl]=Powiadomienie, kiedy zmieniło się urządzenie wyjścia audio -Comment[pt]=Notificação quando o dispositivo de saída do áudio mudou automaticamente -Comment[pt_BR]=Notificação quando o dispositivo de saída do áudio for alterado automaticamente -Comment[ro]=Notificare atunci cînd dispozitivul de ieșire a sunetului este schimbat automat -Comment[ru]=Уведомление об автоматическом изменении устройства вывода звука -Comment[si]=ශ්‍රව්‍ය ප්‍රථිදානයක් ස්වංයක්‍රීයව වෙනස් වූ විට දන්වන්න -Comment[sk]=Upozornenie pri automatickej zmene výstupného zvukového zariadenia -Comment[sl]=Obvestilo, ko se naprava za predvajanje zvoka samodejno spremeni -Comment[sr]=Обавештење о аутоматској промени уређаја за аудио излаз -Comment[sr@ijekavian]=Обавештење о аутоматској промени уређаја за аудио излаз -Comment[sr@ijekavianlatin]=Obaveštenje o automatskoj promeni uređaja za audio izlaz -Comment[sr@latin]=Obaveštenje o automatskoj promeni uređaja za audio izlaz -Comment[sv]=Underrättelse när ljudutenhet har ändrats automatiskt -Comment[tg]=Огоҳдод барои ивазкунии худкори ҳуруҷи дастгоҳи аудиоӣ -Comment[th]=แจ้งให้ทราบเมื่ออุปกรณ์ส่วนส่งออกเสียงมีการเปลี่ยนแปลงที่เกิดขึ้นอย่างอัตโนมัติ -Comment[tr]=Ses çıktı aygıtı otomatik olarak değiştiğinde çıkan bildirim -Comment[ug]=ئۈن چىقىرىش ئۈسكۈنىسى ئۆزلۈكىدىن ئۆزگەرسە ئۇقتۇرىدۇ -Comment[uk]=Сповіщення у відповідь на автоматичну зміну пристрою відтворення звуку -Comment[vi]=Thông báo khi thiết bị xuất âm thanh tự động thay đổi -Comment[wa]=Notifiaedje cwand l' éndjin d' rexhowe odio a candjî otomaticmint -Comment[x-test]=xxNotification when audio output device has automatically changedxx -Comment[zh_CN]=音频输出设备自动更改的通知 -Comment[zh_TW]=當音效輸出裝置自動變更時發出通知 -Contexts=Application -Action=Popup diff --git a/phonon/platform_kde/phononbackend.desktop b/phonon/platform_kde/phononbackend.desktop deleted file mode 100644 index 3971c508..00000000 --- a/phonon/platform_kde/phononbackend.desktop +++ /dev/null @@ -1,117 +0,0 @@ -[Desktop Entry] -Type=ServiceType -X-KDE-ServiceType=PhononBackend -Name=KDE Multimedia Backend -Name[ar]=المنتهى الخلفي للوسائط المتعددة في كدي -Name[ast]=Motor multimedia de KDE -Name[be@latin]=Multymedyjnaja systema dla „KDE” -Name[bg]=Мултимедийно ядро на KDE -Name[bn]=কে.ডি.ই. মাল্টিমিডিয়া ব্যাক-এন্ড -Name[bn_IN]=KDE মাল্টিমিডিয়া ব্যাক-এন্ড -Name[bs]=KDE‑ova multimedijska pozadina -Name[ca]=Dorsal multimèdia del KDE -Name[ca@valencia]=Dorsal multimèdia del KDE -Name[cs]=Multimediální podpůrná vrstva KDE -Name[csb]=Òbsłużënk mùltimediów -Name[da]=KDE multimedie-backend -Name[de]=KDE-Multimedia-Unterstützung -Name[el]=Σύστημα υποστήριξης πολυμέσων του KDE -Name[en_GB]=KDE Multimedia Backend -Name[eo]=Aŭdvida interno de KDE -Name[es]=Motor multimedia de KDE -Name[et]=KDE multimeedia taustaprogramm -Name[eu]=KDEren multimedia-motorra -Name[fa]=پشتیبان چندرسانه‌ای کی‌دی‌ای -Name[fi]=KDE-multimediataustaosa -Name[fr]=Module multimédia de KDE -Name[fy]=KDE Multymedia efterein -Name[ga]=Inneall Ilmheán KDE -Name[gl]=Infraestrutura multimedia de KDE -Name[gu]=KDE મલ્ટિમીડિઆ પાશ્વભાગ -Name[he]=מנגנון המולטימדיה של KDE -Name[hi]=केडीई मल्टीमीडिया बैकएण्ड -Name[hne]=केडीई मल्टीमीडिया बैकएन्ड -Name[hr]=KDE podrška za multimediju -Name[hsb]=KDE Multimedijowy backend -Name[hu]=KDE multimédiakezelő -Name[ia]=KDE Multimedia Backend (Retro-Administration de Multimedia de KDE) -Name[id]=Ujung Belakang KDE Multimedia -Name[is]=KDE margmiðlunarbakendi -Name[it]=Motore multimediale di KDE -Name[ja]=KDE マルチメディアバックエンド -Name[kk]=KDE мультимедиа тетігі -Name[km]=ផ្នែក​ខាង​ក្រោយ​​នៃ​ពហុព័ត៌មាន​របស់ KDE -Name[kn]=ಕೆಡಿಇ ಬಹುಮಾಧ್ಯಮ (ಮಲ್ಟಿಮೀಡಿಯಾ) ಹಿಂಬದಿ (ಬ್ಯಾಕ್ ಎಂಡ್) -Name[ko]=KDE 멀티미디어 백엔드 -Name[ku]=KDE Binesazî ya Pir-medya -Name[lt]=KDE daugialypės terpės programinė sąsaja -Name[lv]=KDE multivides aizmugure -Name[mk]=Заден крај за мултимедија во KDE -Name[ml]=കെഡിഇ മള്‍ട്ടിമീഡിയ ബാക്കെന്‍ഡ് -Name[mr]=केडीई मल्टीमीडिया बॅकएन्ड -Name[nb]=KDE Multimediebakstykke -Name[nds]=Multimedia-Hülpprogramm vun KDE -Name[nl]=KDE multimedia-backend -Name[nn]=KDE-multimediemotor -Name[or]=KDE ବହୁମାଧ୍ଯମ ପୃଷ୍ଠଭୂମି -Name[pa]=KDE ਮਲਟੀਮੀਡਿਆ ਬੈਕਐਡ -Name[pl]=Obsługa multimediów w KDE -Name[pt]=Infra-estrutura Multimédia do KDE -Name[pt_BR]=Infraestrutura de multimídia do KDE -Name[ro]=Suportul multimedia KDE -Name[ru]=Мультимедийная подсистема KDE -Name[si]=KDE බහුමාධ්‍යය පසුඈදුම -Name[sk]=Multimediálny backend pre KDE -Name[sl]=KDE-jevo zaledje za predstavnost -Name[sr]=КДЕ‑ова мултимедијска позадина -Name[sr@ijekavian]=КДЕ‑ова мултимедијска позадина -Name[sr@ijekavianlatin]=KDE‑ova multimedijska pozadina -Name[sr@latin]=KDE‑ova multimedijska pozadina -Name[sv]=KDE:s multimediagränssnitt -Name[ta]=கேபசூ பல்லூடக பின்னணி -Name[te]=KDE బహుళమాద్యమం బ్యాక్ఎండ్ -Name[tg]=Пуштибонии мултимедиаи KDE -Name[th]=โปรแกรมเบื้องหลังจัดการสื่อประสมของ KDE -Name[tr]=KDE Çoklu Ortam Arka Ucu -Name[ug]=KDE كۆپ ۋاسىتە ئارقا ئۇچى -Name[uk]=Сервер мультимедіа KDE -Name[uz]=KDE multimedia xizmati -Name[uz@cyrillic]=KDE мултимедиа хизмати -Name[vi]=Hậu trường đa phương tiện KDE -Name[wa]=Bouye di fond multimedia di KDE -Name[x-test]=xxKDE Multimedia Backendxx -Name[zh_CN]=KDE 多媒体后端 -Name[zh_TW]=KDE 多媒體後端介面 - -## -# The interface version is used by phonon to be able to only load binary -# compatible backends. -[PropertyDef::X-KDE-PhononBackendInfo-InterfaceVersion] -Type=int - -## This is information for the user -[PropertyDef::X-KDE-PhononBackendInfo-Version] -Type=QString - -## This is information for the user -[PropertyDef::X-KDE-PhononBackendInfo-Website] -Type=QString - -#[PropertyDef::X-KDE-PhononBackendInfo-Supports] -#Type=QStringList -# -#[PropertyDef::X-KDE-PhononBackendInfo-Depends] -#Type=QStringList -# -#[PropertyDef::X-KDE-PhononBackendInfo-License] -#Type=QString -# -#[PropertyDef::X-KDE-PhononBackendInfo-Author] -#Type=QString -# -#[PropertyDef::X-KDE-PhononBackendInfo-Email] -#Type=QString -# -#[PropertyDef::X-KDE-PhononBackendInfo-Name] -#Type=QString -# diff --git a/phonon/platform_kde/phonondevice.alsa b/phonon/platform_kde/phonondevice.alsa deleted file mode 100644 index 3f7132d7..00000000 --- a/phonon/platform_kde/phonondevice.alsa +++ /dev/null @@ -1,202 +0,0 @@ -pcm.x-phonon { - @args [ CARD DEV SUBDEV ] - @args.CARD { - type string - default { - @func refer - name defaults.pcm.card - } - } - @args.DEV { - type integer - default { - @func refer - name defaults.pcm.device - } - } - @args.SUBDEV { - type integer - default -1 - } - type asym - playback.pcm { - type plug - slave.pcm { - type dmix - ipc_key { - @func refer - name defaults.pcm.ipc_key - } - ipc_key_add_uid false - ipc_gid { - @func refer - name defaults.pcm.ipc_gid - } - ipc_perm { - @func refer - name defaults.pcm.ipc_perm - } - slave { - pcm { - type hw - card $CARD - device $DEV - subdevice $SUBDEV - } - format { - @func refer - name defaults.pcm.dmix.format - } - rate { - @func refer - name defaults.pcm.dmix.rate - } - period_size { - @func refer - name { - @func concat - strings [ - "cards." - { - @func card_driver - card $CARD - } - ".pcm.dmix.period_size" - ] - } - default 1024 - } - period_time { - @func refer - name { - @func concat - strings [ - "cards." - { - @func card_driver - card $CARD - } - ".pcm.dmix.period_time" - ] - } - default -1 - } - periods { - @func refer - name { - @func concat - strings [ - "cards." - { - @func card_driver - card $CARD - } - ".pcm.dmix.periods" - ] - } - default 16 - } - } - } - } - capture.pcm { - type plug - slave.pcm { - type dsnoop - ipc_key { - @func refer - name defaults.pcm.ipc_key - } - ipc_gid { - @func refer - name defaults.pcm.ipc_gid - } - ipc_perm { - @func refer - name defaults.pcm.ipc_perm - } - slave { - pcm { - type hw - card $CARD - device $DEV - subdevice $SUBDEV - } - format { - @func refer - name defaults.pcm.dmix.format - } - rate { - @func refer - name defaults.pcm.dmix.rate - } - period_size { - @func refer - name { - @func concat - strings [ - "cards." - { - @func card_driver - card $CARD - } - ".pcm.dsnoop.period_size" - ] - } - default 1024 - } - period_time { - @func refer - name { - @func concat - strings [ - "cards." - { - @func card_driver - card $CARD - } - ".pcm.dsnoop.period_time" - ] - } - default -1 - } - periods { - @func refer - name { - @func concat - strings [ - "cards." - { - @func card_driver - card $CARD - } - ".pcm.dsnoop.periods" - ] - } - default 16 - } - } - } - } -} - -ctl.x-phonon { - @args [ CARD DEV SUBDEV ] - @args.CARD { - type string - default { - @func refer - name defaults.pcm.card - } - } - @args.DEV { - type integer - default -1 - } - @args.SUBDEV { - type integer - default -1 - } - type hw - card $CARD -} diff --git a/phonon/platform_kde/resources.qrc b/phonon/platform_kde/resources.qrc deleted file mode 100644 index 47ae62e0..00000000 --- a/phonon/platform_kde/resources.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - - phonondevice.alsa - - diff --git a/phonon/platform_kde/softvol.alsa b/phonon/platform_kde/softvol.alsa deleted file mode 100644 index d497601a..00000000 --- a/phonon/platform_kde/softvol.alsa +++ /dev/null @@ -1,38 +0,0 @@ -pcm.phonon_softvol { - @args [ CARD SLAVE NAME ] - @args.CARD { - type string - default { - @func getenv - vars [ - PHONON_ALSA_CARD - ] - default { - @func refer - name defaults.pcm.card - } - } - } - @args.SLAVE { - type string - default { - @func getenv - vars [ - PHONON_ALSA_DEVICE - ] - default "default" - } - } - @args.NAME { - type string - } - type softvol - slave.pcm $SLAVE - control { - name $NAME - card $CARD - } - min_dB -51.0 - max_dB 0.0 - resolution 100 -} diff --git a/phonon/serviceregistry.h b/phonon/serviceregistry.h deleted file mode 100644 index ac59c537..00000000 --- a/phonon/serviceregistry.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 Matthias Kretz - - 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 SERVICEREGISTRYADAPTOR_H -#define SERVICEREGISTRYADAPTOR_H - -#include - -class ServiceRegistry : public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.Phonon.ServiceRegistry") -public: - explicit ServiceRegistry(QObject *parent); - virtual ~ServiceRegistry(); - -public Q_SLOTS: // METHODS - Q_SCRIPTABLE QStringList registeredServices() const; - Q_SCRIPTABLE void registerService(const QString &serviceName); - Q_SCRIPTABLE void unregisterService(const QString &serviceName); -}; -#endif // SERVICEREGISTRYADAPTOR_H diff --git a/plasma/applets/homerun/fullscreen/applet/CMakeLists.txt b/plasma/applets/homerun/fullscreen/applet/CMakeLists.txt index b9aa0280..53b976d8 100644 --- a/plasma/applets/homerun/fullscreen/applet/CMakeLists.txt +++ b/plasma/applets/homerun/fullscreen/applet/CMakeLists.txt @@ -7,7 +7,7 @@ set(homerunlauncher_SRCS kde4_add_plugin(plasma_applet_homerunlauncher ${homerunlauncher_SRCS}) -target_link_libraries(plasma_applet_homerunlauncher ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDE4_PHONON_LIBS} ) +target_link_libraries(plasma_applet_homerunlauncher ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ) configure_file(plasma-applet-homerunlauncher.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/plasma-applet-homerunlauncher.desktop @ONLY) diff --git a/plasma/applets/kickoff/DESIGN-GOALS b/plasma/applets/kickoff/DESIGN-GOALS index 4c7adc46..7d5956a6 100644 --- a/plasma/applets/kickoff/DESIGN-GOALS +++ b/plasma/applets/kickoff/DESIGN-GOALS @@ -37,8 +37,6 @@ Detailed goals: Ideas to explore in future: -> Use Sonnet for spell-checking the user's search query - -> Use Phonon for previews of audio and video content - in the favorites and recently used sections -> Light KWin integration for interesting effects for revealing, hiding or rendering the Kickoff launcher on composited '3D' desktops. diff --git a/plasma/declarativeimports/graphicswidgets/graphicswidgetsbindingsplugin.cpp b/plasma/declarativeimports/graphicswidgets/graphicswidgetsbindingsplugin.cpp index 82486cbd..d8d332c9 100644 --- a/plasma/declarativeimports/graphicswidgets/graphicswidgetsbindingsplugin.cpp +++ b/plasma/declarativeimports/graphicswidgets/graphicswidgetsbindingsplugin.cpp @@ -46,7 +46,6 @@ #include #include #include -#include #ifdef HAVE_QTWEBKIT #include #endif @@ -100,7 +99,6 @@ void GraphicsWidgetsBindingsPlugin::registerTypes(const char *uri) qmlRegisterType(uri, 0, 1, "TextEdit"); qmlRegisterType(uri, 0, 1, "ToolButton"); qmlRegisterType(uri, 0, 1, "TreeView"); - qmlRegisterType(uri, 0, 1, "VideoWidget"); #ifdef HAVE_QTWEBKIT qmlRegisterType(uri, 0, 1, "WebView"); #endif diff --git a/plasma/scriptengines/javascript/CMakeLists.txt b/plasma/scriptengines/javascript/CMakeLists.txt index 176b9868..f96b5ade 100644 --- a/plasma/scriptengines/javascript/CMakeLists.txt +++ b/plasma/scriptengines/javascript/CMakeLists.txt @@ -43,7 +43,7 @@ set(simple_javascript_engine_SRCS simplebindings/url.cpp ) -include_directories(${PHONON_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/common) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common) kde4_add_plugin(plasma_appletscript_simple_javascript ${simple_javascript_engine_SRCS}) @@ -145,7 +145,7 @@ set(declarative_appletscript_SRCS simplebindings/point.cpp ) -include_directories(${PHONON_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/common) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common) kde4_add_plugin(plasma_appletscript_declarative ${declarative_appletscript_SRCS}) target_link_libraries(plasma_appletscript_declarative diff --git a/plasma/scriptengines/javascript/plasmoid/simplejavascriptapplet.cpp b/plasma/scriptengines/javascript/plasmoid/simplejavascriptapplet.cpp index 7767bf20..d0e10559 100644 --- a/plasma/scriptengines/javascript/plasmoid/simplejavascriptapplet.cpp +++ b/plasma/scriptengines/javascript/plasmoid/simplejavascriptapplet.cpp @@ -53,7 +53,6 @@ #include #include #include -#include #define USE_JS_SCRIPTENGINE diff --git a/plasma/scriptengines/javascript/simplebindings/qscriptbookkeeping.cpp b/plasma/scriptengines/javascript/simplebindings/qscriptbookkeeping.cpp index bc9cb8b7..a4a9b860 100644 --- a/plasma/scriptengines/javascript/simplebindings/qscriptbookkeeping.cpp +++ b/plasma/scriptengines/javascript/simplebindings/qscriptbookkeeping.cpp @@ -23,7 +23,6 @@ #include #include #include -#include //Q_DECLARE_METATYPE(SimpleJavaScriptApplet*) Q_DECLARE_METATYPE(QGraphicsWidget*) @@ -32,43 +31,10 @@ Q_DECLARE_METATYPE(QGraphicsLayout*) Q_DECLARE_METATYPE(Plasma::Animation*) Q_DECLARE_METATYPE(Plasma::Applet*) Q_DECLARE_METATYPE(Plasma::Extender*) -Q_DECLARE_METATYPE(Plasma::VideoWidget::Controls) Q_DECLARE_METATYPE(Plasma::Svg*) Q_DECLARE_METATYPE(Qt::MouseButton) Q_DECLARE_METATYPE(QList) -QScriptValue qScriptValueFromControls(QScriptEngine *engine, const Plasma::VideoWidget::Controls &controls) -{ - return QScriptValue(engine, controls); -} - -void controlsFromScriptValue(const QScriptValue& obj, Plasma::VideoWidget::Controls &controls) -{ - int flagValue = obj.toInteger(); - //FIXME: it has to be a less ugly way to do that :) - if (flagValue & Plasma::VideoWidget::Play) { - controls |= Plasma::VideoWidget::Play; - } - if (flagValue & Plasma::VideoWidget::Pause) { - controls |= Plasma::VideoWidget::Pause; - } - if (flagValue & Plasma::VideoWidget::Stop) { - controls |= Plasma::VideoWidget::Stop; - } - if (flagValue & Plasma::VideoWidget::PlayPause) { - controls |= Plasma::VideoWidget::PlayPause; - } - if (flagValue & Plasma::VideoWidget::Progress) { - controls |= Plasma::VideoWidget::Progress; - } - if (flagValue & Plasma::VideoWidget::Volume) { - controls |= Plasma::VideoWidget::Volume; - } - if (flagValue & Plasma::VideoWidget::OpenFile) { - controls |= Plasma::VideoWidget::OpenFile; - } -} - typedef Plasma::Animation* AnimationPtr; QScriptValue qScriptValueFromAnimation(QScriptEngine *engine, const AnimationPtr &anim) { @@ -140,7 +106,6 @@ void registerSimpleAppletMetaTypes(QScriptEngine *engine) qScriptRegisterSequenceMetaType >(engine); qScriptRegisterMetaType(engine, qScriptValueFromAnimation, abstractAnimationFromQScriptValue); qScriptRegisterMetaType(engine, qScriptValueFromExtender, extenderFromQScriptValue); - qScriptRegisterMetaType(engine, qScriptValueFromControls, controlsFromScriptValue, QScriptValue()); qScriptRegisterMetaType(engine, qScriptValueFromMouseButton, mouseButtonFromScriptValue); } diff --git a/plasma/scriptengines/javascript/simplebindings/uiloader.cpp b/plasma/scriptengines/javascript/simplebindings/uiloader.cpp index 56fe141f..e694fe6c 100644 --- a/plasma/scriptengines/javascript/simplebindings/uiloader.cpp +++ b/plasma/scriptengines/javascript/simplebindings/uiloader.cpp @@ -50,7 +50,6 @@ #include #include #include -#include QGraphicsWidget *createBusyWidget(QGraphicsWidget *parent) { return new Plasma::BusyWidget(parent); } @@ -77,7 +76,6 @@ QGraphicsWidget *createTabBar(QGraphicsWidget *parent) { return new Plasma::TabB QGraphicsWidget *createTextEdit(QGraphicsWidget *parent) { return new Plasma::TextEdit(parent); } QGraphicsWidget *createToolButton(QGraphicsWidget *parent) { return new Plasma::ToolButton(parent); } QGraphicsWidget *createTreeView(QGraphicsWidget *parent) { return new Plasma::TreeView(parent); } -QGraphicsWidget *createVideoWidget(QGraphicsWidget *parent) { return new Plasma::VideoWidget(parent); } #ifdef HAVE_QTWEBKIT QGraphicsWidget *createWebView(QGraphicsWidget *parent) { return new Plasma::WebView(parent); } #endif @@ -109,7 +107,6 @@ UiLoader::UiLoader() m_widgetCtors.insert("TextEdit", createTextEdit); m_widgetCtors.insert("ToolButton", createToolButton); m_widgetCtors.insert("TreeView", createTreeView); - m_widgetCtors.insert("VideoWidget", createVideoWidget); #ifdef HAVE_QTWEBKIT m_widgetCtors.insert("WebView", createWebView); #endif diff --git a/renamedlgplugins/audio/audiopreview.cpp b/renamedlgplugins/audio/audiopreview.cpp index adda2fb0..624d855a 100644 --- a/renamedlgplugins/audio/audiopreview.cpp +++ b/renamedlgplugins/audio/audiopreview.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -111,11 +110,12 @@ void AudioPreview::initView( const QString& mimeType ) description = new QLabel(this); description->setText( desc ); description->adjustSize(); - m_player = KServiceTypeTrader::createInstanceFromQuery( "KMediaPlayer/Player", QString(), this ); + m_player = new KMediaWidget( this ); if ( m_player ) { - static_cast(m_player)->openUrl( url ); - m_player->widget()->show(); + + m_player->show(); + m_player->open( url.url() ); } } diff --git a/renamedlgplugins/audio/audiopreview.h b/renamedlgplugins/audio/audiopreview.h index 73f1c4b5..3fb9aec6 100644 --- a/renamedlgplugins/audio/audiopreview.h +++ b/renamedlgplugins/audio/audiopreview.h @@ -21,11 +21,7 @@ #define AUDIOPREVIEW_H #include - -namespace KMediaPlayer -{ - class Player; -} +#include class QLabel; class KUrl; @@ -48,7 +44,7 @@ private: QString m_localFile; bool m_isTempFile; - KMediaPlayer::Player *m_player; + KMediaWidget *m_player; }; #endif