diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp
index b51ebdbca..96afaac73 100644
--- a/src/persistence/settings.cpp
+++ b/src/persistence/settings.cpp
@@ -171,6 +171,7 @@ void Settings::loadGlobal()
showWindow = s.value("showWindow", true).toBool();
showInFront = s.value("showInFront", false).toBool();
notifySound = s.value("notifySound", true).toBool();
+ busySound = s.value("busySound", false).toBool();
groupAlwaysNotify = s.value("groupAlwaysNotify", false).toBool();
fauxOfflineMessaging = s.value("fauxOfflineMessaging", true).toBool();
autoSaveEnabled = s.value("autoSaveEnabled", false).toBool();
@@ -417,6 +418,7 @@ void Settings::saveGlobal()
s.setValue("showWindow", showWindow);
s.setValue("showInFront", showInFront);
s.setValue("notifySound", notifySound);
+ s.setValue("busySound", busySound);
s.setValue("groupAlwaysNotify", groupAlwaysNotify);
s.setValue("fauxOfflineMessaging", fauxOfflineMessaging);
s.setValue("separateWindow", separateWindow);
@@ -828,6 +830,18 @@ void Settings::setNotifySound(bool newValue)
notifySound = newValue;
}
+bool Settings::getBusySound() const
+{
+ QMutexLocker locker{&bigLock};
+ return busySound;
+}
+
+void Settings::setBusySound(bool newValue)
+{
+ QMutexLocker locker{&bigLock};
+ busySound = newValue;
+}
+
bool Settings::getGroupAlwaysNotify() const
{
QMutexLocker locker{&bigLock};
diff --git a/src/persistence/settings.h b/src/persistence/settings.h
index 562e25df0..081c278f0 100644
--- a/src/persistence/settings.h
+++ b/src/persistence/settings.h
@@ -169,6 +169,9 @@ public:
bool getNotifySound() const;
void setNotifySound(bool newValue);
+ bool getBusySound() const;
+ void setBusySound(bool newValue);
+
bool getGroupAlwaysNotify() const;
void setGroupAlwaysNotify(bool newValue);
@@ -372,6 +375,7 @@ private:
bool showWindow;
bool showInFront;
bool notifySound;
+ bool busySound;
bool groupAlwaysNotify;
bool forceTCP;
diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp
index def6302b5..1e47d0ca4 100644
--- a/src/widget/form/settings/generalform.cpp
+++ b/src/widget/form/settings/generalform.cpp
@@ -138,7 +138,12 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
bodyUI->showWindow->setChecked(showWindow);
bodyUI->showInFront->setChecked(Settings::getInstance().getShowInFront());
bodyUI->showInFront->setEnabled(showWindow);
- bodyUI->notifySound->setChecked(Settings::getInstance().getNotifySound());
+
+ bool notifySound = Settings::getInstance().getNotifySound();
+
+ bodyUI->notifySound->setChecked(notifySound);
+ bodyUI->busySound->setChecked(Settings::getInstance().getBusySound());
+ bodyUI->busySound->setEnabled(notifySound);
bodyUI->groupAlwaysNotify->setChecked(Settings::getInstance().getGroupAlwaysNotify());
bodyUI->cbFauxOfflineMessaging->setChecked(Settings::getInstance().getFauxOfflineMessaging());
bodyUI->cbCompactLayout->setChecked(Settings::getInstance().getCompactLayout());
@@ -217,6 +222,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
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->busySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetBusySound);
connect(bodyUI->markdownComboBox, &QComboBox::currentTextChanged, this, &GeneralForm::onMarkdownUpdated);
connect(bodyUI->groupAlwaysNotify, &QCheckBox::stateChanged, this, &GeneralForm::onSetGroupAlwaysNotify);
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
@@ -489,6 +495,11 @@ void GeneralForm::onSetNotifySound()
Settings::getInstance().setNotifySound(bodyUI->notifySound->isChecked());
}
+void GeneralForm::onSetBusySound()
+{
+ Settings::getInstance().setBusySound(bodyUI->busySound->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 6b27e6f06..8480fa276 100644
--- a/src/widget/form/settings/generalform.h
+++ b/src/widget/form/settings/generalform.h
@@ -65,6 +65,7 @@ private slots:
void onShowWindowChanged();
void onSetShowInFront();
void onSetNotifySound();
+ void onSetBusySound();
void onSetGroupAlwaysNotify();
void onFauxOfflineMessaging();
void onCompactLayout();
diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui
index 87c34a3fe..af4911bd2 100644
--- a/src/widget/form/settings/generalsettings.ui
+++ b/src/widget/form/settings/generalsettings.ui
@@ -39,8 +39,8 @@
0
0
- 1278
- 1413
+ 1270
+ 1468
@@ -328,6 +328,20 @@ instead of closing itself.
+ -
+
+
+ 40
+
+
-
+
+
+ Play sound while Busy
+
+
+
+
+
-
@@ -955,5 +969,21 @@ will be sent to them when they appear online to you.
+
+ notifySound
+ toggled(bool)
+ busySound
+ setEnabled(bool)
+
+
+ 665
+ 522
+
+
+ 684
+ 551
+
+
+
diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp
index 4ba853a58..7903388b6 100644
--- a/src/widget/widget.cpp
+++ b/src/widget/widget.cpp
@@ -1294,7 +1294,11 @@ bool Widget::newMessageAlert(QWidget* currentWindow, bool isActive, bool sound,
currentWindow->activateWindow();
}
- if (Settings::getInstance().getNotifySound() && sound)
+ bool isBusy = Nexus::getCore()->getStatus() == Status::Busy;
+ bool busySound = Settings::getInstance().getBusySound();
+ bool notifySound = Settings::getInstance().getNotifySound();
+
+ if (notifySound && sound && (!isBusy || busySound))
Audio::getInstance().playMono16Sound(QStringLiteral(":/audio/notification.pcm"));
}