Commit 32cf6be8 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

call UI: highlight selected video input

Change-Id: I443f661028675c99ebdb180e1cf2254533a580b4
parent 9a2791a9
......@@ -994,6 +994,18 @@ CVPixelBufferRef pixelBufferPreview;
return mediaModel->getDevices();
}
-(NSString*) getDefaultDeviceName {
auto type = mediaModel->getCurrentRenderedDevice(callUid_).type;
switch (type) {
case lrc::api::video::DeviceType::CAMERA:
return @(mediaModel->getCurrentRenderedDevice(callUid_).name.c_str());
case lrc::api::video::DeviceType::DISPLAY:
return NSLocalizedString(@"Share screen", @"Contextual menu entry");
default:
return @"";
}
}
-(void) switchToFile:(std::string)uri {
mediaModel->setInputFile(QUrl::fromLocalFile(uri.c_str()).toLocalFile().toStdString());
}
......
......@@ -30,6 +30,7 @@
-(void) switchToDevice:(int)deviceID;
-(void) switchToFile:(std::string)uri;
-(std::vector<std::string>) getDeviceList;
-(NSString *) getDefaultDeviceName;
@end
......
......@@ -29,6 +29,8 @@
@end
@implementation CallView
NSString *currentDevice;
@synthesize contextualMenu;
@synthesize shouldAcceptInteractions;
......@@ -173,6 +175,8 @@
contextualMenu = [[NSMenu alloc] initWithTitle:@"Switch camera"];
auto devices = [self.callDelegate getDeviceList];
currentDevice = [self.callDelegate getDefaultDeviceName];
for(int i = 0 ; i < devices.size() ; ++i) {
std::string device = devices[i];
......@@ -191,6 +195,10 @@
atIndex:contextualMenu.itemArray.count];
#endif
auto menuItem = [contextualMenu itemWithTitle:currentDevice];
if(menuItem) {
[menuItem setState: NSControlStateValueOn];
}
[NSMenu popUpContextMenu:contextualMenu withEvent:theEvent forView:self];
}
......@@ -224,17 +232,26 @@
- (void) switchInput:(NSMenuItem*) sender
{
if([sender.title isEqualToString:currentDevice]) {
return;
}
int index = [contextualMenu indexOfItem:sender];
[self.callDelegate switchToDevice: index];
}
- (void) captureScreen:(NSMenuItem*) sender
{
if([sender.title isEqualToString:currentDevice]) {
return;
}
[self.callDelegate screenShare];
}
- (void) chooseFile:(NSMenuItem*) sender
{
if([sender.title isEqualToString:currentDevice]) {
return;
}
NSOpenPanel *browsePanel = [[NSOpenPanel alloc] init];
[browsePanel setDirectoryURL:[NSURL URLWithString:NSHomeDirectory()]];
[browsePanel setCanChooseFiles:YES];
......
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