phonon/objectdescription.h Source File

objectdescription.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2006-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_OBJECTDESCRIPTION_H
24 #define PHONON_OBJECTDESCRIPTION_H
25 
26 #include "phonon_export.h"
27 
28 #include <QtCore/QExplicitlySharedDataPointer>
29 #include <QtCore/QtDebug>
30 #include <QtCore/QList>
31 #include <QtCore/QSharedData>
32 #include <QtCore/QString>
33 #include <QtCore/QVariant>
34 
37 
38 namespace Phonon
39 {
40  class ObjectDescriptionPrivate;
41 
49  {
61 
68 
80 
81  //VideoOutputDeviceType,
82  //VideoCaptureDeviceType,
83  //AudioCodecType,
84  //VideoCodecType,
85  //ContainerFormatType,
86  //VisualizationType,
87  };
88 
96 class PHONON_EXPORT ObjectDescriptionData : public QSharedData //krazy:exclude=dpointer (it's protected, which should be fine for this type of class)
97 {
98  public:
103  bool operator==(const ObjectDescriptionData &otherDescription) const;
104 
111  QString name() const;
112 
120  QString description() const;
121 
129  QVariant property(const char *name) const;
130 
136  QList<QByteArray> propertyNames() const;
137 
142  bool isValid() const;
143 
150  int index() const;
151 
152  static ObjectDescriptionData *fromIndex(ObjectDescriptionType type, int index);
153 
155 
156  ObjectDescriptionData(ObjectDescriptionPrivate * = 0);
157  ObjectDescriptionData(int index, const QHash<QByteArray, QVariant> &properties);
158 
159  protected:
160  ObjectDescriptionPrivate *const d;
161 
162  private:
163  ObjectDescriptionData &operator=(const ObjectDescriptionData &rhs);
164 };
165 
166 template<ObjectDescriptionType T> class ObjectDescriptionModel;
167 
179 template<ObjectDescriptionType T>
181 {
182  public:
187  static inline ObjectDescription<T> fromIndex(int index) { //krazy:exclude=inline
189  }
190 
195  inline bool operator==(const ObjectDescription &otherDescription) const { //krazy:exclude=inline
196  return *d == *otherDescription.d;
197  }
198 
203  inline bool operator!=(const ObjectDescription &otherDescription) const { //krazy:exclude=inline
204  return !operator==(otherDescription);
205  }
206 
213  inline QString name() const { return d->name(); } //krazy:exclude=inline
214 
222  inline QString description() const { return d->description(); } //krazy:exclude=inline
223 
231  inline QVariant property(const char *name) const { return d->property(name); } //krazy:exclude=inline
232 
238  inline QList<QByteArray> propertyNames() const { return d->propertyNames(); } //krazy:exclude=inline
239 
244  inline bool isValid() const { return d->isValid(); } //krazy:exclude=inline
245 
252  inline int index() const { return d->index(); } //krazy:exclude=inline
253 
255  ObjectDescription(int index, const QHash<QByteArray, QVariant> &properties) : d(new ObjectDescriptionData(index, properties)) {}
256 
257  protected:
258  friend class ObjectDescriptionModel<T>;
261 };
262 
263 template<ObjectDescriptionType T>
264 inline QDebug operator<<(QDebug s, const ObjectDescription<T> &o) //krazy:exclude=inline
265 {
266  return s << o.name();
267 }
268 
276 #ifndef QT_NO_PHONON_AUDIOCAPTURE
278 #endif //QT_NO_PHONON_AUDIOCAPTURE
279 
282 //typedef ObjectDescription<VideoOutputDeviceType> VideoOutputDevice;
286 //typedef ObjectDescription<VideoCaptureDeviceType> VideoCaptureDevice;
290 #ifndef QT_NO_PHONON_EFFECT
292 #endif //QT_NO_PHONON_EFFECT
293 
297 //typedef ObjectDescription<AudioCodecType> AudioCodecDescription;
301 //typedef ObjectDescription<VideoCodecType> VideoCodecDescription;
305 //typedef ObjectDescription<ContainerFormatType> ContainerFormatDescription;
309 //typedef ObjectDescription<VisualizationType> VisualizationDescription;
310 #ifndef QT_NO_PHONON_MEDIACONTROLLER
313 #endif //QT_NO_PHONON_MEDIACONTROLLER
314 
315 } //namespace Phonon
316 
318 
321 
322 #ifndef QT_NO_PHONON_AUDIOCAPTURE
325 #endif //QT_NO_PHONON_AUDIOCAPTURE
326 
327 #ifndef QT_NO_PHONON_EFFECT
330 #endif //QT_NO_PHONON_EFFECT
331 
332 
333 #ifndef QT_NO_PHONON_MEDIACONTROLLER
338 #endif //QT_NO_PHONON_MEDIACONTROLLER
339 
341 
342 #endif // PHONON_OBJECTDESCRIPTION_H
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
bool operator!=(const ObjectDescription &otherDescription) const
Returns false if this ObjectDescription describes the same as otherDescription; otherwise returns tru...
ObjectDescription< AudioCaptureDeviceType > AudioCaptureDevice
The ObjectDescriptionModel class provides a model from a list of ObjectDescription objects...
#define QT_END_NAMESPACE
Definition: qglobal.h:128
ObjectDescription< EffectType > EffectDescription
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
Lists all processing effects the backend supports.
ObjectDescription(int index, const QHash< QByteArray, QVariant > &properties)
ObjectDescriptionType
Defines the type of information that is contained in a ObjectDescription object.
QVariant property(const char *name) const
Returns a named property.
QString description() const
Returns a description of the capture source.
Definition: qdebug.h:62
#define Q_DECLARE_METATYPE(TYPE)
Definition: qmetatype.h:265
ObjectDescription< AudioOutputDeviceType > AudioOutputDevice
ObjectDescription< AudioChannelType > AudioChannelDescription
bool operator==(const Attribute &cA, const AttributeInstance< type > &cB)
This operator compares the two attributes and NOT their values.
Definition: node.h:577
QString name() const
Returns the name of the capture source.
ObjectDescriptionPrivate *const d
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
bool operator==(const ObjectDescription &otherDescription) const
Returns true if this ObjectDescription describes the same as otherDescription; otherwise returns fals...
ObjectDescription(const QExplicitlySharedDataPointer< ObjectDescriptionData > &dd)
bool isValid() const
Returns true if the Tuple is valid (index != -1); otherwise returns false.
Provides a tuple of enduser visible name and description.
static ObjectDescriptionData * fromIndex(ObjectDescriptionType type, int index)
Audio output devices.
QList< QByteArray > propertyNames() const
Returns all names that return valid data when property() is called.
Data class for objects describing devices or features of the backend.
Audio capture devices.
GLuint const GLchar * name
Definition: GLee.h:1704
QExplicitlySharedDataPointer< ObjectDescriptionData > d
The KDE Multimedia classes.
static ObjectDescription< T > fromIndex(int index)
Returns a new description object that describes the device/effect/codec/...
#define PHONON_EXPORT
Definition: phonon_export.h:38
GLdouble s
Definition: GLee.h:1173
ObjectDescription< SubtitleType > SubtitleDescription
#define QT_END_HEADER
Definition: qglobal.h:142
int index() const
A unique identifier for this device/.
GLuint index
Definition: GLee.h:1704