Commit 3bfd7fd9 authored by Yang Wang's avatar Yang Wang Committed by Andreas Traczyk

recorddialog: implementaion of record dialog

Change-Id: Ifd925804f7ffc95bc02788bea664b74af818b84b
parent 1f3eca55
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" fill="white"/><path d="M0 0h24v24H0z" fill="none"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="none" d="M24 24H0V0h24v24z"/><circle fill="#ff0000" cx="12" cy="12" r="8"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z" fill="white"/><path d="M0 0h24v24H0z" fill="none"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M10 16.5l6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" fill="white"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z" fill="white"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" fill="white"/><path d="M0 0h24v24H0z" fill="none"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 6h12v12H6z" fill="#ff0000"/></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path d="M6 6h12v12H6z" fill="#ffffff"/></svg>
\ No newline at end of file
TEMPLATE = app
TARGET = jami-qt

CONFIG += c++17
QT += widgets xml multimedia multimediawidgets network webenginewidgets svg
......@@ -82,8 +82,10 @@ HEADERS += ./aboutdialog.h \
./section.h \
./collapsiblepasswordwidget.h \
./notifypushbutton.h \
./popupdialog.h \
./recordoverlay.h \
./widgethelpers.h \
./popupdialog.h
./recordwidget.h
SOURCES += ./aboutdialog.cpp \
./banneditemwidget.cpp \
./conversationsfilterwidget.cpp \
......@@ -148,8 +150,10 @@ SOURCES += ./aboutdialog.cpp \
./section.cpp \
./collapsiblepasswordwidget.cpp \
./notifypushbutton.cpp \
./popupdialog.cpp \
./recordoverlay.cpp \
./widgethelpers.cpp \
./popupdialog.cpp
./recordwidget.cpp
FORMS += ./aboutdialog.ui \
./advancedsipsettingwidget.ui \
./callwidget.ui \
......@@ -177,5 +181,7 @@ FORMS += ./aboutdialog.ui \
./accountmigration.ui \
./section.ui \
./collapsiblepasswordwidget.ui \
./popupdialog.ui
RESOURCES += ressources.qrc
./popupdialog.ui \
./recordoverlay.ui \
./recordwidget.ui
RESOURCES += ressources.qrc
\ No newline at end of file
......@@ -20,6 +20,7 @@
**************************************************************************/
#include "messagewebview.h"
#include "recordwidget.h"
#include <QCryptographicHash>
#include <QDebug>
......@@ -113,6 +114,8 @@ MessageWebView::MessageWebView(QWidget *parent)
break;
}
});
recordWidget_ = new RecordWidget(this);
recordWidget_->getContainer()->hide();
}
MessageWebView::~MessageWebView()
......@@ -238,6 +241,38 @@ void MessageWebView::runJsText()
});
}
void
MessageWebView::openAudioRecorder(int spikePosX, int spikePosY)
{
if (LRCInstance::hasVideoCall() || LRCInstance::avModel().getDevices().size() == 0) {
return;
}
// spikePosX, spikePosY are positions relative to Document
auto pointOfVideoButton = mapToGlobal(QPoint(spikePosX, spikePosY));
auto recorderWidth = recordWidget_->size().width();
auto recorderHeight = recordWidget_->size().height();
recordWidget_->getContainer()->setGeometry(pointOfVideoButton.x() - recorderWidth / 2,
pointOfVideoButton.y() - recorderHeight - recordWidgetMargin_,
recorderWidth, recorderHeight);
recordWidget_->openRecorder(true);
}
void
MessageWebView::openVideoRecorder(int spikePosX, int spikePosY)
{
if (LRCInstance::hasVideoCall() || LRCInstance::avModel().getDevices().size() == 0) {
return;
}
// spikePosX, spikePosY are positions relative to Document
auto pointOfVideoButton = mapToGlobal(QPoint(spikePosX, spikePosY));
auto recorderWidth = recordWidget_->size().width();
auto recorderHeight = recordWidget_->size().height();
recordWidget_->getContainer()->setGeometry(pointOfVideoButton.x() - recorderWidth / 2,
pointOfVideoButton.y() - recorderHeight - recordWidgetMargin_,
recorderWidth, recorderHeight);
recordWidget_->openRecorder(false);
}
void MessageWebView::buildView()
{
auto html = Utils::QByteArrayFromFile(":/chatview.html");
......@@ -642,3 +677,31 @@ PrivateBridging::emitPasteKeyDetected()
}
return 0;
}
int
PrivateBridging::openAudioRecorder(int spikePosX, int spikePosY)
{
//call the open audio recorder function in messageweview
try {
if (auto messageView = qobject_cast<MessageWebView*>(this->parent())) {
messageView->openAudioRecorder(spikePosX, spikePosY);
}
} catch (...) {
qDebug() << "JS bridging - exception during openAudioRecorder!";
}
return 0;
}
int
PrivateBridging::openVideoRecorder(int spikePosX, int spikePosY)
{
//call the open video recorder function in messageweview
try {
if (auto messageView = qobject_cast<MessageWebView*>(this->parent())) {
messageView->openVideoRecorder(spikePosX, spikePosY);
}
} catch (...) {
qDebug() << "JS bridging - exception during openVideoRecorder!";
}
return 0;
}
......@@ -25,6 +25,8 @@
#include "api/conversationmodel.h"
class RecordWidget;
class PrivateBridging : public QObject
{
Q_OBJECT
......@@ -49,6 +51,8 @@ public:
Q_INVOKABLE int emitMessagesCleared();
Q_INVOKABLE int emitMessagesLoaded();
Q_INVOKABLE int emitPasteKeyDetected();
Q_INVOKABLE int openAudioRecorder(int spikePosX,int spikePosY);
Q_INVOKABLE int openVideoRecorder(int spikePosX,int spikePosY);
};
class MessageWebView : public QWebEngineView
......@@ -87,6 +91,8 @@ public:
void setMessagesFileContent(const QString& path);
bool textSelected();
void runJsText();
void openAudioRecorder(int spikePosX,int spikePosY);
void openVideoRecorder(int spikePosX,int spikePosY);
protected:
......@@ -113,5 +119,9 @@ private:
PrivateBridging* jsBridge_;
QLabel* dragDroplabel_;
bool textSelected_;
RecordWidget* recordWidget_;
/*TODO: Generatic Popup Dialog setGeometry function corrsponding to spike alignment*/
const quint16 recordWidgetMargin_{ 15 };
};
......@@ -21,6 +21,8 @@
#include "lrcinstance.h"
#include "utils.h"
#include <QPixmap>
PreviewWidget::PreviewWidget(QWidget * parent)
: VideoWidgetBase(Qt::transparent, parent)
{
......@@ -235,3 +237,79 @@ VideoCallPreviewWidget::getTopLeft()
containerSize_.height() - margin_ - this->height());
}
}
VideoRecordPreviewWidget::VideoRecordPreviewWidget(QWidget* parent)
: PreviewWidget(parent)
{}
VideoRecordPreviewWidget::~VideoRecordPreviewWidget()
{}
void
VideoRecordPreviewWidget::paintEvent(QPaintEvent* e)
{
Q_UNUSED(e);
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
auto parentRect = qobject_cast<QWidget*>(this->parent());
if (!parentRect) {
return;
}
auto previewImage = LRCInstance::renderer()->getPreviewFrame();
if (previewImage) {
QImage scaledPreview;
auto parentAspectRatio =
static_cast<qreal>(parentRect->width()) /
static_cast<qreal>(parentRect->height());
auto aspectRatio =
static_cast<qreal>(previewImage->width()) /
static_cast<qreal>(previewImage->height());
int previewHeight;
int previewWidth;
int xOffset = 0;
int yOffset = 0;
if (parentAspectRatio < aspectRatio) {
previewHeight = parentRect->height();
previewWidth = previewHeight * aspectRatio;
xOffset = (parentRect->width() - previewWidth) / 2;
} else {
previewWidth = parentRect->width();
previewHeight = previewWidth / aspectRatio;
yOffset = (parentRect->height() - previewHeight) / 2;
}
scaledPreview = previewImage->scaled(previewWidth, previewHeight, Qt::KeepAspectRatio);
scaledPreviewImage_ = scaledPreview;
// draw rounded corner image
QBrush brush(scaledPreview);
brush.setTransform(QTransform::fromTranslate(
this->rect().x() + xOffset,
this->rect().y() + yOffset));
QPainterPath previewPath;
previewPath.addRoundRect(this->rect(), cornerRadius_);
painter.fillPath(previewPath, brush);
} else {
if (paintBackground_) {
paintBackground(&painter);
scaledPreviewImage_ = QImage();
} else if (drawLastFrame_) {
QBrush brush(scaledPreviewImage_);
brush.setTransform(QTransform::fromTranslate(this->rect().x(), this->rect().y()));
QPainterPath previewPath;
previewPath.addRoundRect(this->rect(), cornerRadius_);
painter.fillPath(previewPath, brush);
}
}
}
void
VideoRecordPreviewWidget::paintBackground(QPainter * painter)
{
QBrush brush(Qt::black);
QPainterPath path;
path.addRoundRect(this->rect(), cornerRadius_);
painter->fillPath(path, brush);
}
......@@ -88,4 +88,29 @@ private:
constexpr static QMargins padding_ = QMargins(2, 2, 2, 2);
PreviewSnap location_{ PreviewSnap::SE };
QSize containerSize_{0, 0};
};
\ No newline at end of file
};
// rounded corners for video record view
class VideoRecordPreviewWidget final : public PreviewWidget {
Q_OBJECT;
public:
explicit VideoRecordPreviewWidget(QWidget* parent = 0);
~VideoRecordPreviewWidget();
void toPaintingBackground(bool state) { paintBackground_ = state; }
void toDrawLastFrame(bool state) { drawLastFrame_ = state; }
QImage getScaledPreviewImage() { return scaledPreviewImage_; }
protected:
void paintEvent(QPaintEvent* e) override;
void paintBackground(QPainter* painter) override;
private:
constexpr static qreal cornerRadius_ = 10.0f;
QImage scaledPreviewImage_;
bool paintBackground_{ true };
bool drawLastFrame_{ false };
};
/**************************************************************************
* Copyright (C) 2015-2019 by Savoir-faire Linux *
* Author: Yang Wang <yang.wang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#include "recordwidget.h"
#include "recordoverlay.h"
#include "ui_recordoverlay.h"
#include "utils.h"
RecordOverlay::RecordOverlay(RecordWidget* recordWidget) :
VignetteWidget(qobject_cast<QWidget*>(recordWidget)),
ui(new Ui::RecordOverlay)
{
ui->setupUi(this);
recordWidget_ = recordWidget;
QFont font = ui->timerLabel->font();
font.setPointSize(10);
font.setBold(true);
ui->timerLabel->setFont(font);
connect(&recordTimer_, SIGNAL(timeout()),SLOT(whenAudioRecordProgressUpdate()));
ui->redDotBlinkable->setPixmap(&redDotPix_);
ui->recordOverlayPlayBtn->setVisible(false);
ui->recordOverlayStopPlayingBtn->setVisible(false);
setUpRecorderStatus(RecorderStatus::aboutToRecord);
}
RecordOverlay::~RecordOverlay()
{
delete ui;
}
void
RecordOverlay::setUpRecorderStatus(RecorderStatus status, bool isTimerToBeInvolved, bool isAimationToBeInvolved)
{
status_ = status;
switch(status) {
case RecorderStatus::aboutToRecord:
switchToAboutToRecordPage();
if(isTimerToBeInvolved) {reinitializeTimer();}
if(isAimationToBeInvolved) {stopRedDotBlink();}
break;
case RecorderStatus::recording:
switchToRecordingPage();
if(isTimerToBeInvolved) {
reinitializeTimer();
recordTimer_.start(1000);
}
if(isAimationToBeInvolved) {
stopRedDotBlink();
startRedDotBlink();
}
break;
case RecorderStatus::recorded:
switchToRecordedPage();
if(isTimerToBeInvolved) {reinitializeTimer();}
if(isAimationToBeInvolved) {stopRedDotBlink();}
break;
}
}
void
RecordOverlay::switchToAboutToRecordPage()
{
ui->timerLabel->setVisible(true);
ui->timerLabel->setText("00:00");
ui->redDotBlinkable->setVisible(false);
ui->recordOverlayStartOrFinishRecordingBtn->setVisible(true);
if(ui->recordOverlayStartOrFinishRecordingBtn->isChecked()) ui->recordOverlayStartOrFinishRecordingBtn->setOverlayButtonChecked(false);
ui->recordOverlayRerecordBtn->setVisible(false);
ui->recordOverlaySendBtn->setVisible(false);
ui->recordOverlayDeleteBtn->setVisible(false);
ui->recordOverlayStartOrFinishRecordingBtn->setToolTip("press to start the audio record");
}
void
RecordOverlay::switchToRecordingPage()
{
ui->timerLabel->setVisible(true);
ui->timerLabel->setText("00:00");
ui->redDotBlinkable->setVisible(true);
ui->recordOverlayStartOrFinishRecordingBtn->setVisible(true);
ui->recordOverlayDeleteBtn->setVisible(false);
ui->recordOverlayRerecordBtn->setVisible(true);
ui->recordOverlaySendBtn->setVisible(false);
if(!ui->recordOverlayStartOrFinishRecordingBtn->isChecked()) ui->recordOverlayStartOrFinishRecordingBtn->setOverlayButtonChecked(true);
// set the tool tip
ui->recordOverlayStartOrFinishRecordingBtn->setToolTip("press to finish the audio record");
ui->recordOverlayDeleteBtn->setToolTip("press to stop the record");
ui->recordOverlayRerecordBtn->setToolTip("press to restart the audio record");
}
void
RecordOverlay::switchToRecordedPage()
{
ui->redDotBlinkable->setVisible(false);
ui->recordOverlayStartOrFinishRecordingBtn->setVisible(false);
ui->recordOverlayRerecordBtn->setVisible(false);
ui->recordOverlaySendBtn->setVisible(true);
ui->recordOverlayDeleteBtn->setVisible(true);
// set the tool tip
ui->recordOverlayRerecordBtn->setToolTip("press to restart the record");
ui->recordOverlaySendBtn->setToolTip("press to send");
ui->recordOverlayDeleteBtn->setToolTip("press to delete the recorded clip");
}
void
RecordOverlay::reinitializeTimer()
{
recordTimer_.stop();
currentTime_ = 0;
}
void
RecordOverlay::startRedDotBlink()
{
ui->redDotBlinkable->start();
}
void
RecordOverlay::stopRedDotBlink()
{
ui->redDotBlinkable->stop();
}
void
RecordOverlay::showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
setUpRecorderStatus(RecorderStatus::aboutToRecord);
}
void
RecordOverlay::hideEvent(QHideEvent* event)
{
QWidget::hideEvent(event);
// set the page to about record page
setUpRecorderStatus(RecorderStatus::aboutToRecord);
}
void
RecordOverlay::on_recordOverlayStartOrFinishRecordingBtn_toggled(bool checked)
{
if(status_ == RecorderStatus::aboutToRecord) {
// start record function call, if call succeed, switch the page to recording page and start the timer
if(recordWidget_->actionToStartRecord()) {
setUpRecorderStatus(RecorderStatus::recording);
} else {
ui->recordOverlayStartOrFinishRecordingBtn->setOverlayButtonChecked(!checked);
qDebug() << "The recording does not start properly";
}
} else if(status_ == RecorderStatus::recording) {
// finish the record, if it succeed, switch the page and re-initialize the timer
if(recordWidget_->actionToFinishRecord()) {
setUpRecorderStatus(RecorderStatus::recorded);
} else {
ui->recordOverlayStartOrFinishRecordingBtn->setOverlayButtonChecked(!checked);
qDebug() << "The recording does not finish properly";
}
} else {
}
}
void
RecordOverlay::on_recordOverlaySendBtn_pressed()
{
if(status_ != RecorderStatus::recorded) {
qDebug() << "The contented is not recorded and cannot be sent out";
return;
}
if(recordWidget_->actionToSend()) {
setUpRecorderStatus(RecorderStatus::aboutToRecord);
// define what to do when the record is sent out
recordWidget_->getContainer()->accept();
}
}
void
RecordOverlay::on_recordOverlayDeleteBtn_pressed()
{
if(status_ != RecorderStatus::recorded) {
qDebug() << "The contente is not recorded and cannot be deleted";
return;
}
if(recordWidget_->actionToDeleteRecord()) {
setUpRecorderStatus(RecorderStatus::aboutToRecord);
}
}
void
RecordOverlay::on_recordOverlayRerecordBtn_pressed()
{
if(status_ != RecorderStatus::recording) {
qDebug() << "it's not on the recording page and thus there's cannot re-record";
return;
}
if(recordWidget_->actionToReRecord()) {
// re-initialize the timer at the same time
setUpRecorderStatus(RecorderStatus::recording);
}
}
void
RecordOverlay::whenAudioRecordProgressUpdate()
{
currentTime_ ++;
ui->timerLabel->setText(Utils::convertTimeDisplayFromMilisecond(currentTime_));
}
QPixmap
RecordOverlay::getOriginPix()
{
return redDotPix_;
}
void
RecordOverlay::setOriginPix(QPixmap pix)
{
redDotPix_ = pix;
}
/**************************************************************************
* Copyright (C) 2015-2019 by Savoir-faire Linux *
* Author: Yang Wang <yang.wang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#pragma once
#include <QWidget>
#include <QTimer>
#include "widgethelpers.h"
namespace Ui {
class RecordOverlay;
}
class RecordWidget;
class RecordOverlay : public VignetteWidget
{
Q_OBJECT
Q_PROPERTY(QPixmap pixRedDot READ getOriginPix WRITE setOriginPix DESIGNABLE true NOTIFY originPixChanged);
public:
enum class RecorderStatus
{
aboutToRecord,
recording,
recorded
};
QPixmap getOriginPix();
void setOriginPix(QPixmap);
signals:
void originPixChanged(QPixmap);
public:
explicit RecordOverlay(RecordWidget *recordWidget);
~RecordOverlay();
void setUpRecorderStatus(RecorderStatus status, bool isTimerToBeInvolved = true, bool isAimationToBeInvolved = true);
void startRedDotBlink();
void stopRedDotBlink();
private:
void switchToAboutToRecordPage();
void switchToRecordingPage();
void switchToRecordedPage();
void reinitializeTimer();
protected:
void showEvent(QShowEvent* event) override;
void hideEvent(QHideEvent* event) override;
private slots:
void on_recordOverlayStartOrFinishRecordingBtn_toggled(bool checked);
void on_recordOverlaySendBtn_pressed();
void on_recordOverlayDeleteBtn_pressed();
void on_recordOverlayRerecordBtn_pressed();
void whenAudioRecordProgressUpdate();
private:
Ui::RecordOverlay* ui;
RecordWidget* recordWidget_;
RecorderStatus status_;
int currentTime_ = 0;
QTimer recordTimer_;
QPixmap redDotPix_;
};
\ No newline at end of file
This diff is collapsed.
/**************************************************************************
* Copyright (C) 2015-2019 by Savoir-faire Linux *
* Author: Yang Wang <yang.wang@savoirfairelinux.com> *
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#include "recordwidget.h"
#include "ui_recordwidget.h"
#include "lrcinstance.h"
#include <QtConcurrent/QtConcurrent>
RecordWidget::RecordWidget(QWidget *parent) :
PopupWidget(parent, Qt::black, PopupDialog::SpikeLabelAlignment::AlignHCenter),
ui(new Ui::RecordWidget)
{
ui->setupUi(this);
recordOverlay_ = new RecordOverlay(this);
previewWidget_ = new VideoRecordPreviewWidget(this);
recordOverlay_->setDrawRoundedCorner(true);
}
RecordWidget::~RecordWidget()
{
}
bool
RecordWidget::actionToStartRecord()
{
bool isSuccessful = false;
if(!isAudio_ && !LRCInstance::renderer()->isPreviewing()){return isSuccessful;}
try {
recordedFilePath_ = QString::fromStdString(LRCInstance::avModel().startLocalRecorder(isAudio_));
isSuccessful = true;
}
catch (...) {
qDebug() << "The start of record fails";
}
return isSuccessful;
}
bool
RecordWidget::actionToFinishRecord()
{
bool isSuccessful = false;
try {
LRCInstance::avModel().stopLocalRecorder(recordedFilePath_.toStdString());
isSuccessful = true;
}
catch (...) {
qDebug() << "The finish of record fails";
}
return isSuccessful;
}
bool
RecordWidget::actionToReRecord()
{
QtConcurrent::run(
[this] {
Utils::oneShotConnect(&LRCInstance::avModel(), &lrc::api::AVModel::recordPlaybackStopped,
[this] {
deleteRecordedFileDetached(recordedFilePath_);
recordedFilePath_ = QString::fromStdString(LRCInstance::avModel().startLocalRecorder(isAudio_));
});
LRCInstance::avModel().stopLocalRecorder(recordedFilePath_.toStdString());
});
return true;
}
bool
RecordWidget::actionToDeleteRecord()
{
deleteRecordedFileDetached(recordedFilePath_);
return true;
}
bool
RecordWidget::actionToSend()
{
bool isSuccessful = false;
// send out the stored video file
QFileInfo fi(recordedFilePath_);
QString fileName = fi.fileName();
try {
auto convUid = LRCInstance::getCurrentConvUid();
LRCInstance::getCurrentConversationModel()->sendFile(convUid, recordedFilePath_.toStdString(), fileName.toStdString());