diff --git a/src/views/CallView.h b/src/views/CallView.h index b31967f63ffc2dd8ef4ef4840f84b1ac7ab62cb6..9f820a8bafbf94ae85aa13f8ab01ba3043646683 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 3d439569de58df7a4c6e78695d153e1bd2f2db20..6c129c62072d534f76e604631c140c0bb2e441a9 100644 --- a/src/views/CallView.mm +++ b/src/views/CallView.mm @@ -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]; } }]; }