KABC::Sound Class Reference
#include <sound.h>
Detailed Description
Class that holds a Sound clip for a contact.The sound can be played doing something like this:
KTempFile tmp; if(sound.isIntern()) { tmp.file()->writeBlock( sound.data() ); tmp.close(); KAudioPlayer::play( tmp.name() ); } else if(!sound.url().isEmpty()) { QString tmpFile; if(!KIO::NetAccess::download(KURL(themeURL.url()), tmpFile, NULL)) { KMessageBox::error(0L, KIO::NetAccess::lastErrorString(), i18n("Failed to download sound file"), KMessageBox::Notify ); return; } KAudioPlayer::play( tmpFile ); }
Unfortunetly KAudioPlayer::play is ASync, so to delete the temporary file, the best you can really do is set a timer.
Definition at line 59 of file sound.h.
Public Member Functions | |
Sound () | |
Sound (const QString &url) | |
Sound (const QByteArray &data) | |
~Sound () | |
bool | operator== (const Sound &) const |
bool | operator!= (const Sound &) const |
void | setUrl (const QString &url) |
bool | isEmpty () const |
void | setData (const QByteArray &data) |
bool | isIntern () const |
QString | url () const |
QByteArray | data () const |
QString | asString () const |
Friends | |
KABC_EXPORT QDataStream & | operator<< (QDataStream &, const Sound &) |
KABC_EXPORT QDataStream & | operator>> (QDataStream &, Sound &) |
Constructor & Destructor Documentation
|
Consturctor. Creates an empty object. |
|
Consturctor.
|
|
Consturctor.
|
|
Destructor.
|
Member Function Documentation
|
Returns string representation of the sound.
|
|
Returns the raw data of this sound.
|
|
Test if this sound file has been set. Just does: !isIntern() && url.isEmpty()
|
|
Returns whether the sound is described by a URL (extern) or by the raw data (intern). When this method returns 'true' you can use data() to get the raw data. Otherwise you can request the URL of this sound by url() and load the raw data from that location. |
|
Sets the raw data of the sound. When using this function, isIntern() will return 'true' until you use setUrl().
|
|
Sets a URL for the location of the sound file. When using this function, isIntern() will return 'false' until you use setData().
|
|
Returns the location URL of this sound.
|
The documentation for this class was generated from the following files: