From 38c51508f22861621bdd1d5b2d2cd2caf16ba7a5 Mon Sep 17 00:00:00 2001 From: Andreas Date: Tue, 16 Sep 2014 12:54:35 +0200 Subject: [PATCH] Added a preference to disable the pause notification. Fixes #2450. --- src/ui/notificationssettingspage.cpp | 3 +++ src/ui/notificationssettingspage.ui | 7 +++++++ src/widgets/osd.cpp | 6 +++++- src/widgets/osd.h | 8 +++++++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ui/notificationssettingspage.cpp b/src/ui/notificationssettingspage.cpp index 11b1e4c55..413f23f80 100644 --- a/src/ui/notificationssettingspage.cpp +++ b/src/ui/notificationssettingspage.cpp @@ -154,6 +154,8 @@ void NotificationsSettingsPage::Load() { s.value("ShowOnVolumeChange", false).toBool()); ui_->notifications_play_mode->setChecked( s.value("ShowOnPlayModeChange", true).toBool()); + ui_->notifications_pause->setChecked( + s.value("ShowOnPausePlayback", true).toBool()); ui_->notifications_art->setChecked(s.value("ShowArt", true).toBool()); ui_->notifications_custom_text_enabled->setChecked( s.value("CustomTextEnabled", false).toBool()); @@ -203,6 +205,7 @@ void NotificationsSettingsPage::Save() { s.setValue("Timeout", ui_->notifications_duration->value() * 1000); s.setValue("ShowOnVolumeChange", ui_->notifications_volume->isChecked()); s.setValue("ShowOnPlayModeChange", ui_->notifications_play_mode->isChecked()); + s.setValue("ShowOnPausePlayback", ui_->notifications_pause->isChecked()); s.setValue("ShowArt", ui_->notifications_art->isChecked()); s.setValue("CustomTextEnabled", ui_->notifications_custom_text_enabled->isChecked()); diff --git a/src/ui/notificationssettingspage.ui b/src/ui/notificationssettingspage.ui index d61ff0d47..52da4c048 100644 --- a/src/ui/notificationssettingspage.ui +++ b/src/ui/notificationssettingspage.ui @@ -117,6 +117,13 @@ + + + + Show a notification when I pause playback + + + diff --git a/src/widgets/osd.cpp b/src/widgets/osd.cpp index b64f8e0b4..87f6ddb23 100644 --- a/src/widgets/osd.cpp +++ b/src/widgets/osd.cpp @@ -42,6 +42,7 @@ OSD::OSD(SystemTrayIcon* tray_icon, Application* app, QObject* parent) show_on_volume_change_(false), show_art_(true), show_on_play_mode_change_(true), + show_on_pause_(true), use_custom_text_(false), custom_text1_(QString()), custom_text2_(QString()), @@ -67,6 +68,7 @@ void OSD::ReloadSettings() { show_on_volume_change_ = s.value("ShowOnVolumeChange", false).toBool(); show_art_ = s.value("ShowArt", true).toBool(); show_on_play_mode_change_ = s.value("ShowOnPlayModeChange", true).toBool(); + show_on_pause_ = s.value("ShowOnPausePlayback", true).toBool(); use_custom_text_ = s.value(("CustomTextEnabled"), false).toBool(); custom_text1_ = s.value("CustomText1").toString(); custom_text2_ = s.value("CustomText2").toString(); @@ -150,7 +152,9 @@ void OSD::AlbumArtLoaded(const Song& song, const QString& uri, } void OSD::Paused() { - ShowMessage(QCoreApplication::applicationName(), tr("Paused")); + if (show_on_pause_) { + ShowMessage(QCoreApplication::applicationName(), tr("Paused")); + } } void OSD::Stopped() { diff --git a/src/widgets/osd.h b/src/widgets/osd.h index f4f36962d..201481a1f 100644 --- a/src/widgets/osd.h +++ b/src/widgets/osd.h @@ -52,7 +52,12 @@ class OSD : public QObject { static const char* kSettingsGroup; - enum Behaviour { Disabled = 0, Native, TrayPopup, Pretty, }; + enum Behaviour { + Disabled = 0, + Native, + TrayPopup, + Pretty, + }; // Implemented in the OS-specific files static bool SupportsNativeNotifications(); @@ -113,6 +118,7 @@ class OSD : public QObject { bool show_on_volume_change_; bool show_art_; bool show_on_play_mode_change_; + bool show_on_pause_; bool use_custom_text_; QString custom_text1_; QString custom_text2_;