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 <call.h> |
| 33 | #import <callmodel.h> |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 34 | #import <recentmodel.h> |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 35 | #import <useractionmodel.h> |
| 36 | #import <contactmethod.h> |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 37 | #import <video/previewmanager.h> |
| 38 | #import <video/renderer.h> |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 39 | #import <media/text.h> |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 40 | #import <person.h> |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 41 | #import <globalinstances.h> |
Anthony Léonard | 6097085 | 2017-07-21 11:33:41 -0400 | [diff] [blame] | 42 | #import <personmodel.h> |
| 43 | #import <peerprofilecollection.h> |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 44 | |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 45 | #import "AppDelegate.h" |
Alexandre Lision | f47a256 | 2015-06-15 15:48:29 -0400 | [diff] [blame] | 46 | #import "views/ITProgressIndicator.h" |
Alexandre Lision | 74dd47f | 2015-04-14 13:47:42 -0400 | [diff] [blame] | 47 | #import "views/CallView.h" |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 48 | #import "delegates/ImageManipulationDelegate.h" |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 49 | #import "PersonLinkerVC.h" |
Alexandre Lision | 16d9c0a | 2015-08-10 12:05:15 -0400 | [diff] [blame] | 50 | #import "ChatVC.h" |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 51 | #import "BrokerVC.h" |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 52 | #import "views/IconButton.h" |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 53 | #import "views/CallLayer.h" |
Alexandre Lision | 74dd47f | 2015-04-14 13:47:42 -0400 | [diff] [blame] | 54 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 55 | @interface RendererConnectionsHolder : NSObject |
| 56 | |
| 57 | @property QMetaObject::Connection frameUpdated; |
| 58 | @property QMetaObject::Connection started; |
| 59 | @property QMetaObject::Connection stopped; |
| 60 | |
| 61 | @end |
| 62 | |
| 63 | @implementation RendererConnectionsHolder |
| 64 | |
| 65 | @end |
| 66 | |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 67 | @interface CurrentCallVC () <NSPopoverDelegate, ContactLinkedDelegate> |
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 | |
| 79 | // Call Controls |
| 80 | @property (unsafe_unretained) IBOutlet NSView* controlsPanel; |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 81 | |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 82 | @property QHash<int, IconButton*> actionHash; |
| 83 | @property (unsafe_unretained) IBOutlet IconButton* holdOnOffButton; |
| 84 | @property (unsafe_unretained) IBOutlet IconButton* hangUpButton; |
| 85 | @property (unsafe_unretained) IBOutlet IconButton* recordOnOffButton; |
| 86 | @property (unsafe_unretained) IBOutlet IconButton* pickUpButton; |
| 87 | @property (unsafe_unretained) IBOutlet IconButton* muteAudioButton; |
| 88 | @property (unsafe_unretained) IBOutlet IconButton* muteVideoButton; |
| 89 | @property (unsafe_unretained) IBOutlet IconButton* addContactButton; |
| 90 | @property (unsafe_unretained) IBOutlet IconButton* transferButton; |
| 91 | @property (unsafe_unretained) IBOutlet IconButton* addParticipantButton; |
| 92 | @property (unsafe_unretained) IBOutlet IconButton* chatButton; |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 93 | |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 94 | @property (unsafe_unretained) IBOutlet NSView* advancedPanel; |
| 95 | @property (unsafe_unretained) IBOutlet IconButton* advancedButton; |
| 96 | |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 97 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 98 | // Join call panel |
| 99 | @property (unsafe_unretained) IBOutlet NSView* joinPanel; |
| 100 | @property (unsafe_unretained) IBOutlet NSButton* mergeCallsButton; |
| 101 | |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 102 | @property (strong) NSPopover* addToContactPopover; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 103 | @property (strong) NSPopover* brokerPopoverVC; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 104 | @property (strong) IBOutlet ChatVC* chatVC; |
Alexandre Lision | f23ec5a | 2015-07-16 11:24:06 -0400 | [diff] [blame] | 105 | |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 106 | // Ringing call panel |
| 107 | @property (unsafe_unretained) IBOutlet NSView* ringingPanel; |
| 108 | @property (unsafe_unretained) IBOutlet NSImageView* incomingPersonPhoto; |
| 109 | @property (unsafe_unretained) IBOutlet NSTextField* incomingDisplayName; |
| 110 | |
| 111 | // Outgoing call panel |
| 112 | @property (unsafe_unretained) IBOutlet NSView* outgoingPanel; |
| 113 | @property (unsafe_unretained) IBOutlet ITProgressIndicator *loadingIndicator; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 114 | |
| 115 | // Video |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 116 | @property (unsafe_unretained) IBOutlet CallView *videoView; |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 117 | @property (unsafe_unretained) IBOutlet NSView *previewView; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 118 | |
| 119 | @property RendererConnectionsHolder* previewHolder; |
| 120 | @property RendererConnectionsHolder* videoHolder; |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 121 | @property QMetaObject::Connection videoStarted; |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 122 | @property QMetaObject::Connection selectedCallChanged; |
Alexandre Lision | b65c027 | 2015-07-22 15:51:29 -0400 | [diff] [blame] | 123 | @property QMetaObject::Connection messageConnection; |
| 124 | @property QMetaObject::Connection mediaAddedConnection; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 125 | |
| 126 | @end |
| 127 | |
| 128 | @implementation CurrentCallVC |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 129 | @synthesize personLabel, personPhoto, actionHash, stateLabel, holdOnOffButton, hangUpButton, |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 130 | recordOnOffButton, pickUpButton, chatButton, transferButton, addParticipantButton, timeSpentLabel, |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 131 | muteVideoButton, muteAudioButton, controlsPanel, advancedPanel, advancedButton, headerContainer, videoView, incomingDisplayName, incomingPersonPhoto, |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 132 | previewView, splitView, loadingIndicator, ringingPanel, joinPanel, outgoingPanel; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 133 | |
| 134 | @synthesize previewHolder; |
| 135 | @synthesize videoHolder; |
| 136 | |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 137 | - (void) updateAllActions |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 138 | { |
Alexandre Lision | f7e1114 | 2015-12-15 10:58:11 -0500 | [diff] [blame] | 139 | for (int i = 0 ; i < CallModel::instance().userActionModel()->rowCount() ; i++) { |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 140 | [self updateActionAtIndex:i]; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | - (void) updateActionAtIndex:(int) row |
| 145 | { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 146 | const QModelIndex& idx = CallModel::instance().userActionModel()->index(row,0); |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 147 | UserActionModel::Action action = qvariant_cast<UserActionModel::Action>(idx.data(UserActionModel::Role::ACTION)); |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 148 | if (auto a = actionHash[(int) action]) { |
Alexandre Lision | 266fca0 | 2015-09-28 14:47:05 -0400 | [diff] [blame] | 149 | [a setHidden:!(idx.flags() & Qt::ItemIsEnabled)]; |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 150 | [a setPressed:(idx.data(Qt::CheckStateRole) == Qt::Checked) ? YES : NO]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 151 | } |
| 152 | } |
| 153 | |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 154 | -(void) updateCall:(BOOL) firstRun |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 155 | { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 156 | QModelIndex callIdx = CallModel::instance().selectionModel()->currentIndex(); |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 157 | if (!callIdx.isValid()) { |
| 158 | return; |
| 159 | } |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 160 | auto current = CallModel::instance().selectedCall(); |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 161 | |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 162 | [personLabel setStringValue:callIdx.data(Qt::DisplayRole).toString().toNSString()]; |
| 163 | [timeSpentLabel setStringValue:callIdx.data((int)Call::Role::Length).toString().toNSString()]; |
Alexandre Lision | 5722777 | 2016-01-15 17:19:36 -0500 | [diff] [blame] | 164 | [stateLabel setStringValue:callIdx.data((int)Call::Role::HumanStateName).toString().toNSString()]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 165 | |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 166 | if (firstRun) { |
Alexandre Lision | 261f1b9 | 2016-04-04 12:35:34 -0400 | [diff] [blame] | 167 | QVariant photo = GlobalInstances::pixmapManipulator().callPhoto(current, QSize(100,100)); |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 168 | [personPhoto setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(photo))]; |
| 169 | } |
| 170 | |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 171 | auto contactmethod = qvariant_cast<Call*>(callIdx.data(static_cast<int>(Call::Role::Object)))->peerContactMethod(); |
| 172 | BOOL shouldShow = (!contactmethod->contact() || contactmethod->contact()->isPlaceHolder()); |
| 173 | [self.addContactButton setHidden:!shouldShow]; |
| 174 | |
Alexandre Lision | 266fca0 | 2015-09-28 14:47:05 -0400 | [diff] [blame] | 175 | // Default values for this views |
Alexandre Lision | f47a256 | 2015-06-15 15:48:29 -0400 | [diff] [blame] | 176 | [loadingIndicator setHidden:YES]; |
Alexandre Lision | 266fca0 | 2015-09-28 14:47:05 -0400 | [diff] [blame] | 177 | [videoView setShouldAcceptInteractions:NO]; |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 178 | [ringingPanel setHidden:YES]; |
| 179 | [outgoingPanel setHidden:YES]; |
| 180 | [controlsPanel setHidden:NO]; |
| 181 | [headerContainer setHidden:NO]; |
Alexandre Lision | 266fca0 | 2015-09-28 14:47:05 -0400 | [diff] [blame] | 182 | |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 183 | auto state = callIdx.data((int)Call::Role::State).value<Call::State>(); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 184 | switch (state) { |
Alexandre Lision | e6dbf09 | 2015-04-11 17:19:35 -0400 | [diff] [blame] | 185 | case Call::State::NEW: |
Alexandre Lision | e6dbf09 | 2015-04-11 17:19:35 -0400 | [diff] [blame] | 186 | break; |
Alexandre Lision | 22d615b | 2016-01-25 12:54:34 -0500 | [diff] [blame] | 187 | case Call::State::DIALING: |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 188 | case Call::State::INITIALIZATION: |
Alexandre Lision | f47a256 | 2015-06-15 15:48:29 -0400 | [diff] [blame] | 189 | case Call::State::CONNECTED: |
Alexandre Lision | f47a256 | 2015-06-15 15:48:29 -0400 | [diff] [blame] | 190 | [loadingIndicator setHidden:NO]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 191 | case Call::State::RINGING: |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 192 | [controlsPanel setHidden:YES]; |
| 193 | [outgoingPanel setHidden:NO]; |
| 194 | break; |
| 195 | case Call::State::INCOMING: |
| 196 | [self setupIncoming:current]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 197 | break; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 198 | case Call::State::CONFERENCE: |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 199 | [self setupConference:current]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 200 | break; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 201 | case Call::State::CURRENT: |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 202 | [self setupCurrent:current]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 203 | break; |
| 204 | case Call::State::HOLD: |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 205 | break; |
| 206 | case Call::State::BUSY: |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 207 | break; |
| 208 | case Call::State::OVER: |
Alexandre Lision | 266fca0 | 2015-09-28 14:47:05 -0400 | [diff] [blame] | 209 | case Call::State::FAILURE: |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 210 | [controlsPanel setHidden:YES]; |
| 211 | [outgoingPanel setHidden:NO]; |
Alexandre Lision | a1eee3c | 2015-08-10 13:44:51 -0400 | [diff] [blame] | 212 | if(self.splitView.isInFullScreenMode) |
| 213 | [self.splitView exitFullScreenModeWithOptions:nil]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 214 | break; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 215 | } |
| 216 | |
| 217 | } |
| 218 | |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 219 | -(void) setupIncoming:(Call*) c |
| 220 | { |
| 221 | [ringingPanel setHidden:NO]; |
| 222 | [controlsPanel setHidden:YES]; |
| 223 | [headerContainer setHidden:YES]; |
| 224 | QVariant photo = GlobalInstances::pixmapManipulator().callPhoto(c, QSize(100,100)); |
| 225 | [incomingPersonPhoto setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(photo))]; |
| 226 | [incomingDisplayName setStringValue:c->formattedName().toNSString()]; |
| 227 | } |
| 228 | |
| 229 | -(void) setupCurrent:(Call*) c |
| 230 | { |
| 231 | [joinPanel setHidden:!c->hasParentCall()]; |
| 232 | [controlsPanel setHidden:c->hasParentCall()]; |
| 233 | [videoView setShouldAcceptInteractions:YES]; |
| 234 | [self.chatButton setHidden:NO]; |
| 235 | [self.addParticipantButton setHidden:NO]; |
| 236 | [self.transferButton setHidden:NO]; |
| 237 | } |
| 238 | |
| 239 | -(void) setupConference:(Call*) c |
| 240 | { |
| 241 | [videoView setShouldAcceptInteractions:YES]; |
| 242 | [self.chatButton setHidden:NO]; |
| 243 | [joinPanel setHidden:YES]; |
| 244 | [self.addParticipantButton setHidden:NO]; |
| 245 | [self.transferButton setHidden:YES]; |
| 246 | } |
| 247 | |
| 248 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 249 | - (void)awakeFromNib |
| 250 | { |
| 251 | NSLog(@"INIT CurrentCall VC"); |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 252 | [self.view setWantsLayer:YES]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 253 | |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 254 | actionHash[ (int)UserActionModel::Action::ACCEPT] = pickUpButton; |
| 255 | actionHash[ (int)UserActionModel::Action::HOLD ] = holdOnOffButton; |
| 256 | actionHash[ (int)UserActionModel::Action::RECORD] = recordOnOffButton; |
| 257 | actionHash[ (int)UserActionModel::Action::HANGUP] = hangUpButton; |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 258 | actionHash[ (int)UserActionModel::Action::MUTE_AUDIO] = muteAudioButton; |
| 259 | actionHash[ (int)UserActionModel::Action::MUTE_VIDEO] = muteVideoButton; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 260 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 261 | [previewView setWantsLayer:YES]; |
Alexandre Lision | 22d615b | 2016-01-25 12:54:34 -0500 | [diff] [blame] | 262 | [previewView.layer setBackgroundColor:[NSColor blackColor].CGColor]; |
| 263 | [previewView.layer setContentsGravity:kCAGravityResizeAspectFill]; |
| 264 | [previewView.layer setFrame:previewView.frame]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 265 | |
| 266 | [controlsPanel setWantsLayer:YES]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 267 | [controlsPanel.layer setBackgroundColor:[NSColor clearColor].CGColor]; |
| 268 | [controlsPanel.layer setFrame:controlsPanel.frame]; |
| 269 | |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 270 | previewHolder = [[RendererConnectionsHolder alloc] init]; |
| 271 | videoHolder = [[RendererConnectionsHolder alloc] init]; |
| 272 | |
Alexandre Lision | f47a256 | 2015-06-15 15:48:29 -0400 | [diff] [blame] | 273 | [loadingIndicator setColor:[NSColor whiteColor]]; |
| 274 | [loadingIndicator setNumberOfLines:100]; |
| 275 | [loadingIndicator setWidthOfLine:2]; |
| 276 | [loadingIndicator setLengthOfLine:2]; |
| 277 | [loadingIndicator setInnerMargin:30]; |
| 278 | |
Alexandre Lision | a1eee3c | 2015-08-10 13:44:51 -0400 | [diff] [blame] | 279 | [self.videoView setCallDelegate:self]; |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 280 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 281 | [self connect]; |
| 282 | } |
| 283 | |
| 284 | - (void) connect |
| 285 | { |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 286 | QObject::connect(RecentModel::instance().selectionModel(), |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 287 | &QItemSelectionModel::currentChanged, |
| 288 | [=](const QModelIndex ¤t, const QModelIndex &previous) { |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 289 | auto call = RecentModel::instance().getActiveCall(current); |
| 290 | if(!current.isValid() || !call) { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 291 | return; |
| 292 | } |
Alexandre Lision | bb5dbcd | 2015-07-09 16:36:47 -0400 | [diff] [blame] | 293 | |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 294 | [self changeCallSelection:call]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 295 | |
Alexandre Lision | bb5dbcd | 2015-07-09 16:36:47 -0400 | [diff] [blame] | 296 | if (call->state() == Call::State::HOLD) { |
| 297 | call << Call::Action::HOLD; |
| 298 | } |
| 299 | |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 300 | [self collapseRightView]; |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 301 | [self updateCall:YES]; |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 302 | [self updateAllActions]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 303 | }); |
| 304 | |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 305 | QObject::connect(CallModel::instance().userActionModel(), |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 306 | &QAbstractItemModel::dataChanged, |
| 307 | [=](const QModelIndex &topLeft, const QModelIndex &bottomRight) { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 308 | const int first(topLeft.row()),last(bottomRight.row()); |
| 309 | for(int i = first; i <= last;i++) { |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 310 | [self updateActionAtIndex:i]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 311 | } |
| 312 | }); |
| 313 | |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 314 | QObject::connect(&CallModel::instance(), |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 315 | &CallModel::callStateChanged, |
| 316 | [self](Call* c, Call::State state) { |
Alexandre Lision | 5722777 | 2016-01-15 17:19:36 -0500 | [diff] [blame] | 317 | auto current = CallModel::instance().selectionModel()->currentIndex(); |
| 318 | if (!current.isValid()) |
| 319 | [self animateOut]; |
| 320 | else if (CallModel::instance().getIndex(c) == current) { |
| 321 | if (c->state() == Call::State::OVER) { |
Alexandre Lision | 01cf5e3 | 2016-01-21 15:54:30 -0500 | [diff] [blame] | 322 | RecentModel::instance().selectionModel()->clearCurrentIndex(); |
Alexandre Lision | 5722777 | 2016-01-15 17:19:36 -0500 | [diff] [blame] | 323 | } else { |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 324 | [self updateCall:NO]; |
Alexandre Lision | 5722777 | 2016-01-15 17:19:36 -0500 | [diff] [blame] | 325 | } |
| 326 | } |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 327 | }); |
| 328 | |
| 329 | QObject::connect(&CallModel::instance(), |
| 330 | &CallModel::incomingCall, |
| 331 | [self](Call* c) { |
| 332 | [self changeCallSelection:c]; |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 333 | }); |
| 334 | } |
| 335 | |
| 336 | - (void) changeCallSelection:(Call* )c |
| 337 | { |
| 338 | QObject::disconnect(self.selectedCallChanged); |
| 339 | CallModel::instance().selectCall(c); |
| 340 | self.selectedCallChanged = QObject::connect(CallModel::instance().selectedCall(), |
| 341 | &Call::changed, |
| 342 | [=]() { |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 343 | [self updateCall:NO]; |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 344 | }); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 345 | } |
| 346 | |
Alexandre Lision | b65c027 | 2015-07-22 15:51:29 -0400 | [diff] [blame] | 347 | - (void) monitorIncomingTextMessages:(Media::Text*) media |
| 348 | { |
| 349 | /* connect to incoming chat messages to open the chat view */ |
| 350 | QObject::disconnect(self.messageConnection); |
| 351 | self.messageConnection = QObject::connect(media, |
| 352 | &Media::Text::messageReceived, |
| 353 | [self] (const QMap<QString,QString>& m) { |
| 354 | if([[self splitView] isSubviewCollapsed:[[[self splitView] subviews] objectAtIndex: 1]]) |
| 355 | [self uncollapseRightView]; |
| 356 | }); |
| 357 | } |
| 358 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 359 | -(void) connectVideoSignals |
| 360 | { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 361 | QModelIndex idx = CallModel::instance().selectionModel()->currentIndex(); |
| 362 | Call* call = CallModel::instance().getCall(idx); |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 363 | QObject::disconnect(self.videoStarted); |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 364 | self.videoStarted = QObject::connect(call, |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 365 | &Call::videoStarted, |
| 366 | [=](Video::Renderer* renderer) { |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 367 | NSLog(@"Video started!"); |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 368 | [self connectVideoRenderer:renderer]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 369 | }); |
| 370 | |
| 371 | if(call->videoRenderer()) |
| 372 | { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 373 | [self connectVideoRenderer:call->videoRenderer()]; |
| 374 | } |
| 375 | |
| 376 | [self connectPreviewRenderer]; |
| 377 | |
| 378 | } |
| 379 | |
| 380 | -(void) connectPreviewRenderer |
| 381 | { |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 382 | QObject::disconnect(previewHolder.frameUpdated); |
| 383 | QObject::disconnect(previewHolder.stopped); |
| 384 | QObject::disconnect(previewHolder.started); |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 385 | previewHolder.started = QObject::connect(&Video::PreviewManager::instance(), |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 386 | &Video::PreviewManager::previewStarted, |
| 387 | [=](Video::Renderer* renderer) { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 388 | QObject::disconnect(previewHolder.frameUpdated); |
| 389 | previewHolder.frameUpdated = QObject::connect(renderer, |
| 390 | &Video::Renderer::frameUpdated, |
| 391 | [=]() { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 392 | [self renderer:Video::PreviewManager::instance().previewRenderer() |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 393 | renderFrameForPreviewView:previewView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 394 | }); |
| 395 | }); |
| 396 | |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 397 | previewHolder.stopped = QObject::connect(&Video::PreviewManager::instance(), |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 398 | &Video::PreviewManager::previewStopped, |
| 399 | [=](Video::Renderer* renderer) { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 400 | QObject::disconnect(previewHolder.frameUpdated); |
| 401 | [previewView.layer setContents:nil]; |
| 402 | }); |
| 403 | |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 404 | previewHolder.frameUpdated = QObject::connect(Video::PreviewManager::instance().previewRenderer(), |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 405 | &Video::Renderer::frameUpdated, |
| 406 | [=]() { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 407 | [self renderer:Video::PreviewManager::instance().previewRenderer() |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 408 | renderFrameForPreviewView:previewView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 409 | }); |
| 410 | } |
| 411 | |
| 412 | -(void) connectVideoRenderer: (Video::Renderer*)renderer |
| 413 | { |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 414 | QObject::disconnect(videoHolder.frameUpdated); |
| 415 | QObject::disconnect(videoHolder.started); |
| 416 | QObject::disconnect(videoHolder.stopped); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 417 | videoHolder.frameUpdated = QObject::connect(renderer, |
| 418 | &Video::Renderer::frameUpdated, |
| 419 | [=]() { |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 420 | [self renderer:renderer renderFrameForDistantView:videoView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 421 | }); |
| 422 | |
| 423 | videoHolder.started = QObject::connect(renderer, |
| 424 | &Video::Renderer::started, |
| 425 | [=]() { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 426 | QObject::disconnect(videoHolder.frameUpdated); |
| 427 | videoHolder.frameUpdated = QObject::connect(renderer, |
| 428 | &Video::Renderer::frameUpdated, |
| 429 | [=]() { |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 430 | [self renderer:renderer renderFrameForDistantView:videoView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 431 | }); |
| 432 | }); |
| 433 | |
| 434 | videoHolder.stopped = QObject::connect(renderer, |
| 435 | &Video::Renderer::stopped, |
| 436 | [=]() { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 437 | QObject::disconnect(videoHolder.frameUpdated); |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 438 | [(CallLayer*)videoView.layer setVideoRunning:NO]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 439 | }); |
| 440 | } |
| 441 | |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 442 | -(void) renderer: (Video::Renderer*)renderer renderFrameForPreviewView:(NSView*) view |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 443 | { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 444 | QSize res = renderer->size(); |
| 445 | |
Alexandre Lision | 6731e13 | 2015-10-14 14:29:06 -0400 | [diff] [blame] | 446 | auto frame_ptr = renderer->currentFrame(); |
| 447 | auto frame_data = frame_ptr.ptr; |
| 448 | if (!frame_data) |
| 449 | return; |
| 450 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 451 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); |
Alexandre Lision | 6731e13 | 2015-10-14 14:29:06 -0400 | [diff] [blame] | 452 | CGContextRef newContext = CGBitmapContextCreate(frame_data, |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 453 | res.width(), |
| 454 | res.height(), |
| 455 | 8, |
| 456 | 4*res.width(), |
| 457 | colorSpace, |
| 458 | kCGImageAlphaPremultipliedLast); |
| 459 | |
| 460 | |
| 461 | CGImageRef newImage = CGBitmapContextCreateImage(newContext); |
| 462 | |
| 463 | /*We release some components*/ |
| 464 | CGContextRelease(newContext); |
| 465 | CGColorSpaceRelease(colorSpace); |
| 466 | |
| 467 | [CATransaction begin]; |
| 468 | view.layer.contents = (__bridge id)newImage; |
| 469 | [CATransaction commit]; |
| 470 | |
| 471 | CFRelease(newImage); |
| 472 | } |
| 473 | |
Anthony Léonard | 14e7bf3 | 2017-06-08 08:13:16 -0400 | [diff] [blame] | 474 | -(void) renderer: (Video::Renderer*)renderer renderFrameForDistantView:(CallView*) view |
| 475 | { |
| 476 | QSize res = renderer->size(); |
| 477 | |
| 478 | auto frame_ptr = renderer->currentFrame(); |
| 479 | if (!frame_ptr.ptr) |
| 480 | return; |
| 481 | |
| 482 | CallLayer* callLayer = (CallLayer*) view.layer; |
| 483 | |
| 484 | [callLayer setCurrentFrame:std::move(frame_ptr) ofSize:res]; |
| 485 | [callLayer setVideoRunning:YES]; |
| 486 | } |
| 487 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 488 | - (void) initFrame |
| 489 | { |
| 490 | [self.view setFrame:self.view.superview.bounds]; |
| 491 | [self.view setHidden:YES]; |
| 492 | self.view.layer.position = self.view.frame.origin; |
Alexandre Lision | bb5dbcd | 2015-07-09 16:36:47 -0400 | [diff] [blame] | 493 | [self collapseRightView]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 494 | } |
| 495 | |
| 496 | # pragma private IN/OUT animations |
| 497 | |
| 498 | -(void) animateIn |
| 499 | { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 500 | CGRect frame = CGRectOffset(self.view.superview.bounds, -self.view.superview.bounds.size.width, 0); |
| 501 | [self.view setHidden:NO]; |
| 502 | |
| 503 | [CATransaction begin]; |
| 504 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; |
| 505 | [animation setFromValue:[NSValue valueWithPoint:frame.origin]]; |
| 506 | [animation setToValue:[NSValue valueWithPoint:self.view.superview.bounds.origin]]; |
| 507 | [animation setDuration:0.2f]; |
Alexandre Lision | 22d615b | 2016-01-25 12:54:34 -0500 | [diff] [blame] | 508 | [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 509 | [CATransaction setCompletionBlock:^{ |
Alexandre Lision | a1eee3c | 2015-08-10 13:44:51 -0400 | [diff] [blame] | 510 | |
| 511 | // when call comes in we want to show the controls/header |
| 512 | [self mouseIsMoving:YES]; |
| 513 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 514 | [self connectVideoSignals]; |
Alexandre Lision | b65c027 | 2015-07-22 15:51:29 -0400 | [diff] [blame] | 515 | /* check if text media is already present */ |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 516 | if(!CallModel::instance().selectedCall()) |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 517 | return; |
Alexandre Lision | 21666f3 | 2015-09-22 17:04:36 -0400 | [diff] [blame] | 518 | |
Alexandre Lision | 22d615b | 2016-01-25 12:54:34 -0500 | [diff] [blame] | 519 | [loadingIndicator setAnimates:YES]; |
Alexandre Lision | 210fe21 | 2016-01-27 11:15:13 -0500 | [diff] [blame] | 520 | [self updateCall:YES]; |
Alexandre Lision | 4d9905e | 2016-01-22 12:01:36 -0500 | [diff] [blame] | 521 | |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 522 | if (CallModel::instance().selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::IN)) { |
| 523 | Media::Text *text = CallModel::instance().selectedCall()->firstMedia<Media::Text>(Media::Media::Direction::IN); |
Alexandre Lision | b65c027 | 2015-07-22 15:51:29 -0400 | [diff] [blame] | 524 | [self monitorIncomingTextMessages:text]; |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 525 | } else if (CallModel::instance().selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::OUT)) { |
| 526 | Media::Text *text = CallModel::instance().selectedCall()->firstMedia<Media::Text>(Media::Media::Direction::OUT); |
Alexandre Lision | b65c027 | 2015-07-22 15:51:29 -0400 | [diff] [blame] | 527 | [self monitorIncomingTextMessages:text]; |
| 528 | } else { |
| 529 | /* monitor media for messaging text messaging */ |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 530 | self.mediaAddedConnection = QObject::connect(CallModel::instance().selectedCall(), |
Alexandre Lision | b65c027 | 2015-07-22 15:51:29 -0400 | [diff] [blame] | 531 | &Call::mediaAdded, |
| 532 | [self] (Media::Media* media) { |
| 533 | if (media->type() == Media::Media::Type::TEXT) { [self monitorIncomingTextMessages:(Media::Text*)media]; |
| 534 | QObject::disconnect(self.mediaAddedConnection); |
| 535 | } |
| 536 | }); |
| 537 | } |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 538 | }]; |
| 539 | [self.view.layer addAnimation:animation forKey:animation.keyPath]; |
| 540 | |
| 541 | [CATransaction commit]; |
| 542 | } |
| 543 | |
| 544 | -(void) cleanUp |
| 545 | { |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 546 | QObject::disconnect(videoHolder.frameUpdated); |
| 547 | QObject::disconnect(videoHolder.started); |
| 548 | QObject::disconnect(videoHolder.stopped); |
| 549 | QObject::disconnect(previewHolder.frameUpdated); |
| 550 | QObject::disconnect(previewHolder.stopped); |
| 551 | QObject::disconnect(previewHolder.started); |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 552 | [previewView.layer setContents:nil]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 553 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 554 | [_brokerPopoverVC performClose:self]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 555 | [self.addToContactPopover performClose:self]; |
Alexandre Lision | 0e66aea | 2015-11-02 16:36:30 -0500 | [diff] [blame] | 556 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 557 | [self.chatButton setHidden:YES]; |
| 558 | [self.addParticipantButton setHidden:YES]; |
| 559 | [self.transferButton setHidden:YES]; |
| 560 | |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 561 | [self.chatButton setPressed:NO]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 562 | [self.mergeCallsButton setState:NSOffState]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 563 | [self collapseRightView]; |
Alexandre Lision | 5722777 | 2016-01-15 17:19:36 -0500 | [diff] [blame] | 564 | |
| 565 | [personLabel setStringValue:@""]; |
| 566 | [timeSpentLabel setStringValue:@""]; |
| 567 | [stateLabel setStringValue:@""]; |
| 568 | [self.addContactButton setHidden:YES]; |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 569 | |
| 570 | [advancedButton setPressed:NO]; |
| 571 | [advancedPanel setHidden:YES]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 572 | } |
| 573 | |
| 574 | -(void) animateOut |
| 575 | { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 576 | if(self.view.frame.origin.x < 0) { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 577 | return; |
| 578 | } |
| 579 | |
| 580 | CGRect frame = CGRectOffset(self.view.frame, -self.view.frame.size.width, 0); |
| 581 | [CATransaction begin]; |
| 582 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; |
| 583 | [animation setFromValue:[NSValue valueWithPoint:self.view.frame.origin]]; |
| 584 | [animation setToValue:[NSValue valueWithPoint:frame.origin]]; |
| 585 | [animation setDuration:0.2f]; |
Alexandre Lision | 22d615b | 2016-01-25 12:54:34 -0500 | [diff] [blame] | 586 | [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 587 | |
| 588 | [CATransaction setCompletionBlock:^{ |
| 589 | [self.view setHidden:YES]; |
Alexandre Lision | ef6333a | 2015-03-24 12:30:31 -0400 | [diff] [blame] | 590 | // first make sure everything is disconnected |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 591 | [self cleanUp]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 592 | if (RecentModel::instance().getActiveCall(RecentModel::instance().selectionModel()->currentIndex())) { |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 593 | [self animateIn]; |
| 594 | } |
| 595 | }]; |
| 596 | [self.view.layer addAnimation:animation forKey:animation.keyPath]; |
Alexandre Lision | a1c6d75 | 2015-06-23 12:27:38 -0400 | [diff] [blame] | 597 | |
| 598 | [self.view.layer setPosition:frame.origin]; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 599 | [CATransaction commit]; |
| 600 | } |
| 601 | |
| 602 | /** |
| 603 | * Debug purpose |
| 604 | */ |
| 605 | -(void) dumpFrame:(CGRect) frame WithName:(NSString*) name |
| 606 | { |
| 607 | NSLog(@"frame %@ : %f %f %f %f \n\n",name ,frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); |
| 608 | } |
| 609 | |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 610 | -(void)collapseRightView |
| 611 | { |
| 612 | NSView *right = [[splitView subviews] objectAtIndex:1]; |
| 613 | NSView *left = [[splitView subviews] objectAtIndex:0]; |
| 614 | NSRect leftFrame = [left frame]; |
| 615 | [right setHidden:YES]; |
| 616 | [splitView display]; |
| 617 | } |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 618 | |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 619 | -(void)uncollapseRightView |
| 620 | { |
| 621 | NSView *left = [[splitView subviews] objectAtIndex:0]; |
| 622 | NSView *right = [[splitView subviews] objectAtIndex:1]; |
| 623 | [right setHidden:NO]; |
| 624 | |
| 625 | CGFloat dividerThickness = [splitView dividerThickness]; |
| 626 | |
| 627 | // get the different frames |
| 628 | NSRect leftFrame = [left frame]; |
| 629 | NSRect rightFrame = [right frame]; |
| 630 | |
| 631 | leftFrame.size.width = (leftFrame.size.width - rightFrame.size.width - dividerThickness); |
| 632 | rightFrame.origin.x = leftFrame.size.width + dividerThickness; |
| 633 | [left setFrameSize:leftFrame.size]; |
| 634 | [right setFrame:rightFrame]; |
| 635 | [splitView display]; |
Alexandre Lision | 16d9c0a | 2015-08-10 12:05:15 -0400 | [diff] [blame] | 636 | |
| 637 | [self.chatVC takeFocus]; |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 638 | } |
| 639 | |
| 640 | |
| 641 | #pragma mark - Button methods |
| 642 | |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 643 | - (IBAction)addToContact:(NSButton*) sender { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 644 | auto contactmethod = CallModel::instance().getCall(CallModel::instance().selectionModel()->currentIndex())->peerContactMethod(); |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 645 | |
Anthony Léonard | 6097085 | 2017-07-21 11:33:41 -0400 | [diff] [blame] | 646 | // TODO: Uncomment to reuse contact name editing popover |
| 647 | // if (self.addToContactPopover != nullptr) { |
| 648 | // [self.addToContactPopover performClose:self]; |
| 649 | // self.addToContactPopover = NULL; |
| 650 | // } else if (!contactmethod->contact() || contactmethod->contact()->isPlaceHolder()) { |
| 651 | // auto* editorVC = [[PersonLinkerVC alloc] initWithNibName:@"PersonLinker" bundle:nil]; |
| 652 | // [editorVC setMethodToLink:contactmethod]; |
| 653 | // [editorVC setContactLinkedDelegate:self]; |
| 654 | // self.addToContactPopover = [[NSPopover alloc] init]; |
| 655 | // [self.addToContactPopover setContentSize:editorVC.view.frame.size]; |
| 656 | // [self.addToContactPopover setContentViewController:editorVC]; |
| 657 | // [self.addToContactPopover setAnimates:YES]; |
| 658 | // [self.addToContactPopover setBehavior:NSPopoverBehaviorTransient]; |
| 659 | // [self.addToContactPopover setDelegate:self]; |
| 660 | // |
| 661 | // [self.addToContactPopover showRelativeToRect:sender.bounds ofView:sender preferredEdge:NSMaxXEdge]; |
| 662 | // } |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 663 | |
Anthony Léonard | 6097085 | 2017-07-21 11:33:41 -0400 | [diff] [blame] | 664 | auto* newPerson = new Person(); |
| 665 | newPerson->setFormattedName(contactmethod->bestName()); |
| 666 | |
| 667 | Person::ContactMethods numbers; |
| 668 | numbers << contactmethod; |
| 669 | newPerson->setContactMethods(numbers); |
| 670 | contactmethod->setPerson(newPerson); |
| 671 | |
| 672 | auto personCollections = PersonModel::instance().collections(); |
| 673 | CollectionInterface *peerProfileCollection = nil; |
| 674 | foreach(auto collection, personCollections) { |
| 675 | if(dynamic_cast<PeerProfileCollection*>(collection)) |
| 676 | peerProfileCollection = collection; |
| 677 | } |
| 678 | if(peerProfileCollection) { |
| 679 | PersonModel::instance().addNewPerson(newPerson, peerProfileCollection); |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 680 | } |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 681 | |
| 682 | [videoView setCallDelegate:nil]; |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 683 | } |
| 684 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 685 | - (IBAction)hangUp:(id)sender { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 686 | CallModel::instance().getCall(CallModel::instance().selectionModel()->currentIndex()) << Call::Action::REFUSE; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 687 | } |
| 688 | |
| 689 | - (IBAction)accept:(id)sender { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 690 | CallModel::instance().getCall(CallModel::instance().selectionModel()->currentIndex()) << Call::Action::ACCEPT; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 691 | } |
| 692 | |
| 693 | - (IBAction)toggleRecording:(id)sender { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 694 | CallModel::instance().getCall(CallModel::instance().selectionModel()->currentIndex()) << Call::Action::RECORD_AUDIO; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | - (IBAction)toggleHold:(id)sender { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 698 | CallModel::instance().getCall(CallModel::instance().selectionModel()->currentIndex()) << Call::Action::HOLD; |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 699 | } |
| 700 | |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 701 | - (IBAction)toggleAdvancedControls:(id)sender { |
| 702 | [advancedButton setPressed:!advancedButton.isPressed]; |
| 703 | [advancedPanel setHidden:![advancedButton isPressed]]; |
| 704 | } |
| 705 | |
| 706 | - (IBAction)showDialpad:(id)sender { |
| 707 | AppDelegate* appDelegate = (AppDelegate *)[[NSApplication sharedApplication] delegate]; |
| 708 | [appDelegate showDialpad]; |
| 709 | } |
| 710 | |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 711 | -(IBAction)toggleChat:(id)sender; |
| 712 | { |
| 713 | BOOL rightViewCollapsed = [[self splitView] isSubviewCollapsed:[[[self splitView] subviews] objectAtIndex: 1]]; |
| 714 | if (rightViewCollapsed) { |
| 715 | [self uncollapseRightView]; |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 716 | CallModel::instance().getCall(CallModel::instance().selectionModel()->currentIndex())->addOutgoingMedia<Media::Text>(); |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 717 | } else { |
| 718 | [self collapseRightView]; |
| 719 | } |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 720 | [chatButton setPressed:rightViewCollapsed]; |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 721 | } |
| 722 | |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 723 | - (IBAction)muteAudio:(id)sender |
| 724 | { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 725 | UserActionModel* uam = CallModel::instance().userActionModel(); |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 726 | uam << UserActionModel::Action::MUTE_AUDIO; |
| 727 | } |
| 728 | |
| 729 | - (IBAction)muteVideo:(id)sender |
| 730 | { |
Alexandre Lision | d3aa3ad | 2015-10-23 14:28:41 -0400 | [diff] [blame] | 731 | UserActionModel* uam = CallModel::instance().userActionModel(); |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 732 | uam << UserActionModel::Action::MUTE_VIDEO; |
| 733 | } |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 734 | |
| 735 | - (IBAction)toggleTransferView:(id)sender { |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 736 | if (_brokerPopoverVC != nullptr) { |
| 737 | [_brokerPopoverVC performClose:self]; |
| 738 | _brokerPopoverVC = NULL; |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 739 | [self.transferButton setPressed:NO]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 740 | } else { |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 741 | auto* brokerVC = [[BrokerVC alloc] initWithMode:BrokerMode::TRANSFER]; |
| 742 | _brokerPopoverVC = [[NSPopover alloc] init]; |
| 743 | [_brokerPopoverVC setContentSize:brokerVC.view.frame.size]; |
| 744 | [_brokerPopoverVC setContentViewController:brokerVC]; |
| 745 | [_brokerPopoverVC setAnimates:YES]; |
| 746 | [_brokerPopoverVC setBehavior:NSPopoverBehaviorTransient]; |
| 747 | [_brokerPopoverVC setDelegate:self]; |
| 748 | [_brokerPopoverVC showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 749 | [videoView setCallDelegate:nil]; |
| 750 | } |
Alexandre Lision | f23ec5a | 2015-07-16 11:24:06 -0400 | [diff] [blame] | 751 | } |
Alexandre Lision | d18fa27 | 2015-06-15 11:18:03 -0400 | [diff] [blame] | 752 | |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 753 | - (IBAction)toggleAddParticipantView:(id)sender { |
| 754 | if (_brokerPopoverVC != nullptr) { |
| 755 | [_brokerPopoverVC performClose:self]; |
| 756 | _brokerPopoverVC = NULL; |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 757 | [self.addParticipantButton setPressed:NO]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 758 | } else { |
| 759 | auto* brokerVC = [[BrokerVC alloc] initWithMode:BrokerMode::CONFERENCE]; |
| 760 | _brokerPopoverVC = [[NSPopover alloc] init]; |
| 761 | [_brokerPopoverVC setContentSize:brokerVC.view.frame.size]; |
| 762 | [_brokerPopoverVC setContentViewController:brokerVC]; |
| 763 | [_brokerPopoverVC setAnimates:YES]; |
| 764 | [_brokerPopoverVC setBehavior:NSPopoverBehaviorTransient]; |
| 765 | [_brokerPopoverVC setDelegate:self]; |
| 766 | [_brokerPopoverVC showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSMinYEdge]; |
| 767 | [videoView setCallDelegate:nil]; |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | /** |
| 772 | * Merge current call with its parent call |
| 773 | */ |
| 774 | - (IBAction)mergeCalls:(id)sender |
| 775 | { |
| 776 | auto current = CallModel::instance().selectedCall(); |
| 777 | current->joinToParent(); |
| 778 | } |
| 779 | |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 780 | #pragma mark - NSPopOverDelegate |
| 781 | |
Alexandre Lision | 266fca0 | 2015-09-28 14:47:05 -0400 | [diff] [blame] | 782 | - (void)popoverWillClose:(NSNotification *)notification |
| 783 | { |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 784 | if (_brokerPopoverVC != nullptr) { |
| 785 | [_brokerPopoverVC performClose:self]; |
| 786 | _brokerPopoverVC = NULL; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 787 | } |
Alexandre Lision | 266fca0 | 2015-09-28 14:47:05 -0400 | [diff] [blame] | 788 | |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 789 | if (self.addToContactPopover != nullptr) { |
| 790 | [self.addToContactPopover performClose:self]; |
| 791 | self.addToContactPopover = NULL; |
| 792 | } |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 793 | |
Alexandre Lision | 6200531 | 2016-01-28 15:55:16 -0500 | [diff] [blame] | 794 | [self.addContactButton setPressed:NO]; |
| 795 | [self.transferButton setPressed:NO]; |
Alexandre Lision | 89edc6a | 2015-11-09 11:30:47 -0500 | [diff] [blame] | 796 | [self.addParticipantButton setState:NSOffState]; |
Alexandre Lision | 883719f | 2015-10-22 17:37:45 -0400 | [diff] [blame] | 797 | } |
| 798 | |
| 799 | - (void)popoverDidClose:(NSNotification *)notification |
| 800 | { |
| 801 | [videoView setCallDelegate:self]; |
Alexandre Lision | 2db8f47 | 2015-07-22 15:05:46 -0400 | [diff] [blame] | 802 | } |
| 803 | |
| 804 | #pragma mark - ContactLinkedDelegate |
| 805 | |
| 806 | - (void)contactLinked |
| 807 | { |
| 808 | if (self.addToContactPopover != nullptr) { |
| 809 | [self.addToContactPopover performClose:self]; |
| 810 | self.addToContactPopover = NULL; |
| 811 | } |
| 812 | } |
| 813 | |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 814 | #pragma mark - NSSplitViewDelegate |
| 815 | |
| 816 | /* 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. |
| 817 | */ |
| 818 | - (BOOL)splitView:(NSSplitView *)splitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex; |
| 819 | { |
| 820 | NSView* rightView = [[splitView subviews] objectAtIndex:1]; |
| 821 | return ([subview isEqual:rightView]); |
| 822 | } |
| 823 | |
| 824 | |
| 825 | - (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview; |
| 826 | { |
| 827 | NSView* rightView = [[splitView subviews] objectAtIndex:1]; |
| 828 | return ([subview isEqual:rightView]); |
| 829 | } |
| 830 | |
| 831 | |
Alexandre Lision | a1eee3c | 2015-08-10 13:44:51 -0400 | [diff] [blame] | 832 | # pragma mark - CallnDelegate |
Alexandre Lision | 58cab67 | 2015-06-09 15:25:40 -0400 | [diff] [blame] | 833 | |
| 834 | - (void) callShouldToggleFullScreen |
| 835 | { |
| 836 | if(self.splitView.isInFullScreenMode) |
| 837 | [self.splitView exitFullScreenModeWithOptions:nil]; |
| 838 | else { |
| 839 | NSApplicationPresentationOptions options = NSApplicationPresentationDefault +NSApplicationPresentationAutoHideDock + |
| 840 | NSApplicationPresentationAutoHideMenuBar + NSApplicationPresentationAutoHideToolbar; |
| 841 | NSDictionary *opts = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:options], |
| 842 | NSFullScreenModeApplicationPresentationOptions, nil]; |
| 843 | |
| 844 | [self.splitView enterFullScreenMode:[NSScreen mainScreen] withOptions:opts]; |
| 845 | } |
| 846 | } |
| 847 | |
Alexandre Lision | a1eee3c | 2015-08-10 13:44:51 -0400 | [diff] [blame] | 848 | -(void) mouseIsMoving:(BOOL) move |
| 849 | { |
| 850 | [[controlsPanel animator] setAlphaValue:move]; // fade out |
| 851 | [[headerContainer animator] setAlphaValue:move]; |
| 852 | } |
| 853 | |
Alexandre Lision | c514805 | 2015-03-04 15:10:35 -0500 | [diff] [blame] | 854 | @end |