First tray attempt, seems to be working

This commit is contained in:
Blue 2022-08-15 19:40:07 +03:00
parent 7192286aeb
commit 7e9eed2075
Signed by untrusted user: blue
GPG key ID: 9B203B252A63EE38
13 changed files with 201 additions and 7 deletions

View file

@ -57,6 +57,7 @@ void Settings::onVariableModified(const QString& key, const QVariant& value)
void Settings::apply()
{
QSettings settings;
bool trayChanged = false;
for (const std::pair<const QString, QVariant>& pair: modifiedSettings) {
if (pair.first == "style") {
Shared::Global::setStyle(pair.second.toString());
@ -73,8 +74,18 @@ void Settings::apply()
emit changeDownloadsPath(path);
}
}
} else if (pair.first == "tray" || pair.first == "hideTray") {
bool oldValue = settings.value(pair.first, false).toBool();
bool newValue = pair.second.toBool();
if (oldValue != newValue) {
trayChanged = true;
settings.setValue(pair.first, pair.second);
}
}
}
if (trayChanged) {
emit changeTray(settings.value("tray", false).toBool(), settings.value("hideTray", false).toBool());
}
modifiedSettings.clear();