• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeabc
 

tdeabc

  • TDEABC
  • Sound
Public Member Functions | Friends | List of all members
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))
{
KMessageBox::error(0L,
TDEIO::NetAccess::lastErrorString(),
i18n("Failed to download sound file"),
KMessageBox::Notify
);
return;
}
KAudioPlayer::play( tmpFile );
}
KAudioPlayer::play
void play()
KMessageBox::Notify
Notify
KMessageBox::error
static void error(TQWidget *parent, const TQString &text, const TQString &caption=TQString::null, int options=Notify)
KTempFile
KTempFile::file
TQFile * file()
KTempFile::close
bool close()
KTempFile::name
TQString name() const
KURL

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.

Constructor & Destructor Documentation

◆ Sound() [1/3]

Sound::Sound ( )

Consturctor.

Creates an empty object.

Definition at line 27 of file sound.cpp.

◆ Sound() [2/3]

Sound::Sound ( const TQString &  url)

Consturctor.

Parameters
urlA URL that describes the position of the sound file.

Definition at line 32 of file sound.cpp.

◆ Sound() [3/3]

Sound::Sound ( const TQByteArray &  data)

Consturctor.

Parameters
dataThe raw data of the sound.

Definition at line 37 of file sound.cpp.

◆ ~Sound()

Sound::~Sound ( )

Destructor.

Definition at line 42 of file sound.cpp.

Member Function Documentation

◆ asString()

TQString Sound::asString ( ) const

Returns string representation of the sound.

Definition at line 99 of file sound.cpp.

◆ data()

TQByteArray Sound::data ( ) const

Returns the raw data of this sound.

Definition at line 94 of file sound.cpp.

◆ isEmpty()

bool Sound::isEmpty ( ) const

Test if this sound file has been set.

Just does: !isIntern() && url.isEmpty()

Since
3.4

Definition at line 83 of file sound.cpp.

◆ isIntern()

bool Sound::isIntern ( ) const

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.

Definition at line 78 of file sound.cpp.

◆ operator!=()

bool Sound::operator!= ( const Sound &  s) const

Definition at line 61 of file sound.cpp.

◆ operator==()

bool Sound::operator== ( const Sound &  s) const

Definition at line 46 of file sound.cpp.

◆ 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
dataThe raw data of the sound.

Definition at line 72 of file sound.cpp.

◆ 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
urlThe location URL of the sound file.

Definition at line 66 of file sound.cpp.

◆ url()

TQString Sound::url ( ) const

Returns the location URL of this sound.

Definition at line 89 of file sound.cpp.


The documentation for this class was generated from the following files:
  • sound.h
  • sound.cpp

tdeabc

Skip menu "tdeabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeabc

Skip menu "tdeabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeabc by doxygen 1.9.4
This website is maintained by Timothy Pearson.