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