Change QSettings to IniFormat on macOS. Closes #5770 #5808

On macOS 10.12 Sierra, Apple changed the behaviour of CFPreferencesSetValue()
truncating data after a null character. https://bugreports.qt.io/browse/QTBUG-56344
Due to this, we have to move from native plist to IniFormat.
This commit is contained in:
Yez Ezey
2016-10-07 22:42:47 +09:00
committed by sledgehammer999
parent a790901691
commit 664664394c
4 changed files with 40 additions and 3 deletions

View File

@@ -39,7 +39,7 @@ class QIniSettings : public QSettings {
public:
QIniSettings(const QString &organization = "qBittorrent", const QString &application = "qBittorrent", QObject *parent = 0 ):
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
QSettings(QSettings::IniFormat, QSettings::UserScope, organization, application, parent)
#else
QSettings(organization, application, parent)

View File

@@ -39,7 +39,8 @@
#include "utils/fs.h"
#ifdef Q_OS_MAC
#define QSETTINGS_SYNC_IS_SAVE // whether QSettings::sync() is "atomic"
// now mac uses ini
//#define QSETTINGS_SYNC_IS_SAVE // whether QSettings::sync() is "atomic"
#endif
namespace
@@ -69,7 +70,7 @@ namespace
using SettingsPtr = std::unique_ptr<QSettings>;
SettingsPtr createSettings(const QString &name)
{
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
return SettingsPtr(new QSettings(QSettings::IniFormat, QSettings::UserScope, "qBittorrent", name));
#else
return SettingsPtr(new QSettings("qBittorrent", name));