mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-23 09:47:08 +03:00
Fixed QIniSettings on Windows
This commit is contained in:
parent
208e988c70
commit
864bb8285e
1 changed files with 13 additions and 11 deletions
|
@ -61,8 +61,9 @@ public:
|
||||||
QVariant value(const QString & key, const QVariant &defaultValue = QVariant()) {
|
QVariant value(const QString & key, const QVariant &defaultValue = QVariant()) {
|
||||||
QString key_tmp(key);
|
QString key_tmp(key);
|
||||||
QVariant ret = QSettings::value(key_tmp);
|
QVariant ret = QSettings::value(key_tmp);
|
||||||
if(format() == QSettings::NativeFormat) {
|
|
||||||
if(ret.isNull()) {
|
if(ret.isNull()) {
|
||||||
|
if(format() == QSettings::NativeFormat) {
|
||||||
|
|
||||||
// Fallback on Windows, use \ in key instead of /
|
// Fallback on Windows, use \ in key instead of /
|
||||||
if(key_tmp.contains("/")) {
|
if(key_tmp.contains("/")) {
|
||||||
ret = QSettings::value(key_tmp.replace("/", "\\"));
|
ret = QSettings::value(key_tmp.replace("/", "\\"));
|
||||||
|
@ -71,7 +72,7 @@ public:
|
||||||
ret = QSettings::value(key_tmp.replace("\\", "/"));
|
ret = QSettings::value(key_tmp.replace("\\", "/"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Keep compatibility with qBittorrent < 2.3.0
|
// Keep compatibility with qBittorrent < 2.3.0
|
||||||
// Import the setting from the registry
|
// Import the setting from the registry
|
||||||
|
@ -82,6 +83,7 @@ public:
|
||||||
old_settings.remove(key_tmp);
|
old_settings.remove(key_tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(ret.isNull())
|
if(ret.isNull())
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue