48
48
virtual ~EmoticonTheme();
50
50
// Create a new emoticon and add it to the theme
51
void addEmoticon( QString pictureFile, QStringList shortcuts );
51
void addEmoticon( const QString& pictureFile, const QStringList& shortcuts );
52
52
// Check if the theme contains a certain emoticon
53
53
bool contains( QString shortcut );
54
// Returns true if a custom emoticon has already been added
55
bool emoticonIsAdded( QString dataHash );
54
56
// Obtain an emoticon by its shortcut
55
57
const Emoticon *getEmoticon( QString shortcut ) const;
56
58
// Return the full list of emoticons
57
59
const QList<Emoticon*> & getEmoticons() const;
58
60
// Return the picture file names of all emoticons, mapped by their first shortcut code
59
61
const QHash<QString,QString> &getFileNames() const;
62
// Return a QHash to map shortcut to data hash
63
const QHash<QString,QString> &getHashes() const;
60
64
// Return the search pattern to find emoticons in an HTML text
61
65
const QRegExp &getHtmlPattern() const;
62
66
// Return the HTML replacement codes for all emoticons
63
const QHash<QString,QString> &getHtmlReplacements( bool small = false ) const;
67
const QHash<QString,QString> &getHtmlReplacements( bool isSmall = false ) const;
64
68
// Return a QStringList of emoticons
65
69
const QStringList &getList() const;
66
70
// Return the search pattern to find emoticons in a text
67
71
const QRegExp &getPattern() const;
68
72
// Return one replacement code for the given emoticon
69
QString getReplacement( const QString &code, bool small = false ) const;
73
QString getReplacement( const QString &code, bool isSmall = false ) const;
70
74
// Return the replacement codes for all emoticons
71
const QHash<QString,QString> &getReplacements( bool small = false ) const;
75
const QHash<QString,QString> &getReplacements( bool isSmall = false ) const;
72
76
// Return where the picture files for this theme are located
73
77
const QString &getThemePath();
74
78
// Load a theme, by creating it anew or by refreshing the current one
89
93
private: // Private methods
90
94
// Create the theme from nothing
91
bool createTheme( QString themeDir );
95
bool createTheme( const QString& themeDir );
92
96
// Rebuild the search&replace caches
93
97
void updateCache();
94
98
// Update a standard theme with names for the standard MSN emoticons
95
99
void updateTitles();
96
100
// Update the currently loaded theme with new images
97
bool updateTheme( QString themeDir );
101
bool updateTheme( const QString& themeDir );
99
103
private: // Private properties
100
104
QList<Emoticon*> emoticons_;
116
120
QHash<QString,QString> smallHtmlReplacements_;
117
121
// The replace codes for emoticons
118
122
QHash<QString,QString> smallReplacements_;
123
// The hashes for all emoticons
124
QHash<QString,QString> hashes_;
119
125
// The full path to the currently loaded theme
120
126
QString themePath_;
121
127
// A mapping from code to emoticon picture filename