Commit efbfa72f authored by Ming Rui Zhang's avatar Ming Rui Zhang

callwidget: better handling for setCurrentCall

Change-Id: I4413cae64c98a2888d6c2f749690f030ebca6cd1
parent 2de13a70
......@@ -1227,12 +1227,15 @@ CallWidget::selectConversation(const lrc::api::conversation::Info& item)
accInfo.conversationModel->selectConversation(item.uid);
accInfo.conversationModel->clearUnreadInteractions(item.uid);
if (!item.callId.isEmpty()) {
QtConcurrent::run(
[convUid=item.uid, accId=item.accountId] {
auto item = LRCInstance::getConversationFromConvUid(convUid);
auto& accInfo = LRCInstance::getAccountInfo(item.accountId);
accInfo.callModel->setCurrentCall(item.callId);
});
// when changing conversation, current call should only be set when there is a call on pause
if (accInfo.callModel->getCall(item.callId).status == lrc::api::call::Status::PAUSED) {
QtConcurrent::run(
[convUid = item.uid, accId = item.accountId]{
auto item = LRCInstance::getConversationFromConvUid(convUid);
auto & accInfo = LRCInstance::getAccountInfo(item.accountId);
accInfo.callModel->setCurrentCall(item.callId);
});
}
}
ui->conversationsFilterWidget->update();
return true;
......@@ -1389,6 +1392,14 @@ CallWidget::connectAccount(const QString& accountId)
auto convInfo = LRCInstance::getConversationFromCallId(callId, accountId);
if (!convInfo.uid.isEmpty() && convInfo.uid == LRCInstance::getCurrentConvUid()) {
accInfo.conversationModel->selectConversation(convInfo.uid);
if (!convInfo.callId.isEmpty()) {
QtConcurrent::run(
[convUid = convInfo.uid, accId = convInfo.accountId]{
auto item = LRCInstance::getConversationFromConvUid(convUid);
auto & accInfo = LRCInstance::getAccountInfo(item.accountId);
accInfo.callModel->setCurrentCall(item.callId);
});
}
}
LRCInstance::renderer()->addDistantRenderer(callId);
ui->videoView->updateCall();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment