mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Keep legacy defaults for existing users
This commit is contained in:
parent
86c95db91d
commit
0c6c65f6f8
3 changed files with 33 additions and 0 deletions
|
@ -237,6 +237,8 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!firstTimeUser) {
|
if (!firstTimeUser) {
|
||||||
|
handleChangedDefaults(DefaultPreferencesMode::Legacy);
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
if (!upgrade()) return EXIT_FAILURE;
|
if (!upgrade()) return EXIT_FAILURE;
|
||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
|
@ -248,6 +250,10 @@ int main(int argc, char *argv[])
|
||||||
&& isatty(fileno(stdout)))) return EXIT_FAILURE;
|
&& isatty(fileno(stdout)))) return EXIT_FAILURE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
handleChangedDefaults(DefaultPreferencesMode::Current);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(DISABLE_GUI) && !defined(Q_OS_WIN)
|
#if defined(DISABLE_GUI) && !defined(Q_OS_WIN)
|
||||||
if (params.shouldDaemonize) {
|
if (params.shouldDaemonize) {
|
||||||
app.reset(); // Destroy current application
|
app.reset(); // Destroy current application
|
||||||
|
|
|
@ -82,3 +82,23 @@ bool upgrade(const bool /*ask*/)
|
||||||
exportWebUIHttpsFiles();
|
exportWebUIHttpsFiles();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handleChangedDefaults(const DefaultPreferencesMode mode)
|
||||||
|
{
|
||||||
|
struct DefaultValue
|
||||||
|
{
|
||||||
|
QString name;
|
||||||
|
QVariant legacy;
|
||||||
|
QVariant current;
|
||||||
|
};
|
||||||
|
|
||||||
|
const QVector<DefaultValue> changedDefaults {
|
||||||
|
{QLatin1String {"BitTorrent/Session/QueueingSystemEnabled"}, true, false}
|
||||||
|
};
|
||||||
|
|
||||||
|
SettingsStorage *settingsStorage {SettingsStorage::instance()};
|
||||||
|
for (auto it = changedDefaults.cbegin(); it != changedDefaults.cend(); ++it) {
|
||||||
|
if (settingsStorage->loadValue(it->name).isNull())
|
||||||
|
settingsStorage->storeValue(it->name, (mode == DefaultPreferencesMode::Legacy ? it->legacy : it->current));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -28,4 +28,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
enum class DefaultPreferencesMode
|
||||||
|
{
|
||||||
|
Legacy,
|
||||||
|
Current
|
||||||
|
};
|
||||||
|
|
||||||
|
void handleChangedDefaults(DefaultPreferencesMode mode);
|
||||||
bool upgrade(bool ask = true);
|
bool upgrade(bool ask = true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue