mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 15:07:22 -06:00
Revise SettingsStorage store/load value interface
This commit is contained in:
@@ -46,8 +46,8 @@ namespace
|
||||
const auto migrate = [](const QString &oldKey, const QString &newKey, const QString &savePath)
|
||||
{
|
||||
SettingsStorage *settingsStorage {SettingsStorage::instance()};
|
||||
const QByteArray oldData {settingsStorage->loadValue(oldKey).toByteArray()};
|
||||
const QString newData {settingsStorage->loadValue(newKey).toString()};
|
||||
const auto oldData {settingsStorage->loadValue<QByteArray>(oldKey)};
|
||||
const auto newData {settingsStorage->loadValue<QString>(newKey)};
|
||||
const QString errorMsgFormat {QObject::tr("Migrate preferences failed: WebUI https, file: \"%1\", error: \"%2\"")};
|
||||
|
||||
if (!newData.isEmpty() || oldData.isEmpty())
|
||||
@@ -89,8 +89,8 @@ namespace
|
||||
const QString newKey {QLatin1String {"BitTorrent/Session/TorrentContentLayout"}};
|
||||
|
||||
SettingsStorage *settingsStorage {SettingsStorage::instance()};
|
||||
const QVariant oldData {settingsStorage->loadValue(oldKey)};
|
||||
const QString newData {settingsStorage->loadValue(newKey).toString()};
|
||||
const auto oldData {settingsStorage->loadValue<QVariant>(oldKey)};
|
||||
const auto newData {settingsStorage->loadValue<QString>(newKey)};
|
||||
|
||||
if (!newData.isEmpty() || !oldData.isValid())
|
||||
return;
|
||||
@@ -128,7 +128,7 @@ void handleChangedDefaults(const DefaultPreferencesMode mode)
|
||||
SettingsStorage *settingsStorage {SettingsStorage::instance()};
|
||||
for (auto it = changedDefaults.cbegin(); it != changedDefaults.cend(); ++it)
|
||||
{
|
||||
if (settingsStorage->loadValue(it->name).isNull())
|
||||
if (settingsStorage->loadValue<QVariant>(it->name).isNull())
|
||||
settingsStorage->storeValue(it->name, (mode == DefaultPreferencesMode::Legacy ? it->legacy : it->current));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user