diff --git a/src/misc/settings.cpp b/src/misc/settings.cpp
index 750520f9c..9640d41b8 100644
--- a/src/misc/settings.cpp
+++ b/src/misc/settings.cpp
@@ -209,6 +209,7 @@ void Settings::load()
checkUpdates = s.value("checkUpdates", false).toBool();
showWindow = s.value("showWindow", true).toBool();
showInFront = s.value("showInFront", false).toBool();
+ notifySound = s.value("notifySound", true).toBool();
groupAlwaysNotify = s.value("groupAlwaysNotify", false).toBool();
fauxOfflineMessaging = s.value("fauxOfflineMessaging", true).toBool();
autoSaveEnabled = s.value("autoSaveEnabled", false).toBool();
@@ -380,6 +381,7 @@ void Settings::saveGlobal(QString path)
s.setValue("checkUpdates", checkUpdates);
s.setValue("showWindow", showWindow);
s.setValue("showInFront", showInFront);
+ s.setValue("notifySound", notifySound);
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
s.setValue("compactLayout", compactLayout);
@@ -693,6 +695,16 @@ void Settings::setShowInFront(bool newValue)
showInFront = newValue;
}
+bool Settings::getNotifySound() const
+{
+ return notifySound;
+}
+
+void Settings::setNotifySound(bool newValue)
+{
+ notifySound = newValue;
+}
+
bool Settings::getGroupAlwaysNotify() const
{
return groupAlwaysNotify;
diff --git a/src/misc/settings.h b/src/misc/settings.h
index e69a39e89..bd7bbbf74 100644
--- a/src/misc/settings.h
+++ b/src/misc/settings.h
@@ -128,6 +128,9 @@ public:
bool getShowInFront() const;
void setShowInFront(bool newValue);
+ bool getNotifySound() const;
+ void setNotifySound(bool newValue);
+
bool getGroupAlwaysNotify() const;
void setGroupAlwaysNotify(bool newValue);
@@ -280,6 +283,7 @@ private:
bool checkUpdates;
bool showWindow;
bool showInFront;
+ bool notifySound;
bool groupAlwaysNotify;
bool forceTCP;
diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp
index 4d7629ea7..eba3e5bb0 100644
--- a/src/widget/form/settings/generalform.cpp
+++ b/src/widget/form/settings/generalform.cpp
@@ -73,6 +73,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
bodyUI->autoSaveFilesDir->setText(Settings::getInstance().getGlobalAutoAcceptDir());
bodyUI->showWindow->setChecked(Settings::getInstance().getShowWindow());
bodyUI->showInFront->setChecked(Settings::getInstance().getShowInFront());
+ bodyUI->notifySound->setChecked(Settings::getInstance().getNotifySound());
bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
@@ -132,6 +133,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged()));
connect(bodyUI->showWindow, &QCheckBox::stateChanged, this, &GeneralForm::onShowWindowChanged);
connect(bodyUI->showInFront, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowInFront);
+ connect(bodyUI->notifySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetNotifySound);
connect(bodyUI->groupAlwaysNotify, &QCheckBox::stateChanged, this, &GeneralForm::onSetGroupAlwaysNotify);
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
if (bodyUI->autoacceptFiles->isChecked())
@@ -371,6 +373,11 @@ void GeneralForm::onSetShowInFront()
Settings::getInstance().setShowInFront(bodyUI->showInFront->isChecked());
}
+void GeneralForm::onSetNotifySound()
+{
+ Settings::getInstance().setNotifySound(bodyUI->notifySound->isChecked());
+}
+
void GeneralForm::onSetGroupAlwaysNotify()
{
Settings::getInstance().setGroupAlwaysNotify(bodyUI->groupAlwaysNotify->isChecked());
diff --git a/src/widget/form/settings/generalform.h b/src/widget/form/settings/generalform.h
index 89da786ef..33e74d807 100644
--- a/src/widget/form/settings/generalform.h
+++ b/src/widget/form/settings/generalform.h
@@ -56,6 +56,7 @@ private slots:
void onCheckUpdateChanged();
void onShowWindowChanged();
void onSetShowInFront();
+ void onSetNotifySound();
void onSetGroupAlwaysNotify();
void onFauxOfflineMessaging();
void onCompactLayout();
diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui
index d5a03d137..5e774846e 100644
--- a/src/widget/form/settings/generalsettings.ui
+++ b/src/widget/form/settings/generalsettings.ui
@@ -345,6 +345,16 @@ instead of system taskbar.
+ -
+
+
+ Play a sound when you recieve message.
+
+
+ Play sound
+
+
+
-
diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp
index 5b9a415a3..c33559175 100644
--- a/src/widget/widget.cpp
+++ b/src/widget/widget.cpp
@@ -745,17 +745,20 @@ void Widget::newMessageAlert(GenericChatroomWidget* chat)
setWindowState(Qt::WindowActive);
}
- static QFile sndFile(":audio/notification.pcm");
- static QByteArray sndData;
-
- if (sndData.isEmpty())
+ if (Settings::getInstance().getNotifySound())
{
- sndFile.open(QIODevice::ReadOnly);
- sndData = sndFile.readAll();
- sndFile.close();
- }
+ static QFile sndFile(":audio/notification.pcm");
+ static QByteArray sndData;
- Audio::playMono16Sound(sndData);
+ if (sndData.isEmpty())
+ {
+ sndFile.open(QIODevice::ReadOnly);
+ sndData = sndFile.readAll();
+ sndFile.close();
+ }
+
+ Audio::playMono16Sound(sndData);
+ }
}
void Widget::playRingtone()