Commit 6762840c authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk

media messages: hide record buttons when in call

Change-Id: I113246c5536e8ec4926127c4448427c3c4086468
parent e16b69f0
...@@ -713,13 +713,6 @@ CallWidget::slotShowIncomingCallView(const std::string& accountId, ...@@ -713,13 +713,6 @@ CallWidget::slotShowIncomingCallView(const std::string& accountId,
auto isCallSelected = LRCInstance::getCurrentConvUid() == convInfo.uid; auto isCallSelected = LRCInstance::getCurrentConvUid() == convInfo.uid;
ui->callingStatusLabel->setText(QString::fromStdString(lrc::api::call::to_string(call.status))); ui->callingStatusLabel->setText(QString::fromStdString(lrc::api::call::to_string(call.status)));
connect(callModel, &lrc::api::NewCallModel::callStatusChanged, ui->incomingCallPage,
[this, accountId](const std::string& callId) {
auto callModel = LRCInstance::accountModel().getAccountInfo(accountId).callModel.get();
auto call = callModel->getCall(callId);
ui->callingStatusLabel->setText(QString::fromStdString(lrc::api::call::to_string(call.status)));
});
auto itemInCurrentFilter = false; auto itemInCurrentFilter = false;
if (call.isOutgoing) { if (call.isOutgoing) {
if (isCallSelected) { if (isCallSelected) {
...@@ -1327,6 +1320,10 @@ CallWidget::connectAccount(const std::string& accountId) ...@@ -1327,6 +1320,10 @@ CallWidget::connectAccount(const std::string& accountId)
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId); auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId);
auto& callModel = accInfo.callModel; auto& callModel = accInfo.callModel;
auto call = callModel->getCall(callId); auto call = callModel->getCall(callId);
// change status label text
ui->callingStatusLabel->setText(QString::fromStdString(lrc::api::call::to_string(call.status)));
switch (call.status) { switch (call.status) {
case lrc::api::call::Status::INVALID: case lrc::api::call::Status::INVALID:
case lrc::api::call::Status::INACTIVE: case lrc::api::call::Status::INACTIVE:
...@@ -1404,6 +1401,7 @@ CallWidget::setCallPanelVisibility(bool visible) ...@@ -1404,6 +1401,7 @@ CallWidget::setCallPanelVisibility(bool visible)
ui->btnAudioCall->setVisible(!visible); ui->btnAudioCall->setVisible(!visible);
ui->btnVideoCall->setVisible(!visible); ui->btnVideoCall->setVisible(!visible);
ui->callStackWidget->setVisible(visible); ui->callStackWidget->setVisible(visible);
ui->messageView->setRecordButtonsVisibility(!visible);
} }
void void
......
...@@ -20,7 +20,12 @@ ...@@ -20,7 +20,12 @@
**************************************************************************/ **************************************************************************/
#include "messagewebview.h" #include "messagewebview.h"
#include "recordwidget.h" #include "recordwidget.h"
#include "lrcinstance.h"
#include "messagewebpage.h"
#include "utils.h"
#include "webchathelpers.h"
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QDebug> #include <QDebug>
...@@ -43,11 +48,6 @@ ...@@ -43,11 +48,6 @@
#include <ciso646> #include <ciso646>
#include <fstream> #include <fstream>
#include "lrcinstance.h"
#include "messagewebpage.h"
#include "utils.h"
#include "webchathelpers.h"
MessageWebView::MessageWebView(QWidget *parent) MessageWebView::MessageWebView(QWidget *parent)
: QWebEngineView(parent) : QWebEngineView(parent)
{ {
...@@ -273,6 +273,14 @@ MessageWebView::openVideoRecorder(int spikePosX, int spikePosY) ...@@ -273,6 +273,14 @@ MessageWebView::openVideoRecorder(int spikePosX, int spikePosY)
recordWidget_->openRecorder(false); recordWidget_->openRecorder(false);
} }
void
MessageWebView::setRecordButtonsVisibility(bool visible)
{
QString s = QString::fromLatin1("displayRecordControls(%1);")
.arg(visible ? "true" : "false");
page()->runJavaScript(s, QWebEngineScript::MainWorld);
}
void MessageWebView::buildView() void MessageWebView::buildView()
{ {
auto html = Utils::QByteArrayFromFile(":/chatview.html"); auto html = Utils::QByteArrayFromFile(":/chatview.html");
......
...@@ -93,6 +93,7 @@ public: ...@@ -93,6 +93,7 @@ public:
void runJsText(); void runJsText();
void openAudioRecorder(int spikePosX,int spikePosY); void openAudioRecorder(int spikePosX,int spikePosY);
void openVideoRecorder(int spikePosX,int spikePosY); void openVideoRecorder(int spikePosX,int spikePosY);
void setRecordButtonsVisibility(bool visible);
protected: protected:
......
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