mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
add ringtone (not well done, but still better than status quo)
This commit is contained in:
parent
f441ffd74a
commit
54eb425238
BIN
audio/ToxicIncomingCall.pcm
Normal file
BIN
audio/ToxicIncomingCall.pcm
Normal file
Binary file not shown.
1
res.qrc
1
res.qrc
|
@ -123,6 +123,7 @@
|
|||
<file>ui/fileTransferInstance/emptyRGreenFileButton.png</file>
|
||||
<file>ui/fileTransferInstance/emptyRRedFileButton.png</file>
|
||||
<file>audio/notification.pcm</file>
|
||||
<file>audio/ToxicIncomingCall.pcm</file>
|
||||
<file>img/settings/general.png</file>
|
||||
<file>img/settings/identity.png</file>
|
||||
<file>img/settings/privacy.png</file>
|
||||
|
|
|
@ -145,6 +145,7 @@ Widget::Widget(QWidget *parent)
|
|||
connect(core, &Core::groupMessageReceived, this, &Widget::onGroupMessageReceived);
|
||||
connect(core, &Core::groupNamelistChanged, this, &Widget::onGroupNamelistChanged);
|
||||
connect(core, &Core::emptyGroupCreated, this, &Widget::onEmptyGroupCreated);
|
||||
connect(core, &Core::avInvite, this, &Widget::playRingtone);
|
||||
|
||||
connect(core, SIGNAL(messageSentResult(int,QString,int)), this, SLOT(onMessageSendResult(int,QString,int)));
|
||||
connect(core, SIGNAL(groupSentResult(int,QString,int)), this, SLOT(onGroupSendResult(int,QString,int)));
|
||||
|
@ -535,6 +536,26 @@ void Widget::newMessageAlert()
|
|||
alSourcePlay(core->alMainSource);
|
||||
}
|
||||
|
||||
void Widget::playRingtone()
|
||||
{
|
||||
QApplication::alert(this);
|
||||
|
||||
static QFile sndFile1(":audio/ToxicIncomingCall.pcm"); // for whatever reason this plays slower/downshifted from what any other program plays the file as... but whatever
|
||||
static QByteArray sndData1;
|
||||
if (sndData1.isEmpty())
|
||||
{
|
||||
sndFile1.open(QIODevice::ReadOnly);
|
||||
sndData1 = sndFile1.readAll();
|
||||
sndFile1.close();
|
||||
}
|
||||
|
||||
ALuint buffer;
|
||||
alGenBuffers(1, &buffer);
|
||||
alBufferData(buffer, AL_FORMAT_MONO16, sndData1.data(), sndData1.size(), 44100);
|
||||
alSourcei(core->alMainSource, AL_BUFFER, buffer);
|
||||
alSourcePlay(core->alMainSource);
|
||||
}
|
||||
|
||||
void Widget::onFriendRequestReceived(const QString& userId, const QString& message)
|
||||
{
|
||||
FriendRequestDialog dialog(this, userId, message);
|
||||
|
|
|
@ -104,6 +104,7 @@ private slots:
|
|||
void setStatusBusy();
|
||||
void onMessageSendResult(int friendId, const QString& message, int messageId);
|
||||
void onGroupSendResult(int groupId, const QString& message, int result);
|
||||
void playRingtone();
|
||||
|
||||
private:
|
||||
void hideMainForms();
|
||||
|
|
Loading…
Reference in New Issue
Block a user