add more spacing
[personal-kdebase.git] / runtime / phonon / kcm / medianode_p.h
blob47b55e0200c62fd637d40416c12bd40e0d9008b4
1 /* This file is part of the KDE project
2 Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
20 #ifndef PHONON_MEDIANODE_P_H
21 #define PHONON_MEDIANODE_P_H
23 #include <QtCore/QtGlobal>
24 #include <QtCore/QList>
25 #include <QtCore/QObject>
26 #include <phonon/path.h>
27 #include <phonon/phonon_export.h>
29 QT_BEGIN_NAMESPACE
31 class QObject;
33 namespace Phonon
35 class MediaNode;
36 class MediaNodeDestructionHandler;
38 class PHONON_EXPORT MediaNodePrivate
40 Q_DECLARE_PUBLIC(MediaNode)
42 friend class AudioOutputPrivate;
43 friend class FactoryPrivate;
45 protected:
46 enum CastId {
47 MediaNodePrivateType,
48 AbstractAudioOutputPrivateType,
49 AudioOutputType
51 public:
52 /**
53 * Returns the backend object. If the object does not exist it tries to
54 * create it before returning.
56 * \return the Iface object, might return \c 0
58 QObject *backendObject();
60 const CastId castId;
62 protected:
63 MediaNodePrivate(CastId _castId = MediaNodePrivateType);
65 virtual ~MediaNodePrivate();
67 /**
68 * \internal
69 * This method cleanly deletes the Iface object. It is called on
70 * destruction and before a backend change.
72 void deleteBackendObject();
74 virtual bool aboutToDeleteBackendObject() = 0;
76 /**
77 * \internal
78 * Creates the Iface object belonging to this class. For most cases the
79 * implementation is
80 * \code
81 * Q_Q(ClassName);
82 * m_iface = Factory::createClassName(this);
83 * return m_iface;
84 * \endcode
86 * This function should not be called except from slotCreateIface.
88 * \see slotCreateIface
90 virtual void createBackendObject() = 0;
92 public:
93 /**
94 * \internal
95 * This class has its own destroyed signal since some cleanup calls
96 * need the pointer to the backend object intact. The
97 * QObject::destroyed signals comes after the backend object was
98 * deleted.
100 * As this class cannot derive from QObject a simple handler
101 * interface is used.
103 void addDestructionHandler(MediaNodeDestructionHandler *handler);
106 * \internal
107 * This class has its own destroyed signal since some cleanup calls
108 * need the pointer to the backend object intact. The
109 * QObject::destroyed signals comes after the backend object was
110 * deleted.
112 * As this class cannot derive from QObject a simple handler
113 * interface is used.
115 void removeDestructionHandler(MediaNodeDestructionHandler *handler);
117 void addOutputPath(const Path &);
118 void addInputPath(const Path &);
119 void removeOutputPath(const Path &);
120 void removeInputPath(const Path &);
122 const QObject *qObject() const { return const_cast<MediaNodePrivate *>(this)->qObject(); }
123 virtual QObject *qObject() = 0;
125 protected:
126 MediaNode *q_ptr;
127 public:
128 QObject *m_backendObject;
129 protected:
130 QList<Path> outputPaths;
131 QList<Path> inputPaths;
133 private:
134 QList<MediaNodeDestructionHandler *> handlers;
135 Q_DISABLE_COPY(MediaNodePrivate)
138 } // namespace Phonon
140 QT_END_NAMESPACE
142 #endif // PHONON_MEDIANODE_P_H