File indexing completed on 2024-04-21 04:43:19

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2007-2008 Matthias Kretz <kretz@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) version 3, or any
0008     later version accepted by the membership of KDE e.V. (or its
0009     successor approved by the membership of KDE e.V.), Nokia Corporation 
0010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
0011     act as a proxy defined in Section 6 of version 3 of the license.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public 
0019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 */
0022 
0023 #ifndef PHONON_PLATFORMPLUGIN_H
0024 #define PHONON_PLATFORMPLUGIN_H
0025 
0026 #include <QObject>
0027 #include <QStringList>
0028 #include <QPair>
0029 #include "phonon_export.h"
0030 #include "objectdescription.h"
0031 
0032 
0033 #ifndef QT_NO_PHONON_PLATFORMPLUGIN
0034 
0035 class QUrl;
0036 class QObject;
0037 class QIcon;
0038 
0039 namespace Phonon
0040 {
0041 class AbstractMediaStream;
0042 
0043 class PlatformPlugin
0044 {
0045     public:
0046         virtual ~PlatformPlugin() {}
0047 
0048         /**
0049          * Creates a AbstractMediaStream object that provides the data for the given \p url. On KDE
0050          * this uses KIO.
0051          */
0052         virtual AbstractMediaStream *createMediaStream(const QUrl &url, QObject *parent) = 0;
0053 
0054         /**
0055          * Returns the icon for the given icon name.
0056          */
0057         virtual QIcon icon(const QString &name) const = 0;
0058 
0059         /**
0060          * Shows a notification popup
0061          */
0062         virtual void notification(const char *notificationName, const QString &text,
0063                 const QStringList &actions = QStringList(), QObject *receiver = nullptr,
0064                 const char *actionSlot = nullptr) const = 0;
0065 
0066         /**
0067          * Returns the name of the application. For most Qt application this is
0068          * QCoreApplication::applicationName(), but for KDE this is overridden by KAboutData.
0069          */
0070         virtual QString applicationName() const = 0;
0071 
0072         /**
0073          * Creates a backend object. This way the platform can decide the backend preference.
0074          */
0075         virtual QObject *createBackend() = 0;
0076 
0077         /**
0078          * Using the library loader of the platform, loads a given backend.
0079          */
0080         virtual QObject *createBackend(const QString &library, const QString &version) = 0;
0081 
0082         /**
0083          * Tries to check whether the default backend supports a given MIME type without loading the
0084          * actual backend library. On KDE this reads the MIME type list from the .desktop file of
0085          * the backend.
0086          */
0087         virtual bool isMimeTypeAvailable(const QString &mimeType) const = 0;
0088 
0089         /**
0090          * Saves the volume for the given output.
0091          */
0092         virtual void saveVolume(const QString &outputName, qreal volume) = 0;
0093 
0094         /**
0095          * Loads the volume for the given output.
0096          */
0097         virtual qreal loadVolume(const QString &outputName) const = 0;
0098 
0099         virtual QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const = 0;
0100         virtual QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const = 0;
0101 
0102         /**
0103          * Returns a list of (driver, handle) pairs for the given AudioOutputDevice description.
0104          * Implementation is optional.
0105          */
0106         virtual DeviceAccessList deviceAccessListFor(const AudioOutputDevice &) const { return DeviceAccessList(); }
0107 
0108 #ifndef PHONON_NO_AUDIOCAPTURE
0109         /**
0110          * Returns a list of (driver, handle) pairs for the given AudioCaptureDevice description.
0111          * Implementation is optional.
0112          */
0113         virtual DeviceAccessList deviceAccessListFor(const AudioCaptureDevice &) const { return DeviceAccessList(); }
0114 #endif // PHONON_NO_AUDIOCAPTURE
0115 
0116 #ifndef PHONON_NO_VIDEOCAPTURE
0117         /**
0118          * Returns a list of (driver, handle) pairs for the given VideoCaptureDevice description.
0119          * Implementation is optional.
0120          */
0121         virtual DeviceAccessList deviceAccessListFor(const VideoCaptureDevice &) const { return DeviceAccessList(); }
0122 #endif // PHONON_NO_VIDEOCAPTURE
0123 };
0124 } // namespace Phonon
0125 
0126 Q_DECLARE_INTERFACE(Phonon::PlatformPlugin, "3PlatformPlugin.phonon.kde.org")
0127 
0128 #endif //QT_NO_PHONON_PLATFORMPLUGIN
0129 
0130 
0131 #endif // PHONON_PLATFORMPLUGIN_H