add more spacing
[personal-kdebase.git] / runtime / phonon / kded-module / phononserver.h
blob25838635218aab5f1b1261bd68776e088fe5a3b9
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
17 02110-1301, USA.
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
36 Q_OBJECT
37 Q_CLASSINFO("D-Bus Interface", "org.kde.PhononServer")
38 public:
39 PhononServer(QObject *parent, const QList<QVariant> &args);
40 ~PhononServer();
42 public slots:
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);
48 protected:
49 void timerEvent(QTimerEvent *e);
51 private slots:
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);
60 private:
61 void findDevices();
62 void findVirtualDevices();
63 void updateAudioDevicesCache();
65 KSharedConfigPtr m_config;
66 QBasicTimer m_updateDeviceListing;
68 // cache
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