From f51c1e3c589fd9734a811defdd41acf44ce121a9 Mon Sep 17 00:00:00 2001 From: Jared <7060603@hotmail.ca> Date: Sun, 12 Jan 2025 13:31:13 -0700 Subject: [PATCH] fix(Notify): Notify sound setting disables all sounds --- src/widget/widget.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index be3c96c577..0b6693b6c5 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1047,7 +1047,11 @@ void Widget::setStatusMessage(const QString& statusMessage) */ void Widget::playNotificationSound(IAudioSink::Sound sound, bool loop) { - if (!settings.getAudioOutDevEnabled()) { + bool isBusy = core->getStatus() == Status::Status::Busy; + bool busySound = settings.getBusySound(); + bool notifySound = settings.getNotifySound(); + + if (!settings.getAudioOutDevEnabled() || !(notifySound && (!isBusy || busySound))) { // don't try to play sounds if audio is disabled return; } @@ -1572,7 +1576,8 @@ bool Widget::newFriendMessageAlert(const ToxPk& friendId, const QString& text, b notificationData = notificationGenerator->friendMessageNotification(f, text); } } else { - notificationData = notificationGenerator->fileTransferNotification(f, filename, filesize); + notificationData = + notificationGenerator->fileTransferNotification(f, filename, filesize); } notifier->notifyMessage(notificationData); } @@ -1672,11 +1677,8 @@ bool Widget::newMessageAlert(QWidget* currentWindow, bool isActive, bool sound, } eventFlag = true; } - bool isBusy = core->getStatus() == Status::Status::Busy; - bool busySound = settings.getBusySound(); - bool notifySound = settings.getNotifySound(); - if (notifySound && sound && (!isBusy || busySound)) { + if (sound) { playNotificationSound(IAudioSink::Sound::NewMessage); } }