Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 1 | /* |
Alexandre Lision | 9fe374b | 2016-01-06 10:17:31 -0500 | [diff] [blame] | 2 | * Copyright (C) 2015-2016 Savoir-faire Linux Inc. |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 3 | * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 18 | */ |
| 19 | #import "CurrentCallVC.h" |
| 20 | |
| 21 | #import <QuartzCore/QuartzCore.h> |
| 22 | |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 23 | ///Qt |
| 24 | #import <QMimeData> |
| 25 | #import <QtMacExtras/qmacfunctions.h> |
| 26 | #import <QtCore/qabstractitemmodel.h> |
| 27 | #import <QItemSelectionModel> |
| 28 | #import <QItemSelection> |
| 29 | #import <QPixmap> |
| 30 | |
| 31 | ///LRC |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 32 | #import <video/previewmanager.h> |
| 33 | #import <video/renderer.h> |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 34 | #import <api/newcallmodel.h> |
| 35 | #import <api/call.h> |
| 36 | #import <api/conversationmodel.h> |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 37 | #import <globalinstances.h> |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 38 | |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 39 | #import "AppDelegate.h" |
Alexandre Lision | f47a256 | 2015-06-15 15:48:29 -0400 | [diff] [blame] | 40 | #import "views/ITProgressIndicator.h" |
Alexandre Lision | 74dd47f | 2015-04-14 13:47:42 -0400 | [diff] [blame] | 41 | #import "views/CallView.h" |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 42 | #import "delegates/ImageManipulationDelegate.h" |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 43 | #import "PersonLinkerVC.h" |
Alexandre Lision | 16d9c0a | 2015-08-10 12:05:15 -0400 | [diff] [blame] | 44 | #import "ChatVC.h" |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 45 | #import "BrokerVC.h" |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 46 | #import "views/IconButton.h" |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 47 | #import "views/CallLayer.h" |
Anthony Léonard | 6f81975 | 2018-01-05 09:53:40 -0500 | [diff] [blame] | 48 | #import "utils.h" |
Alexandre Lision | 74dd47f | 2015-04-14 13:47:42 -0400 | [diff] [blame] | 49 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 50 | @interface RendererConnectionsHolder : NSObject |
| 51 | |
| 52 | @property QMetaObject::Connection frameUpdated; |
| 53 | @property QMetaObject::Connection started; |
| 54 | @property QMetaObject::Connection stopped; |
| 55 | |
| 56 | @end |
| 57 | |
| 58 | @implementation RendererConnectionsHolder |
| 59 | |
| 60 | @end |
| 61 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 62 | @interface CurrentCallVC () <NSPopoverDelegate, ContactLinkedDelegate> { |
| 63 | std::string convUid_; |
| 64 | std::string callUid_; |
| 65 | const lrc::api::account::Info *accountInfo_; |
Anthony Léonard | 66a050c | 2018-01-03 16:32:34 -0500 | [diff] [blame] | 66 | NSTimer* refreshDurationTimer; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 67 | } |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 68 | |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 69 | // Main container |
| 70 | @property (unsafe_unretained) IBOutlet NSSplitView* splitView; |
| 71 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 72 | // Header info |
| 73 | @property (unsafe_unretained) IBOutlet NSView* headerContainer; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 74 | @property (unsafe_unretained) IBOutlet NSTextField* personLabel; |
| 75 | @property (unsafe_unretained) IBOutlet NSTextField* stateLabel; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 76 | @property (unsafe_unretained) IBOutlet NSTextField* timeSpentLabel; |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 77 | @property (unsafe_unretained) IBOutlet NSImageView* personPhoto; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 78 | |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 79 | @property (unsafe_unretained) IBOutlet NSImageView* outgoingPhoto; |
| 80 | @property (unsafe_unretained) IBOutlet NSTextField* outgoingPersonLabel; |
| 81 | @property (unsafe_unretained) IBOutlet NSTextField* outgoingStateLabel; |
| 82 | @property (unsafe_unretained) IBOutlet NSTextField* outgoingId; |
| 83 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 84 | // Call Controls |
| 85 | @property (unsafe_unretained) IBOutlet NSView* controlsPanel; |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 86 | |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 87 | @property (unsafe_unretained) IBOutlet IconButton* holdOnOffButton; |
| 88 | @property (unsafe_unretained) IBOutlet IconButton* hangUpButton; |
| 89 | @property (unsafe_unretained) IBOutlet IconButton* recordOnOffButton; |
| 90 | @property (unsafe_unretained) IBOutlet IconButton* pickUpButton; |
| 91 | @property (unsafe_unretained) IBOutlet IconButton* muteAudioButton; |
| 92 | @property (unsafe_unretained) IBOutlet IconButton* muteVideoButton; |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 93 | @property (unsafe_unretained) IBOutlet IconButton* transferButton; |
| 94 | @property (unsafe_unretained) IBOutlet IconButton* addParticipantButton; |
| 95 | @property (unsafe_unretained) IBOutlet IconButton* chatButton; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 96 | @property (unsafe_unretained) IBOutlet IconButton* qualityButton; |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 97 | |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 98 | @property (unsafe_unretained) IBOutlet NSView* advancedPanel; |
| 99 | @property (unsafe_unretained) IBOutlet IconButton* advancedButton; |
| 100 | |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 101 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 102 | // Join call panel |
| 103 | @property (unsafe_unretained) IBOutlet NSView* joinPanel; |
| 104 | @property (unsafe_unretained) IBOutlet NSButton* mergeCallsButton; |
| 105 | |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 106 | @property (strong) NSPopover* addToContactPopover; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 107 | @property (strong) NSPopover* brokerPopoverVC; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 108 | @property (strong) IBOutlet ChatVC* chatVC; |
Alexandre Lision | f23ec5a | 2015-07-16 11:24:06 -0400 | [diff] [blame] | 109 | |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 110 | // Ringing call panel |
| 111 | @property (unsafe_unretained) IBOutlet NSView* ringingPanel; |
| 112 | @property (unsafe_unretained) IBOutlet NSImageView* incomingPersonPhoto; |
| 113 | @property (unsafe_unretained) IBOutlet NSTextField* incomingDisplayName; |
| 114 | |
| 115 | // Outgoing call panel |
| 116 | @property (unsafe_unretained) IBOutlet NSView* outgoingPanel; |
| 117 | @property (unsafe_unretained) IBOutlet ITProgressIndicator *loadingIndicator; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 118 | |
| 119 | // Video |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 120 | @property (unsafe_unretained) IBOutlet CallView *videoView; |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 121 | @property (unsafe_unretained) IBOutlet NSView *previewView; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 122 | |
| 123 | @property RendererConnectionsHolder* previewHolder; |
| 124 | @property RendererConnectionsHolder* videoHolder; |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 125 | @property QMetaObject::Connection videoStarted; |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 126 | @property QMetaObject::Connection selectedCallChanged; |
Alexandre Lision | b65c027 | 2015-07-22 15:51:29 -0400 | [diff] [blame] | 127 | @property QMetaObject::Connection messageConnection; |
| 128 | @property QMetaObject::Connection mediaAddedConnection; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 129 | |
| 130 | @end |
| 131 | |
| 132 | @implementation CurrentCallVC |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 133 | @synthesize personLabel, personPhoto, stateLabel, holdOnOffButton, hangUpButton, |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 134 | recordOnOffButton, pickUpButton, chatButton, transferButton, addParticipantButton, timeSpentLabel, |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 135 | muteVideoButton, muteAudioButton, controlsPanel, advancedPanel, advancedButton, headerContainer, videoView, |
| 136 | incomingDisplayName, incomingPersonPhoto, previewView, splitView, loadingIndicator, ringingPanel, joinPanel, |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 137 | outgoingPanel, outgoingPersonLabel, outgoingStateLabel, outgoingPhoto, outgoingId; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 138 | |
| 139 | @synthesize previewHolder; |
| 140 | @synthesize videoHolder; |
| 141 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 142 | -(void) setCurrentCall:(const std::string&)callUid |
| 143 | conversation:(const std::string&)convUid |
| 144 | account:(const lrc::api::account::Info*)account; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 145 | { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 146 | if(account == nil) |
| 147 | return; |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 148 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 149 | auto* callModel = account->callModel.get(); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 150 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 151 | if (not callModel->hasCall(callUid)){ |
| 152 | callUid_.clear(); |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 153 | return; |
| 154 | } |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 155 | callUid_ = callUid; |
| 156 | convUid_ = convUid; |
| 157 | accountInfo_ = account; |
Anthony Léonard | 4b0935f | 2017-12-26 12:05:22 -0500 | [diff] [blame] | 158 | [self.chatVC setConversationUid:convUid model:account->conversationModel.get()]; |
Kateryna Kostiuk | 54d7697 | 2018-06-07 15:45:07 -0400 | [diff] [blame^] | 159 | auto currentCall = callModel->getCall(callUid_); |
| 160 | if(currentCall.isAudioOnly) { |
| 161 | muteVideoButton.image = [NSImage imageNamed:@"ic_action_mute_video.png"]; |
| 162 | } |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | - (void)awakeFromNib |
| 166 | { |
| 167 | NSLog(@"INIT CurrentCall VC"); |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 168 | [self.view setWantsLayer:YES]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 169 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 170 | [previewView setWantsLayer:YES]; |
Alexandre Lision | 22d615b | 2016-01-25 12:54:34 -0500 | [diff] [blame] | 171 | [previewView.layer setBackgroundColor:[NSColor blackColor].CGColor]; |
| 172 | [previewView.layer setContentsGravity:kCAGravityResizeAspectFill]; |
| 173 | [previewView.layer setFrame:previewView.frame]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 174 | |
| 175 | [controlsPanel setWantsLayer:YES]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 176 | [controlsPanel.layer setBackgroundColor:[NSColor clearColor].CGColor]; |
| 177 | [controlsPanel.layer setFrame:controlsPanel.frame]; |
| 178 | |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 179 | previewHolder = [[RendererConnectionsHolder alloc] init]; |
| 180 | videoHolder = [[RendererConnectionsHolder alloc] init]; |
| 181 | |
Alexandre Lision | f47a256 | 2015-06-15 15:48:29 -0400 | [diff] [blame] | 182 | [loadingIndicator setColor:[NSColor whiteColor]]; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 183 | [loadingIndicator setNumberOfLines:200]; |
| 184 | [loadingIndicator setWidthOfLine:4]; |
| 185 | [loadingIndicator setLengthOfLine:4]; |
| 186 | [loadingIndicator setInnerMargin:59]; |
Alexandre Lision | f47a256 | 2015-06-15 15:48:29 -0400 | [diff] [blame] | 187 | |
Alexandre Lision | a1eee3c | 2015-08-10 13:44:51 -0400 | [diff] [blame] | 188 | [self.videoView setCallDelegate:self]; |
Kateryna Kostiuk | 1004caa | 2018-03-29 13:48:07 -0400 | [diff] [blame] | 189 | CGColor* color = [[[NSColor blackColor] colorWithAlphaComponent:0.2] CGColor]; |
| 190 | [headerContainer.layer setBackgroundColor:color]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 191 | } |
| 192 | |
Anthony Léonard | 66a050c | 2018-01-03 16:32:34 -0500 | [diff] [blame] | 193 | -(void) updateDurationLabel |
| 194 | { |
| 195 | if (accountInfo_ != nil) { |
| 196 | auto* callModel = accountInfo_->callModel.get(); |
| 197 | if (callModel->hasCall(callUid_)) { |
| 198 | auto& callStatus = callModel->getCall(callUid_).status; |
| 199 | if (callStatus != lrc::api::call::Status::ENDED && |
| 200 | callStatus != lrc::api::call::Status::TERMINATING && |
| 201 | callStatus != lrc::api::call::Status::INVALID) { |
| 202 | [timeSpentLabel setStringValue:@(callModel->getFormattedCallDuration(callUid_).c_str())]; |
| 203 | return; |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | // If call is not running anymore or accountInfo_ is not set for any reason |
| 209 | // we stop the refresh loop |
| 210 | [refreshDurationTimer invalidate]; |
| 211 | refreshDurationTimer = nil; |
| 212 | [timeSpentLabel setHidden:YES]; |
| 213 | } |
| 214 | |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 215 | -(void) updateCall |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 216 | { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 217 | if (accountInfo_ == nil) |
| 218 | return; |
Alexandre Lision | bb5dbcd | 2015-07-09 16:36:47 -0400 | [diff] [blame] | 219 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 220 | auto* callModel = accountInfo_->callModel.get(); |
| 221 | if (not callModel->hasCall(callUid_)) { |
| 222 | return; |
| 223 | } |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 224 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 225 | auto currentCall = callModel->getCall(callUid_); |
| 226 | NSLog(@"\n status %@ \n",@(lrc::api::call::to_string(currentCall.status).c_str())); |
Anthony Léonard | 8ee2678 | 2018-01-05 10:23:04 -0500 | [diff] [blame] | 227 | auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel); |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 228 | if (convIt != accountInfo_->conversationModel->allFilteredConversations().end()) { |
| 229 | NSString* bestName = bestNameForConversation(*convIt, *accountInfo_->conversationModel); |
| 230 | [personLabel setStringValue:bestName]; |
| 231 | [outgoingPersonLabel setStringValue:bestName]; |
| 232 | NSString* ringID = bestIDForConversation(*convIt, *accountInfo_->conversationModel); |
| 233 | if([bestName isEqualToString:ringID]) { |
| 234 | ringID = @""; |
| 235 | } |
| 236 | [outgoingId setStringValue:ringID]; |
| 237 | } |
| 238 | |
Anthony Léonard | 66a050c | 2018-01-03 16:32:34 -0500 | [diff] [blame] | 239 | [timeSpentLabel setStringValue:@(callModel->getFormattedCallDuration(callUid_).c_str())]; |
Anthony Léonard | 66a050c | 2018-01-03 16:32:34 -0500 | [diff] [blame] | 240 | if (refreshDurationTimer == nil) |
| 241 | refreshDurationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 |
| 242 | target:self |
| 243 | selector:@selector(updateDurationLabel) |
| 244 | userInfo:nil |
| 245 | repeats:YES]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 246 | [stateLabel setStringValue:@(to_string(currentCall.status).c_str())]; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 247 | [outgoingStateLabel setStringValue:@(to_string(currentCall.status).c_str())]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 248 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 249 | // Default values for this views |
| 250 | [loadingIndicator setHidden:YES]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 251 | [ringingPanel setHidden:YES]; |
| 252 | [outgoingPanel setHidden:YES]; |
| 253 | [controlsPanel setHidden:NO]; |
| 254 | [headerContainer setHidden:NO]; |
Anthony Léonard | 4b0935f | 2017-12-26 12:05:22 -0500 | [diff] [blame] | 255 | [chatButton setHidden:NO]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 256 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 257 | using Status = lrc::api::call::Status; |
| 258 | switch (currentCall.status) { |
| 259 | case Status::SEARCHING: |
| 260 | case Status::OUTGOING_REQUESTED: |
| 261 | case Status::CONNECTING: |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 262 | [headerContainer setHidden:YES]; |
| 263 | [outgoingPanel setHidden:NO]; |
| 264 | [outgoingPhoto setHidden:NO]; |
| 265 | [self setupContactInfo:outgoingPhoto]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 266 | [loadingIndicator setHidden:NO]; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 267 | [controlsPanel setHidden:YES]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 268 | break; |
| 269 | case Status::INCOMING_RINGING: |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 270 | [outgoingPhoto setHidden:YES]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 271 | [controlsPanel setHidden:YES]; |
| 272 | [outgoingPanel setHidden:YES]; |
| 273 | [self setupIncoming:callUid_]; |
| 274 | break; |
| 275 | case Status::OUTGOING_RINGING: |
| 276 | [controlsPanel setHidden:YES]; |
| 277 | [outgoingPanel setHidden:NO]; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 278 | [loadingIndicator setHidden:NO]; |
| 279 | [headerContainer setHidden:YES]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 280 | break; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 281 | /*case Status::CONFERENCE: |
| 282 | [self setupConference:currentCall]; |
| 283 | break;*/ |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 284 | case Status::PAUSED: |
| 285 | case Status::PEER_PAUSED: |
| 286 | case Status::INACTIVE: |
| 287 | case Status::IN_PROGRESS: |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 288 | // change constraints (uncollapse avatar) |
| 289 | [self setupContactInfo:personPhoto]; |
Kateryna Kostiuk | 1004caa | 2018-03-29 13:48:07 -0400 | [diff] [blame] | 290 | [timeSpentLabel setHidden:NO]; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 291 | [outgoingPhoto setHidden:YES]; |
| 292 | [headerContainer setHidden:NO]; |
| 293 | break; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 294 | case Status::CONNECTED: |
| 295 | case Status::AUTO_ANSWERING: |
| 296 | break; |
| 297 | case Status::ENDED: |
| 298 | case Status::TERMINATING: |
| 299 | case Status::INVALID: |
| 300 | [controlsPanel setHidden:YES]; |
| 301 | [outgoingPanel setHidden:NO]; |
Andreas Traczyk | ecdc4fa | 2018-03-22 16:11:47 -0400 | [diff] [blame] | 302 | [self hideWithAnimation:false]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 303 | break; |
| 304 | } |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 305 | |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 306 | } |
| 307 | |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 308 | -(void) setupContactInfo:(NSImageView*)imageView |
| 309 | { |
| 310 | auto* convModel = accountInfo_->conversationModel.get(); |
| 311 | auto it = getConversationFromUid(convUid_, *convModel); |
| 312 | if (it != convModel->allFilteredConversations().end()) { |
| 313 | auto& imgManip = reinterpret_cast<Interfaces::ImageManipulationDelegate&>(GlobalInstances::pixmapManipulator()); |
| 314 | QVariant photo = imgManip.conversationPhoto(*it, *accountInfo_, QSize(120, 120), NO); |
| 315 | [imageView setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(photo))]; |
| 316 | } |
| 317 | } |
| 318 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 319 | -(void) setupIncoming:(const std::string&) callId |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 320 | { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 321 | if (accountInfo_ == nil) |
| 322 | return; |
| 323 | |
| 324 | auto* callModel = accountInfo_->callModel.get(); |
| 325 | if (not callModel->hasCall(callUid_)) { |
| 326 | return; |
| 327 | } |
| 328 | |
| 329 | auto call = callModel->getCall(callUid_); |
| 330 | auto* convModel = accountInfo_->conversationModel.get(); |
| 331 | |
| 332 | [ringingPanel setHidden:NO]; |
| 333 | [controlsPanel setHidden:YES]; |
| 334 | [headerContainer setHidden:YES]; |
Anthony Léonard | 6f81975 | 2018-01-05 09:53:40 -0500 | [diff] [blame] | 335 | auto it = getConversationFromUid(convUid_, *convModel); |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 336 | if (it != convModel->allFilteredConversations().end()) { |
| 337 | auto& imgManip = reinterpret_cast<Interfaces::ImageManipulationDelegate&>(GlobalInstances::pixmapManipulator()); |
| 338 | QVariant photo = imgManip.conversationPhoto(*it, *accountInfo_); |
| 339 | [incomingPersonPhoto setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(photo))]; |
Anthony Léonard | 8ee2678 | 2018-01-05 10:23:04 -0500 | [diff] [blame] | 340 | [incomingDisplayName setStringValue:bestNameForConversation(*it, *convModel)]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 341 | } |
| 342 | } |
| 343 | |
| 344 | |
| 345 | -(void) setupConference:(Call*) c |
| 346 | { |
| 347 | [videoView setShouldAcceptInteractions:YES]; |
| 348 | [self.chatButton setHidden:NO]; |
| 349 | [joinPanel setHidden:YES]; |
| 350 | [self.addParticipantButton setHidden:NO]; |
| 351 | [self.transferButton setHidden:YES]; |
| 352 | } |
| 353 | |
| 354 | -(void)collapseRightView |
| 355 | { |
| 356 | NSView *right = [[splitView subviews] objectAtIndex:1]; |
| 357 | NSView *left = [[splitView subviews] objectAtIndex:0]; |
| 358 | NSRect leftFrame = [left frame]; |
| 359 | [right setHidden:YES]; |
| 360 | [splitView display]; |
| 361 | } |
| 362 | |
| 363 | - (void) changeCallSelection:(std::string&)callUid |
| 364 | { |
| 365 | if (accountInfo_ == nil) |
| 366 | return; |
| 367 | |
| 368 | auto* callModel = accountInfo_->callModel.get(); |
| 369 | if (not callModel->hasCall(callUid)) { |
| 370 | return; |
| 371 | } |
| 372 | |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 373 | QObject::disconnect(self.selectedCallChanged); |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 374 | self.selectedCallChanged = QObject::connect(callModel, |
| 375 | &lrc::api::NewCallModel::callStatusChanged, |
| 376 | [self](const std::string callId) { |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 377 | [self updateCall]; |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 378 | }); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 379 | } |
| 380 | |
| 381 | -(void) connectVideoSignals |
| 382 | { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 383 | if (accountInfo_ == nil) |
| 384 | return; |
| 385 | |
| 386 | auto* callModel = accountInfo_->callModel.get(); |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 387 | QObject::disconnect(self.videoStarted); |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 388 | self.videoStarted = QObject::connect(callModel, |
| 389 | &lrc::api::NewCallModel::remotePreviewStarted, |
| 390 | [self](const std::string& callId, Video::Renderer* renderer) { |
| 391 | NSLog(@"Video started!"); |
Kateryna Kostiuk | 1004caa | 2018-03-29 13:48:07 -0400 | [diff] [blame] | 392 | [videoView setShouldAcceptInteractions:YES]; |
| 393 | [self mouseIsMoving: NO]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 394 | [self connectVideoRenderer:renderer]; |
| 395 | }); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 396 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 397 | if (callModel->hasCall(callUid_)) { |
| 398 | if (auto renderer = callModel->getRenderer(callUid_)) { |
| 399 | QObject::disconnect(self.videoStarted); |
| 400 | [self connectVideoRenderer: renderer]; |
| 401 | } |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 402 | } |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 403 | [self connectPreviewRenderer]; |
| 404 | |
| 405 | } |
| 406 | |
| 407 | -(void) connectPreviewRenderer |
| 408 | { |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 409 | QObject::disconnect(previewHolder.frameUpdated); |
| 410 | QObject::disconnect(previewHolder.stopped); |
| 411 | QObject::disconnect(previewHolder.started); |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 412 | previewHolder.started = QObject::connect(&Video::PreviewManager::instance(), |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 413 | &Video::PreviewManager::previewStarted, |
| 414 | [=](Video::Renderer* renderer) { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 415 | QObject::disconnect(previewHolder.frameUpdated); |
| 416 | previewHolder.frameUpdated = QObject::connect(renderer, |
| 417 | &Video::Renderer::frameUpdated, |
| 418 | [=]() { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 419 | [self renderer:Video::PreviewManager::instance().previewRenderer() |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 420 | renderFrameForPreviewView:previewView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 421 | }); |
| 422 | }); |
| 423 | |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 424 | previewHolder.stopped = QObject::connect(&Video::PreviewManager::instance(), |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 425 | &Video::PreviewManager::previewStopped, |
| 426 | [=](Video::Renderer* renderer) { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 427 | QObject::disconnect(previewHolder.frameUpdated); |
| 428 | [previewView.layer setContents:nil]; |
| 429 | }); |
| 430 | |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 431 | previewHolder.frameUpdated = QObject::connect(Video::PreviewManager::instance().previewRenderer(), |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 432 | &Video::Renderer::frameUpdated, |
| 433 | [=]() { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 434 | [self renderer:Video::PreviewManager::instance().previewRenderer() |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 435 | renderFrameForPreviewView:previewView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 436 | }); |
| 437 | } |
| 438 | |
| 439 | -(void) connectVideoRenderer: (Video::Renderer*)renderer |
| 440 | { |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 441 | QObject::disconnect(videoHolder.frameUpdated); |
| 442 | QObject::disconnect(videoHolder.started); |
| 443 | QObject::disconnect(videoHolder.stopped); |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 444 | |
| 445 | if(renderer == nil) |
| 446 | return; |
| 447 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 448 | videoHolder.frameUpdated = QObject::connect(renderer, |
| 449 | &Video::Renderer::frameUpdated, |
| 450 | [=]() { |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 451 | [self renderer:renderer renderFrameForDistantView:videoView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 452 | }); |
| 453 | |
| 454 | videoHolder.started = QObject::connect(renderer, |
| 455 | &Video::Renderer::started, |
| 456 | [=]() { |
Kateryna Kostiuk | 1004caa | 2018-03-29 13:48:07 -0400 | [diff] [blame] | 457 | [self mouseIsMoving: NO]; |
| 458 | [videoView setShouldAcceptInteractions:YES]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 459 | QObject::disconnect(videoHolder.frameUpdated); |
| 460 | videoHolder.frameUpdated = QObject::connect(renderer, |
| 461 | &Video::Renderer::frameUpdated, |
| 462 | [=]() { |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 463 | [self renderer:renderer renderFrameForDistantView:videoView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 464 | }); |
| 465 | }); |
| 466 | |
| 467 | videoHolder.stopped = QObject::connect(renderer, |
| 468 | &Video::Renderer::stopped, |
| 469 | [=]() { |
Kateryna Kostiuk | 1004caa | 2018-03-29 13:48:07 -0400 | [diff] [blame] | 470 | [self mouseIsMoving: YES]; |
| 471 | [videoView setShouldAcceptInteractions:NO]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 472 | QObject::disconnect(videoHolder.frameUpdated); |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 473 | [(CallLayer*)videoView.layer setVideoRunning:NO]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 474 | }); |
| 475 | } |
| 476 | |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 477 | -(void) renderer: (Video::Renderer*)renderer renderFrameForPreviewView:(NSView*) view |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 478 | { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 479 | QSize res = renderer->size(); |
| 480 | |
Alexandre Lision | 6731e13 | 2015-10-14 14:29:06 -0400 | [diff] [blame] | 481 | auto frame_ptr = renderer->currentFrame(); |
| 482 | auto frame_data = frame_ptr.ptr; |
| 483 | if (!frame_data) |
| 484 | return; |
| 485 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 486 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); |
Alexandre Lision | 6731e13 | 2015-10-14 14:29:06 -0400 | [diff] [blame] | 487 | CGContextRef newContext = CGBitmapContextCreate(frame_data, |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 488 | res.width(), |
| 489 | res.height(), |
| 490 | 8, |
| 491 | 4*res.width(), |
| 492 | colorSpace, |
| 493 | kCGImageAlphaPremultipliedLast); |
| 494 | |
| 495 | |
| 496 | CGImageRef newImage = CGBitmapContextCreateImage(newContext); |
| 497 | |
| 498 | /*We release some components*/ |
| 499 | CGContextRelease(newContext); |
| 500 | CGColorSpaceRelease(colorSpace); |
| 501 | |
| 502 | [CATransaction begin]; |
| 503 | view.layer.contents = (__bridge id)newImage; |
| 504 | [CATransaction commit]; |
| 505 | |
| 506 | CFRelease(newImage); |
| 507 | } |
| 508 | |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 509 | -(void) renderer: (Video::Renderer*)renderer renderFrameForDistantView:(CallView*) view |
| 510 | { |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 511 | auto frame_ptr = renderer->currentFrame(); |
| 512 | if (!frame_ptr.ptr) |
| 513 | return; |
| 514 | |
| 515 | CallLayer* callLayer = (CallLayer*) view.layer; |
| 516 | |
Anthony Léonard | a9d7c8e | 2018-01-03 14:41:17 -0500 | [diff] [blame] | 517 | [callLayer setCurrentFrame:std::move(frame_ptr)]; |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 518 | [callLayer setVideoRunning:YES]; |
| 519 | } |
| 520 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 521 | - (void) initFrame |
| 522 | { |
| 523 | [self.view setFrame:self.view.superview.bounds]; |
| 524 | [self.view setHidden:YES]; |
| 525 | self.view.layer.position = self.view.frame.origin; |
Alexandre Lision | bb5dbcd | 2015-07-09 16:36:47 -0400 | [diff] [blame] | 526 | [self collapseRightView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 527 | } |
| 528 | |
| 529 | # pragma private IN/OUT animations |
| 530 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 531 | -(void)uncollapseRightView |
| 532 | { |
| 533 | NSView *left = [[splitView subviews] objectAtIndex:0]; |
| 534 | NSView *right = [[splitView subviews] objectAtIndex:1]; |
| 535 | [right setHidden:NO]; |
| 536 | |
| 537 | CGFloat dividerThickness = [splitView dividerThickness]; |
| 538 | |
| 539 | // get the different frames |
| 540 | NSRect leftFrame = [left frame]; |
| 541 | NSRect rightFrame = [right frame]; |
| 542 | |
| 543 | leftFrame.size.width = (leftFrame.size.width - rightFrame.size.width - dividerThickness); |
| 544 | rightFrame.origin.x = leftFrame.size.width + dividerThickness; |
| 545 | [left setFrameSize:leftFrame.size]; |
| 546 | [right setFrame:rightFrame]; |
| 547 | [splitView display]; |
| 548 | |
| 549 | [self.chatVC takeFocus]; |
| 550 | } |
| 551 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 552 | -(void) cleanUp |
| 553 | { |
Anthony Léonard | 5c28764 | 2018-02-21 15:54:19 -0500 | [diff] [blame] | 554 | if(self.splitView.isInFullScreenMode) |
| 555 | [self.splitView exitFullScreenModeWithOptions:nil]; |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 556 | QObject::disconnect(videoHolder.frameUpdated); |
| 557 | QObject::disconnect(videoHolder.started); |
| 558 | QObject::disconnect(videoHolder.stopped); |
| 559 | QObject::disconnect(previewHolder.frameUpdated); |
| 560 | QObject::disconnect(previewHolder.stopped); |
| 561 | QObject::disconnect(previewHolder.started); |
Anthony Léonard | c0013bb | 2018-02-20 16:23:02 -0500 | [diff] [blame] | 562 | QObject::disconnect(self.messageConnection); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 563 | [previewView.layer setContents:nil]; |
Kateryna Kostiuk | 1004caa | 2018-03-29 13:48:07 -0400 | [diff] [blame] | 564 | [(CallLayer*)videoView.layer setVideoRunning:NO]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 565 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 566 | [_brokerPopoverVC performClose:self]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 567 | [self.addToContactPopover performClose:self]; |
Alexandre Lision | 0e66aea | 2015-11-02 16:36:30 -0500 | [diff] [blame] | 568 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 569 | [self.chatButton setHidden:YES]; |
| 570 | [self.addParticipantButton setHidden:YES]; |
| 571 | [self.transferButton setHidden:YES]; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 572 | [self.qualityButton setHidden:YES]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 573 | |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 574 | [self.chatButton setPressed:NO]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 575 | [self.mergeCallsButton setState:NSOffState]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 576 | [self collapseRightView]; |
Alexandre Lision | 5722777 | 2016-01-15 17:19:36 -0500 | [diff] [blame] | 577 | |
| 578 | [personLabel setStringValue:@""]; |
| 579 | [timeSpentLabel setStringValue:@""]; |
| 580 | [stateLabel setStringValue:@""]; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 581 | |
| 582 | [outgoingPersonLabel setStringValue:@""]; |
| 583 | [outgoingStateLabel setStringValue:@""]; |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 584 | |
| 585 | [advancedButton setPressed:NO]; |
| 586 | [advancedPanel setHidden:YES]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 587 | } |
| 588 | |
Andreas Traczyk | ecdc4fa | 2018-03-22 16:11:47 -0400 | [diff] [blame] | 589 | -(void) setupCallView |
| 590 | { |
| 591 | if (accountInfo_ == nil) |
| 592 | return; |
| 593 | |
| 594 | auto* callModel = accountInfo_->callModel.get(); |
| 595 | auto* convModel = accountInfo_->conversationModel.get(); |
| 596 | |
| 597 | // when call comes in we want to show the controls/header |
Kateryna Kostiuk | 1004caa | 2018-03-29 13:48:07 -0400 | [diff] [blame] | 598 | [self mouseIsMoving: YES]; |
| 599 | [videoView setShouldAcceptInteractions: NO]; |
Andreas Traczyk | ecdc4fa | 2018-03-22 16:11:47 -0400 | [diff] [blame] | 600 | |
| 601 | [self connectVideoSignals]; |
| 602 | /* check if text media is already present */ |
| 603 | if(not callModel->hasCall(callUid_)) |
| 604 | return; |
| 605 | |
| 606 | [loadingIndicator setAnimates:YES]; |
Andreas Traczyk | 77a50d5 | 2018-05-08 17:47:31 -0400 | [diff] [blame] | 607 | [self updateCall]; |
Andreas Traczyk | ecdc4fa | 2018-03-22 16:11:47 -0400 | [diff] [blame] | 608 | |
| 609 | /* monitor media for messaging text messaging */ |
| 610 | QObject::disconnect(self.messageConnection); |
| 611 | self.messageConnection = QObject::connect(convModel, |
| 612 | &lrc::api::ConversationModel::interactionStatusUpdated, |
| 613 | [self] (std::string convUid, |
| 614 | uint64_t msgId, |
| 615 | lrc::api::interaction::Info msg) { |
| 616 | if (msg.type == lrc::api::interaction::Type::TEXT) { |
| 617 | if(not [[self splitView] isSubviewCollapsed:[[[self splitView] subviews] objectAtIndex: 1]]){ |
| 618 | return; |
| 619 | } |
| 620 | [self uncollapseRightView]; |
| 621 | } |
| 622 | }); |
| 623 | } |
| 624 | |
| 625 | -(void) showWithAnimation:(BOOL)animate |
| 626 | { |
| 627 | if (!animate) { |
| 628 | [self.view setHidden:NO]; |
| 629 | [self setupCallView]; |
| 630 | return; |
| 631 | } |
| 632 | |
| 633 | CGRect frame = CGRectOffset(self.view.superview.bounds, -self.view.superview.bounds.size.width, 0); |
| 634 | [self.view setHidden:NO]; |
| 635 | |
| 636 | [CATransaction begin]; |
| 637 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; |
| 638 | [animation setFromValue:[NSValue valueWithPoint:frame.origin]]; |
| 639 | [animation setToValue:[NSValue valueWithPoint:self.view.superview.bounds.origin]]; |
| 640 | [animation setDuration:0.2f]; |
| 641 | [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]]; |
| 642 | [CATransaction setCompletionBlock:^{ |
| 643 | [self setupCallView]; |
| 644 | }]; |
| 645 | |
| 646 | [self.view.layer addAnimation:animation forKey:animation.keyPath]; |
| 647 | [CATransaction commit]; |
| 648 | } |
| 649 | |
| 650 | -(void) hideWithAnimation:(BOOL)animate |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 651 | { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 652 | if(self.view.frame.origin.x < 0) { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 653 | return; |
| 654 | } |
| 655 | |
Andreas Traczyk | ecdc4fa | 2018-03-22 16:11:47 -0400 | [diff] [blame] | 656 | if (!animate) { |
Kateryna Kostiuk | 1004caa | 2018-03-29 13:48:07 -0400 | [diff] [blame] | 657 | [self cleanUp]; |
Andreas Traczyk | ecdc4fa | 2018-03-22 16:11:47 -0400 | [diff] [blame] | 658 | [self.view setHidden:YES]; |
| 659 | return; |
| 660 | } |
| 661 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 662 | CGRect frame = CGRectOffset(self.view.frame, -self.view.frame.size.width, 0); |
| 663 | [CATransaction begin]; |
| 664 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; |
| 665 | [animation setFromValue:[NSValue valueWithPoint:self.view.frame.origin]]; |
| 666 | [animation setToValue:[NSValue valueWithPoint:frame.origin]]; |
| 667 | [animation setDuration:0.2f]; |
Alexandre Lision | 22d615b | 2016-01-25 12:54:34 -0500 | [diff] [blame] | 668 | [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 669 | |
| 670 | [CATransaction setCompletionBlock:^{ |
| 671 | [self.view setHidden:YES]; |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 672 | // first make sure everything is disconnected |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 673 | [self cleanUp]; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 674 | // if (currentCall_) { |
| 675 | // [self animateIn]; |
| 676 | // } |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 677 | }]; |
| 678 | [self.view.layer addAnimation:animation forKey:animation.keyPath]; |
Alexandre Lision | a1c6d75 | 2015-06-23 12:27:38 -0400 | [diff] [blame] | 679 | |
| 680 | [self.view.layer setPosition:frame.origin]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 681 | [CATransaction commit]; |
| 682 | } |
| 683 | |
| 684 | /** |
| 685 | * Debug purpose |
| 686 | */ |
| 687 | -(void) dumpFrame:(CGRect) frame WithName:(NSString*) name |
| 688 | { |
| 689 | NSLog(@"frame %@ : %f %f %f %f \n\n",name ,frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); |
| 690 | } |
| 691 | |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 692 | #pragma mark - Button methods |
| 693 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 694 | - (IBAction)hangUp:(id)sender { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 695 | if (accountInfo_ == nil) |
| 696 | return; |
| 697 | |
| 698 | auto* callModel = accountInfo_->callModel.get(); |
| 699 | |
| 700 | callModel->hangUp(callUid_); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 701 | } |
| 702 | |
| 703 | - (IBAction)accept:(id)sender { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 704 | if (accountInfo_ == nil) |
| 705 | return; |
| 706 | |
Anthony Léonard | f584cc5 | 2018-01-19 12:00:19 -0500 | [diff] [blame] | 707 | // If we accept a conversation with a non trusted contact, we first accept it |
| 708 | auto convIt = getConversationFromUid(convUid_, *accountInfo_->conversationModel.get()); |
| 709 | if (convIt != accountInfo_->conversationModel->allFilteredConversations().end()) { |
| 710 | auto& contact = accountInfo_->contactModel->getContact(convIt->participants[0]); |
| 711 | if (contact.profileInfo.type == lrc::api::profile::Type::PENDING) |
| 712 | accountInfo_->conversationModel->makePermanent(convUid_); |
| 713 | } |
| 714 | |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 715 | auto* callModel = accountInfo_->callModel.get(); |
| 716 | |
| 717 | callModel->accept(callUid_); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 718 | } |
| 719 | |
| 720 | - (IBAction)toggleRecording:(id)sender { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 721 | if (accountInfo_ == nil) |
| 722 | return; |
| 723 | |
| 724 | auto* callModel = accountInfo_->callModel.get(); |
| 725 | |
| 726 | callModel->toggleAudioRecord(callUid_); |
Kateryna Kostiuk | 54d7697 | 2018-06-07 15:45:07 -0400 | [diff] [blame^] | 727 | [recordOnOffButton setPressed:!recordOnOffButton.isPressed]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 728 | } |
| 729 | |
| 730 | - (IBAction)toggleHold:(id)sender { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 731 | if (accountInfo_ == nil) |
| 732 | return; |
| 733 | |
| 734 | auto* callModel = accountInfo_->callModel.get(); |
Kateryna Kostiuk | 54d7697 | 2018-06-07 15:45:07 -0400 | [diff] [blame^] | 735 | auto currentCall = callModel->getCall(callUid_); |
| 736 | if (currentCall.status != lrc::api::call::Status::PAUSED) { |
| 737 | holdOnOffButton.image = [NSImage imageNamed:@"ic_action_holdoff.png"]; |
| 738 | } else { |
| 739 | holdOnOffButton.image = [NSImage imageNamed:@"ic_action_hold.png"]; |
| 740 | } |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 741 | |
| 742 | callModel->togglePause(callUid_); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 743 | } |
| 744 | |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 745 | - (IBAction)toggleAdvancedControls:(id)sender { |
| 746 | [advancedButton setPressed:!advancedButton.isPressed]; |
| 747 | [advancedPanel setHidden:![advancedButton isPressed]]; |
| 748 | } |
| 749 | |
| 750 | - (IBAction)showDialpad:(id)sender { |
| 751 | AppDelegate* appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate]; |
| 752 | [appDelegate showDialpad]; |
| 753 | } |
| 754 | |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 755 | -(IBAction)toggleChat:(id)sender; |
| 756 | { |
| 757 | BOOL rightViewCollapsed = [[self splitView] isSubviewCollapsed:[[[self splitView] subviews] objectAtIndex: 1]]; |
| 758 | if (rightViewCollapsed) { |
| 759 | [self uncollapseRightView]; |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 760 | } else { |
| 761 | [self collapseRightView]; |
| 762 | } |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 763 | [chatButton setPressed:rightViewCollapsed]; |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 764 | } |
| 765 | |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 766 | - (IBAction)muteAudio:(id)sender |
| 767 | { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 768 | if (accountInfo_ == nil) |
| 769 | return; |
| 770 | |
| 771 | auto* callModel = accountInfo_->callModel.get(); |
Kateryna Kostiuk | 54d7697 | 2018-06-07 15:45:07 -0400 | [diff] [blame^] | 772 | auto currentCall = callModel->getCall(callUid_); |
| 773 | if (currentCall.audioMuted) { |
| 774 | muteAudioButton.image = [NSImage imageNamed:@"ic_action_audio.png"]; |
| 775 | } else { |
| 776 | muteAudioButton.image = [NSImage imageNamed:@"ic_action_mute_audio.png"]; |
| 777 | } |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 778 | callModel->toggleMedia(callUid_, lrc::api::NewCallModel::Media::AUDIO); |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | - (IBAction)muteVideo:(id)sender |
| 782 | { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 783 | if (accountInfo_ == nil) |
| 784 | return; |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 785 | auto* callModel = accountInfo_->callModel.get(); |
Kateryna Kostiuk | 54d7697 | 2018-06-07 15:45:07 -0400 | [diff] [blame^] | 786 | auto currentCall = callModel->getCall(callUid_); |
| 787 | if(!currentCall.isAudioOnly) { |
| 788 | if (currentCall.videoMuted) { |
| 789 | muteVideoButton.image = [NSImage imageNamed:@"ic_action_video.png"]; |
| 790 | } else { |
| 791 | muteVideoButton.image = [NSImage imageNamed:@"ic_action_mute_video.png"]; |
| 792 | } |
| 793 | } |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 794 | callModel->toggleMedia(callUid_, lrc::api::NewCallModel::Media::VIDEO); |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 795 | } |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 796 | |
| 797 | - (IBAction)toggleTransferView:(id)sender { |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 798 | if (_brokerPopoverVC != nullptr) { |
| 799 | [_brokerPopoverVC performClose:self]; |
| 800 | _brokerPopoverVC = NULL; |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 801 | [self.transferButton setPressed:NO]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 802 | } else { |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 803 | auto* brokerVC = [[BrokerVC alloc] initWithMode:BrokerMode::TRANSFER]; |
| 804 | _brokerPopoverVC = [[NSPopover alloc] init]; |
| 805 | [_brokerPopoverVC setContentSize:brokerVC.view.frame.size]; |
| 806 | [_brokerPopoverVC setContentViewController:brokerVC]; |
| 807 | [_brokerPopoverVC setAnimates:YES]; |
| 808 | [_brokerPopoverVC setBehavior:NSPopoverBehaviorTransient]; |
| 809 | [_brokerPopoverVC setDelegate:self]; |
| 810 | [_brokerPopoverVC showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 811 | [videoView setCallDelegate:nil]; |
| 812 | } |
Alexandre Lision | f23ec5a | 2015-07-16 11:24:06 -0400 | [diff] [blame] | 813 | } |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 814 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 815 | - (IBAction)toggleAddParticipantView:(id)sender { |
| 816 | if (_brokerPopoverVC != nullptr) { |
| 817 | [_brokerPopoverVC performClose:self]; |
| 818 | _brokerPopoverVC = NULL; |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 819 | [self.addParticipantButton setPressed:NO]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 820 | } else { |
| 821 | auto* brokerVC = [[BrokerVC alloc] initWithMode:BrokerMode::CONFERENCE]; |
| 822 | _brokerPopoverVC = [[NSPopover alloc] init]; |
| 823 | [_brokerPopoverVC setContentSize:brokerVC.view.frame.size]; |
| 824 | [_brokerPopoverVC setContentViewController:brokerVC]; |
| 825 | [_brokerPopoverVC setAnimates:YES]; |
| 826 | [_brokerPopoverVC setBehavior:NSPopoverBehaviorTransient]; |
| 827 | [_brokerPopoverVC setDelegate:self]; |
| 828 | [_brokerPopoverVC showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge]; |
| 829 | [videoView setCallDelegate:nil]; |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | /** |
| 834 | * Merge current call with its parent call |
| 835 | */ |
| 836 | - (IBAction)mergeCalls:(id)sender |
| 837 | { |
Olivier Soldano | 994971f | 2017-12-05 16:30:12 -0500 | [diff] [blame] | 838 | // auto current = CallModel::instance().selectedCall(); |
| 839 | // current->joinToParent(); |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 840 | } |
| 841 | |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 842 | #pragma mark - NSPopOverDelegate |
| 843 | |
Alexandre Lision | 266fca0 | 2015-09-28 14:47:05 -0400 | [diff] [blame] | 844 | - (void)popoverWillClose:(NSNotification *)notification |
| 845 | { |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 846 | if (_brokerPopoverVC != nullptr) { |
| 847 | [_brokerPopoverVC performClose:self]; |
| 848 | _brokerPopoverVC = NULL; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 849 | } |
Alexandre Lision | 266fca0 | 2015-09-28 14:47:05 -0400 | [diff] [blame] | 850 | |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 851 | if (self.addToContactPopover != nullptr) { |
| 852 | [self.addToContactPopover performClose:self]; |
| 853 | self.addToContactPopover = NULL; |
| 854 | } |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 855 | |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 856 | [self.transferButton setPressed:NO]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 857 | [self.addParticipantButton setState:NSOffState]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 858 | } |
| 859 | |
| 860 | - (void)popoverDidClose:(NSNotification *)notification |
| 861 | { |
| 862 | [videoView setCallDelegate:self]; |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 863 | } |
| 864 | |
| 865 | #pragma mark - ContactLinkedDelegate |
| 866 | |
| 867 | - (void)contactLinked |
| 868 | { |
| 869 | if (self.addToContactPopover != nullptr) { |
| 870 | [self.addToContactPopover performClose:self]; |
| 871 | self.addToContactPopover = NULL; |
| 872 | } |
| 873 | } |
| 874 | |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 875 | #pragma mark - NSSplitViewDelegate |
| 876 | |
| 877 | /* Return YES if the subview should be collapsed because the user has double-clicked on an adjacent divider. If a split view has a delegate, and the delegate responds to this message, it will be sent once for the subview before a divider when the user double-clicks on that divider, and again for the subview after the divider, but only if the delegate returned YES when sent -splitView:canCollapseSubview: for the subview in question. When the delegate indicates that both subviews should be collapsed NSSplitView's behavior is undefined. |
| 878 | */ |
| 879 | - (BOOL)splitView:(NSSplitView *)splitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex; |
| 880 | { |
| 881 | NSView* rightView = [[splitView subviews] objectAtIndex:1]; |
| 882 | return ([subview isEqual:rightView]); |
| 883 | } |
| 884 | |
| 885 | |
| 886 | - (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview; |
| 887 | { |
| 888 | NSView* rightView = [[splitView subviews] objectAtIndex:1]; |
| 889 | return ([subview isEqual:rightView]); |
| 890 | } |
| 891 | |
| 892 | |
Alexandre Lision | a1eee3c | 2015-08-10 13:44:51 -0400 | [diff] [blame] | 893 | # pragma mark - CallnDelegate |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 894 | |
| 895 | - (void) callShouldToggleFullScreen |
| 896 | { |
| 897 | if(self.splitView.isInFullScreenMode) |
| 898 | [self.splitView exitFullScreenModeWithOptions:nil]; |
| 899 | else { |
| 900 | NSApplicationPresentationOptions options = NSApplicationPresentationDefault +NSApplicationPresentationAutoHideDock + |
| 901 | NSApplicationPresentationAutoHideMenuBar + NSApplicationPresentationAutoHideToolbar; |
| 902 | NSDictionary *opts = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:options], |
| 903 | NSFullScreenModeApplicationPresentationOptions, nil]; |
| 904 | |
| 905 | [self.splitView enterFullScreenMode:[NSScreen mainScreen] withOptions:opts]; |
| 906 | } |
| 907 | } |
| 908 | |
Alexandre Lision | a1eee3c | 2015-08-10 13:44:51 -0400 | [diff] [blame] | 909 | -(void) mouseIsMoving:(BOOL) move |
| 910 | { |
| 911 | [[controlsPanel animator] setAlphaValue:move]; // fade out |
| 912 | [[headerContainer animator] setAlphaValue:move]; |
| 913 | } |
| 914 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 915 | @end |