Qt 4.8
Public Functions | Protected Functions | Private Slots | Private Functions | Properties | List of all members
QAuServerQWS Class Reference
Inheritance diagram for QAuServerQWS:
QAuServer QObject

Public Functions

void init (QSound *s)
 Initializes the sound. More...
 
void insert (QAuBucketQWS *bucket)
 
bool okay ()
 
void play (QSound *s)
 
 QAuServerQWS (QObject *parent)
 
void remove (QAuBucketQWS *bucket)
 
void stop (QSound *s)
 
- Public Functions inherited from QAuServer
virtual void play (const QString &filename)
 
 QAuServer (QObject *parent)
 
 ~QAuServer ()
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Protected Functions

QAuBucketQWSbucket (QSound *s)
 
- Protected Functions inherited from QAuServer
QAuBucketbucket (QSound *)
 Returns the internal bucket record of sound s. More...
 
int decLoop (QSound *)
 Decrements the QSound::loopRemaining() value for sound s, returning the result. More...
 
void setBucket (QSound *, QAuBucket *)
 Sets the internal bucket record of sound s to b, deleting any previous setting. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 

Private Slots

void complete (int id)
 
void complete (QAuBucketQWS *bucket)
 

Private Functions

QAuBucketQWSfind (int id)
 

Properties

QHash< int, QAuBucketQWS * > buckets
 
QWSSoundClient * client
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 138 of file qsound_qws.cpp.

Constructors and Destructors

◆ QAuServerQWS()

QAuServerQWS::QAuServerQWS ( QObject parent)

Definition at line 253 of file qsound_qws.cpp.

253  :
254  QAuServer(parent)
255 {
256 #ifndef MEDIA_SERVER
257  setObjectName(QLatin1String("qauserverqws"));
258 
259 #ifdef QT_NO_QWS_SOUNDSERVER
260  server = new QWSSoundServer( this ); // ### only suitable for single application
261 
262  connect( server, SIGNAL(soundCompleted(int)),
263  this, SLOT(complete(int)) );
264 #else
265  client = new QWSSoundClient( this ); // ### requires successful connection
266 
267  connect( client, SIGNAL(soundCompleted(int)),
268  this, SLOT(complete(int)) );
269 #endif
270 
271 #endif // MEDIA_SERVER
272 }
#define SLOT(a)
Definition: qobjectdefs.h:226
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void complete(int id)
Definition: qsound_qws.cpp:195
void setObjectName(const QString &name)
Definition: qobject.cpp:1112
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
QAuServer(QObject *parent)
Definition: qsound.cpp:54
static QAuServer & server()
Definition: qsound.cpp:79
QWSSoundClient * client
Definition: qsound_qws.cpp:247

Functions

◆ bucket()

QAuBucketQWS* QAuServerQWS::bucket ( QSound s)
inlineprotected

Definition at line 224 of file qsound_qws.cpp.

225  {
226  return (QAuBucketQWS*)QAuServer::bucket( s );
227  }
QAuBucket * bucket(QSound *)
Returns the internal bucket record of sound s.
Definition: qsound.cpp:365

◆ complete [1/2]

void QAuServerQWS::complete ( int  id)
inlineprivateslot

Definition at line 195 of file qsound_qws.cpp.

Referenced by QAuServerQWS().

196  {
197 #ifndef MEDIA_SERVER
198  QAuBucketQWS *bucket = find( id );
199  if( bucket ) {
200  QSound *sound = bucket->sound();
201  if( decLoop( sound ) ) {
202  play( sound );
203  }
204  }
205 #else
206  Q_UNUSED(id);
207 #endif
208  }
int decLoop(QSound *)
Decrements the QSound::loopRemaining() value for sound s, returning the result.
Definition: qsound.cpp:374
QAuBucketQWS * find(int id)
Definition: qsound_qws.cpp:232
QAuBucketQWS * bucket(QSound *s)
Definition: qsound_qws.cpp:224
QSound * sound() const
Definition: qsound_qws.cpp:105
void play(QSound *s)
Definition: qsound_qws.cpp:168
The QSound class provides access to the platform audio facilities.
Definition: qsound.h:57
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ complete [2/2]

void QAuServerQWS::complete ( QAuBucketQWS bucket)
inlineprivateslot

Definition at line 211 of file qsound_qws.cpp.

212  {
213 #ifndef MEDIA_SERVER
214  Q_UNUSED(bucket);
215 #else
216  QSound *sound = bucket->sound();
217  if( decLoop( sound ) ) {
218  play( sound );
219  }
220 #endif
221  }
int decLoop(QSound *)
Decrements the QSound::loopRemaining() value for sound s, returning the result.
Definition: qsound.cpp:374
QSound * sound() const
Definition: qsound_qws.cpp:105
void play(QSound *s)
Definition: qsound_qws.cpp:168
The QSound class provides access to the platform audio facilities.
Definition: qsound.h:57
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ find()

