1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-11-02 12:47:42 +01:00
parent 77edbb668e
commit a908e036ce
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
5 changed files with 40 additions and 2 deletions

View File

@ -186,6 +186,7 @@ signals:
void avPeerTimeout(int friendId, int callIndex);
void avMediaChange(int friendId, int callIndex, bool videoEnabled);
void avCallFailed(int friendId);
void avRejected(int friendId, int callIndex);
void videoFrameReceived(vpx_image* frame);

View File

@ -324,9 +324,19 @@ void Core::onAvCancel(void* _toxav, int32_t callId, void* core)
emit static_cast<Core*>(core)->avCancel(friendId, callId);
}
void Core::onAvReject(void*, int32_t, void*)
void Core::onAvReject(void* _toxav, int32_t callId, void* core)
{
qDebug() << "Core: AV reject";
ToxAv* toxav = static_cast<ToxAv*>(_toxav);
int friendId = toxav_get_peer_id(toxav, callId, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV reject";
return;
}
qDebug() << QString("Core: AV reject from %1").arg(friendId);
emit static_cast<Core*>(core)->avRejected(friendId, callId);
}
void Core::onAvEnd(void* _toxav, int32_t call_index, void* core)

View File

@ -434,6 +434,31 @@ void ChatForm::onAvPeerTimeout(int FriendId, int)
netcam->hide();
}
void ChatForm::onAvRejected(int FriendId, int)
{
if (FriendId != f->friendId)
return;
audioInputFlag = false;
audioOutputFlag = false;
micButton->setObjectName("green");
micButton->style()->polish(micButton);
volButton->setObjectName("green");
volButton->style()->polish(volButton);
callButton->disconnect();
videoButton->disconnect();
callButton->setObjectName("green");
callButton->style()->polish(callButton);
callButton->disconnect();
videoButton->setObjectName("green");
videoButton->style()->polish(videoButton);
videoButton->disconnect();
connect(callButton, SIGNAL(clicked()), this, SLOT(onCallTriggered()));
connect(videoButton, SIGNAL(clicked()), this, SLOT(onVideoCallTriggered()));
netcam->hide();
}
void ChatForm::onAvMediaChange(int FriendId, int CallId, bool video)
{
if (FriendId != f->friendId || CallId != callId)

View File

@ -57,6 +57,7 @@ public slots:
void onAvPeerTimeout(int FriendId, int CallId);
void onAvMediaChange(int FriendId, int CallId, bool video);
void onAvCallFailed(int FriendId);
void onAvRejected(int FriendId, int CallId);
void onMicMuteToggle();
void onVolMuteToggle();
void onAvatarChange(int FriendId, const QPixmap& pic);

View File

@ -623,6 +623,7 @@ void Widget::addFriend(int friendId, const QString &userId)
connect(core, &Core::avPeerTimeout, newfriend->chatForm, &ChatForm::onAvPeerTimeout);
connect(core, &Core::avMediaChange, newfriend->chatForm, &ChatForm::onAvMediaChange);
connect(core, &Core::avCallFailed, newfriend->chatForm, &ChatForm::onAvCallFailed);
connect(core, &Core::avRejected, newfriend->chatForm, &ChatForm::onAvRejected);
connect(core, &Core::friendAvatarChanged, newfriend->chatForm, &ChatForm::onAvatarChange);
connect(core, &Core::friendAvatarChanged, newfriend->widget, &FriendWidget::onAvatarChange);
connect(core, &Core::friendAvatarRemoved, newfriend->chatForm, &ChatForm::onAvatarRemoved);