1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat(audio):OutgoingCallSound

Adds outgoing call sound when call is started
This commit is contained in:
Alice Weigt 2017-06-12 21:27:29 -07:00
parent 23ed1a3966
commit a06ad7048e
8 changed files with 18 additions and 1 deletions

BIN
audio/ToxOutgoingCall.pcm Normal file

Binary file not shown.

View File

@ -8,6 +8,7 @@
<qresource prefix="/">
<file>audio/notification.pcm</file>
<file>audio/ToxIncomingCall.pcm</file>
<file>audio/ToxOutgoingCall.pcm</file>
<file>img/add.svg</file>
<file>img/avatar_mask.svg</file>
<file>img/contact.svg</file>

View File

@ -34,6 +34,7 @@
* @value NewMessage Returns the new message notification sound.
* @value Test Returns the test sound.
* @value IncomingCall Returns the incoming call sound.
* @value OutgoingCall Returns the outgoing call sound.
*
* @fn QString Audio::getSound(Sound s)
* @brief Function to get the path of the requested sound.

View File

@ -39,7 +39,8 @@ public:
{
NewMessage,
Test,
IncomingCall
IncomingCall,
OutgoingCall
};
inline static QString getSound(Sound s)
@ -51,6 +52,8 @@ public:
return QStringLiteral(":/audio/notification.pcm");
case Sound::IncomingCall:
return QStringLiteral(":/audio/ToxIncomingCall.pcm");
case Sound::OutgoingCall:
return QStringLiteral(":/audio/ToxOutgoingCall.pcm");
}
assert(false);
return QString();

View File

@ -369,6 +369,7 @@ void ChatForm::onAvStart(uint32_t friendId, bool video)
hideNetcam();
}
Audio::getInstance().stopLoop();
updateCallButtons();
startCounter();
}
@ -399,6 +400,7 @@ void ChatForm::showOutgoingCall(bool video)
btn->setToolTip(video ? tr("Cancel video call") : tr("Cancel audio call"));
addSystemInfoMessage(tr("Calling %1").arg(f->getDisplayedName()), ChatMessage::INFO,
QDateTime::currentDateTime());
emit outgoingNotification();
Widget::getInstance()->updateFriendActivity(f);
}

View File

@ -58,6 +58,7 @@ public:
signals:
void aliasChanged(const QString& alias);
void incomingNotification(uint32_t friendId);
void outgoingNotification();
void rejectCall(uint32_t friendId);
void acceptCall(uint32_t friendId);

View File

@ -934,6 +934,13 @@ void Widget::incomingNotification(uint32_t friendId)
audio.playMono16Sound(Audio::getSound(Audio::Sound::IncomingCall));
}
void Widget::outgoingNotification()
{
Audio& audio = Audio::getInstance();
audio.startLoop();
audio.playMono16Sound(Audio::getSound(Audio::Sound::OutgoingCall));
}
void Widget::onRejectCall(uint32_t friendId)
{
Audio::getInstance().stopLoop();
@ -977,6 +984,7 @@ void Widget::addFriend(int friendId, const ToxPk& friendPk)
connect(newfriend, &Friend::nameChanged, this, &Widget::onFriendAliasChanged);
connect(friendForm, &ChatForm::incomingNotification, this, &Widget::incomingNotification);
connect(friendForm, &ChatForm::outgoingNotification, this, &Widget::outgoingNotification);
connect(friendForm, &ChatForm::rejectCall, this, &Widget::onRejectCall);
connect(friendForm, &ChatForm::acceptCall, this, &Widget::onAcceptCall);

View File

@ -217,6 +217,7 @@ private slots:
void groupInvitesUpdate();
void groupInvitesClear();
void onDialogShown(GenericChatroomWidget* widget);
void outgoingNotification();
void incomingNotification(uint32_t friendId);
void onRejectCall(uint32_t friendId);
void onAcceptCall(uint32_t friendId);