Commit 0e1074d5 authored by Edric Milaret's avatar Edric Milaret

video: adjust to source model modification

Related to change #3155

Change-Id: Iae4e998c7503cd81b6a844bd034edf7fc8f03b29
Tuleap: #180
parent bf67431e
......@@ -23,6 +23,8 @@
#include <QPainter>
#include "video/sourcemodel.h"
#include "media/video.h"
#include "callmodel.h"
SelectAreaDialog::SelectAreaDialog() :
rubberBand_(nullptr)
......@@ -67,7 +69,11 @@ SelectAreaDialog::mouseReleaseEvent(QMouseEvent* event)
if(rubberBand_) {
QApplication::restoreOverrideCursor();
releaseMouse();
Video::SourceModel::instance().setDisplay(0, rubberBand_->rect());
if (auto call = CallModel::instance().selectedCall()) {
if (auto outVideo = call->firstMedia<Media::Video>(Media::Media::Direction::OUT)) {
outVideo->sourceModel()->setDisplay(0, rubberBand_->rect());
}
}
delete rubberBand_;
rubberBand_ = nullptr;
reject();
......
......@@ -22,6 +22,7 @@
#include "video/devicemodel.h"
#include "video/sourcemodel.h"
#include "recentmodel.h"
#include "media/video.h"
#include <QGraphicsOpacityEffect>
#include <QPropertyAnimation>
......@@ -138,7 +139,11 @@ void
VideoView::dropEvent(QDropEvent* event)
{
auto urls = event->mimeData()->urls();
Video::SourceModel::instance().setFile(urls.at(0));
if (auto call = CallModel::instance().selectedCall()) {
if (auto outVideo = call->firstMedia<Media::Video>(Media::Media::Direction::OUT)) {
outVideo->sourceModel()->setFile(urls.at(0));
}
}
}
void
......@@ -173,7 +178,11 @@ VideoView::showContextMenu(const QPoint& pos)
menu.addAction(ptr);
connect(ptr, &QAction::toggled, [=](bool checked) {
if (checked == true) {
Video::SourceModel::instance().switchTo(device);
if (auto call = CallModel::instance().selectedCall()) {
if (auto outVideo = call->firstMedia<Media::Video>(Media::Media::Direction::OUT)) {
outVideo->sourceModel()->switchTo(device);
}
}
Video::DeviceModel::instance().setActive(device);
}
});
......@@ -184,7 +193,11 @@ VideoView::showContextMenu(const QPoint& pos)
auto shareAction = new QAction(tr("Share entire screen"), this);
menu.addAction(shareAction);
connect(shareAction, &QAction::triggered, [=]() {
Video::SourceModel::instance().setDisplay(0, QApplication::desktop()->rect());
if (auto call = CallModel::instance().selectedCall()) {
if (auto outVideo = call->firstMedia<Media::Video>(Media::Media::Direction::OUT)) {
outVideo->sourceModel()->setDisplay(0, QApplication::desktop()->rect());
}
}
});
auto shareAreaAction = new QAction(tr("Share screen area"), this);
menu.addAction(shareAreaAction);
......@@ -201,7 +214,11 @@ VideoView::showContextMenu(const QPoint& pos)
if (!dialog.exec())
return;
fileNames = dialog.selectedFiles();
Video::SourceModel::instance().setFile(QUrl::fromLocalFile(fileNames.at(0)));
if (auto call = CallModel::instance().selectedCall()) {
if (auto outVideo = call->firstMedia<Media::Video>(Media::Media::Direction::OUT)) {
outVideo->sourceModel()->setFile(QUrl::fromLocalFile(fileNames.at(0)));
}
}
});
menu.exec(globalPos);
......
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