generic: drop Phonon in favour of MPV and custom player classes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-03-14 21:48:05 +00:00
parent 665778862c
commit 0e40e66ccb
69 changed files with 53 additions and 9406 deletions

View file

@ -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)

View file

@ -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(

View file

@ -4,7 +4,7 @@
#include <QTimer>
#include <QPainter>
#include <QLabel>
#include <QtGui/QDesktopWidget>
#include <QDesktopWidget>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QVBoxLayout>
@ -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);
}
}

View file

@ -1,18 +1,15 @@
#ifndef __K_ACCESS_H__
#define __K_ACCESS_H__
#include <QWidget>
#include <QColor>
//Added by qt3to4:
#include <QLabel>
#include <QtGui/qevent.h>
#include <QEvent>
#include <KUniqueApplication>
#include <KUrl>
#include <Phonon/MediaObject>
#include <QTextStream> // so that it can define Status
#include <KMediaPlayer>
#include <X11/Xlib.h>
#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;

View file

@ -1,4 +1,3 @@
#include "kaccess.h"
#include <kdebug.h>
#include <kaboutdata.h>

View file

@ -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})

View file

@ -45,59 +45,32 @@
#include <config-runtime.h>
#include <kcomponentdata.h>
#include <knotifyconfig.h>
// Phonon headers
#include <phonon/mediaobject.h>
#include <phonon/path.h>
#include <phonon/audiooutput.h>
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 <kmediaplayer.h>
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<Player *> m_playersInUse;
KAudioPlayer *m_idlePlayer;
QList<KAudioPlayer *> 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<int, KProcess *> processes;
QHash<int, Player*> playerObjects;
QHash<int, KAudioPlayer*> 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);

View file

