1
/*  This file is part of the KDE project
2
    Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
3
4
    This library is free software; you can redistribute it and/or
5
    modify it under the terms of the GNU Lesser General Public
6
    License as published by the Free Software Foundation; either
7
    version 2.1 of the License, or (at your option) version 3, or any
8
    later version accepted by the membership of KDE e.V. (or its
9
    successor approved by the membership of KDE e.V.), Nokia Corporation 
10
    (or its successors, if any) and the KDE Free Qt Foundation, which shall
11
    act as a proxy defined in Section 6 of version 3 of the license.
12
13
    This library is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
    Lesser General Public License for more details.
17
18
    You should have received a copy of the GNU Lesser General Public 
19
    License along with this library.  If not, see <http://www.gnu.org/licenses/>.
20
21
*/
22
23
#ifndef PHONON_PLATFORMPLUGIN_H
24
#define PHONON_PLATFORMPLUGIN_H
25
26
#include <QtCore/QObject>
27
#include <QtCore/QStringList>
28
#include <QtCore/QPair>
29
#include "phonon_export.h"
30
#include "objectdescription.h"
31
32
QT_BEGIN_HEADER
33
QT_BEGIN_NAMESPACE
34
35
#ifndef QT_NO_PHONON_PLATFORMPLUGIN
36
37
class QUrl;
38
class QObject;
39
class QIcon;
40
41
namespace Phonon
42
{
43
class AbstractMediaStream;
44
45
class PlatformPlugin
46
{
47
    public:
48
        virtual ~PlatformPlugin() {}
49
50
        /**
51
         * Creates a AbstractMediaStream object that provides the data for the given \p url. On KDE
52
         * this uses KIO.
53
         */
54
        virtual AbstractMediaStream *createMediaStream(const QUrl &url, QObject *parent) = 0;
55
56
        /**
57
         * Returns the icon for the given icon name.
58
         */
59
        virtual QIcon icon(const QString &name) const = 0;
60
61
        /**
62
         * Shows a notification popup
63
         */
64
        virtual void notification(const char *notificationName, const QString &text,
65
                const QStringList &actions = QStringList(), QObject *receiver = 0,
66
                const char *actionSlot = 0) const = 0;
67
68
        /**
69
         * Returns the name of the application. For most Qt application this is
70
         * QCoreApplication::applicationName(), but for KDE this is overridden by KAboutData.
71
         */
72
        virtual QString applicationName() const = 0;
73
74
        /**
75
         * Creates a backend object. This way the platform can decide the backend preference.
76
         */
77
        virtual QObject *createBackend() = 0;
78
79
        /**
80
         * Using the library loader of the platform, loads a given backend.
81
         */
82
        virtual QObject *createBackend(const QString &library, const QString &version) = 0;
83
84
        /**
85
         * Tries to check whether the default backend supports a given MIME type without loading the
86
         * actual backend library. On KDE this reads the MIME type list from the .desktop file of
87
         * the backend.
88
         */
89
        virtual bool isMimeTypeAvailable(const QString &mimeType) const = 0;
90
91
        /**
92
         * Saves the volume for the given output.
93
         */
94
        virtual void saveVolume(const QString &outputName, qreal volume) = 0;
95
96
        /**
97
         * Loads the volume for the given output.
98
         */
99
        virtual qreal loadVolume(const QString &outputName) const = 0;
100
101
        virtual QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const = 0;
102
        virtual QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const = 0;
103
104
        /**
105
         * Returns a list of (driver, handle) pairs for the given AudioOutputDevice description.
106
         */
107
        virtual QList<QPair<QByteArray, QString> > deviceAccessListFor(const Phonon::AudioOutputDevice &) const { return QList<QPair<QByteArray, QString> >(); }
108
};
109
} // namespace Phonon
110
111
Q_DECLARE_INTERFACE(Phonon::PlatformPlugin, "3PlatformPlugin.phonon.kde.org")
112
113
#endif //QT_NO_PHONON_PLATFORMPLUGIN
114
115
QT_END_NAMESPACE
116
QT_END_HEADER
117
118
#endif // PHONON_PLATFORMPLUGIN_H