Commit a1b42789 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

call: enable streaming from file

Change-Id: I8f75e454560d81816e4083d65e918f537a64ca01
parent 43de2e25
......@@ -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;
......
......@@ -149,8 +149,7 @@ NSString *currentDevice;
//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 @@ NSString *currentDevice;
--------------------------------------------------------*/
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 @@ NSString *currentDevice;
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 @@ NSString *currentDevice;
[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];
}
}];
}
......
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