mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 09:55:55 +00:00
Still cleaning up registry access code
This commit is contained in:
parent
8113f8df63
commit
7f71e3981e
@ -62,18 +62,7 @@ public:
|
|||||||
QString key_tmp(key);
|
QString key_tmp(key);
|
||||||
QVariant ret = QSettings::value(key_tmp);
|
QVariant ret = QSettings::value(key_tmp);
|
||||||
if(ret.isNull()) {
|
if(ret.isNull()) {
|
||||||
if(format() == QSettings::NativeFormat) {
|
if(format() != QSettings::NativeFormat) {
|
||||||
|
|
||||||
// Fallback on Windows, use \ in key instead of /
|
|
||||||
if(key_tmp.contains("/")) {
|
|
||||||
ret = QSettings::value(key_tmp.replace("/", "\\"));
|
|
||||||
} else {
|
|
||||||
if(key_tmp.contains("\\")) {
|
|
||||||
ret = QSettings::value(key_tmp.replace("\\", "/"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} 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
|
||||||
QSettings old_settings(organizationName(), applicationName());
|
QSettings old_settings(organizationName(), applicationName());
|
||||||
@ -92,7 +81,7 @@ public:
|
|||||||
void setValue(const QString &key, const QVariant &val) {
|
void setValue(const QString &key, const QVariant &val) {
|
||||||
QString key_tmp(key);
|
QString key_tmp(key);
|
||||||
if(format() == QSettings::NativeFormat)
|
if(format() == QSettings::NativeFormat)
|
||||||
key_tmp = key_tmp.replace("/", "\\");
|
key_tmp = key_tmp.replace("\\", "/");
|
||||||
QSettings::setValue(key_tmp, val);
|
QSettings::setValue(key_tmp, val);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user