From 22b4d50ce3f4a774155adffe86caed2376007a8d Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Tue, 23 Jun 2015 18:46:34 +0200 Subject: [PATCH] add setting to disable notification sounds --- src/libsnore/notification/notification_p.cpp | 7 ++++--- src/libsnore/settingsdialog.cpp | 4 ++++ src/libsnore/settingsdialog.ui | 10 ++++++++++ src/libsnore/snore_p.cpp | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/libsnore/notification/notification_p.cpp b/src/libsnore/notification/notification_p.cpp index c615c8e..d7e9e1d 100644 --- a/src/libsnore/notification/notification_p.cpp +++ b/src/libsnore/notification/notification_p.cpp @@ -19,8 +19,9 @@ #include "notification/notification_p.h" #include "notification/icon.h" #include "../hint.h" -#include "../log.h" -#include "../plugins/plugins.h" +#include "libsnore/log.h" +#include "libsnore/plugins/plugins.h" +#include "libsnore/snore.h" #include @@ -91,6 +92,6 @@ void NotificationData::setTimeoutTimer(QTimer *timer) void NotificationData::initHints() { - m_hints.setValue("silent", QVariant::fromValue(false)); + m_hints.setValue("silent", SnoreCore::instance().value("Silent", LOCAL_SETTING)); } diff --git a/src/libsnore/settingsdialog.cpp b/src/libsnore/settingsdialog.cpp index 9a9a7f4..1898139 100644 --- a/src/libsnore/settingsdialog.cpp +++ b/src/libsnore/settingsdialog.cpp @@ -98,6 +98,7 @@ void SettingsDialog::load() ui->primaryBackendLabel->setVisible(false); } ui->timeoutSpinBox->setValue(SnoreCore::instance().value("Timeout", LOCAL_SETTING).toInt()); + ui->disableNotificationSoundCheckBox->setChecked(SnoreCore::instance().value("Silent", LOCAL_SETTING).toBool()); for (auto widget : m_tabs) { widget->loadSettings(); } @@ -113,8 +114,11 @@ void SettingsDialog::save() } dirty |= SnoreCore::instance().value("PrimaryBackend", LOCAL_SETTING).toString() != ui->primaryBackendComboBox->currentText(); dirty |= SnoreCore::instance().value("Timeout", LOCAL_SETTING).toInt() != ui->timeoutSpinBox->value(); + dirty |= SnoreCore::instance().value("Silent", LOCAL_SETTING).toBool() != ui->disableNotificationSoundCheckBox->isChecked(); + SnoreCore::instance().setValue("PrimaryBackend", ui->primaryBackendComboBox->currentText(), LOCAL_SETTING); SnoreCore::instance().setValue("Timeout", ui->timeoutSpinBox->value(), LOCAL_SETTING); + SnoreCore::instance().setValue("Silent", ui->disableNotificationSoundCheckBox->isChecked(), LOCAL_SETTING); if (dirty) { SnoreCorePrivate::instance()->syncSettings(); diff --git a/src/libsnore/settingsdialog.ui b/src/libsnore/settingsdialog.ui index 628e342..991cc41 100644 --- a/src/libsnore/settingsdialog.ui +++ b/src/libsnore/settingsdialog.ui @@ -63,6 +63,16 @@ + + + + Disable Notification Sound: + + + + + + diff --git a/src/libsnore/snore_p.cpp b/src/libsnore/snore_p.cpp index b94e521..b292873 100644 --- a/src/libsnore/snore_p.cpp +++ b/src/libsnore/snore_p.cpp @@ -140,6 +140,7 @@ void SnoreCorePrivate::init() { Q_Q(SnoreCore); q->setDefaultValue("Timeout", 10, LOCAL_SETTING); + q->setDefaultValue("Silent", false, LOCAL_SETTING); q->setDefaultApplication(Application("SnoreNotify", Icon(":/root/snore.png"))); }