Skip to content

Commit

Permalink
fix(Notify): Notify sound setting disables all sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Pigpog committed Jan 12, 2025
1 parent 9f4b8a0 commit f2f80f1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/widget/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit f2f80f1

Please sign in to comment.