Commit 93bd2068 authored by Sébastien Blin's avatar Sébastien Blin Committed by Andreas Traczyk

callview: show call maximized by default

Change-Id: I94e5a4eb3ef7228395d4de7485560b7b6113c2e5
Gitlab: #418Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 26c86617
......@@ -109,6 +109,7 @@ CallWidget::CallWidget(QWidget* parent) :
}
ui->mainActivitySplitter->setCollapsible(0, false);
ui->mainActivitySplitter->setCollapsible(1, false);
ui->splitter->setCollapsible(0, false);
ui->splitter->setCollapsible(1, false);
......@@ -129,7 +130,11 @@ CallWidget::CallWidget(QWidget* parent) :
connect(ui->videoWidget, &VideoView::setChatVisibility,
[this](bool visible) {
ui->callStackWidget->hide();
if (visible) {
ui->messagesWidget->show();
} else {
ui->messagesWidget->hide();
}
});
connect(ui->mainActivitySplitter, &QSplitter::splitterMoved,
......@@ -419,7 +424,9 @@ CallWidget::showConversationView()
{
ui->stackedWidget->setCurrentWidget(ui->mainActivityWidget);
ui->messageView->setFocus();
if (ui->messagesWidget->isHidden()) {
ui->messagesWidget->show();
}
}
void
......@@ -591,6 +598,7 @@ void CallWidget::slotShowCallView(const std::string& accountId,
qDebug() << "slotShowCallView";
ui->callStackWidget->show();
ui->callStackWidget->setCurrentWidget(ui->videoPage);
ui->videoWidget->showChatviewIfToggled();
hideMiniSpinner();
}
......@@ -642,6 +650,10 @@ void CallWidget::slotShowIncomingCallView(const std::string& accountId,
}
}
if (ui->messagesWidget->isHidden()) {
ui->messagesWidget->show();
}
// flashing index widget during call
for (int row = 0; row < smartListModel_->rowCount(); row++) {
QModelIndex index = smartListModel_->index(row);
......@@ -697,6 +709,36 @@ void CallWidget::slotShowChatView(const std::string& accountId,
showConversationView();
}
void
CallWidget::slotToggleFullScreenClicked()
{
if (ui->mainActivityWidget->isFullScreen()) {
ui->stackedWidget->addWidget(ui->mainActivityWidget);
ui->stackedWidget->setCurrentWidget(ui->mainActivityWidget);
ui->mainActivityWidget->showNormal();
} else {
ui->stackedWidget->removeWidget(ui->mainActivityWidget);
ui->mainActivityWidget->setParent(0);
ui->mainActivityWidget->showFullScreen();
}
}
void
CallWidget::slotVideoViewDestroyed(const std::string& callid)
{
auto convUid = LRCInstance::getSelectedConvUid();
auto currentConversationModel = LRCInstance::getCurrentConversationModel();
auto callModel = LRCInstance::getCurrentCallModel();
auto conversation = Utils::getConversationFromUid(convUid, *currentConversationModel);
if (callid != conversation->callId) return;
if (ui->mainActivityWidget->isFullScreen()) {
ui->stackedWidget->addWidget(ui->mainActivityWidget);
ui->stackedWidget->setCurrentWidget(ui->mainActivityWidget);
ui->mainActivityWidget->showNormal();
}
showConversationView();
}
void
CallWidget::setSelectedAccount(const std::string& accountId)
{
......@@ -787,8 +829,6 @@ CallWidget::showIMOutOfCall(const QModelIndex& nodeIdx)
ui->messageView->clear();
ui->messageView->printHistory(*convModel, currentConversation->interactions);
showConversationView();
// Contact Avatars
auto accInfo = &LRCInstance::getCurrentAccountInfo();
auto contactUri = currentConversation->participants.front();
......@@ -993,9 +1033,6 @@ CallWidget::updateConversationView(const std::string& convUid)
if (convUid != selectedConvUid()) {
return;
}
}
void
......
......@@ -83,6 +83,8 @@ public slots:
void slotShowCallView(const std::string & accountId, const lrc::api::conversation::Info & convInfo);
void slotShowIncomingCallView(const std::string & accountId, const lrc::api::conversation::Info & convInfo);
void slotShowChatView(const std::string & accountId, const lrc::api::conversation::Info & convInfo);
void slotToggleFullScreenClicked();
void slotVideoViewDestroyed(const std::string& callid);
void update();
private slots:
......
......@@ -84,6 +84,18 @@ VideoOverlay::shouldShowOverlay()
return ui->bottomButtons->underMouse() || ui->topInfoBar->underMouse();
}
void
VideoOverlay::simulateShowChatview(bool checked)
{
ui->chatButton->setChecked(checked);
}
bool
VideoOverlay::getShowChatView()
{
return ui->chatButton->isChecked();
}
void
VideoOverlay::on_hangupButton_clicked()
{
......
......@@ -40,6 +40,8 @@ public:
void toggleContextButtons(bool visible);
void setVideoMuteVisibility(bool visible);
bool shouldShowOverlay();
void simulateShowChatview(bool checked);
bool getShowChatView();
//UI SLOTS
private slots:
......
......@@ -70,6 +70,20 @@ VideoView::VideoView(QWidget* parent) :
emit this->setChatVisibility(visible);
});
connect(overlay_, &VideoOverlay::videoCfgBtnClicked, [=](){emit videoSettingsClicked();});
auto convModel = LRCInstance::getCurrentConversationModel();
connect(convModel, &lrc::api::ConversationModel::newInteraction,
[this](const std::string& uid, uint64_t, lrc::api::interaction::Info info) {
if (info.type == lrc::api::interaction::Type::CALL) {
return;
}
auto selectedConvUid = LRCInstance::getSelectedConvUid();
if (uid == selectedConvUid) {
overlay_->simulateShowChatview(true);
}
});
}
VideoView::~VideoView()
......@@ -156,15 +170,25 @@ VideoView::callStateChanged(Call* call, Call::State previousState)
if (call->state() == Call::State::CURRENT) {
ui->videoWidget->show();
timerConnection_ = connect(call, SIGNAL(changed()), this, SLOT(updateCall()));
}
else {
} else {
QObject::disconnect(timerConnection_);
emit setChatVisibility(false);
if (isFullScreen())
toggleFullScreen();
try {
if (call) {
emit closing(call->historyId().toStdString());
}
} catch (...) {
qWarning() << "VideoView::callStateChanged except";
}
}
}
void
VideoView::showChatviewIfToggled()
{
emit setChatVisibility(overlay_->getShowChatView());
}
void
VideoView::updateCall()
{
......@@ -212,19 +236,7 @@ VideoView::dropEvent(QDropEvent* event)
void
VideoView::toggleFullScreen()
{
qDebug() << "toggle FS";
/*overlay_->toggleContextButtons(isFullScreen());
if(isFullScreen()) {
dynamic_cast<QSplitter*>(oldParent_)->insertWidget(0,this);
this->resize(oldSize_.width(), oldSize_.height());
this->showNormal();
} else {
oldSize_ = this->size();
oldParent_ = static_cast<QWidget*>(this->parent());
this->setParent(0);
this->showFullScreen();
}
ui->videoWidget->setResetPreview(true);*/
emit toggleFullScreenClicked();
}
void
......
......@@ -42,6 +42,7 @@ public:
explicit VideoView(QWidget* parent = 0);
~VideoView();
void pushRenderer(const std::string& callUid);
void showChatviewIfToggled();
protected:
void resizeEvent(QResizeEvent* event);
......@@ -97,5 +98,7 @@ private:
signals:
void setChatVisibility(bool visible);
void videoSettingsClicked();
void toggleFullScreenClicked();
void closing(const std::string& callid);
};
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