mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
feat(video): Error message on call fail
notifies user if call ended unexpectedly
This commit is contained in:
parent
90910cbfe1
commit
ac75f7b594
|
@ -728,7 +728,7 @@ void CoreAV::stateCallback(ToxAV* toxav, uint32_t friendNum, uint32_t state, voi
|
|||
if (state & TOXAV_FRIEND_CALL_STATE_ERROR) {
|
||||
qWarning() << "Call with friend" << friendNum << "died of unnatural causes!";
|
||||
calls.remove(friendNum);
|
||||
emit self->avEnd(friendNum);
|
||||
emit self->avEnd(friendNum, true);
|
||||
} else if (state & TOXAV_FRIEND_CALL_STATE_FINISHED) {
|
||||
qDebug() << "Call with friend" << friendNum << "finished quietly";
|
||||
calls.remove(friendNum);
|
||||
|
|
|
@ -92,7 +92,7 @@ public slots:
|
|||
signals:
|
||||
void avInvite(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:
|
||||
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();
|
||||
}
|
||||
|
||||
void ChatForm::onAvEnd(uint32_t friendId)
|
||||
void ChatForm::onAvEnd(uint32_t friendId, bool error)
|
||||
{
|
||||
if (friendId != f->getFriendId()) {
|
||||
return;
|
||||
|
@ -392,7 +392,7 @@ void ChatForm::onAvEnd(uint32_t friendId)
|
|||
}
|
||||
|
||||
updateCallButtons();
|
||||
stopCounter();
|
||||
stopCounter(error);
|
||||
hideNetcam();
|
||||
}
|
||||
|
||||
|
@ -891,14 +891,17 @@ void ChatForm::startCounter()
|
|||
callDuration->show();
|
||||
}
|
||||
|
||||
void ChatForm::stopCounter()
|
||||
void ChatForm::stopCounter(bool error)
|
||||
{
|
||||
if (!callDurationTimer) {
|
||||
return;
|
||||
}
|
||||
QString dhms = secondsToDHMS(timeElapsed.elapsed() / 1000);
|
||||
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());
|
||||
callDurationTimer->stop();
|
||||
callDuration->setText("");
|
||||
|
|
|
@ -68,7 +68,7 @@ public slots:
|
|||
void onFileRecvRequest(ToxFile file);
|
||||
void onAvInvite(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 onAvatarRemoved(uint32_t friendId);
|
||||
|
||||
|
@ -108,7 +108,7 @@ private:
|
|||
void retranslateUi();
|
||||
void showOutgoingCall(bool video);
|
||||
void startCounter();
|
||||
void stopCounter();
|
||||
void stopCounter(bool error = false);
|
||||
void updateCallButtons();
|
||||
void SendMessageStr(QString msg);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user