@ -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()));

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -1,890 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2010 Colin Guthrie <cguthrie@mandriva.org>
Copyright (C) 2011 Harald Sitter <sitter@kde.org>
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 <QtCore/QAbstractEventDispatcher>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QTimer>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusInterface>
#include <QLabel>
#include <kaboutdata.h>
#include <kconfiggroup.h>
#include <kdebug.h>
#include <kicon.h>
#include <kuser.h>
#include <glib.h>
#include <pulse/xmalloc.h>
#include <pulse/glib-mainloop.h>
#include "testspeakerwidget.h"
#define SS_DEFAULT_ICON "audio-card"
#define THAT(userdata) Q_ASSERT(userdata); AudioSetup *ss = static_cast<AudioSetup *>(userdata)
static pa_glib_mainloop *s_mainloop = NULL;
static pa_context *s_context = NULL;
QMap<quint32, cardInfo> s_Cards;
QMap<quint32, deviceInfo> s_Sinks;
QMap<quint32, deviceInfo> 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<QString, QString> 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<QString,QString>(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<QString,QString>(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<quint32, QPair<QString, QString> >::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<quint32, deviceInfo>::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<quint32, deviceInfo>::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<quint32, QPair<QString, QString> >::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<quint32>(-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<quint32>(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"

View file

@ -1,99 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2010 Colin Guthrie <cguthrie@mandriva.org>
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 <canberra.h>
#include <pulse/pulseaudio.h>
#include "ui_audiosetup.h"
#include <kconfig.h>
class QTimer;
struct pa_glib_mainloop;
typedef struct {
quint32 index;
QString name;
QString icon;
QMap<quint32, QPair<QString, QString> > profiles;
QString activeProfile;
} cardInfo;
typedef struct {
quint32 index;
quint32 cardIndex;
QString name;
QString icon;
pa_channel_map channelMap;
QMap<quint32, QPair<QString, QString> > 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

View file

@ -1,224 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Colin Guthrie</author>
<class>AudioSetup</class>
<widget class="QWidget" name="AudioSetup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>654</width>
<height>480</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="hardwareGroupBox">
<property name="title">
<string>Hardware</string>
</property>
<layout class="QGridLayout" name="_3">
<item row="3" column="1">
<widget class="KComboBox" name="profileBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KComboBox" name="cardBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="profileLabel">
<property name="text">
<string>Profile</string>
</property>
<property name="buddy">
<cstring>profileBox</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="cardLabel">
<property name="text">
<string>Sound Card</string>
</property>
<property name="buddy">
<cstring>cardBox</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="deviceGroupBox">
<property name="title">
<string>Device Configuration</string>
</property>
<layout class="QGridLayout" name="_2">
<item row="0" column="1">
<widget class="KComboBox" name="deviceBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>Connector</string>
</property>
<property name="buddy">
<cstring>portBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="portBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="deviceLabel">
<property name="text">
<string>Sound Device</string>
</property>
<property name="buddy">
<cstring>deviceBox</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="playbackOrCaptureStack">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="playbackPage">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="outputGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Speaker Placement and Testing</string>
</property>
<layout class="QVBoxLayout" name="_4">
<item>
<layout class="QGridLayout" name="placementGrid"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="capturePage">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="inputGroupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
<property name="title">
<string>Input Levels</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QProgressBar" name="inputLevels">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="value">
<number>50</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,240 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2004-2007 Matthias Kretz <kretz@kde.org>
Copyright (C) 2011 Harald Sitter <sitter@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "backendselection.h"
#include <QtCore/QList>
#include <QtCore/QStringList>
#include <QListWidget>
#include <KApplication>
#include <KCModuleProxy>
#include <KConfig>
#include <KIcon>
#include <KIconLoader>
#include <KRun>
#include <KServiceTypeProfile>
#include <KServiceTypeTrader>
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("<a href=\"%1\">%1</a>").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<QListWidgetItem *> selectedList = m_select->selectedItems();
foreach (QListWidgetItem *selected, selectedList) {
const int row = m_select->row(selected);
if (row > 0) {
QListWidgetItem *taken = m_select->takeItem(row - 1);
m_select->insertItem(row, taken);
emit changed();
selectionChanged();
}
}
}
void BackendSelection::down()
{
QList<QListWidgetItem *> selectedList = m_select->selectedItems();
foreach (QListWidgetItem *selected, selectedList) {
const int row = m_select->row(selected);
if (row + 1 < m_select->count()) {
QListWidgetItem *taken = m_select->takeItem(row + 1);
m_select->insertItem(row, taken);
emit changed();
selectionChanged();
}
}
}
#include "moc_backendselection.cpp"
// vim: sw=4 ts=4

View file

@ -1,60 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2004-2007 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef BACKENDSELECTION_H
#define BACKENDSELECTION_H
#include "ui_backendselection.h"
#include <QWidget>
#include <QtCore/QHash>
#include <kservice.h>
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<QString, KService::Ptr> m_services;
QHash<QString, KCModuleProxy *> m_kcms;
int m_emptyPage;
};
// vim: sw=4 ts=4 tw=80
#endif // BACKENDSELECTION_H

View file

@ -1,221 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Matthias Kretz &lt;kretz@kde.org&gt;</author>
<class>BackendSelection</class>
<widget class="QWidget" name="BackendSelection">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>510</width>
<height>325</height>
</rect>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="0">
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="3">
<widget class="QListWidget" name="m_select">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>A list of Phonon Backends found on your system. The order here determines the order Phonon will use them in.</string>
</property>
<property name="whatsThis">
<string>A list of Phonon Backends found on your system. The order here determines the order Phonon will use them in.</string>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="m_up">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Prefer</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="m_down">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Defer</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout2">
<property name="margin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="m_comment">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_website">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="m_version">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" rowspan="4">
<widget class="QFrame" name="frame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="m_icon">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1" rowspan="2">
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="KMessageWidget" name="m_messageWidget" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KMessageWidget</class>
<extends>QWidget</extends>
<header location="global">KMessageWidget</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

File diff suppressed because it is too large Load diff

View file

@ -1,95 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
Copyright (C) 2011 Casian Andrei <skeletk13@gmail.com>
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 <phonon/objectdescriptionmodel.h>
#include <phonon/objectdescription.h>
#include <QtGui/qstandarditemmodel.h>
#include <QtCore/QMap>
#include <QtCore/QList>
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<ObjectDescriptionType T> void removeDevice(const ObjectDescription<T> &deviceToRemove,
QMap<int, ObjectDescriptionModel<T> *> *modelMap);
void loadCategoryDevices();
QList<AudioOutputDevice> availableAudioOutputDevices() const;
QList<AudioCaptureDevice> availableAudioCaptureDevices() const;
QList<VideoCaptureDevice> availableVideoCaptureDevices() const;
DeviceType shownModelType() const;
private:
QMap<int, AudioOutputDeviceModel *> m_audioOutputModel;
QMap<int, AudioCaptureDeviceModel *> m_audioCaptureModel;
QMap<int, VideoCaptureDeviceModel *> 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

View file

@ -1,222 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Matthias Kretz &lt;kretz@kde.org&gt;</author>
<class>DevicePreference</class>
<widget class="QWidget" name="DevicePreference">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>400</height>
</rect>
</property>
<layout class="QGridLayout">
<item row="0" column="0" rowspan="2">
<layout class="QVBoxLayout">
<item>
<widget class="QTreeView" name="categoryTree">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="toolTip">
<string>Various categories of media use cases. For each category, you may choose what device you prefer to be used by the Phonon applications.</string>
</property>
<property name="whatsThis">
<string>Various categories of media use cases. For each category, you may choose what device you prefer to be used by the Phonon applications.</string>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="showAdvancedDevicesContainer">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="showAdvancedDevicesCheckBox">
<property name="text">
<string>Show advanced devices</string>
</property>
</widget>
</item>
<item>
<spacer name="showAdvancedDevicesSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="applyPreferencesButton">
<property name="toolTip">
<string>Use the currently shown device list for more categories.</string>
</property>
<property name="whatsThis">
<string>Use the currently shown device list for more categories.</string>
</property>
<property name="text">
<string>Apply Device List To...</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QTreeView" name="deviceList">
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Devices found on your system, suitable for the selected category. Choose the device that you wish to be used by the applications.</string>
</property>
<property name="whatsThis">
<string>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.</string>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="textElideMode">
<enum>Qt::ElideNone</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout">
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>29</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="testPlaybackButton">
<property name="text">
<string>Test</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="preferButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>prefer the selected device</string>
</property>
<property name="text">
<string>Prefer</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="deferButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>no preference for the selected device</string>
</property>
<property name="text">
<string>Defer</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<includes>
<include location="global">kdialog.h</include>
</includes>
<resources/>
<connections/>
</ui>

View file

@ -1,197 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2004-2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PHONON_FACTORY_P_H
#define PHONON_FACTORY_P_H
#include <phonon/phonon_export.h>
#include <QtCore/QObject>
#include <QtCore/QStringList>
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 <kretz@kde.org>
*/
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

View file

@ -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,nhc,giao tiếp, phương tin
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,106 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
Copyright (C) 2010 Colin Guthrie <cguthrie@mandriva.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "main.h"
#include <QBoxLayout>
#include <KAboutData>
#include <KDialog>
#include <KPluginFactory>
#include <KTabWidget>
#include <kdeversion.h>
#include "devicepreference.h"
#include "backendselection.h"
#ifdef HAVE_PULSEAUDIO
# include "audiosetup.h"
#endif
K_PLUGIN_FACTORY(PhononKcmFactory, registerPlugin<PhononKcm>();)
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

View file

@ -1,59 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef MAIN_H
#define MAIN_H
#include <kcmodule.h>
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

View file

@ -1,142 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PHONON_MEDIANODE_P_H
#define PHONON_MEDIANODE_P_H
#include <QtCore/QtGlobal>
#include <QtCore/QList>
#include <QtCore/QObject>
#include <phonon/path.h>
#include <phonon/phonon_export.h>
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<MediaNodePrivate *>(this)->qObject(); }
virtual QObject *qObject() = 0;
protected:
MediaNode *q_ptr;
public:
QObject *m_backendObject;
protected:
QList<Path> outputPaths;
QList<Path> inputPaths;
private:
QList<MediaNodeDestructionHandler *> handlers;
Q_DISABLE_COPY(MediaNodePrivate)
};
} // namespace Phonon
QT_END_NAMESPACE
#endif // PHONON_MEDIANODE_P_H

