MainWindow: Keep running require system tray icon

Fixes bug where Strawberry remains running when system tray icon is disabled.
This commit is contained in:
Jonas Kvinge 2024-09-27 18:13:38 +02:00
parent 4b55150515
commit 19b3adeb96
1 changed files with 2 additions and 2 deletions

View File

@ -1107,10 +1107,10 @@ void MainWindow::ReloadSettings() {
constexpr bool keeprunning_available = true;
#else
const bool systemtray_available = tray_icon_->IsSystemTrayAvailable();
const bool keeprunning_available = systemtray_available;
s.beginGroup(BehaviourSettingsPage::kSettingsGroup);
const bool showtrayicon = s.value("showtrayicon", systemtray_available).toBool();
s.endGroup();
const bool keeprunning_available = systemtray_available && showtrayicon;
if (systemtray_available) {
tray_icon_->setVisible(showtrayicon);
}
@ -1642,7 +1642,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
}
if (!exit_) {
if (!hidden_ && keep_running_ && tray_icon_->IsSystemTrayAvailable()) {
if (!hidden_ && tray_icon_->IsSystemTrayAvailable() && tray_icon_->isVisible() && keep_running_) {
SetHiddenInTray(true);
}
else {