mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fast concatenation
This commit is contained in:
parent
f9cc5dbccd
commit
57a7324d41
|
@ -103,7 +103,7 @@ QString SmileyPack::replaceEmoticons(const QString &msg)
|
||||||
loadSmiley(file);
|
loadSmiley(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString imgRichText = "<img src=\"data:image/png;base64," + cache[file] + "\">";
|
QString imgRichText = "<img src=\"data:image/png;base64," % cache[file] % "\">";
|
||||||
|
|
||||||
out.replace(index + offset, key.length(), imgRichText);
|
out.replace(index + offset, key.length(), imgRichText);
|
||||||
offset += imgRichText.length() - key.length();
|
offset += imgRichText.length() - key.length();
|
||||||
|
@ -117,7 +117,7 @@ QString SmileyPack::replaceEmoticons(const QString &msg)
|
||||||
void SmileyPack::loadSmiley(const QString &name)
|
void SmileyPack::loadSmiley(const QString &name)
|
||||||
{
|
{
|
||||||
QSize size(16, 16); // TODO: adapt to text size
|
QSize size(16, 16); // TODO: adapt to text size
|
||||||
QString filename = path + "/" + name;
|
QString filename = path % "/" % name;
|
||||||
QImage img(filename);
|
QImage img(filename);
|
||||||
|
|
||||||
if (!img.isNull())
|
if (!img.isNull())
|
||||||
|
|
|
@ -42,7 +42,7 @@ private:
|
||||||
void loadSmiley(const QString& name);
|
void loadSmiley(const QString& name);
|
||||||
|
|
||||||
QHash<QString, QString> assignmentTable; // matches an emoticon to its corresponding smiley
|
QHash<QString, QString> assignmentTable; // matches an emoticon to its corresponding smiley
|
||||||
QHash<QString, QByteArray> cache;
|
QHash<QString, QString> cache;
|
||||||
QString path; // directory containing the cfg file
|
QString path; // directory containing the cfg file
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user