View file

@ -1,366 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PHONONDEFS_P_H
#define PHONONDEFS_P_H
#include <QtCore/QMetaType>
#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<typename T> struct IsValid { enum { Result = true }; };
/// except NoIface
template<> struct IsValid<NoIface> { enum { Result = false }; };
template<class T> inline T my_cast(QObject *o) { return qobject_cast<T>(o); }
template<class T> inline T my_cast(const QObject *o) { return qobject_cast<T>(o); }
template<> inline NoIface *my_cast<NoIface *>(QObject *) { return 0; }
template<> inline NoIface *my_cast<NoIface *>(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<FooInterface0, FooInterface> iface0(d);
if (iface0) {
iface0->oldMethod();
}
Iface<FooInterface> 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<IFACES0> iface0(d);
if (iface0) {
iface0->oldMethod();
}
Iface<IFACES1> 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 <kretz@kde.org>
*/
template<class T0, class T1 = NoIface, class T2 = NoIface>
class Iface
{
public:
static inline T0 *cast(MediaNodePrivate *const d)
{
if (IsValid<T1>::Result) {
T0 *ret;
if (IsValid<T2>::Result) {
ret = reinterpret_cast<T0 *>(my_cast<T2 *>(d->m_backendObject));
if (ret) return ret;
}
ret = reinterpret_cast<T0 *>(my_cast<T1 *>(d->m_backendObject));
if (ret) return ret;
}
return qobject_cast<T0 *>(d->m_backendObject);
}
static inline const T0 *cast(const MediaNodePrivate *const d)
{
if (IsValid<T1>::Result) {
const T0 *ret;
if (IsValid<T2>::Result) {
ret = reinterpret_cast<const T0 *>(my_cast<T2 *>(d->m_backendObject));
if (ret) return ret;
}
ret = reinterpret_cast<const T0 *>(my_cast<T1 *>(d->m_backendObject));
if (ret) return ret;
}
return qobject_cast<T0 *>(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 T0, class T1 = NoIface, class T2 = NoIface>
class ConstIface
{
public:
inline ConstIface(const MediaNodePrivate *const d) : iface(Iface<T0, T1, T2>::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<PHONON_INTERFACENAME >::cast(d)->function
#define pINTERFACE_CALL(function) \
Iface<PHONON_INTERFACENAME >::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<PHONON_INTERFACENAME >::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<PHONON_INTERFACENAME >::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<PHONON_INTERFACENAME >::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<int>)
#endif
#endif // PHONONDEFS_P_H

View file

@ -1,51 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2005-2006 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PHONONNAMESPACE_P_H
#define PHONONNAMESPACE_P_H
#include <QtCore/QDebug>
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

View file

@ -1,89 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PHONON_QSETTINGSGROUP_P_H
#define PHONON_QSETTINGSGROUP_P_H
#include <QtCore/QSettings>
#include <QtCore/QString>
#include <QtCore/QVariant>
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<typename T>
inline T value(const QString &key, const T &def) const
{
return qvariant_cast<T>(value(key, qVariantFromValue(def)));
}
inline QVariant value(const QString &key, const QVariant &def) const
{
return m_settings->value(m_group + key, def);
}
template<typename T>
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

View file

@ -1,242 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2010 Colin Guthrie <cguthrie@mandriva.org>
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 <stdio.h>
#include <klocale.h>
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

View file

@ -1,54 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2010 Colin Guthrie <cguthrie@mandriva.org>
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 <kpushbutton.h>
#include <canberra.h>
#include <pulse/pulseaudio.h>
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

View file

@ -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)

View file

@ -1,2 +0,0 @@
#!/bin/bash
$XGETTEXT *.cpp -o $podir/phononserver.pot

View file

@ -1 +0,0 @@
- List all available audio devices and keep the list updated when devices are (un)plugged. Make that list available over dbus.

View file

@ -1,120 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "deviceaccess.h"
#include <klocale.h>
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

View file

@ -1,99 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef DEVICEACCESS_H
#define DEVICEACCESS_H
#include <QtCore/QDebug>
#include <QtCore/QStringList>
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

View file

@ -1,244 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "deviceinfo.h"
#include "hardwaredatabase.h"
#include <kconfiggroup.h>
#include <kdebug.h>
#include <klocale.h>
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("<html>This device is currently not available (either it is unplugged or the "
"driver is not loaded).</html>");
}
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", "<li>%1: %2</li>",
a.driverName(), id);
}
}
return i18n("<html>This will try the following devices and use the first that works: "
"<ol>%1</ol></html>", 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

View file

@ -1,198 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef DEVICEINFO_H
#define DEVICEINFO_H
#include "deviceaccess.h"
#include <QtCore/QDebug>
#include <QtCore/QHash>
#include <QtCore/QList>
#include <QtCore/QString>
#include <ksharedconfig.h>
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<DeviceAccess> &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<DeviceAccess> 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

View file

@ -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

View file

@ -1,263 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 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 <kcomponentdata.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <kglobal.h>
#include <ksavefile.h>
#include <kstandarddirs.h>
#include <QtCore/QCache>
#include <QtCore/QList>
#include <QtCore/QVarLengthArray>
#include <QtCore/QVector>
#include <QtCore/QDataStream>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QSet>
#include <QtCore/QString>
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<QString, Entry> entryCache;
private:
QWeakPointer<QFile> 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<uint, quint32> 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<QList<BucketEntry> > bucketContents(hashTableBuckets);
{
QHashIterator<uint, quint32> 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<quint32, 4099> 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<BucketEntry> 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

View file

@ -1,92 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 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 <QtCore/QString>
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
* <bus>:<vendor id>:<product id>:<subsystem vendor id>:<system product id>:<device number>:[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

File diff suppressed because it is too large Load diff

View file

@ -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 cp chế đ âm thanh h thng cho các ng dng
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]=

View file

@ -1,88 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
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 <kdedmodule.h>
#include <ksharedconfig.h>
#include <phonon/objectdescription.h>
#include <QtCore/QBasicTimer>
#include <QtCore/QHash>
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QtDBus/qdbusextratypes.h>
class PhononServer : public KDEDModule
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.PhononServer")
public:
PhononServer(QObject *parent, const QList<QVariant> &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<int> &indexes);
Q_SCRIPTABLE void removeVideoDevices(const QList<int> &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<int> &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<int, QByteArray> m_audioDevicesPropertiesCache;
QHash<int, QByteArray> m_videoDevicesPropertiesCache;
// devices ordered by preference
QList<PS::DeviceInfo> m_audioOutputDevices;
QList<PS::DeviceInfo> m_audioCaptureDevices;
QList<PS::DeviceInfo> m_videoCaptureDevices;
QStringList m_udisOfDevices;
};
#endif // PHONONSERVER_H

View file

@ -1,11 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.Phonon.ServiceRegistry">
<method name="category">
<arg type="s" direction="out"/>
</method>
<method name="name">
<arg type="s" direction="out"/>
</method>
</interface>
</node>

View file

@ -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}
)

