Commit d3aa3ade authored by Alexandre Lision's avatar Alexandre Lision

lrc: adapt to API changes

Tuleap: #44
Change-Id: I0b005b7019d204e049a280819aac5f29558cafea
parent c8d9f0ba
......@@ -126,7 +126,7 @@
[publishedPortField setTag:PUBLICPORT_TAG];
[publishedAddrField setTag:PUBLICADDR_TAG];
QObject::connect(AccountModel::instance()->selectionModel(),
QObject::connect(AccountModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
[=](const QModelIndex &current, const QModelIndex &previous) {
if(!current.isValid())
......@@ -138,8 +138,8 @@
- (Account*) currentAccount
{
auto accIdx = AccountModel::instance()->selectionModel()->currentIndex();
return AccountModel::instance()->getAccountByModelIndex(accIdx);
auto accIdx = AccountModel::instance().selectionModel()->currentIndex();
return AccountModel::instance().getAccountByModelIndex(accIdx);
}
- (void)loadAccount
......
......@@ -53,7 +53,7 @@
- (void)awakeFromNib
{
NSLog(@"INIT Audio VC");
QObject::connect(AccountModel::instance()->selectionModel(),
QObject::connect(AccountModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
[=](const QModelIndex &current, const QModelIndex &previous) {
if(!current.isValid())
......@@ -64,8 +64,8 @@
- (Account*) currentAccount
{
auto accIdx = AccountModel::instance()->selectionModel()->currentIndex();
return AccountModel::instance()->getAccountByModelIndex(accIdx);
auto accIdx = AccountModel::instance().selectionModel()->currentIndex();
return AccountModel::instance().getAccountByModelIndex(accIdx);
}
- (void)loadAccount
......
......@@ -86,7 +86,7 @@
[passwordTextField setTag:PASSWORD_TAG];
[userAgentTextField setTag:USERAGENT_TAG];
QObject::connect(AccountModel::instance()->selectionModel(),
QObject::connect(AccountModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
[=](const QModelIndex &current, const QModelIndex &previous) {
if(!current.isValid())
......@@ -97,8 +97,8 @@
- (Account*) currentAccount
{
auto accIdx = AccountModel::instance()->selectionModel()->currentIndex();
return AccountModel::instance()->getAccountByModelIndex(accIdx);
auto accIdx = AccountModel::instance().selectionModel()->currentIndex();
return AccountModel::instance().getAccountByModelIndex(accIdx);
}
- (IBAction)toggleUpnp:(NSButton *)sender {
......
......@@ -73,7 +73,7 @@
[userAgentTextField setTag:USERAGENT_TAG];
[bootstrapField setTag:HOSTNAME_TAG];
QObject::connect(AccountModel::instance()->selectionModel(),
QObject::connect(AccountModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
[=](const QModelIndex &current, const QModelIndex &previous) {
if(!current.isValid())
......@@ -84,8 +84,8 @@
- (Account*) currentAccount
{
auto accIdx = AccountModel::instance()->selectionModel()->currentIndex();
return AccountModel::instance()->getAccountByModelIndex(accIdx);
auto accIdx = AccountModel::instance().selectionModel()->currentIndex();
return AccountModel::instance().getAccountByModelIndex(accIdx);
}
- (void)loadAccount
......
......@@ -79,7 +79,7 @@
[tlsNegotiationTimeoutStepper setTag:TLS_NEGOTIATION_TAG];
[tlsNegotiationTimeout setTag:TLS_NEGOTIATION_TAG];
QObject::connect(AccountModel::instance()->selectionModel(),
QObject::connect(AccountModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
[=](const QModelIndex &current, const QModelIndex &previous) {
if(!current.isValid())
......@@ -90,8 +90,8 @@
- (Account*) currentAccount
{
auto accIdx = AccountModel::instance()->selectionModel()->currentIndex();
return AccountModel::instance()->getAccountByModelIndex(accIdx);
auto accIdx = AccountModel::instance().selectionModel()->currentIndex();
return AccountModel::instance().getAccountByModelIndex(accIdx);
}
- (void)loadAccount
......
......@@ -59,7 +59,7 @@
- (void)awakeFromNib
{
NSLog(@"INIT Video VC");
QObject::connect(AccountModel::instance()->selectionModel(),
QObject::connect(AccountModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
[=](const QModelIndex &current, const QModelIndex &previous) {
if(!current.isValid())
......@@ -70,8 +70,8 @@
- (Account*) currentAccount
{
auto accIdx = AccountModel::instance()->selectionModel()->currentIndex();
return AccountModel::instance()->getAccountByModelIndex(accIdx);
auto accIdx = AccountModel::instance().selectionModel()->currentIndex();
return AccountModel::instance().getAccountByModelIndex(accIdx);
}
- (void)loadAccount
......
......@@ -104,7 +104,7 @@ public:
- (void)awakeFromNib
{
treeController = [[QNSTreeController alloc] initWithQModel:AccountModel::instance()];
treeController = [[QNSTreeController alloc] initWithQModel:&AccountModel::instance()];
[treeController setAvoidsEmptySelection:NO];
[treeController setAlwaysUsesMultipleValuesMarker:YES];
[treeController setChildrenKeyPath:@"children"];
......@@ -113,7 +113,7 @@ public:
[accountsListView bind:@"sortDescriptors" toObject:treeController withKeyPath:@"sortDescriptors" options:nil];
[accountsListView bind:@"selectionIndexPaths" toObject:treeController withKeyPath:@"selectionIndexPaths" options:nil];
QObject::connect(AccountModel::instance(),
QObject::connect(&AccountModel::instance(),
&QAbstractItemModel::dataChanged,
[=](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
[accountsListView reloadDataForRowIndexes:
......@@ -121,12 +121,12 @@ public:
columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, accountsListView.tableColumns.count)]];
});
AccountModel::instance()->selectionModel()->clearCurrentIndex();
AccountModel::instance().selectionModel()->clearCurrentIndex();
proxyProtocolModel = new ActiveProtocolModel(AccountModel::instance()->protocolModel());
QModelIndex qProtocolIdx = AccountModel::instance()->protocolModel()->selectionModel()->currentIndex();
proxyProtocolModel = new ActiveProtocolModel(AccountModel::instance().protocolModel());
QModelIndex qProtocolIdx = AccountModel::instance().protocolModel()->selectionModel()->currentIndex();
[self.protocolList addItemWithTitle:
AccountModel::instance()->protocolModel()->data(qProtocolIdx, Qt::DisplayRole).toString().toNSString()];
AccountModel::instance().protocolModel()->data(qProtocolIdx, Qt::DisplayRole).toString().toNSString()];
self.generalVC = [[AccGeneralVC alloc] initWithNibName:@"AccGeneral" bundle:nil];
[[self.generalVC view] setFrame:[self.generalTabItem.view frame]];
......@@ -165,36 +165,36 @@ public:
}
- (IBAction)moveUp:(id)sender {
AccountModel::instance()->moveUp();
AccountModel::instance().moveUp();
}
- (IBAction)moveDown:(id)sender {
AccountModel::instance()->moveDown();
AccountModel::instance().moveDown();
}
- (IBAction)removeAccount:(id)sender {
if(treeController.selectedNodes.count > 0) {
QModelIndex qIdx = [treeController toQIdx:[treeController selectedNodes][0]];
AccountModel::instance()->remove(qIdx);
AccountModel::instance()->save();
AccountModel::instance().remove(qIdx);
AccountModel::instance().save();
}
}
- (IBAction)addAccount:(id)sender {
QModelIndex qIdx = AccountModel::instance()->protocolModel()->selectionModel()->currentIndex();
QModelIndex qIdx = AccountModel::instance().protocolModel()->selectionModel()->currentIndex();
auto newAccName = [[NSString alloc] initWithFormat:@"%@ account",
AccountModel::instance()->protocolModel()->data(qIdx, Qt::DisplayRole).toString().toNSString(), nil];
auto acc = AccountModel::instance()->add([newAccName UTF8String], qIdx);
AccountModel::instance().protocolModel()->data(qIdx, Qt::DisplayRole).toString().toNSString(), nil];
auto acc = AccountModel::instance().add([newAccName UTF8String], qIdx);
acc->setDisplayName(acc->alias());
AccountModel::instance()->save();
AccountModel::instance().save();
}
- (IBAction)protocolSelectedChanged:(id)sender {
int index = [sender indexOfSelectedItem];
QModelIndex proxyIdx = proxyProtocolModel->index(index, 0);
AccountModel::instance()->protocolModel()->selectionModel()->setCurrentIndex(
AccountModel::instance().protocolModel()->selectionModel()->setCurrentIndex(
proxyProtocolModel->mapToSource(proxyIdx), QItemSelectionModel::ClearAndSelect);
}
......@@ -247,8 +247,8 @@ public:
NSTableColumn* col = [sender.tableColumns objectAtIndex:[sender clickedColumn]];
if([col.identifier isEqualToString:COLUMNID_ENABLE]) {
NSInteger row = [sender clickedRow];
QModelIndex accIdx = AccountModel::instance()->index(row);
Account* toToggle = AccountModel::instance()->getAccountByModelIndex(accIdx);
QModelIndex accIdx = AccountModel::instance().index(row);
Account* toToggle = AccountModel::instance().getAccountByModelIndex(accIdx);
NSButtonCell *cell = [col dataCellForRow:row];
toToggle->setEnabled(cell.state == NSOnState ? NO : YES);
toToggle << Account::EditAction::SAVE;
......@@ -275,7 +275,7 @@ public:
QModelIndex qIdx = [treeController toQIdx:((NSTreeNode*)item)];
// Prevent user from enabling/disabling IP2IP account
if ([[tableColumn identifier] isEqualToString:COLUMNID_ENABLE] &&
AccountModel::instance()->ip2ip()->index() == qIdx) {
AccountModel::instance().ip2ip()->index() == qIdx) {
return [[NSCell alloc] init];
} else {
......@@ -323,7 +323,7 @@ public:
cell.title = qIdx.data(Qt::DisplayRole).toString().toNSString();
} else if([[tableColumn identifier] isEqualToString:COLUMNID_STATE]) {
NSTextFieldCell* stateCell = cell;
auto account = AccountModel::instance()->getAccountByModelIndex(qIdx);
auto account = AccountModel::instance().getAccountByModelIndex(qIdx);
auto humanState = account->toHumanStateName();
[stateCell setTitle:humanState.toNSString()];
......@@ -358,8 +358,8 @@ public:
if([[treeController selectedNodes] count] > 0) {
auto qIdx = [treeController toQIdx:[treeController selectedNodes][0]];
//Update details view
auto acc = AccountModel::instance()->getAccountByModelIndex(qIdx);
AccountModel::instance()->selectionModel()->setCurrentIndex(qIdx, QItemSelectionModel::ClearAndSelect);
auto acc = AccountModel::instance().getAccountByModelIndex(qIdx);
AccountModel::instance().selectionModel()->setCurrentIndex(qIdx, QItemSelectionModel::ClearAndSelect);
switch (acc->protocol()) {
case Account::Protocol::SIP:
......@@ -381,7 +381,7 @@ public:
[self.accountDetailsView setHidden:NO];
} else {
[self.accountDetailsView setHidden:YES];
AccountModel::instance()->selectionModel()->clearCurrentIndex();
AccountModel::instance().selectionModel()->clearCurrentIndex();
}
}
......@@ -390,7 +390,7 @@ public:
- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel
{
QModelIndex proxyIdx = proxyProtocolModel->index(index, 0);
QModelIndex qIdx = AccountModel::instance()->protocolModel()->index(proxyProtocolModel->mapToSource(proxyIdx).row());
QModelIndex qIdx = AccountModel::instance().protocolModel()->index(proxyProtocolModel->mapToSource(proxyIdx).row());
[item setTitle:qIdx.data(Qt::DisplayRole).toString().toNSString()];
return YES;
......
......@@ -63,7 +63,7 @@
- (void) connect
{
QObject::connect(CallModel::instance(),
QObject::connect(&CallModel::instance(),
&CallModel::incomingCall,
[=](Call* call) {
BOOL shouldComeToForeground = [[NSUserDefaults standardUserDefaults] boolForKey:Preferences::WindowBehaviour];
......@@ -120,9 +120,9 @@
- (BOOL) checkForRingAccount
{
BOOL foundRingAcc = NO;
for (int i = 0 ; i < AccountModel::instance()->rowCount() ; ++i) {
QModelIndex idx = AccountModel::instance()->index(i);
Account* acc = AccountModel::instance()->getAccountByModelIndex(idx);
for (int i = 0 ; i < AccountModel::instance().rowCount() ; ++i) {
QModelIndex idx = AccountModel::instance().index(i);
Account* acc = AccountModel::instance().getAccountByModelIndex(idx);
if(acc->protocol() == Account::Protocol::RING) {
if (acc->displayName().isEmpty())
acc->setDisplayName(acc->alias());
......@@ -160,7 +160,7 @@
BOOL valid = [[ringID stringByTrimmingCharactersInSet:hexSet] isEqualToString:@""];
if(valid && ringID.length == 40) {
Call* c = CallModel::instance()->dialingCall();
Call* c = CallModel::instance().dialingCall();
c->setDialNumber(QString::fromNSString([NSString stringWithFormat:@"ring:%@",ringID]));
c << Call::Action::ACCEPT;
} else {
......@@ -185,13 +185,13 @@
- (void)handleQuitEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent
{
delete CallModel::instance()->QObject::parent();
delete CallModel::instance().QObject::parent();
[[NSApplication sharedApplication] terminate:self];
}
-(void)applicationWillTerminate:(NSNotification *)notification
{
delete CallModel::instance()->QObject::parent();
delete CallModel::instance().QObject::parent();
[[NSApplication sharedApplication] terminate:self];
}
......
......@@ -57,55 +57,55 @@
{
[super loadView];
QModelIndex qInputIdx = Audio::Settings::instance()->inputDeviceModel()->selectionModel()->currentIndex();
QModelIndex qOutputIdx = Audio::Settings::instance()->outputDeviceModel()->selectionModel()->currentIndex();
QModelIndex qInputIdx = Audio::Settings::instance().inputDeviceModel()->selectionModel()->currentIndex();
QModelIndex qOutputIdx = Audio::Settings::instance().outputDeviceModel()->selectionModel()->currentIndex();
[self.outputDeviceList addItemWithTitle:
Audio::Settings::instance()->outputDeviceModel()->data(qOutputIdx, Qt::DisplayRole).toString().toNSString()];
Audio::Settings::instance().outputDeviceModel()->data(qOutputIdx, Qt::DisplayRole).toString().toNSString()];
[self.inputDeviceList addItemWithTitle:
Audio::Settings::instance()->inputDeviceModel()->data(qInputIdx, Qt::DisplayRole).toString().toNSString()];
Audio::Settings::instance().inputDeviceModel()->data(qInputIdx, Qt::DisplayRole).toString().toNSString()];
[self.alwaysRecordingButton setState:
Media::RecordingModel::instance()->isAlwaysRecording() ? NSOnState:NSOffState];
Media::RecordingModel::instance().isAlwaysRecording() ? NSOnState:NSOffState];
[self.muteDTMFButton setState:
Audio::Settings::instance()->areDTMFMuted()?NSOnState:NSOffState];
Audio::Settings::instance().areDTMFMuted()?NSOnState:NSOffState];
if([[Media::RecordingModel::instance()->recordPath().toNSURL() absoluteString] isEqualToString:@""]) {
if([[Media::RecordingModel::instance().recordPath().toNSURL() absoluteString] isEqualToString:@""]) {
NSArray * pathComponentArray = [self pathComponentArray];
[recordingsPathControl setPathComponentCells:pathComponentArray];
} else {
[recordingsPathControl setURL:Media::RecordingModel::instance()->recordPath().toNSURL()];
[recordingsPathControl setURL:Media::RecordingModel::instance().recordPath().toNSURL()];
}
}
- (IBAction)toggleMuteDTMF:(NSButton *)sender
{
Audio::Settings::instance()->setDTMFMuted([sender state] == NSOnState);
Audio::Settings::instance().setDTMFMuted([sender state] == NSOnState);
}
- (IBAction)toggleAlwaysRecording:(NSButton *)sender
{
Media::RecordingModel::instance()->setAlwaysRecording([sender state] == NSOnState);
Media::RecordingModel::instance().setAlwaysRecording([sender state] == NSOnState);
}
- (IBAction)pathControlSingleClick:(id)sender {
// Select that chosen component of the path.
[self.recordingsPathControl setURL:[[self.recordingsPathControl clickedPathComponentCell] URL]];
Media::RecordingModel::instance()->setRecordPath(QUrl::fromNSURL(self.recordingsPathControl.URL));
Media::RecordingModel::instance().setRecordPath(QUrl::fromNSURL(self.recordingsPathControl.URL));
}
- (IBAction)chooseOutput:(id)sender {
int index = [sender indexOfSelectedItem];
QModelIndex qIdx = Audio::Settings::instance()->outputDeviceModel()->index(index, 0);
Audio::Settings::instance()->outputDeviceModel()->selectionModel()->setCurrentIndex(
QModelIndex qIdx = Audio::Settings::instance().outputDeviceModel()->index(index, 0);
Audio::Settings::instance().outputDeviceModel()->selectionModel()->setCurrentIndex(
qIdx, QItemSelectionModel::ClearAndSelect);
}
- (IBAction)chooseInput:(id)sender {
int index = [sender indexOfSelectedItem];
QModelIndex qIdx = Audio::Settings::instance()->inputDeviceModel()->index(index, 0);
Audio::Settings::instance()->inputDeviceModel()->selectionModel()->setCurrentIndex(
QModelIndex qIdx = Audio::Settings::instance().inputDeviceModel()->index(index, 0);
Audio::Settings::instance().inputDeviceModel()->selectionModel()->setCurrentIndex(
qIdx, QItemSelectionModel::ClearAndSelect);
}
......@@ -191,12 +191,12 @@
if([menu.title isEqualToString:@"inputlist"])
{
qIdx = Audio::Settings::instance()->inputDeviceModel()->index(index);
[item setTitle:Audio::Settings::instance()->inputDeviceModel()->data(qIdx, Qt::DisplayRole).toString().toNSString()];
qIdx = Audio::Settings::instance().inputDeviceModel()->index(index);
[item setTitle:Audio::Settings::instance().inputDeviceModel()->data(qIdx, Qt::DisplayRole).toString().toNSString()];
} else
{
qIdx = Audio::Settings::instance()->outputDeviceModel()->index(index);
[item setTitle:Audio::Settings::instance()->outputDeviceModel()->data(qIdx, Qt::DisplayRole).toString().toNSString()];
qIdx = Audio::Settings::instance().outputDeviceModel()->index(index);
[item setTitle:Audio::Settings::instance().outputDeviceModel()->data(qIdx, Qt::DisplayRole).toString().toNSString()];
}
return YES;
......@@ -205,9 +205,9 @@
- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
{
if([menu.title isEqualToString:@"inputlist"])
return Audio::Settings::instance()->inputDeviceModel()->rowCount();
return Audio::Settings::instance().inputDeviceModel()->rowCount();
else
return Audio::Settings::instance()->outputDeviceModel()->rowCount();
return Audio::Settings::instance().outputDeviceModel()->rowCount();
}
@end
......@@ -47,7 +47,7 @@
- (void)viewWillAppear
{
// Get the first video codec of the selected call and use this value as default
auto selectedCall = CallModel::instance()->selectedCall();
auto selectedCall = CallModel::instance().selectedCall();
if (selectedCall) {
int bitrate = selectedCall->account()->codecModel()->videoCodecs()->index(0,0).data(static_cast<int>(CodecModel::Role::BITRATE)).toInt();
[self.bitrateSlider setNumberOfTickMarks:4];
......@@ -58,7 +58,7 @@
- (IBAction)valueChanged:(id)sender
{
if (const auto& codecModel = CallModel::instance()->selectedCall()->account()->codecModel()) {
if (const auto& codecModel = CallModel::instance().selectedCall()->account()->codecModel()) {
const auto& videoCodecs = codecModel->videoCodecs();
for (int i=0; i < videoCodecs->rowCount();i++) {
const auto& idx = videoCodecs->index(i,0);
......
......@@ -72,7 +72,7 @@
mediaHolder = [[MediaConnectionsHolder alloc] init];
QObject::connect(CallModel::instance()->selectionModel(),
QObject::connect(CallModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
[=](const QModelIndex &current, const QModelIndex &previous) {
[self setupChat];
......@@ -90,12 +90,12 @@
QObject::disconnect(mediaHolder.newMediaAdded);
QObject::disconnect(mediaHolder.newMessage);
QModelIndex callIdx = CallModel::instance()->selectionModel()->currentIndex();
QModelIndex callIdx = CallModel::instance().selectionModel()->currentIndex();
if (!callIdx.isValid())
return;
Call* call = CallModel::instance()->getCall(callIdx);
Call* call = CallModel::instance().getCall(callIdx);
/* check if text media is already present */
if (call->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::IN)) {
......@@ -173,8 +173,8 @@
- (IBAction)sendMessage:(id)sender {
QModelIndex callIdx = CallModel::instance()->selectionModel()->currentIndex();
Call* call = CallModel::instance()->getCall(callIdx);
QModelIndex callIdx = CallModel::instance().selectionModel()->currentIndex();
Call* call = CallModel::instance().getCall(callIdx);
/* make sure there is text to send */
NSString* text = self.message;
......
......@@ -100,14 +100,14 @@
- (void) updateAllActions
{
for(int i = 0 ; i <= CallModel::instance()->userActionModel()->rowCount() ; i++) {
for(int i = 0 ; i <= CallModel::instance().userActionModel()->rowCount() ; i++) {
[self updateActionAtIndex:i];
}
}
- (void) updateActionAtIndex:(int) row
{
const QModelIndex& idx = CallModel::instance()->userActionModel()->index(row,0);
const QModelIndex& idx = CallModel::instance().userActionModel()->index(row,0);
UserActionModel::Action action = qvariant_cast<UserActionModel::Action>(idx.data(UserActionModel::Role::ACTION));
NSButton* a = actionHash[(int) action];
if (a) {
......@@ -118,7 +118,7 @@
-(void) updateCall
{
QModelIndex callIdx = CallModel::instance()->selectionModel()->currentIndex();
QModelIndex callIdx = CallModel::instance().selectionModel()->currentIndex();
if (!callIdx.isValid()) {
return;
}
......@@ -225,7 +225,7 @@
- (void) connect
{
QObject::connect(CallModel::instance()->selectionModel(),
QObject::connect(CallModel::instance().selectionModel(),
&QItemSelectionModel::currentChanged,
[=](const QModelIndex &current, const QModelIndex &previous) {
if(!current.isValid()) {
......@@ -233,7 +233,7 @@
return;
}
auto call = CallModel::instance()->getCall(current);
auto call = CallModel::instance().getCall(current);
if (call->state() == Call::State::HOLD) {
call << Call::Action::HOLD;
}
......@@ -244,7 +244,7 @@
[self animateOut];
});
QObject::connect(CallModel::instance()->userActionModel(),
QObject::connect(CallModel::instance().userActionModel(),
&QAbstractItemModel::dataChanged,
[=](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
const int first(topLeft.row()),last(bottomRight.row());
......@@ -253,7 +253,7 @@
}
});
QObject::connect(CallModel::instance(),
QObject::connect(&CallModel::instance(),
&CallModel::callStateChanged,
[self](Call* c, Call::State state) {
[self updateCall];
......@@ -274,8 +274,8 @@
-(void) connectVideoSignals
{
QModelIndex idx = CallModel::instance()->selectionModel()->currentIndex();
Call* call = CallModel::instance()->getCall(idx);
QModelIndex idx = CallModel::instance().selectionModel()->currentIndex();
Call* call = CallModel::instance().getCall(idx);
self.videoStarted = QObject::connect(call,
&Call::videoStarted,
[=](Video::Renderer* renderer) {
......@@ -297,29 +297,29 @@
QObject::disconnect(previewHolder.frameUpdated);
QObject::disconnect(previewHolder.stopped);
QObject::disconnect(previewHolder.started);
previewHolder.started = QObject::connect(Video::PreviewManager::instance(),
previewHolder.started = QObject::connect(&Video::PreviewManager::instance(),
&Video::PreviewManager::previewStarted,
[=](Video::Renderer* renderer) {
QObject::disconnect(previewHolder.frameUpdated);
previewHolder.frameUpdated = QObject::connect(renderer,
&Video::Renderer::frameUpdated,
[=]() {
[self renderer:Video::PreviewManager::instance()->previewRenderer()
[self renderer:Video::PreviewManager::instance().previewRenderer()
renderFrameForView:previewView];
});
});
previewHolder.stopped = QObject::connect(Video::PreviewManager::instance(),
previewHolder.stopped = QObject::connect(&Video::PreviewManager::instance(),
&Video::PreviewManager::previewStopped,
[=](Video::Renderer* renderer) {
QObject::disconnect(previewHolder.frameUpdated);
[previewView.layer setContents:nil];
});
previewHolder.frameUpdated = QObject::connect(Video::PreviewManager::instance()->previewRenderer(),
previewHolder.frameUpdated = QObject::connect(Video::PreviewManager::instance().previewRenderer(),
&Video::Renderer::frameUpdated,
[=]() {
[self renderer:Video::PreviewManager::instance()->previewRenderer()
[self renderer:Video::PreviewManager::instance().previewRenderer()
renderFrameForView:previewView];
});
}
......@@ -416,23 +416,23 @@
[self connectVideoSignals];
/* check if text media is already present */
if(!CallModel::instance()->selectedCall())
if(!CallModel::instance().selectedCall())
return;
QObject::connect(CallModel::instance()->selectedCall(),
QObject::connect(CallModel::instance().selectedCall(),
&Call::changed,
[=]() {
[self updateCall];
});
if (CallModel::instance()->selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::IN)) {
Media::Text *text = CallModel::instance()->selectedCall()->firstMedia<Media::Text>(Media::Media::Direction::IN);
if (CallModel::instance().selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::IN)) {
Media::Text *text = CallModel::instance().selectedCall()->firstMedia<Media::Text>(Media::Media::Direction::IN);
[self monitorIncomingTextMessages:text];
} else if (CallModel::instance()->selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::OUT)) {
Media::Text *text = CallModel::instance()->selectedCall()->firstMedia<Media::Text>(Media::Media::Direction::OUT);
} else if (CallModel::instance().selectedCall()->hasMedia(Media::Media::Type::TEXT, Media::Media::Direction::OUT)) {
Media::Text *text = CallModel::instance().selectedCall()->firstMedia<Media::Text>(Media::Media::Direction::OUT);
[self monitorIncomingTextMessages:text];
} else {
/* monitor media for messaging text messaging */
self.mediaAddedConnection = QObject::connect(CallModel::instance()->selectedCall(),
self.mediaAddedConnection = QObject::connect(CallModel::instance().selectedCall(),
&Call::mediaAdded,
[self] (Media::Media* media) {
if (media->type() == Media::Media::Type::TEXT) { [self monitorIncomingTextMessages:(Media::Text*)media];
......@@ -463,7 +463,7 @@
NSLog(@"animateOut");
if(self.view.frame.origin.x < 0) {
NSLog(@"Already hidden");
if (CallModel::instance()->selectionModel()->currentIndex().isValid()) {
if (CallModel::instance().selectionModel()->currentIndex().isValid()) {
[self animateIn];
}
return;
......@@ -481,7 +481,7 @@
[self.view setHidden:YES];
// first make sure everything is disconnected
[self cleanUp];
if (CallModel::instance()->selectionModel()->currentIndex().isValid()) {