1 /* This file is part of the KDE project
2 Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License, or (at your option) version 3.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #ifndef PHONONSERVER_H
22 #define PHONONSERVER_H
24 #include <kdedmodule.h>
25 #include <ksharedconfig.h>
26 #include <Phonon/ObjectDescription>
27 #include <QtCore/QBasicTimer>
28 #include <QtCore/QHash>
29 #include <QtCore/QVector>
30 #include <QtCore/QList>
31 #include <QtDBus/QDBusVariant>
32 #include "audiodevice.h"
34 class PhononServer
: public KDEDModule
37 Q_CLASSINFO("D-Bus Interface", "org.kde.PhononServer")
39 PhononServer(QObject
*parent
, const QList
<QVariant
> &args
);
43 Q_SCRIPTABLE QByteArray
audioDevicesIndexes(int type
);
44 Q_SCRIPTABLE QByteArray
audioDevicesProperties(int index
);
45 Q_SCRIPTABLE
bool isAudioDeviceRemovable(int index
) const;
46 Q_SCRIPTABLE
void removeAudioDevices(const QList
<int> &indexes
);
49 void timerEvent(QTimerEvent
*e
);
52 void deviceAdded(const QString
&udi
);
53 void deviceRemoved(const QString
&udi
);
54 // TODO add callbacks for Pulse, Jack changes and whatever else, if somehow possible
56 void alsaConfigChanged();
58 void askToRemoveDevices(const QStringList
&, const QList
<int> &indexes
);
62 void findVirtualDevices();
63 void updateAudioDevicesCache();
65 KSharedConfigPtr m_config
;
66 QBasicTimer m_updateDeviceListing
;
69 QByteArray m_audioOutputDevicesIndexesCache
;
70 QByteArray m_audioCaptureDevicesIndexesCache
;
71 QHash
<int, QByteArray
> m_audioDevicesPropertiesCache
;
73 // devices ordered by preference
74 QList
<PS::AudioDevice
> m_audioOutputDevices
;
75 QList
<PS::AudioDevice
> m_audioCaptureDevices
;
77 QStringList m_udisOfAudioDevices
;
80 #endif // PHONONSERVER_H