mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 17:53:08 -07:00
fixup! Implement enum support in CachedSettingValue
This commit is contained in:
parent
a22d2f0139
commit
ff710ebd2c
1 changed files with 2 additions and 2 deletions
|
@ -87,7 +87,7 @@ private:
|
||||||
SettingsStorage::instance()->storeValue(m_keyName, value);
|
SettingsStorage::instance()->storeValue(m_keyName, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// load/save pair for enum
|
// load/save pair for an enum
|
||||||
// saves literal value of the enum constant, obtained from QMetaEnum
|
// saves literal value of the enum constant, obtained from QMetaEnum
|
||||||
template <typename U, typename std::enable_if<std::is_enum<U>::value, int>::type = 0>
|
template <typename U, typename std::enable_if<std::is_enum<U>::value, int>::type = 0>
|
||||||
U loadValue(const U &defaultValue)
|
U loadValue(const U &defaultValue)
|
||||||
|
@ -97,7 +97,7 @@ private:
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const U res = static_cast<U>(QMetaEnum::fromType<U>().keyToValue(
|
const U res = static_cast<U>(QMetaEnum::fromType<U>().keyToValue(
|
||||||
SettingsStorage::instance()->loadValue(m_keyName, QString()).toString().toLatin1().constData(), &ok));
|
SettingsStorage::instance()->loadValue(m_keyName).toString().toLatin1().constData(), &ok));
|
||||||
return ok ? res : defaultValue;
|
return ok ? res : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue