23 #include <QtCore/QDataStream>
24 #include <QtCore/QSharedData>
28 class Sound::Private :
public QSharedData
36 Private(
const Private &other )
37 : QSharedData( other )
41 mIntern = other.mIntern;
79 if (
this != &other ) {
88 if ( d->mIntern != other.d->mIntern ) {
93 if ( d->mData != other.d->mData ) {
97 if ( d->mUrl != other.d->mUrl ) {
107 return !( other == *this );
130 ( ( d->mIntern && d->mData.isEmpty() ) || ( !d->mIntern && d->mUrl.isEmpty() ) );
147 str += QLatin1String(
"Sound {\n" );
148 str += QString::fromLatin1(
" IsIntern: %1\n" ).
149 arg( d->mIntern ? QLatin1String(
"true" ) : QLatin1String(
"false" ) );
151 str += QString::fromLatin1(
" Data: %1\n" ).
152 arg( QString::fromLatin1( d->mData.toBase64() ) );
154 str += QString::fromLatin1(
" Url: %1\n" ).arg( d->mUrl );
156 str += QLatin1String(
"}\n" );
161 QDataStream &KABC::operator<<( QDataStream &s,
const Sound &sound )
163 return s << sound.d->mIntern << sound.d->mUrl << sound.d->mData;
166 QDataStream &KABC::operator>>( QDataStream &s,
Sound &sound )
168 s >> sound.d->mIntern >> sound.d->mUrl >> sound.d->mData;
Class that holds a Sound clip for a contact.
Sound & operator=(const Sound &other)
Assignment operator.
void setData(const QByteArray &data)
Sets the raw data of the sound.
void setUrl(const QString &url)
Sets a URL for the location of the sound file.
QString toString() const
Returns string representation of the sound.
~Sound()
Destroys the sound object.
QByteArray data() const
Returns the raw data of this sound.
bool operator!=(const Sound &other) const
Not-Equal operator.
Sound()
Creates an empty sound object.
bool isIntern() const
Returns whether the sound is described by a URL (extern) or by the raw data (intern).
bool isEmpty() const
Returns true, if the sound object is empty.
QString url() const
Returns the location URL of this sound.
bool operator==(const Sound &other) const
Equality operator.