Maps emoticons to smileys.
More...
#include <smileypack.h>
|
QString | smileyfied (const QString &msg) |
| Replaces all found text emoticons to HTML reference with its according icon filename. More...
|
|
QList< QStringList > | getEmoticons () const |
| Returns all emoticons that was extracted from files, grouped by according icon file. More...
|
|
std::shared_ptr< QIcon > | getAsIcon (const QString &key) const |
| Gets icon accoring to passed emoticon. More...
|
|
Maps emoticons to smileys.
Definition at line 31 of file smileypack.h.
◆ SmileyPack() [1/2]
SmileyPack::SmileyPack |
( |
| ) |
|
|
private |
◆ SmileyPack() [2/2]
◆ ~SmileyPack()
SmileyPack::~SmileyPack |
( |
| ) |
|
|
overrideprivate |
◆ cleanupIconsCache
void SmileyPack::cleanupIconsCache |
( |
| ) |
|
|
privateslot |
◆ constructRegex()
void SmileyPack::constructRegex |
( |
| ) |
|
|
private |
Creates the regex for replacing emoticons with the path to their pictures.
Definition at line 264 of file smileypack.cpp.
◆ getAsIcon()
std::shared_ptr< QIcon > SmileyPack::getAsIcon |
( |
const QString & |
emoticon | ) |
const |
Gets icon accoring to passed emoticon.
- Parameters
-
- Returns
- Returns cached icon according to passed emoticon, null if no icon mapped to this emoticon
Definition at line 336 of file smileypack.cpp.
◆ getEmoticons()
QList< QStringList > SmileyPack::getEmoticons |
( |
| ) |
const |
Returns all emoticons that was extracted from files, grouped by according icon file.
Definition at line 325 of file smileypack.cpp.
◆ getInstance()
◆ listSmileyPacks() [1/2]
QList< QPair< QString, QString > > SmileyPack::listSmileyPacks |
( |
| ) |
|
|
static |
Does the same as listSmileyPaths, but with default paths.
Definition at line 156 of file smileypack.cpp.
◆ listSmileyPacks() [2/2]
QList< QPair< QString, QString > > SmileyPack::listSmileyPacks |
( |
const QStringList & |
paths | ) |
|
|
static |
Searches all files called "emoticons.xml" within the every passed path in the depth of 2.
- Parameters
-
paths | Paths where to search for file |
- Returns
- Vector of pairs: {directoryName, absolutePathToFile}
Definition at line 166 of file smileypack.cpp.
◆ load()
bool SmileyPack::load |
( |
const QString & |
filename | ) |
|
|
private |
Load smile pack.
- Note
- The caller must lock loadingMutex and should run it in a thread
- Parameters
-
filename | Filename of smilepack. |
- Returns
- False if cannot open file, true otherwise.
Definition at line 203 of file smileypack.cpp.
◆ onSmileyPackChanged
void SmileyPack::onSmileyPackChanged |
( |
| ) |
|
|
privateslot |
◆ operator=()
◆ smileyfied()
QString SmileyPack::smileyfied |
( |
const QString & |
msg | ) |
|
Replaces all found text emoticons to HTML reference with its according icon filename.
- Parameters
-
msg | Message where to search for emoticons |
- Returns
- Formatted copy of message
Definition at line 303 of file smileypack.cpp.
◆ cachedIcon
std::map<QString, std::shared_ptr<QIcon> > SmileyPack::cachedIcon |
|
mutableprivate |
◆ cleanupTimer
QTimer* SmileyPack::cleanupTimer |
|
private |
◆ emoticons
{{ ":)", ":-)" }, {":(", ...}, ... }
Definition at line 59 of file smileypack.h.
◆ emoticonToPath
QHash<QString, QString> SmileyPack::emoticonToPath |
|
private |
◆ loadingMutex
QMutex SmileyPack::loadingMutex |
|
mutableprivate |
◆ path
directory containing the cfg and image files
Definition at line 60 of file smileypack.h.
◆ smilify
QRegularExpression SmileyPack::smilify |
|
private |
The documentation for this class was generated from the following files: