mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 16:37:21 -06:00
Improve startup window state handling
Replace current "Start qBittorrent minimized" option with "Initial window state" that allows to start qBittorrent as "hidden in system tray" while retaining regular "minimize to panel" functionality. PR #18252. Closes #487.
This commit is contained in:
committed by
GitHub
parent
0d376e7fd6
commit
32e4371208
@@ -39,13 +39,12 @@
|
||||
#include "base/profile.h"
|
||||
#include "base/settingsstorage.h"
|
||||
#include "base/settingvalue.h"
|
||||
#include "base/utils/fs.h"
|
||||
#include "base/utils/io.h"
|
||||
#include "base/utils/string.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
const int MIGRATION_VERSION = 4;
|
||||
const int MIGRATION_VERSION = 5;
|
||||
const QString MIGRATION_VERSION_KEY = u"Meta/MigrationVersion"_qs;
|
||||
|
||||
void exportWebUIHttpsFiles()
|
||||
@@ -384,6 +383,18 @@ namespace
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void migrateStartupWindowState()
|
||||
{
|
||||
auto *settingsStorage = SettingsStorage::instance();
|
||||
if (settingsStorage->hasKey(u"Preferences/General/StartMinimized"_qs))
|
||||
{
|
||||
const auto startMinimized = settingsStorage->loadValue<bool>(u"Preferences/General/StartMinimized"_qs);
|
||||
const auto minimizeToTray = settingsStorage->loadValue<bool>(u"Preferences/General/MinimizeToTray"_qs);
|
||||
const QString windowState = startMinimized ? (minimizeToTray ? u"Hidden"_qs : u"Minimized"_qs) : u"Normal"_qs;
|
||||
settingsStorage->storeValue(u"GUI/StartUpWindowState"_qs, windowState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool upgrade(const bool /*ask*/)
|
||||
@@ -413,6 +424,9 @@ bool upgrade(const bool /*ask*/)
|
||||
migrateMemoryPrioritySettings();
|
||||
#endif
|
||||
|
||||
if (version < 5)
|
||||
migrateStartupWindowState();
|
||||
|
||||
version = MIGRATION_VERSION;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user