Commit 69ed9278 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Ming Rui Zhang

calls: use setCurrentCall when selecting a conversation

Change-Id: If16311cf45ed19e439c9a68fca1568b98864afb5
parent 6fd80512
......@@ -366,7 +366,7 @@ CallWidget::setupSmartListContextMenu(const QPoint& pos)
convModel->placeCall(convUid);
ui->callingPhoto->setPixmap(QPixmap::fromImage(imageForConv(convUid)));
if (convUid != LRCInstance::getCurrentConvUid()) {
selectConversation(conversation, *convModel);
selectConversation(conversation);
}
});
// audio call
......@@ -377,7 +377,7 @@ CallWidget::setupSmartListContextMenu(const QPoint& pos)
convModel->placeAudioOnlyCall(convUid);
ui->callingPhoto->setPixmap(QPixmap::fromImage(imageForConv(convUid)));
if (convUid != LRCInstance::getCurrentConvUid()) {
selectConversation(conversation, *convModel);
selectConversation(conversation);
}
});
// clear conversation
......@@ -1200,7 +1200,7 @@ CallWidget::selectConversation(const QModelIndex& index)
const auto item = convModel->filteredConversation(index.row());
if (selectConversation(item, *convModel)) {
if (selectConversation(item)) {
showChatView(index);
auto convUid = LRCInstance::getCurrentConvUid();
if (!lastConvUid_.compare(convUid)) {
......@@ -1221,15 +1221,18 @@ CallWidget::selectConversation(const QModelIndex& index)
}
bool
CallWidget::selectConversation( const lrc::api::conversation::Info& item,
lrc::api::ConversationModel& convModel)
CallWidget::selectConversation(const lrc::api::conversation::Info& item)
{
if (LRCInstance::getCurrentConvUid() == item.uid) {
return false;
} else if (item.participants.size() > 0) {
auto& accInfo = LRCInstance::getAccountInfo(item.accountId);
LRCInstance::setSelectedConvId(item.uid);
convModel.selectConversation(item.uid);
convModel.clearUnreadInteractions(item.uid);
accInfo.conversationModel->selectConversation(item.uid);
accInfo.conversationModel->clearUnreadInteractions(item.uid);
if (!item.callId.empty()) {
accInfo.callModel->setCurrentCall(item.callId);
}
ui->conversationsFilterWidget->update();
return true;
}
......@@ -1385,12 +1388,11 @@ CallWidget::connectAccount(const std::string& accountId)
auto convInfo = LRCInstance::getConversationFromCallId(callId, accountId);
if (!convInfo.uid.empty() && convInfo.uid == LRCInstance::getCurrentConvUid()) {
accInfo.conversationModel->selectConversation(convInfo.uid);
}
LRCInstance::renderer()->addDistantRenderer(callId);
ui->videoView->updateCall();
break;
}
}
case lrc::api::call::Status::PAUSED:
ui->videoView->resetPreview();
ui->videoView->updateCall();
......
......@@ -114,8 +114,7 @@ private:
void backToWelcomePage();
void selectConversation(const QModelIndex& index);
bool selectConversation(const lrc::api::conversation::Info& item,
lrc::api::ConversationModel& convModel);
bool selectConversation(const lrc::api::conversation::Info& item);
void deselectConversation();
bool connectConversationModel();
void updateConversationView(const std::string& convUid);
......
......@@ -220,6 +220,7 @@ main(int argc, char* argv[])
});
splash->hide();
LRCInstance::subscribeToDebugReceived();
LRCInstance::getAPI().holdConferences = false;
QDir logPath(QStandardPaths::writableLocation(
QStandardPaths::AppLocalDataLocation));
......
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