Browse Source

Fixed QIniSettings on Windows

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
864bb8285e
  1. 6
      src/qinisettings.h

6
src/qinisettings.h

@ -61,8 +61,9 @@ public: @@ -61,8 +61,9 @@ public:
QVariant value(const QString & key, const QVariant &defaultValue = QVariant()) {
QString key_tmp(key);
QVariant ret = QSettings::value(key_tmp);
if(format() == QSettings::NativeFormat) {
if(ret.isNull()) {
if(format() == QSettings::NativeFormat) {
// Fallback on Windows, use \ in key instead of /
if(key_tmp.contains("/")) {
ret = QSettings::value(key_tmp.replace("/", "\\"));
@ -71,7 +72,7 @@ public: @@ -71,7 +72,7 @@ public:
ret = QSettings::value(key_tmp.replace("\\", "/"));
}
}
}
} else {
// Keep compatibility with qBittorrent < 2.3.0
// Import the setting from the registry
@ -82,6 +83,7 @@ public: @@ -82,6 +83,7 @@ public:
old_settings.remove(key_tmp);
}
}
}
if(ret.isNull())
return defaultValue;
return ret;

Loading…
Cancel
Save