add setting to disable notification sounds

This commit is contained in:
Patrick von Reth 2015-06-23 18:46:34 +02:00
parent 6946b0db9f
commit 22b4d50ce3
4 changed files with 19 additions and 3 deletions

View File

@ -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 <QSharedData>
@ -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));
}

View File

@ -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();

View File

@ -63,6 +63,16 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="disableNotificationSoundLabel">
<property name="text">
<string>Disable Notification Sound:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="disableNotificationSoundCheckBox"/>
</item>
</layout>
</item>
</layout>

View File

@ -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")));
}