KVIrc  4.9.2
DeveloperAPIs
Public Member Functions | Private Attributes | List of all members
KviAvatar Class Reference

Avatar class. More...

#include <KviAvatar.h>

+ Inheritance diagram for KviAvatar:

Public Member Functions

KviAnimatedPixmapanimatedPixmap ()
 Returns original animated pixmap. More...
 
KviAnimatedPixmapforSize (const QSize &size)
 Returns animated pixmap, scaled to the requisted size. More...
 
KviAnimatedPixmapforSize (unsigned int uWidth, unsigned int uHeight)
 Returns animated pixmap, scaled to the requisted size. More...
 
const QString & identificationString ()
 Returns the string that uniquely identifies this avatar. More...
 
bool isAnimated ()
 Returns true, if underlying pixmap contains more then one frame. More...
 
bool isRemote ()
 Returns true, if avatar is remote. More...
 
bool isValid ()
 Returns true if pixmap has at least one loaded frame. More...
 
 KviAvatar (const QString &szLocalPath, const QString &szName, const QSize &scaleOnLoad=QSize())
 Constructs the avatar object. More...
 
const QString & localPath ()
 Returns filepath. More...
 
const QString & name ()
 Returns fiename. More...
 
QPixmap * pixmap ()
 Returns unscaled original frame. More...
 
const QSize & size ()
 Returns original pixmap's size. More...
 
 ~KviAvatar ()
 Destroys the avatar object. More...
 

Private Attributes

bool m_bRemote
 
KviAnimatedPixmapm_pPixmap
 
QHash< QSize, KviAnimatedPixmap * > m_scaledPixmapsCache
 
QString m_szLocalPath
 
QString m_szName
 

Detailed Description

Avatar class.

Constructor & Destructor Documentation

KviAvatar::KviAvatar ( const QString &  szLocalPath,
const QString &  szName,
const QSize &  scaleOnLoad = QSize() 
)

Constructs the avatar object.

Parameters
szLocalPathThe local path of the avatar
szNameThe name of the avatar
scaleOnLoadIf we want to scale the avatar on load
Returns
KviAvatar

References KviQString::equalCIN(), m_bRemote, m_pPixmap, m_scaledPixmapsCache, m_szLocalPath, m_szName, KviAnimatedPixmap::resize(), size(), and KviAnimatedPixmap::size().

KviAvatar::~KviAvatar ( )

Destroys the avatar object.

References m_scaledPixmapsCache.

Member Function Documentation

KviAnimatedPixmap* KviAvatar::animatedPixmap ( )
inline

Returns original animated pixmap.

Returns
KviAnimatedPixmap *

References m_pPixmap.

Referenced by KviUserListEntry::updateAvatarData().

KviAnimatedPixmap * KviAvatar::forSize ( const QSize &  size)

Returns animated pixmap, scaled to the requisted size.

Scaling automagically keeps aspect ratio. Scaled image cached.

KviAvatar takes ownership on it, and will automatically delete it in destructor.

It is safe to connect returned KviAnimatedPixmap signals to external slots.

Parameters
sizeThe size of the avatar
Returns
KviAnimatedPixmap *

References m_pPixmap, m_scaledPixmapsCache, and KviAnimatedPixmap::resize().

Referenced by KviUserListEntry::updateAvatarData().

KviAnimatedPixmap* KviAvatar::forSize ( unsigned int  uWidth,
unsigned int  uHeight 
)
inline

Returns animated pixmap, scaled to the requisted size.

Scaling automagically keeps aspect ratio. Scaled image cached.

KviAvatar takes ownership on it, and will automatically delete it in destructor.

It is safe to connect returned KviAnimatedPixmap signals to external slots.

Parameters
uWidthThe width of the avatar
uHeightThe height of the avatar
Returns
KviAnimatedPixmap *

References forSize().

Referenced by forSize().

const QString& KviAvatar::identificationString ( )
inline

Returns the string that uniquely identifies this avatar.

For remote avatars that have name starting with http:// the name is used. For local avatars the localPath is used instead

Returns
const QString &

Referenced by KviConsoleWindow::avatarChanged().

bool KviAvatar::isAnimated ( )
inline

Returns true, if underlying pixmap contains more then one frame.

Returns
bool

References m_pPixmap.

bool KviAvatar::isRemote ( )
inline

Returns true, if avatar is remote.

Returns
bool

Referenced by KviIrcServerParser::parseCtcpRequestAvatar().

bool KviAvatar::isValid ( )
inline

Returns true if pixmap has at least one loaded frame.

Returns false otherwise.

Returns
bool

References m_pPixmap.

Referenced by KviConsoleWindow::defaultAvatarFromOptions(), and KviIconManager::getAvatar().

const QString& KviAvatar::localPath ( )
inline
const QString& KviAvatar::name ( )
inline

Returns fiename.

For remote avatars, remote address will be returned.

Returns
const QString &

Referenced by avatar_kvs_cmd_notify(), avatar_kvs_fnc_name(), and KviIrcServerParser::parseCtcpRequestAvatar().

QPixmap* KviAvatar::pixmap ( )
inline

Returns unscaled original frame.

Returns
QPixmap *

References m_pPixmap.

Referenced by OptionsWidget_identityAvatar::chooseAvatar(), RegisteredUsersDialog::exportClicked(), and KviApplication::notifierMessage().

const QSize& KviAvatar::size ( )
inline

Returns original pixmap's size.

Returns
const QSize &

References m_pPixmap.

Referenced by KviConsoleWindow::getUserTipText(), KviAvatar(), and KviUserListEntry::updateAvatarData().

Member Data Documentation

bool KviAvatar::m_bRemote
private

Referenced by KviAvatar().

KviAnimatedPixmap* KviAvatar::m_pPixmap
private

Referenced by forSize(), and KviAvatar().

QHash<QSize, KviAnimatedPixmap *> KviAvatar::m_scaledPixmapsCache
private

Referenced by forSize(), KviAvatar(), and ~KviAvatar().

QString KviAvatar::m_szLocalPath
private

Referenced by KviAvatar().

QString KviAvatar::m_szName
private

Referenced by KviAvatar().


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