QAuBucketQWS* QAuServerQWS::find ( int  id)
inlineprivate

Definition at line 232 of file qsound_qws.cpp.

233  {
235  if( it != buckets.end() ) {
236  return it.value();
237  }
238 
239  return 0;
240  }
#define it(className, varName)
T & value() const
Returns a modifiable reference to the current item&#39;s value.
Definition: qhash.h:348
QHash< int, QAuBucketQWS * > buckets
Definition: qsound_qws.cpp:242
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:467
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
Definition: qhash.h:330
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
Definition: qhash.h:865

◆ init()

void QAuServerQWS::init ( QSound )
inlinevirtual

Initializes the sound.

The default implementation does nothing.

Reimplemented from QAuServer.

Definition at line 144 of file qsound_qws.cpp.

145  {
146  QAuBucketQWS *bucket = new QAuBucketQWS( this, s );
147 #ifdef MEDIA_SERVER
148  connect( bucket, SIGNAL(done(QAuBucketQWS*)),
149  this, SLOT(complete(QAuBucketQWS*)) );
150 #endif
151  setBucket( s, bucket );
152  }
#define SLOT(a)
Definition: qobjectdefs.h:226
void complete(int id)
Definition: qsound_qws.cpp:195
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QAuBucketQWS * bucket(QSound *s)
Definition: qsound_qws.cpp:224
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
void setBucket(QSound *, QAuBucket *)
Sets the internal bucket record of sound s to b, deleting any previous setting.
Definition: qsound.cpp:356

◆ insert()

void QAuServerQWS::insert ( QAuBucketQWS bucket)
inline

Definition at line 156 of file qsound_qws.cpp.

Referenced by QAuBucketQWS::QAuBucketQWS().

157  {
158  buckets.insert( bucket->id(), bucket );
159  }
QHash< int, QAuBucketQWS * > buckets
Definition: qsound_qws.cpp:242
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
int id() const
Definition: qsound_qws.cpp:102
QAuBucketQWS * bucket(QSound *s)
Definition: qsound_qws.cpp:224

◆ okay()

bool QAuServerQWS::okay ( )
inlinevirtual

Implements QAuServer.

Definition at line 191 of file qsound_qws.cpp.

191 { return true; }

◆ play()

void QAuServerQWS::play ( QSound s)
inlinevirtual

Implements QAuServer.

Definition at line 168 of file qsound_qws.cpp.

169  {
170  QString filepath = QFileInfo( s->fileName() ).absoluteFilePath();
171 #if defined(QT_NO_QWS_SOUNDSERVER)
172  server->playFile( bucket( s )->id(), filepath );
173 #elif defined(MEDIA_SERVER)
174  bucket( s )->play();
175 #else
176  client->play( bucket( s )->id(), filepath );
177 #endif
178  }
The QString class provides a Unicode character string.
Definition: qstring.h:83
QAuBucketQWS * bucket(QSound *s)
Definition: qsound_qws.cpp:224
static QAuServer & server()
Definition: qsound.cpp:79
QWSSoundClient * client
Definition: qsound_qws.cpp:247
QString fileName() const
Returns the filename associated with this QSound object.
Definition: qsound.cpp:312
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:60

◆ remove()

void QAuServerQWS::remove ( QAuBucketQWS bucket)
inline

Definition at line 162 of file qsound_qws.cpp.

Referenced by QAuBucketQWS::~QAuBucketQWS().

163  {
164  buckets.remove( bucket->id() );
165  }
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
QHash< int, QAuBucketQWS * > buckets
Definition: qsound_qws.cpp:242
int id() const
Definition: qsound_qws.cpp:102

◆ stop()

void QAuServerQWS::stop ( QSound s)
inlinevirtual

Implements QAuServer.

Definition at line 180 of file qsound_qws.cpp.

181  {
182 #if defined(QT_NO_QWS_SOUNDSERVER)
183  server->stopFile( bucket( s )->id() );
184 #elif defined(MEDIA_SERVER)
185  bucket( s )->stop();
186 #else
187  client->stop( bucket( s )->id() );
188 #endif
189  }
QAuBucketQWS * bucket(QSound *s)
Definition: qsound_qws.cpp:224
static QAuServer & server()
Definition: qsound.cpp:79
QWSSoundClient * client
Definition: qsound_qws.cpp:247

Properties

◆ buckets

QHash<int, QAuBucketQWS*> QAuServerQWS::buckets
private

Definition at line 242 of file qsound_qws.cpp.

◆ client

QWSSoundClient* QAuServerQWS::client
private

Definition at line 247 of file qsound_qws.cpp.

Referenced by QAuServerQWS().


The documentation for this class was generated from the following file: