diff --git a/audio/ToxEndCall.pcm b/audio/ToxEndCall.pcm new file mode 100644 index 000000000..02757afbc Binary files /dev/null and b/audio/ToxEndCall.pcm differ diff --git a/res.qrc b/res.qrc index 24c48d855..d6a18972a 100644 --- a/res.qrc +++ b/res.qrc @@ -9,6 +9,7 @@ audio/notification.pcm audio/ToxIncomingCall.pcm audio/ToxOutgoingCall.pcm + audio/ToxEndCall.pcm img/add.svg img/avatar_mask.svg img/contact.svg diff --git a/src/audio/audio.h b/src/audio/audio.h index b36d28428..c004f69ac 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -40,7 +40,8 @@ public: NewMessage, Test, IncomingCall, - OutgoingCall + OutgoingCall, + CallEnd }; inline static QString getSound(Sound s) @@ -54,6 +55,8 @@ public: return QStringLiteral(":/audio/ToxIncomingCall.pcm"); case Sound::OutgoingCall: return QStringLiteral(":/audio/ToxOutgoingCall.pcm"); + case Sound::CallEnd: + return QStringLiteral(":/audio/ToxEndCall.pcm"); } assert(false); return QString(); diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index aaabeed38..fa13bc329 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -402,6 +402,7 @@ void ChatForm::onAvEnd(uint32_t friendId, bool error) } emit stopNotification(); + emit endCallNotification(); updateCallButtons(); stopCounter(error); hideNetcam(); diff --git a/src/widget/form/chatform.h b/src/widget/form/chatform.h index 21ddbf73f..6ea58c120 100644 --- a/src/widget/form/chatform.h +++ b/src/widget/form/chatform.h @@ -60,6 +60,7 @@ signals: void incomingNotification(uint32_t friendId); void outgoingNotification(); void stopNotification(); + void endCallNotification(); void rejectCall(uint32_t friendId); void acceptCall(uint32_t friendId); diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 44240d2d4..344ea147b 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -955,6 +955,12 @@ void Widget::outgoingNotification() audio.playMono16Sound(Audio::getSound(Audio::Sound::OutgoingCall)); } +void Widget::onCallEnd() +{ + Audio& audio = Audio::getInstance(); + audio.playMono16Sound(Audio::getSound(Audio::Sound::CallEnd)); +} + /** * @brief Widget::onStopNotification Stop the notification sound. */ @@ -997,6 +1003,7 @@ void Widget::addFriend(uint32_t friendId, const ToxPk& friendPk) connect(friendForm, &ChatForm::incomingNotification, this, &Widget::incomingNotification); connect(friendForm, &ChatForm::outgoingNotification, this, &Widget::outgoingNotification); connect(friendForm, &ChatForm::stopNotification, this, &Widget::onStopNotification); + connect(friendForm, &ChatForm::endCallNotification, this, &Widget::onCallEnd); connect(friendForm, &ChatForm::rejectCall, this, &Widget::onRejectCall); connect(widget, &FriendWidget::newWindowOpened, this, &Widget::openNewDialog); diff --git a/src/widget/widget.h b/src/widget/widget.h index d530f6b9f..bd82f551b 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -218,6 +218,7 @@ private slots: void groupInvitesClear(); void onDialogShown(GenericChatroomWidget* widget); void outgoingNotification(); + void onCallEnd(); void incomingNotification(uint32_t friendId); void onRejectCall(uint32_t friendId); void onStopNotification();