View file

@ -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

View file

@ -1,163 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "devicelisting.h"
#include <QtCore/QFile>
#include <QtDBus/QDBusReply>
#include <QtCore/qhash.h>
#include <QtCore/qcoreevent.h>
#include <kconfiggroup.h>
#include <kdebug.h>
#include <klocale.h>
#include <ksharedconfig.h>
#include <../config-alsa.h>
#ifdef HAVE_ALSA_ASOUNDLIB_H
#include <alsa/asoundlib.h>
#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<int> DeviceListing::objectDescriptionIndexes(ObjectDescriptionType type)
{
QList<int> r;
QDBusReply<QByteArray> reply;
if (type == AudioOutputDeviceType || type == AudioCaptureDeviceType) {
reply = m_phononServer.call(QLatin1String("audioDevicesIndexes"), static_cast<int>(type));
if (!reply.isValid()) {
kError(600) << reply.error();
return r;
}
} else
if (type == VideoCaptureDeviceType) {
reply = m_phononServer.call(QLatin1String("videoDevicesIndexes"), static_cast<int>(type));
if (!reply.isValid()) {
kError(600) << reply.error();
return r;
}
} else
return r;
QDataStream stream(reply.value());
stream >> r;
return r;
}
QHash<QByteArray, QVariant> DeviceListing::objectDescriptionProperties(ObjectDescriptionType type, int index)
{
QHash<QByteArray, QVariant> r;
QDBusReply<QByteArray> 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

View file

@ -1,61 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef DEVICELISTING_H
#define DEVICELISTING_H
#include <QtCore/QBasicTimer>
#include <QtDBus/QDBusInterface>
#include <QtCore/QByteArray>
#include <QtCore/QHash>
#include <QtCore/QObject>
#include <QtCore/QVariant>
#include <Phonon/ObjectDescription>
namespace Phonon
{
class DeviceListing : public QObject
{
Q_OBJECT
public:
DeviceListing();
~DeviceListing();
QList<int> objectDescriptionIndexes(ObjectDescriptionType type);
QHash<QByteArray, QVariant> 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

View file

@ -1,321 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kdeplatformplugin.h"
#include "kiomediastream.h"
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/qplugin.h>
#include <QtCore/QCoreApplication>
#include <kaboutdata.h>
#include <kdebug.h>
#include <kcomponentdata.h>
#include <kglobal.h>
#include <kicon.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kmimetype.h>
#include <knotification.h>
#include <kservice.h>
#include <kservicetypetrader.h>
#include <kconfiggroup.h>
#include <kstandarddirs.h>
#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<QObject>(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("<qt>Unable to use the <b>%1</b> Multimedia Backend:<br/>%2</qt>",
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<qreal>(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<int> KdePlatformPlugin::objectDescriptionIndexes(ObjectDescriptionType type) const
{
switch (type) {
case AudioOutputDeviceType:
case AudioCaptureDeviceType:
case VideoCaptureDeviceType:
ensureDeviceListingObject();
return m_devList->objectDescriptionIndexes(type);
default:
return QList<int>();
}
}
QHash<QByteArray, QVariant> 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<QByteArray, QVariant>();
}
}
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<DeviceAccessList>(dalVariant);
}
DeviceAccessList ret;
if (driverVariant.isValid()) {
const QByteArray &driver = driverVariant.toByteArray();
const QStringList &deviceIds = deviceIdsVariant.toStringList();
foreach (const QString &deviceId, deviceIds) {
ret << QPair<QByteArray, QString>(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

View file

@ -1,75 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PHONON_KDEPLATFORMPLUGIN_H
#define PHONON_KDEPLATFORMPLUGIN_H
#include <phonon/platformplugin.h>
#include <phonon/objectdescription.h>
#include <QtCore/QObject>
#include <kservice.h>
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<int> objectDescriptionIndexes(ObjectDescriptionType type) const;
virtual QHash<QByteArray, QVariant> 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

View file

@ -1,268 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "kiomediastream.h"
#include "kiomediastream_p.h"
#include <kdebug.h>
#include <kprotocolmanager.h>
#include <kio/filejob.h>
#include <kio/job.h>
#include <klocale.h>
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<KIO::FileJob *>(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<KIO::FileJob *>(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<KIO::FileJob *>(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<KIO::FileJob *>(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<KIO::FileJob *>(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<KIO::FileJob *>(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<KIO::FileJob *>(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<KIO::FileJob *>(kiojob));
QMetaObject::invokeMethod(q, "_k_read", Qt::QueuedConnection);
}
}
void KioMediaStreamPrivate::_k_read()
{
KIO::FileJob *filejob = qobject_cast<KIO::FileJob *>(kiojob);
Q_ASSERT(filejob);
filejob->read(32768);
}
} // namespace Phonon
#include "moc_kiomediastream.cpp"
// vim: sw=4 sts=4 et tw=100

View file

@ -1,58 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PHONON_KIOMEDIASTREAM_H
#define PHONON_KIOMEDIASTREAM_H
#include <Phonon/AbstractMediaStream>
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

View file

@ -1,77 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KIOMEDIASTREAM_P_H
#define KIOMEDIASTREAM_P_H
#include "kiomediastream.h"
#include <kurl.h>
#include <kio/jobclasses.h>
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

View file

@ -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

View file

@ -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]=KDEova 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]=KDEova multimedijska pozadina
Name[sr@latin]=KDEova 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]=Hu trưng đa phương tin 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
#

View file

@ -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
}

View file

@ -1,6 +0,0 @@
<RCC>
<qresource prefix="/phonon" >
<!--<file>softvol.alsa</file>-->
<file>phonondevice.alsa</file>
</qresource>
</RCC>

View file

@ -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
}

View file

@ -1,38 +0,0 @@
/* This file is part of the KDE project
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef SERVICEREGISTRYADAPTOR_H
#define SERVICEREGISTRYADAPTOR_H
#include <QtDBus/QDBusAbstractAdaptor>
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

View file

@ -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)

View file

@ -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.

View file

@ -46,7 +46,6 @@
#include <Plasma/TextEdit>
#include <Plasma/ToolButton>
#include <Plasma/TreeView>
#include <Plasma/VideoWidget>
#ifdef HAVE_QTWEBKIT
#include <Plasma/WebView>
#endif
@ -100,7 +99,6 @@ void GraphicsWidgetsBindingsPlugin::registerTypes(const char *uri)
qmlRegisterType<Plasma::TextEdit>(uri, 0, 1, "TextEdit");
qmlRegisterType<Plasma::ToolButton>(uri, 0, 1, "ToolButton");
qmlRegisterType<Plasma::TreeView>(uri, 0, 1, "TreeView");
qmlRegisterType<Plasma::VideoWidget>(uri, 0, 1, "VideoWidget");
#ifdef HAVE_QTWEBKIT
qmlRegisterType<Plasma::WebView>(uri, 0, 1, "WebView");
#endif

View file

@ -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

View file

@ -53,7 +53,6 @@
#include <Plasma/Package>
#include <Plasma/PopupApplet>
#include <Plasma/Svg>
#include <Plasma/VideoWidget>
#define USE_JS_SCRIPTENGINE

View file

@ -23,7 +23,6 @@
#include <Plasma/Applet>
#include <Plasma/Animation>
#include <Plasma/Extender>
#include <Plasma/VideoWidget>
//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<double>)
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<QList<double> >(engine);
qScriptRegisterMetaType<Plasma::Animation *>(engine, qScriptValueFromAnimation, abstractAnimationFromQScriptValue);
qScriptRegisterMetaType<Plasma::Extender *>(engine, qScriptValueFromExtender, extenderFromQScriptValue);
qScriptRegisterMetaType<Plasma::VideoWidget::Controls>(engine, qScriptValueFromControls, controlsFromScriptValue, QScriptValue());
qScriptRegisterMetaType<Qt::MouseButton>(engine, qScriptValueFromMouseButton, mouseButtonFromScriptValue);
}

View file

@ -50,7 +50,6 @@
#include <Plasma/ToolButton>
#include <Plasma/TreeView>
#include <Plasma/WebView>
#include <Plasma/VideoWidget>
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

View file

@ -28,7 +28,6 @@
#include <kurl.h>
#include <kio/netaccess.h>
#include <kurllabel.h>
#include <kmediaplayer/player.h>
#include <kservicetypetrader.h>
#include <ksqueezedtextlabel.h>
@ -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>( "KMediaPlayer/Player", QString(), this );
m_player = new KMediaWidget( this );
if ( m_player )
{
static_cast<KParts::ReadOnlyPart*>(m_player)->openUrl( url );
m_player->widget()->show();
m_player->show();
m_player->open( url.url() );
}
}

View file

@ -21,11 +21,7 @@
#define AUDIOPREVIEW_H
#include <kvbox.h>
namespace KMediaPlayer
{
class Player;
}
#include <kmediawidget.h>
class QLabel;
class KUrl;
@ -48,7 +44,7 @@ private:
QString m_localFile;
bool m_isTempFile;
KMediaPlayer::Player *m_player;
KMediaWidget *m_player;
};
#endif