call: enable streaming from file
Change-Id: I8f75e454560d81816e4083d65e918f537a64ca01
diff --git a/src/views/CallView.h b/src/views/CallView.h
index b31967f..9f820a8 100644
--- a/src/views/CallView.h
+++ b/src/views/CallView.h
@@ -28,7 +28,7 @@
-(void) mouseIsMoving:(BOOL) move;
-(void) screenShare;
-(void) switchToDevice:(int)deviceID;
--(void) switchToFile:(std::string)uri;
+-(void) switchToFile:(QString)uri;
-(QVector<QString>) getDeviceList;
-(NSString *) getDefaultDeviceName;
diff --git a/src/views/CallView.mm b/src/views/CallView.mm
index 3d43956..6c129c6 100644
--- a/src/views/CallView.mm
+++ b/src/views/CallView.mm
@@ -149,8 +149,7 @@
//check to see if we can accept the data
return conforms;
}
-#if 0
-// TODO: add file as a source
+
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
/*------------------------------------------------------
@@ -158,24 +157,19 @@
--------------------------------------------------------*/
if ( [sender draggingSource] != self ) {
NSURL* fileURL = [NSURL URLFromPasteboard: [sender draggingPasteboard]];
- Call* call = [self getCurrentCall];
- if (call == nullptr) return;
- if (auto outVideo = call->firstMedia<media::Video>(media::Media::Direction::OUT)) {
- outVideo->sourceModel()->setFile(QUrl::fromLocalFile(QString::fromUtf8([fileURL.path UTF8String])));
+ auto name = QString::fromNSString([@"file:///" stringByAppendingString: fileURL.path]);
+ [self.callDelegate switchToFile: name];
return YES;
- }
}
-
return NO;
}
-#endif
- (void)showContextualMenu:(NSEvent *)theEvent {
contextualMenu = [[NSMenu alloc] initWithTitle:@"Switch camera"];
auto devices = [self.callDelegate getDeviceList];
-
+
currentDevice = [self.callDelegate getDefaultDeviceName];
for(int i = 0 ; i < devices.size() ; ++i) {
@@ -186,14 +180,13 @@
action:@selector(captureScreen:)
keyEquivalent:@""
atIndex:contextualMenu.itemArray.count];
-#if 0
-// TODO: add file as a source
+
[contextualMenu addItem:[NSMenuItem separatorItem]];
[contextualMenu insertItemWithTitle:NSLocalizedString(@"Choose file", @"Contextual menu entry")
action:@selector(chooseFile:)
keyEquivalent:@""
atIndex:contextualMenu.itemArray.count];
-#endif
+
auto menuItem = [contextualMenu itemWithTitle:currentDevice];
if(menuItem) {
@@ -270,7 +263,8 @@
[browsePanel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton) {
NSURL* theDoc = [[browsePanel URLs] objectAtIndex:0];
- [self.callDelegate switchToFile: [theDoc.path UTF8String]];
+ auto name = QString::fromNSString([@"file:///" stringByAppendingString: theDoc.path]);
+ [self.callDelegate switchToFile: name];
}
}];
}