Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
feat(call): add call end sound
Browse files Browse the repository at this point in the history
Fix #4905
  • Loading branch information
anthonybilinski committed Apr 26, 2018
1 parent 5dc4e6d commit 65896e4
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 1 deletion.
Binary file added audio/ToxEndCall.pcm
Binary file not shown.
1 change: 1 addition & 0 deletions res.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<file>audio/notification.pcm</file>
<file>audio/ToxIncomingCall.pcm</file>
<file>audio/ToxOutgoingCall.pcm</file>
<file>audio/ToxEndCall.pcm</file>
<file>img/add.svg</file>
<file>img/avatar_mask.svg</file>
<file>img/contact.svg</file>
Expand Down
5 changes: 4 additions & 1 deletion src/audio/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class Audio : public QObject
NewMessage,
Test,
IncomingCall,
OutgoingCall
OutgoingCall,
CallEnd
};

inline static QString getSound(Sound s)
Expand All @@ -54,6 +55,8 @@ class Audio : public QObject
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();
Expand Down
1 change: 1 addition & 0 deletions src/widget/form/chatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ void ChatForm::onAvEnd(uint32_t friendId, bool error)
}

emit stopNotification();
emit endCallNotification();
updateCallButtons();
stopCounter(error);
hideNetcam();
Expand Down
1 change: 1 addition & 0 deletions src/widget/form/chatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ChatForm : public GenericChatForm
void incomingNotification(uint32_t friendId);
void outgoingNotification();
void stopNotification();
void endCallNotification();
void rejectCall(uint32_t friendId);
void acceptCall(uint32_t friendId);

Expand Down
7 changes: 7 additions & 0 deletions src/widget/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/widget/widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 65896e4

Please sign in to comment.