KEmoticons 5.109.0
Public Types | Public Member Functions | Protected Member Functions | List of all members
KEmoticonsProviderabstract

This is the base abstract class for the emoticon provider plugins. More...

#include <kemoticonsprovider.h>

Public Types

enum  AddEmoticonOption { DoNotCopy , Copy }
 Options to pass to addEmoticon. More...
 

Public Member Functions

 KEmoticonsProvider (QObject *parent=nullptr)
 Default constructor.
 
 ~KEmoticonsProvider () override
 Destructor.
 
virtual bool addEmoticon (const QString &emo, const QString &text, AddEmoticonOption option=DoNotCopy)=0
 Adds the emoticon emo with text text.
 
QHash< QChar, QList< Emoticon > > emoticonsIndex () const
 Returns a QHash that contains emoticons indexed by the first char.
 
QHash< QString, QStringList > emoticonsMap () const
 Returns a QHash that contains the emoticon path as keys and the text as values.
 
QString fileName () const
 Returns the file name of the emoticon theme.
 
virtual bool loadTheme (const QString &path)=0
 Loads the emoticon theme inside the directory path.
 
virtual void newTheme ()=0
 Creates a new theme.
 
QSize preferredEmoticonSize () const
 Returns size in which parsed emoticons will be returned.
 
virtual bool removeEmoticon (const QString &emo)=0
 Removes the emoticon emo.
 
virtual void saveTheme ()=0
 Saves the emoticon theme.
 
void setPreferredEmoticonSize (const QSize &size)
 If a preferred size is set, all parsed emoticons will be returned with the size.
 
void setThemeName (const QString &name)
 Sets the emoticon theme name.
 
QString themeName () const
 Returns the theme name.
 
QString themePath () const
 Returns the emoticon theme path.
 

Protected Member Functions

void addIndexItem (const QString &path, const QStringList &emoList)
 Adds an emoticon to the index.
 
void addMapItem (QString key, QStringList value)
 Inserts a new item in the emoticon map.
 
void clearEmoticonsMap ()
 Clears the emoticons map.
 
bool copyEmoticon (const QString &emo)
 Copies the emoticon image to the theme directory.
 
void removeIndexItem (const QString &path, const QStringList &emoList)
 Removes an emoticon from the index.
 
void removeMapItem (QString key)
 Removes an item from the emoticon map.
 
void setThemePath (const QString &path)
 Sets the theme inside the directory path.
 

Detailed Description

This is the base abstract class for the emoticon provider plugins.

Member Enumeration Documentation

◆ AddEmoticonOption

Options to pass to addEmoticon.

Enumerator
DoNotCopy 

< Don't copy the emoticon file into the theme directory

Copy 

< Copy the emoticon file into the theme directory

Constructor & Destructor Documentation

◆ KEmoticonsProvider()

KEmoticonsProvider::KEmoticonsProvider ( QObject *  parent = nullptr)
explicit

Default constructor.

◆ ~KEmoticonsProvider()

KEmoticonsProvider::~KEmoticonsProvider ( )
override

Destructor.

Member Function Documentation

◆ addEmoticon()

virtual bool KEmoticonsProvider::addEmoticon ( const QString &  emo,
const QString &  text,
AddEmoticonOption  option = DoNotCopy 
)
pure virtual

Adds the emoticon emo with text text.

Parameters
emopath to the emoticon image
textthe emoticon text. If alternative texts are to be added, use spaces to separate them.
copywhether or not to copy emo into the theme directory
Returns
true if the emoticon is successfully added

◆ addIndexItem()

void KEmoticonsProvider::addIndexItem ( const QString &  path,
const QStringList &  emoList 
)
protected

Adds an emoticon to the index.

Parameters
pathpath to the emoticon
emoListlist of text associated with this emoticon
Since
5.0
See also
emoticonsIndex()

◆ addMapItem()

void KEmoticonsProvider::addMapItem ( QString  key,
QStringList  value 
)
protected

Inserts a new item in the emoticon map.

Since
5.0
See also
emoticonsMap()

◆ clearEmoticonsMap()

void KEmoticonsProvider::clearEmoticonsMap ( )
protected

Clears the emoticons map.

◆ copyEmoticon()

bool KEmoticonsProvider::copyEmoticon ( const QString &  emo)
protected

Copies the emoticon image to the theme directory.

Parameters
emopath to the emoticon image
Returns
true if the emoticon is successfully copied
Since
5.0

◆ emoticonsIndex()

QHash< QChar, QList< Emoticon > > KEmoticonsProvider::emoticonsIndex ( ) const

Returns a QHash that contains emoticons indexed by the first char.

◆ emoticonsMap()

QHash< QString, QStringList > KEmoticonsProvider::emoticonsMap ( ) const

Returns a QHash that contains the emoticon path as keys and the text as values.

◆ fileName()

QString KEmoticonsProvider::fileName ( ) const

Returns the file name of the emoticon theme.

◆ loadTheme()

virtual bool KEmoticonsProvider::loadTheme ( const QString &  path)
pure virtual

Loads the emoticon theme inside the directory path.

Parameters
pathpath to the directory
Returns
true if the emoticon theme is successfully loaded

◆ newTheme()

virtual void KEmoticonsProvider::newTheme ( )
pure virtual

Creates a new theme.

Since
5.0

◆ preferredEmoticonSize()

QSize KEmoticonsProvider::preferredEmoticonSize ( ) const

Returns size in which parsed emoticons will be returned.

If the QSize returned is not valid (isValid() == false), then the default will be used, that is the actual file size.

Since
5.23

◆ removeEmoticon()

virtual bool KEmoticonsProvider::removeEmoticon ( const QString &  emo)
pure virtual

Removes the emoticon emo.

This doesn't delete the image file.

Parameters
emothe emoticon text to remove
Returns
true if the emoticon theme is successfully removed

◆ removeIndexItem()

void KEmoticonsProvider::removeIndexItem ( const QString &  path,
const QStringList &  emoList 
)
protected

Removes an emoticon from the index.

Parameters
pathpath to the emoticon
emoListlist of text associated with this emoticon
Since
5.0
See also
emoticonsIndex()

◆ removeMapItem()

void KEmoticonsProvider::removeMapItem ( QString  key)
protected

Removes an item from the emoticon map.

Since
5.0
See also
emoticonsMap()

◆ saveTheme()

virtual void KEmoticonsProvider::saveTheme ( )
pure virtual

Saves the emoticon theme.

Since
5.0

◆ setPreferredEmoticonSize()

void KEmoticonsProvider::setPreferredEmoticonSize ( const QSize &  size)

If a preferred size is set, all parsed emoticons will be returned with the size.

Parameters
sizeThe desired QSize of parsed emoticons
Since
5.23

◆ setThemeName()

void KEmoticonsProvider::setThemeName ( const QString &  name)

Sets the emoticon theme name.

Parameters
namename of the theme

◆ setThemePath()

void KEmoticonsProvider::setThemePath ( const QString &  path)
protected

Sets the theme inside the directory path.

Parameters
pathpath to the directory
Since
5.0

◆ themeName()

QString KEmoticonsProvider::themeName ( ) const

Returns the theme name.

◆ themePath()

QString KEmoticonsProvider::themePath ( ) const

Returns the emoticon theme path.