Commit e7a604c1 authored by Alexandre Lision's avatar Alexandre Lision Committed by Edric Milaret

video: adjust to source model modification

Related to change #3155

Change-Id: I08a1f5dfeff25702212a25f829cb0e73f92d5a4a
Tuleap: #188
parent 4d9905e3
......@@ -25,6 +25,8 @@
#import <video/configurationproxy.h>
#import <video/sourcemodel.h>
#import <media/video.h>
#import <callmodel.h>
#import <video/previewmanager.h>
#import <video/renderer.h>
#import <video/device.h>
......@@ -161,10 +163,15 @@
--------------------------------------------------------*/
if ( [sender draggingSource] != self ) {
NSURL* fileURL = [NSURL URLFromPasteboard: [sender draggingPasteboard]];
Video::SourceModel::instance().setFile(QUrl::fromLocalFile(QString::fromUtf8([fileURL.path UTF8String])));
if (auto current = CallModel::instance().selectedCall()) {
if (auto outVideo = current->firstMedia<Media::Video>(Media::Media::Direction::OUT)) {
outVideo->sourceModel()->setFile(QUrl::fromLocalFile(QString::fromUtf8([fileURL.path UTF8String])));
return YES;
}
}
}
return YES;
return NO;
}
- (void)showContextualMenu:(NSEvent *)theEvent {
......@@ -219,7 +226,11 @@
- (void) switchInput:(NSMenuItem*) sender
{
int index = [contextualMenu indexOfItem:sender];
Video::SourceModel::instance().switchTo(Video::DeviceModel::instance().devices()[index]);
if (auto current = CallModel::instance().selectedCall()) {
if (auto outVideo = current->firstMedia<Media::Video>(Media::Media::Direction::OUT)) {
outVideo->sourceModel()->switchTo(Video::DeviceModel::instance().devices()[index]);
}
}
}
- (void) chooseFile:(NSMenuItem*) sender
......@@ -240,7 +251,11 @@
[browsePanel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton) {
NSURL* theDoc = [[browsePanel URLs] objectAtIndex:0];
Video::SourceModel::instance().setFile(QUrl::fromLocalFile(QString::fromUtf8([theDoc.path UTF8String])));
if (auto current = CallModel::instance().selectedCall()) {
if (auto outVideo = current->firstMedia<Media::Video>(Media::Media::Direction::OUT)) {
outVideo->sourceModel()->setFile(QUrl::fromLocalFile(QString::fromUtf8([theDoc.path UTF8String])));
}
}
}
}];
......
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