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:
parent
23ed1a3966
commit
a06ad7048e
BIN
audio/ToxOutgoingCall.pcm
Normal file
BIN
audio/ToxOutgoingCall.pcm
Normal file
Binary file not shown.
1
res.qrc
1
res.qrc
|
@ -8,6 +8,7 @@
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>audio/notification.pcm</file>
|
<file>audio/notification.pcm</file>
|
||||||
<file>audio/ToxIncomingCall.pcm</file>
|
<file>audio/ToxIncomingCall.pcm</file>
|
||||||
|
<file>audio/ToxOutgoingCall.pcm</file>
|
||||||
<file>img/add.svg</file>
|
<file>img/add.svg</file>
|
||||||
<file>img/avatar_mask.svg</file>
|
<file>img/avatar_mask.svg</file>
|
||||||
<file>img/contact.svg</file>
|
<file>img/contact.svg</file>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
* @value NewMessage Returns the new message notification sound.
|
* @value NewMessage Returns the new message notification sound.
|
||||||
* @value Test Returns the test sound.
|
* @value Test Returns the test sound.
|
||||||
* @value IncomingCall Returns the incoming call sound.
|
* @value IncomingCall Returns the incoming call sound.
|
||||||
|
* @value OutgoingCall Returns the outgoing call sound.
|
||||||
*
|
*
|
||||||
* @fn QString Audio::getSound(Sound s)
|
* @fn QString Audio::getSound(Sound s)
|
||||||
* @brief Function to get the path of the requested sound.
|
* @brief Function to get the path of the requested sound.
|
||||||
|
|
|
@ -39,7 +39,8 @@ public:
|
||||||
{
|
{
|
||||||
NewMessage,
|
NewMessage,
|
||||||
Test,
|
Test,
|
||||||
IncomingCall
|
IncomingCall,
|
||||||
|
OutgoingCall
|
||||||
};
|
};
|
||||||
|
|
||||||
inline static QString getSound(Sound s)
|
inline static QString getSound(Sound s)
|
||||||
|
@ -51,6 +52,8 @@ public:
|
||||||
return QStringLiteral(":/audio/notification.pcm");
|
return QStringLiteral(":/audio/notification.pcm");
|
||||||
case Sound::IncomingCall:
|
case Sound::IncomingCall:
|
||||||
return QStringLiteral(":/audio/ToxIncomingCall.pcm");
|
return QStringLiteral(":/audio/ToxIncomingCall.pcm");
|
||||||
|
case Sound::OutgoingCall:
|
||||||
|
return QStringLiteral(":/audio/ToxOutgoingCall.pcm");
|
||||||
}
|
}
|
||||||
assert(false);
|
assert(false);
|
||||||
return QString();
|
return QString();
|
||||||
|
|
|
@ -369,6 +369,7 @@ void ChatForm::onAvStart(uint32_t friendId, bool video)
|
||||||
hideNetcam();
|
hideNetcam();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Audio::getInstance().stopLoop();
|
||||||
updateCallButtons();
|
updateCallButtons();
|
||||||
startCounter();
|
startCounter();
|
||||||
}
|
}
|
||||||
|
@ -399,6 +400,7 @@ void ChatForm::showOutgoingCall(bool video)
|
||||||
btn->setToolTip(video ? tr("Cancel video call") : tr("Cancel audio call"));
|
btn->setToolTip(video ? tr("Cancel video call") : tr("Cancel audio call"));
|
||||||
addSystemInfoMessage(tr("Calling %1").arg(f->getDisplayedName()), ChatMessage::INFO,
|
addSystemInfoMessage(tr("Calling %1").arg(f->getDisplayedName()), ChatMessage::INFO,
|
||||||
QDateTime::currentDateTime());
|
QDateTime::currentDateTime());
|
||||||
|
emit outgoingNotification();
|
||||||
Widget::getInstance()->updateFriendActivity(f);
|
Widget::getInstance()->updateFriendActivity(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void aliasChanged(const QString& alias);
|
void aliasChanged(const QString& alias);
|
||||||
void incomingNotification(uint32_t friendId);
|
void incomingNotification(uint32_t friendId);
|
||||||
|
void outgoingNotification();
|
||||||
void rejectCall(uint32_t friendId);
|
void rejectCall(uint32_t friendId);
|
||||||
void acceptCall(uint32_t friendId);
|
void acceptCall(uint32_t friendId);
|
||||||
|
|
||||||
|
|
|
@ -934,6 +934,13 @@ void Widget::incomingNotification(uint32_t friendId)
|
||||||
audio.playMono16Sound(Audio::getSound(Audio::Sound::IncomingCall));
|
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)
|
void Widget::onRejectCall(uint32_t friendId)
|
||||||
{
|
{
|
||||||
Audio::getInstance().stopLoop();
|
Audio::getInstance().stopLoop();
|
||||||
|
@ -977,6 +984,7 @@ void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
||||||
connect(newfriend, &Friend::nameChanged, this, &Widget::onFriendAliasChanged);
|
connect(newfriend, &Friend::nameChanged, this, &Widget::onFriendAliasChanged);
|
||||||
|
|
||||||
connect(friendForm, &ChatForm::incomingNotification, this, &Widget::incomingNotification);
|
connect(friendForm, &ChatForm::incomingNotification, this, &Widget::incomingNotification);
|
||||||
|
connect(friendForm, &ChatForm::outgoingNotification, this, &Widget::outgoingNotification);
|
||||||
connect(friendForm, &ChatForm::rejectCall, this, &Widget::onRejectCall);
|
connect(friendForm, &ChatForm::rejectCall, this, &Widget::onRejectCall);
|
||||||
connect(friendForm, &ChatForm::acceptCall, this, &Widget::onAcceptCall);
|
connect(friendForm, &ChatForm::acceptCall, this, &Widget::onAcceptCall);
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,7 @@ private slots:
|
||||||
void groupInvitesUpdate();
|
void groupInvitesUpdate();
|
||||||
void groupInvitesClear();
|
void groupInvitesClear();
|
||||||
void onDialogShown(GenericChatroomWidget* widget);
|
void onDialogShown(GenericChatroomWidget* widget);
|
||||||
|
void outgoingNotification();
|
||||||
void incomingNotification(uint32_t friendId);
|
void incomingNotification(uint32_t friendId);
|
||||||
void onRejectCall(uint32_t friendId);
|
void onRejectCall(uint32_t friendId);
|
||||||
void onAcceptCall(uint32_t friendId);
|
void onAcceptCall(uint32_t friendId);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user