TDEABC::Sound Class Reference
#include <sound.h>
Public Member Functions | |
| Sound () | |
| Sound (const TQString &url) | |
| Sound (const TQByteArray &data) | |
| ~Sound () | |
| bool | operator== (const Sound &) const |
| bool | operator!= (const Sound &) const |
| void | setUrl (const TQString &url) |
| bool | isEmpty () const |
| void | setData (const TQByteArray &data) |
| bool | isIntern () const |
| TQString | url () const |
| TQByteArray | data () const |
| TQString | asString () const |
Friends | |
| KABC_EXPORT TQDataStream & | operator<< (TQDataStream &, const Sound &) |
| KABC_EXPORT TQDataStream & | operator>> (TQDataStream &, Sound &) |
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()) {
TQString tmpFile;
if(!TDEIO::NetAccess::download(KURL(themeURL.url()), tmpFile, NULL))
{
TDEIO::NetAccess::lastErrorString(),
i18n("Failed to download sound file"),
);
return;
}
KAudioPlayer::play( tmpFile );
}
void play()
Notify
static void error(TQWidget *parent, const TQString &text, const TQString &caption=TQString::null, int options=Notify)
TQFile * file()
bool close()
TQString name() const
Unfortunetly KAudioPlayer::play is ASync, so to delete the temporary file, the best you can really do is set a timer.
Constructor & Destructor Documentation
◆ Sound() [1/3]
◆ Sound() [2/3]
| Sound::Sound | ( | const TQString & | url | ) |
◆ Sound() [3/3]
| Sound::Sound | ( | const TQByteArray & | data | ) |
◆ ~Sound()
Member Function Documentation
◆ asString()
| TQString Sound::asString | ( | ) | const |
◆ data()
| TQByteArray Sound::data | ( | ) | const |
◆ isEmpty()
| bool Sound::isEmpty | ( | ) | const |
◆ isIntern()
| bool Sound::isIntern | ( | ) | const |
◆ operator!=()
◆ operator==()
◆ setData()
| void Sound::setData | ( | const TQByteArray & | data | ) |
Sets the raw data of the sound.
When using this function, isIntern() will return 'true' until you use setUrl().
- Parameters
-
data The raw data of the sound.
◆ setUrl()
| void Sound::setUrl | ( | const TQString & | url | ) |
Sets a URL for the location of the sound file.
When using this function, isIntern() will return 'false' until you use setData().
- Parameters
-
url The location URL of the sound file.
◆ url()
| TQString Sound::url | ( | ) | const |
The documentation for this class was generated from the following files:
Trinity API Reference