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 @@ ...@@ -23,6 +23,8 @@
#include <QPainter> #include <QPainter>
#include "video/sourcemodel.h" #include "video/sourcemodel.h"
#include "media/video.h"
#include "callmodel.h"
SelectAreaDialog::SelectAreaDialog() : SelectAreaDialog::SelectAreaDialog() :
rubberBand_(nullptr) rubberBand_(nullptr)
...@@ -67,7 +69,11 @@ SelectAreaDialog::mouseReleaseEvent(QMouseEvent* event) ...@@ -67,7 +69,11 @@ SelectAreaDialog::mouseReleaseEvent(QMouseEvent* event)
if(rubberBand_) { if(rubberBand_) {
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
releaseMouse(); 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_; delete rubberBand_;
rubberBand_ = nullptr; rubberBand_ = nullptr;
reject(); reject();
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "video/devicemodel.h" #include "video/devicemodel.h"
#include "video/sourcemodel.h" #include "video/sourcemodel.h"
#include "recentmodel.h" #include "recentmodel.h"
#include "media/video.h"
#include <QGraphicsOpacityEffect> #include <QGraphicsOpacityEffect>
#include <QPropertyAnimation> #include <QPropertyAnimation>
...@@ -138,7 +139,11 @@ void ...@@ -138,7 +139,11 @@ void
VideoView::dropEvent(QDropEvent* event) VideoView::dropEvent(QDropEvent* event)
{ {
auto urls = event->mimeData()->urls(); 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 void
...@@ -173,7 +178,11 @@ VideoView::showContextMenu(const QPoint& pos) ...@@ -173,7 +178,11 @@ VideoView::showContextMenu(const QPoint& pos)
menu.addAction(ptr); menu.addAction(ptr);
connect(ptr, &QAction::toggled, [=](bool checked) { connect(ptr, &QAction::toggled, [=](bool checked) {
if (checked == true) { 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); Video::DeviceModel::instance().setActive(device);
} }
}); });
...@@ -184,7 +193,11 @@ VideoView::showContextMenu(const QPoint& pos) ...@@ -184,7 +193,11 @@ VideoView::showContextMenu(const QPoint& pos)
auto shareAction = new QAction(tr("Share entire screen"), this); auto shareAction = new QAction(tr("Share entire screen"), this);
menu.addAction(shareAction); menu.addAction(shareAction);
connect(shareAction, &QAction::triggered, [=]() { 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); auto shareAreaAction = new QAction(tr("Share screen area"), this);
menu.addAction(shareAreaAction); menu.addAction(shareAreaAction);
...@@ -201,7 +214,11 @@ VideoView::showContextMenu(const QPoint& pos) ...@@ -201,7 +214,11 @@ VideoView::showContextMenu(const QPoint& pos)
if (!dialog.exec()) if (!dialog.exec())
return; return;
fileNames = dialog.selectedFiles(); 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); 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