mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #4531
tWido (1): feat(video): Error message on call fail
This commit is contained in:
commit
c82b66104c
|
@ -728,7 +728,7 @@ void CoreAV::stateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t state, voi
|
||||||
if (state & TOXAV_FRIEND_CALL_STATE_ERROR) {
|
if (state & TOXAV_FRIEND_CALL_STATE_ERROR) {
|
||||||
qWarning() << "Call with friend" << friendNum << "died of unnatural causes!";
|
qWarning() << "Call with friend" << friendNum << "died of unnatural causes!";
|
||||||
calls.remove(friendNum);
|
calls.remove(friendNum);
|
||||||
emit self->avEnd(friendNum);
|
emit self->avEnd(friendNum, true);
|
||||||
} else if (state & TOXAV_FRIEND_CALL_STATE_FINISHED) {
|
} else if (state & TOXAV_FRIEND_CALL_STATE_FINISHED) {
|
||||||
qDebug() << "Call with friend" << friendNum << "finished quietly";
|
qDebug() << "Call with friend" << friendNum << "finished quietly";
|
||||||
calls.remove(friendNum);
|
calls.remove(friendNum);
|
||||||
|
|
|
@ -92,7 +92,7 @@ public slots:
|
||||||
signals:
|
signals:
|
||||||
void avInvite(uint32_t friendId, bool video);
|
void avInvite(uint32_t friendId, bool video);
|
||||||
void avStart(uint32_t friendId, bool video);
|
void avStart(uint32_t friendId, bool video);
|
||||||
void avEnd(uint32_t friendId);
|
void avEnd(uint32_t friendId, bool error = false);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
static void callCallback(ToxAV* toxAV, uint32_t friendNum, bool audio, bool video, void* self);
|
static void callCallback(ToxAV* toxAV, uint32_t friendNum, bool audio, bool video, void* self);
|
||||||
|
|
|
@ -378,7 +378,7 @@ void ChatForm::onAvStart(uint32_t friendId, bool video)
|
||||||
startCounter();
|
startCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onAvEnd(uint32_t friendId)
|
void ChatForm::onAvEnd(uint32_t friendId, bool error)
|
||||||
{
|
{
|
||||||
if (friendId != f->getFriendId()) {
|
if (friendId != f->getFriendId()) {
|
||||||
return;
|
return;
|
||||||
|
@ -392,7 +392,7 @@ void ChatForm::onAvEnd(uint32_t friendId)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCallButtons();
|
updateCallButtons();
|
||||||
stopCounter();
|
stopCounter(error);
|
||||||
hideNetcam();
|
hideNetcam();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,14 +891,17 @@ void ChatForm::startCounter()
|
||||||
callDuration->show();
|
callDuration->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::stopCounter()
|
void ChatForm::stopCounter(bool error)
|
||||||
{
|
{
|
||||||
if (!callDurationTimer) {
|
if (!callDurationTimer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString dhms = secondsToDHMS(timeElapsed.elapsed() / 1000);
|
QString dhms = secondsToDHMS(timeElapsed.elapsed() / 1000);
|
||||||
QString name = f->getDisplayedName();
|
QString name = f->getDisplayedName();
|
||||||
addSystemInfoMessage(tr("Call with %1 ended. %2").arg(name, dhms), ChatMessage::INFO,
|
QString mess = error ? "Call with %1 ended unexpectedly. %2" : "Call with %1 ended. %2";
|
||||||
|
// TODO: add notification once notifications are implemented
|
||||||
|
|
||||||
|
addSystemInfoMessage(tr(mess.toStdString().c_str()).arg(name, dhms), ChatMessage::INFO,
|
||||||
QDateTime::currentDateTime());
|
QDateTime::currentDateTime());
|
||||||
callDurationTimer->stop();
|
callDurationTimer->stop();
|
||||||
callDuration->setText("");
|
callDuration->setText("");
|
||||||
|
|
|
@ -68,7 +68,7 @@ public slots:
|
||||||
void onFileRecvRequest(ToxFile file);
|
void onFileRecvRequest(ToxFile file);
|
||||||
void onAvInvite(uint32_t friendId, bool video);
|
void onAvInvite(uint32_t friendId, bool video);
|
||||||
void onAvStart(uint32_t friendId, bool video);
|
void onAvStart(uint32_t friendId, bool video);
|
||||||
void onAvEnd(uint32_t friendId);
|
void onAvEnd(uint32_t friendId, bool error);
|
||||||
void onAvatarChange(uint32_t friendId, const QPixmap& pic);
|
void onAvatarChange(uint32_t friendId, const QPixmap& pic);
|
||||||
void onAvatarRemoved(uint32_t friendId);
|
void onAvatarRemoved(uint32_t friendId);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
void showOutgoingCall(bool video);
|
void showOutgoingCall(bool video);
|
||||||
void startCounter();
|
void startCounter();
|
||||||
void stopCounter();
|
void stopCounter(bool error = false);
|
||||||
void updateCallButtons();
|
void updateCallButtons();
|
||||||
void SendMessageStr(QString msg);
|
void SendMessageStr(QString msg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user