mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
settings: default smiley pack
This commit is contained in:
parent
8c32699608
commit
7dc00889ee
@ -64,6 +64,3 @@ dhtServerList\16\name=zlacki US
|
||||
dhtServerList\16\userId=9430A83211A7AD1C294711D069D587028CA0B4782FA43CB9B30008247A43C944
|
||||
dhtServerList\16\address=69.42.220.58
|
||||
dhtServerList\16\port=33445
|
||||
|
||||
[GUI]
|
||||
smileyPack=smileys/default/emoticons.xml
|
||||
|
@ -94,7 +94,7 @@ void Settings::load()
|
||||
|
||||
s.beginGroup("GUI");
|
||||
enableSmoothAnimation = s.value("smoothAnimation", true).toBool();
|
||||
smileyPack = s.value("smileyPack", !SmileyPack::listSmileyPacks().empty() ? SmileyPack::listSmileyPacks()[0].second : "").toString();
|
||||
smileyPack = s.value("smileyPack", QString()).toString();
|
||||
customEmojiFont = s.value("customEmojiFont", true).toBool();
|
||||
emojiFontFamily = s.value("emojiFontFamily", "DejaVu Sans").toString();
|
||||
emojiFontPointSize = s.value("emojiFontPointSize", QApplication::font().pointSize()).toInt();
|
||||
@ -108,6 +108,10 @@ void Settings::load()
|
||||
typingNotification = s.value("typingNotification", false).toBool();
|
||||
s.endGroup();
|
||||
|
||||
// try to set a smiley pack if none is selected
|
||||
if (!SmileyPack::isValid(smileyPack) && !SmileyPack::listSmileyPacks().isEmpty())
|
||||
smileyPack = SmileyPack::listSmileyPacks()[0].second;
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,11 @@ QList<QPair<QString, QString> > SmileyPack::listSmileyPacks(const QString &path)
|
||||
return smileyPacks;
|
||||
}
|
||||
|
||||
bool SmileyPack::isValid(const QString &filename)
|
||||
{
|
||||
return QFile(filename).exists();
|
||||
}
|
||||
|
||||
bool SmileyPack::load(const QString& filename)
|
||||
{
|
||||
// discard old data
|
||||
|
@ -29,6 +29,7 @@ class SmileyPack : public QObject
|
||||
public:
|
||||
static SmileyPack& getInstance();
|
||||
static QList<QPair<QString, QString>> listSmileyPacks(const QString& path = "./smileys");
|
||||
static bool isValid(const QString& filename);
|
||||
|
||||
bool load(const QString &filename);
|
||||
QString smileyfied(QString msg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user