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

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::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(), KviAnimatedPixmap::size(), and size().

◆ ~KviAvatar()

KviAvatar::~KviAvatar ( )

Destroys the avatar object.

References m_scaledPixmapsCache.

Member Function Documentation

◆ animatedPixmap()

KviAnimatedPixmap * KviAvatar::animatedPixmap ( ) const
inline

Returns original animated pixmap.

Returns
KviAnimatedPixmap *

References m_pPixmap.

Referenced by KviUserListEntry::updateAvatarData().

◆ forSize() [1/2]

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, KviAnimatedPixmap::resize(), and size().

Referenced by KviUserListEntry::updateAvatarData().

◆ forSize() [2/2]

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().

◆ identificationString()

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().

◆ isAnimated()

bool KviAvatar::isAnimated ( ) const
inline

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

Returns
bool

References m_pPixmap.

◆ isRemote()

bool KviAvatar::isRemote ( ) const
inline

Returns true, if avatar is remote.

Returns
bool

◆ isValid()

bool KviAvatar::isValid ( ) const
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().

◆ localPath()

const QString & KviAvatar::localPath ( ) const
inline

Returns filepath.

Returns
const QString &

◆ name()

const QString & KviAvatar::name ( ) const
inline

Returns fiename.

For remote avatars, remote address will be returned.

Returns
const QString &

◆ pixmap()

QPixmap * KviAvatar::pixmap ( ) const
inline

Returns unscaled original frame.

Returns
QPixmap *

References m_pPixmap.

Referenced by KviConsoleWindow::defaultAvatarFromOptions(), and KviApplication::notifierMessage().

◆ size()

const QSize & KviAvatar::size ( ) const
inline

Returns original pixmap's size.

Returns
const QSize &

References m_pPixmap.

Referenced by forSize(), KviAvatar(), and KviUserListEntry::updateAvatarData().

Member Data Documentation

◆ m_bRemote

bool KviAvatar::m_bRemote
private

Referenced by KviAvatar().

◆ m_pPixmap

KviAnimatedPixmap* KviAvatar::m_pPixmap
private

Referenced by forSize(), and KviAvatar().

◆ m_scaledPixmapsCache

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

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

◆ m_szLocalPath

QString KviAvatar::m_szLocalPath
private

Referenced by KviAvatar().

◆ m_szName

QString KviAvatar::m_szName
private

Referenced by KviAvatar().


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