Commit 957020c4 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

macOS: refactor call screen

Change-Id: Ia19f757cf91a7e8ee62bb5d79f6d11963a19a81a
parent 49c00700
......@@ -192,6 +192,10 @@ SET(ringclient_CONTROLLERS
src/PluginItemDelegateVC.mm
src/PreferenceTabDelegateVC.h
src/PreferenceTabDelegateVC.mm
src/ChooseMediaVC.mm
src/ChooseMediaVC.h
src/ChangeAudioVolumeVC.mm
src/ChangeAudioVolumeVC.h
)
SET(ringclient_VIEWS
......@@ -322,6 +326,8 @@ SET(ringclient_XIBS
PluginItemDelegate
PluginPreferenceTab
PreferenceTabDelegateVC
ChooseMediaVC
ChangeAudioVolumeVC
)
# Icons
......@@ -332,12 +338,8 @@ SET_SOURCE_FILES_PROPERTIES(${myApp_ICON} PROPERTIES
SET(ring_ICONS
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_audio_file.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_exit.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_stoprecord.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_audio.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_audio.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_folder.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_block.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_attachment.png
${CMAKE_CURRENT_SOURCE_DIR}/data/default_avatar_overlay.png
${CMAKE_CURRENT_SOURCE_DIR}/data/symbol_name.png
${CMAKE_CURRENT_SOURCE_DIR}/data/background-light.png
......@@ -345,55 +347,54 @@ ${CMAKE_CURRENT_SOURCE_DIR}/data/background-dark.png
${CMAKE_CURRENT_SOURCE_DIR}/data/symbol_blue.png
${CMAKE_CURRENT_SOURCE_DIR}/data/background_tile.png
${CMAKE_CURRENT_SOURCE_DIR}/data/logo_white.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_more.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_dialpad.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_accept.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_arrow_back.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_call.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_cancel.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_hangup.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_hold.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_holdoff.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_mute_video.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_mute_audio.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_chat.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_search.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_quality.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_record.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_call_received.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_call_missed.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_call_made.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_transfer.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_add_participant.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_merge_calls.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_send.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/audio.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_person_add.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_persons.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_history.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_plugin_fill.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_reset.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/general.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/video.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_camera.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_delete.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/qrcode.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_video.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/pending_contact_request.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_file_upload.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_record_stop.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_camera.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_audio_msg.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_group.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_plugin.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_plugin_fill.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_reset.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_picture.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_moderator_minimize.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_moderator_hangup.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_stoprecord.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_moderator.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_moderator_audio_muted.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_moderator_audio_unmuted.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_moderator_maximize.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_moderator_minimize.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_moderator_hangup.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_file.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/done.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_action_accept.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/add_participant.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/camera_off.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/camera_on.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/message.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/micro_off.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/micro_on.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/record.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/sound_off.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/sound_on.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_action_cancel.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_picture.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_star.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_file.png)
${CMAKE_CURRENT_SOURCE_DIR}/data/light/arrw_up.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/share.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_moderator_audio_muted.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/ic_moderator_audio_unmuted.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/settings.png
${CMAKE_CURRENT_SOURCE_DIR}/data/light/plugin.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_call.png
${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_plugin.png
)
SET_SOURCE_FILES_PROPERTIES(${ring_ICONS} PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
......
data/light/ic_action_cancel.png

353 Bytes | W: | H:

data/light/ic_action_cancel.png

2.26 KB | W: | H:

data/light/ic_action_cancel.png
data/light/ic_action_cancel.png
data/light/ic_action_cancel.png
data/light/ic_action_cancel.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -74,7 +74,7 @@ QMetaObject::Connection audioDeviceEvent;
-(void)connectdDeviceEvent {
QObject::disconnect(audioDeviceEvent);
audioDeviceEvent = QObject::connect(avModel,
&lrc::api::AVModel::deviceEvent,
&lrc::api::AVModel::audioDeviceEvent,
[=]() {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
1 * NSEC_PER_SEC),
......
/*
* Copyright (C) 2021 Savoir-faire Linux Inc.
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import <Cocoa/Cocoa.h>
#import <qstring.h>
namespace lrc {
namespace api {
class AVModel;
}
}
typedef enum {
input = 1,
output
} AudioType;
@protocol ChangeAudioVolumeDelegate <NSObject>
-(BOOL)isAudioMuted:(AudioType)audioType;
@end
NS_ASSUME_NONNULL_BEGIN
@interface ChangeAudioVolumeVC : NSViewController
@property (copy) void (^onMuted)();
@property (retain, nonatomic) id <ChangeAudioVolumeDelegate> delegate;
-(void)setMediaDevice:(const QString&)device avModel:(lrc::api::AVModel *)avModel andType:(AudioType)type;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (C) 2021 Savoir-faire Linux Inc.
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import "ChangeAudioVolumeVC.h"
#import "views/NSColor+RingTheme.h"
#import <api/avmodel.h>
@interface ChangeAudioVolumeVC () {
__unsafe_unretained IBOutlet NSSlider* volumeSlider;
__unsafe_unretained IBOutlet NSButton* muteButton;
}
@end
@implementation ChangeAudioVolumeVC
QString audioDevice;
lrc::api::AVModel *mModel;
AudioType audioType;
-(void)setMediaDevice:(const QString&)device avModel:(lrc::api::AVModel *)avModel andType:(AudioType)type {
audioDevice = device;
mModel = avModel;
audioType = type;
muteButton.image = [self buttonImage];
}
-(NSImage* )buttonImage {
auto muted = [self.delegate isAudioMuted: audioType];
switch (audioType) {
case input:
if (muted) {
return [NSColor image: [NSImage imageNamed:@"micro_off.png"] tintedWithColor: [NSColor whiteColor]];
}
return [NSColor image: [NSImage imageNamed:@"micro_on.png"] tintedWithColor: [NSColor whiteColor]];
case output:
if (muted) {
return [NSColor image: [NSImage imageNamed:@"sound_off.png"] tintedWithColor: [NSColor whiteColor]];
}
return [NSColor image: [NSImage imageNamed:@"sound_on.png"] tintedWithColor: [NSColor whiteColor]];
}
}
- (IBAction)setDeviceVolume:(NSSlider*)sender {
}
- (IBAction)muteDevice:(id)sender {
self.onMuted();
muteButton.image = [self buttonImage];
}
@end
/*
* Copyright (C) 2021 Savoir-faire Linux Inc.
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import <Cocoa/Cocoa.h>
#import <qstring.h>
#import <qvector.h>
NS_ASSUME_NONNULL_BEGIN
@interface ChooseMediaVC: NSViewController<NSTableViewDelegate, NSTableViewDataSource>
@property (copy) void (^onDeviceSelected)(NSString* device, NSInteger index);
-(void)setMediaDevices:(const QVector<QString>&)devices andDefaultDevice:(const QString&)device;
@end
NS_ASSUME_NONNULL_END
/*
* Copyright (C) 2021 Savoir-faire Linux Inc.
* Author: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import "ChooseMediaVC.h"
#import "views/RingTableView.h"
#import "views/HoverTableRowView.h"
#import "views/NSColor+RingTheme.h"
@interface ChooseMediaVC () {
__unsafe_unretained IBOutlet RingTableView* devicesView;
__unsafe_unretained IBOutlet NSLayoutConstraint* tableHeightConstraint;
__unsafe_unretained IBOutlet NSLayoutConstraint* tableWidthConstraint;
}
@end
@implementation ChooseMediaVC
QVector<QString> mediaDevices;
QString defaultDevice;
NSInteger MEDIA_NAME_TAG = 100;
NSInteger CURRENT_SELECTION_TAG = 200;
CGFloat ROW_HEIGHT = 35;
-(void)setMediaDevices:(const QVector<QString>&)devices andDefaultDevice:(const QString&)device {
mediaDevices = devices;
defaultDevice = device;
CGFloat tableHeight = ROW_HEIGHT * mediaDevices.size();
}
-(CGFloat)getTableWidth {
NSTextField* textField = [[NSTextField alloc] init];
CGFloat maxWidth = 0;
for (auto device : mediaDevices) {
NSFont *fontName = [NSFont systemFontOfSize: 13.0 weight: NSFontWeightMedium];
NSDictionary *attrs= [NSDictionary dictionaryWithObjectsAndKeys:
fontName, NSFontAttributeName,
nil];
NSAttributedString* attributed = [[NSAttributedString alloc] initWithString:device.toNSString() attributes: attrs];
textField.attributedStringValue = attributed;
[textField sizeToFit];
if (textField.frame.size.width > maxWidth) {
maxWidth = textField.frame.size.width;
}
}
return maxWidth;
}
- (void)viewDidLoad {
[super viewDidLoad];
CGFloat tableHeight = ROW_HEIGHT * mediaDevices.size();
// we do not need space for check mark for default device
auto margins = defaultDevice.isEmpty() ? 20 : 50;
CGFloat tableWidth = [self getTableWidth] + margins;
tableHeightConstraint.constant = tableHeight;
tableWidthConstraint.constant = tableWidth;
}
#pragma mark - NSTableViewDelegate methods
- (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row
{
HoverTableRowView *howerRow = [tableView makeViewWithIdentifier:@"HoverRowView" owner:nil];
[howerRow setBlurType:7];
return howerRow;
}
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
NSTableCellView* result = [tableView makeViewWithIdentifier:@"MediaDeviceCell" owner:tableView];
NSTextField* mediaName = [result viewWithTag: MEDIA_NAME_TAG];
NSImageView* currentSelection = [result viewWithTag: CURRENT_SELECTION_TAG];
NSStackView* container = [currentSelection superview];
container.detachesHiddenViews = defaultDevice.isEmpty();
mediaName.stringValue = mediaDevices[row].toNSString();
currentSelection.hidden = mediaDevices[row] != defaultDevice;
NSImage* image = [NSColor image: currentSelection.image tintedWithColor: [NSColor textColor]];
currentSelection.image = image;
return result;
}
- (void)tableViewSelectionDidChange:(NSNotification *)notification {
NSInteger row = [notification.object selectedRow];
self.onDeviceSelected(mediaDevices[row].toNSString(), row);
}
- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
{
return ROW_HEIGHT;
}
#pragma mark - NSTableDataSource methods
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
{
return mediaDevices.size();
}
@end
This diff is collapsed.
......@@ -112,7 +112,7 @@ lrc::api::ConversationModel* conversationModel;
} else {
avModel->stopLocalRecorder(QString::fromNSString(filesToSend[conversationUid.toNSString()]));
isRecording = false;
recordButton.image = [NSImage imageNamed:@"ic_action_audio.png"];
recordButton.image = [NSImage imageNamed:@"micro_on.png"];
recordButton.title = NSLocalizedString(@"Record a message", @"Record message title");
[refreshDurationTimer invalidate];
refreshDurationTimer = nil;
......@@ -139,7 +139,7 @@ lrc::api::ConversationModel* conversationModel;
}
- (void)clearData {
recordButton.image = [NSImage imageNamed:@"ic_action_audio.png"];
recordButton.image = [NSImage imageNamed:@"micro_on.png"];
recordButton.title = NSLocalizedString(@"Record a message", @"Record message title");
recordingTime = 0;
[timerLabel setStringValue: [NSString formattedStringTimeFromSeconds: recordingTime]];
......@@ -152,7 +152,7 @@ lrc::api::ConversationModel* conversationModel;
}
- (void)viewWillHide {
recordButton.image = [NSImage imageNamed:@"ic_action_audio.png"];
recordButton.image = [NSImage imageNamed:@"micro_on.png"];
recordButton.title = NSLocalizedString(@"Record a message", @"Record message title");
if(filesToSend[conversationUid.toNSString()]) {
[sendButton setHidden: NO];
......
......@@ -48,7 +48,7 @@ static auto const kPluginPrefsIdentifer = @"PluginPrefsIdentifer";
[self.window setMovableByWindowBackground:YES];
NSArray *items = [self.window.toolbar items];
for(NSToolbarItem *toolbarItem in items) {
NSImage * image = [NSColor image: [toolbarItem image] tintedWithColor: [NSColor secondaryLabelColor]];
NSImage * image = [NSColor image: [toolbarItem image] tintedWithColor: [NSColor labelColor]];
toolbarItem.image = image;
}
[self.window.toolbar setSelectedItemIdentifier:kGeneralPrefsIdentifier];
......
......@@ -26,11 +26,6 @@
-(void) callShouldToggleFullScreen;
-(void) mouseIsMoving:(BOOL) move;
-(void) screenShare;
-(void) switchToDevice:(int)deviceID;
-(void) switchToFile:(QString)uri;
-(QVector<QString>) getDeviceList;
-(NSString *) getDefaultDeviceName;
@end
......
......@@ -40,7 +40,6 @@ NSString *currentDevice;
self = [super initWithFrame:frame];
if (self)
{
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];
[self setWantsLayer:YES];
[self setLayer:[CALayer layer]];
[self.layer setBackgroundColor:[[NSColor blackColor] CGColor]];
......@@ -59,142 +58,6 @@ NSString *currentDevice;
return self;
}
#pragma mark - Destination Operations
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
/*------------------------------------------------------
method called whenever a drag enters our drop zone
--------------------------------------------------------*/
NSLog(@"Dragging entered");
NSURL* fileURL = [NSURL URLFromPasteboard: [sender draggingPasteboard]];
CFStringRef fileExtension = (__bridge CFStringRef) [fileURL.path pathExtension];
CFStringRef fileUTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, fileExtension, NULL);
// Check if the pasteboard contains image data and source/user wants it copied
if ( [sender draggingSourceOperationMask] & NSDragOperationCopy &&
(UTTypeConformsTo(fileUTI, kUTTypeVideo)) ||
(UTTypeConformsTo(fileUTI, kUTTypeMovie)) ||
(UTTypeConformsTo(fileUTI, kUTTypeImage))) {
//highlight our drop zone
highlight=YES;
[self setNeedsDisplay: YES];
/* When an image from one window is dragged over another, we want to resize the dragging item to
* preview the size of the image as it would appear if the user dropped it in. */
[sender enumerateDraggingItemsWithOptions:NSDraggingItemEnumerationConcurrent
forView:self
classes:[NSArray arrayWithObject:[NSPasteboardItem class]]
searchOptions:nil
usingBlock:^(NSDraggingItem *draggingItem, NSInteger idx, BOOL *stop) {
*stop = YES;
}];
CFRelease(fileUTI);
//accept data as a copy operation
return NSDragOperationCopy;
}
CFRelease(fileUTI);
return NSDragOperationNone;
}
- (void)draggingExited:(id <NSDraggingInfo>)sender
{
/*------------------------------------------------------
method called whenever a drag exits our drop zone
--------------------------------------------------------*/
//remove highlight of the drop zone
highlight=NO;
[self setNeedsDisplay: YES];
}