From c7bc9d471abbe7fcb43382fc18885953bf7d4ea0 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 10 Apr 2021 08:22:08 +0200 Subject: [PATCH] Allow keep running option on macOS too --- src/core/mainwindow.cpp | 4 ---- src/settings/behavioursettingspage.cpp | 14 +++++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 0f3e762c6..70d35a3ae 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -1561,16 +1561,12 @@ void MainWindow::showEvent(QShowEvent *e) { void MainWindow::closeEvent(QCloseEvent *e) { -#ifdef Q_OS_MACOS - Exit(); -#else if (!hidden_ && keep_running_ && e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable()) { SetHiddenInTray(true); } else { Exit(); } -#endif QMainWindow::closeEvent(e); diff --git a/src/settings/behavioursettingspage.cpp b/src/settings/behavioursettingspage.cpp index 3a191c8d5..d8ca5929c 100644 --- a/src/settings/behavioursettingspage.cpp +++ b/src/settings/behavioursettingspage.cpp @@ -68,7 +68,6 @@ BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog *dialog) : SettingsP #ifdef Q_OS_MACOS ui_->checkbox_showtrayicon->hide(); - ui_->checkbox_keeprunning->hide(); ui_->checkbox_trayicon_progress->hide(); ui_->checkbox_scrolltrayicon->hide(); ui_->groupbox_startup->hide(); @@ -156,29 +155,34 @@ void BehaviourSettingsPage::Load() { #ifndef Q_OS_MACOS if (QSystemTrayIcon::isSystemTrayAvailable()) { ui_->checkbox_showtrayicon->setEnabled(true); - ui_->checkbox_keeprunning->setEnabled(true); ui_->checkbox_trayicon_progress->setEnabled(true); ui_->checkbox_scrolltrayicon->setEnabled(true); ui_->radiobutton_hide->setEnabled(true); ui_->checkbox_showtrayicon->setChecked(s.value("showtrayicon", true).toBool()); - ui_->checkbox_keeprunning->setChecked(s.value("keeprunning", false).toBool()); ui_->checkbox_trayicon_progress->setChecked(s.value("trayicon_progress", false).toBool()); ui_->checkbox_scrolltrayicon->setChecked(s.value("scrolltrayicon", ui_->checkbox_showtrayicon->isChecked()).toBool()); } else { ui_->checkbox_showtrayicon->setEnabled(false); - ui_->checkbox_keeprunning->setEnabled(false); ui_->checkbox_trayicon_progress->setEnabled(false); ui_->checkbox_scrolltrayicon->setEnabled(false); ui_->radiobutton_hide->setEnabled(false); ui_->checkbox_showtrayicon->setChecked(false); - ui_->checkbox_keeprunning->setChecked(false); ui_->checkbox_trayicon_progress->setChecked(false); ui_->checkbox_scrolltrayicon->setChecked(false); ui_->radiobutton_hide->setChecked(false); } #endif + if (QSystemTrayIcon::isSystemTrayAvailable()) { + ui_->checkbox_keeprunning->setEnabled(true); + ui_->checkbox_keeprunning->setChecked(s.value("keeprunning", false).toBool()); + } + else { + ui_->checkbox_keeprunning->setEnabled(false); + ui_->checkbox_keeprunning->setChecked(false); + } + ui_->checkbox_resumeplayback->setChecked(s.value("resumeplayback", false).toBool()); ui_->checkbox_playingwidget->setChecked(s.value("playing_widget", true).toBool());