1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix #1016: QSettings UTF-8 issues

This commit is contained in:
tux3 2016-01-21 04:59:20 +01:00
parent e45172ea1b
commit 963e8996fb
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -97,6 +97,7 @@ void Settings::loadGlobal()
if (QFile(globalSettingsFile).exists())
{
QSettings ps(globalSettingsFile, QSettings::IniFormat);
ps.setIniCodec("UTF-8");
ps.beginGroup("General");
makeToxPortable = ps.value("makeToxPortable", false).toBool();
ps.endGroup();
@ -119,6 +120,7 @@ void Settings::loadGlobal()
qDebug() << "Loading settings from " + filePath;
QSettings s(filePath, QSettings::IniFormat);
s.setIniCodec("UTF-8");
s.beginGroup("Login");
autoLogin = s.value("autoLogin", false).toBool();
s.endGroup();
@ -246,6 +248,7 @@ void Settings::loadGlobal()
if (dhtServerList.isEmpty())
{
QSettings rcs(":/conf/settings.ini", QSettings::IniFormat);
rcs.setIniCodec("UTF-8");
rcs.beginGroup("DHT Server");
int serverListSize = rcs.beginReadArray("dhtServerList");
for (int i = 0; i < serverListSize; i ++)
@ -350,6 +353,7 @@ void Settings::saveGlobal()
qDebug() << "Saving global settings at " + path;
QSettings s(path, QSettings::IniFormat);
s.setIniCodec("UTF-8");
s.clear();
@ -1515,6 +1519,7 @@ void Settings::createPersonal(QString basename)
qDebug() << "Creating new profile settings in " << path;
QSettings ps(path, QSettings::IniFormat);
ps.setIniCodec("UTF-8");
ps.beginGroup("Friends");
ps.beginWriteArray("Friend", 0);
ps.endArray();