mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-09-11 05:22:12 +00:00
fixup! Implement enum support in CachedSettingValue
This commit is contained in:
parent
a22d2f0139
commit
ff710ebd2c
@ -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…
x
Reference in New Issue
Block a user