| 1 | /* This file is part of the KDE project |
| 2 | Copyright (C) 2007 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_FRONTENDINTERFACEPRIVATE_H |
| 24 | #define PHONON_FRONTENDINTERFACEPRIVATE_H |
| 25 | |
| 26 | #include "addoninterface.h" |
| 27 | #include "mediaobject_p.h" |
| 28 | #include "phononnamespace_p.h" |
| 29 | #include <QPointer> |
| 30 | |
| 31 | #ifndef QT_NO_PHONON_MEDIACONTROLLER |
| 32 | |
| 33 | namespace Phonon |
| 34 | { |
| 35 | class FrontendInterfacePrivate |
| 36 | { |
| 37 | public: |
| 38 | FrontendInterfacePrivate(MediaObject *mp) : media(mp) { |
| 39 | Q_ASSERT(media); |
| 40 | MediaObjectPrivate *d = media->k_func(); |
| 41 | d->interfaceList << this; |
| 42 | } |
| 43 | virtual ~FrontendInterfacePrivate() { |
| 44 | if (media) { |
| 45 | MediaObjectPrivate *d = media->k_func(); |
| 46 | d->interfaceList << this; |
| 47 | } |
| 48 | } |
| 49 | virtual void backendObjectChanged(QObject *iface) = 0; |
| 50 | void _backendObjectChanged() { |
| 51 | pDebug() << Q_FUNC_INFO; |
| 52 | QObject *x = media->k_ptr->backendObject(); |
| 53 | if (x) { |
| 54 | backendObjectChanged(iface: x); |
| 55 | } |
| 56 | } |
| 57 | AddonInterface *iface() { return qobject_cast<AddonInterface *>(object: media->k_ptr->backendObject()); } |
| 58 | QPointer<MediaObject> media; |
| 59 | }; |
| 60 | } // namespace Phonon |
| 61 | |
| 62 | #endif //QT_NO_PHONON_MEDIACONTROLLER |
| 63 | |
| 64 | #endif // PHONON_FRONTENDINTERFACEPRIVATE_H |
| 65 | |