diff --git a/src/AccountSettingsVC.mm b/src/AccountSettingsVC.mm index e237b572905293a2d56d6e546029b38777536f82..85064d89b4f7065bd24b1ce8bd44a504fb062802 100644 --- a/src/AccountSettingsVC.mm +++ b/src/AccountSettingsVC.mm @@ -71,7 +71,7 @@ CGFloat const VIEW_INSET = 40; - (void) setSelectedAccount:(const QString&) account { selectedAccountID = account; const auto& accountInfo = accountModel->getAccountInfo(selectedAccountID); - if (accountInfo.profileInfo.type == lrc::api::profile::Type::RING) { + if (accountInfo.profileInfo.type == lrc::api::profile::Type::JAMI) { accountGeneralVC = ringGeneralVC; accountGeneralVC.delegate = self; accountAdvancedVC = ringAdvancedVC; diff --git a/src/AppDelegate.mm b/src/AppDelegate.mm index a187fc5b7486a2f2985080538a06c00391e27294..dcfb9a4dd5eb46cba39bfce471aa6ea037415d09 100644 --- a/src/AppDelegate.mm +++ b/src/AppDelegate.mm @@ -359,7 +359,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNet - (void) showMainWindow { if(self.ringWindowController == nil) { - self.ringWindowController = [[RingWindowController alloc] initWithWindowNibName:@"RingWindow" bundle: nil accountModel:&lrc->getAccountModel() dataTransferModel:&lrc->getDataTransferModel() behaviourController:&lrc->getBehaviorController() avModel: &lrc->getAVModel() pluginModel: &lrc->getPluginModel()]; + self.ringWindowController = [[RingWindowController alloc] initWithWindowNibName:@"RingWindow" bundle: nil accountModel:&lrc->getAccountModel() behaviourController:&lrc->getBehaviorController() avModel: &lrc->getAVModel() pluginModel: &lrc->getPluginModel()]; } [[NSApplication sharedApplication] removeWindowsItem:self.wizard.window]; self.wizard = nil; diff --git a/src/ChooseAccountVC.mm b/src/ChooseAccountVC.mm index 02912daaadb217c9d3dc34e137503eae4277d36b..d295af793aa5073c3655388ebad485b7453d70fd 100644 --- a/src/ChooseAccountVC.mm +++ b/src/ChooseAccountVC.mm @@ -232,7 +232,7 @@ NSMutableDictionary* menuItemsTags; case lrc::api::profile::Type::SIP: [itemView.accountTypeLabel setStringValue:@"SIP"]; break; - case lrc::api::profile::Type::RING: + case lrc::api::profile::Type::JAMI: [itemView.accountTypeLabel setStringValue:@"Jami"]; break; default: diff --git a/src/CurrentCallVC.mm b/src/CurrentCallVC.mm index 31719c1eaaeee3c51a73b6e8daae68b75c2cf3de..3f148160918b920e220241228b7bbb398226ff14 100644 --- a/src/CurrentCallVC.mm +++ b/src/CurrentCallVC.mm @@ -317,8 +317,6 @@ CVPixelBufferRef pixelBufferPreview; } lrc::api::conversation::Info& conv = *convOpt; auto& contact = accountInfo_->contactModel->getContact(conv.participants[0]); - if (contact.profileInfo.type == lrc::api::profile::Type::RING && contact.profileInfo.uri == contactUri) - accountInfo_->conversationModel->makePermanent(convUid_); [contactPhoto setImage: [self getContactImageOfSize:120.0 withDefaultAvatar:YES]]; [self.delegate conversationInfoUpdatedFor:convUid_]; [self setBackground]; diff --git a/src/GeneralPrefsVC.mm b/src/GeneralPrefsVC.mm index 9512c41b1972975d6cee2fadc0c3a4e982ebeb09..85cedf5a356192d656d8ca1028a7770236ea70c2 100644 --- a/src/GeneralPrefsVC.mm +++ b/src/GeneralPrefsVC.mm @@ -21,6 +21,7 @@ //lrc #import <api/datatransfermodel.h> #import <api/avmodel.h> +#import <api/newaccountmodel.h> #if ENABLE_SPARKLE #import <Sparkle/Sparkle.h> @@ -50,14 +51,13 @@ @implementation GeneralPrefsVC -@synthesize dataTransferModel; @synthesize avModel; +@synthesize accountModel; - --(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil dataTransferModel:(lrc::api::DataTransferModel*) dataTransferModel avModel:(lrc::api::AVModel*) avModel { +-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:( lrc::api::NewAccountModel*) accountModel avModel: (lrc::api::AVModel*)avModel { if (self = [self initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { - self.dataTransferModel = dataTransferModel; + self.accountModel = accountModel; self.avModel = avModel; } return self; @@ -88,8 +88,8 @@ [conversationStackView setHidden:YES]; heightToReduice += (downloadFolder.frame.size.height + recordingFolder.frame.size.height + 25); } else { - if (dataTransferModel) { - downloadFolder.title = [dataTransferModel->downloadDirectory.toNSString() lastPathComponent]; + if (accountModel) { + downloadFolder.title = [self.accountModel->downloadDirectory.toNSString() lastPathComponent]; } if (avModel) { auto name1 = avModel->getRecordPath(); @@ -112,8 +112,8 @@ if ([panel runModal] != NSFileHandlingPanelOKButton) return; if ([[panel URLs] lastObject] == nil) return; NSString * path = [[[[panel URLs] lastObject] path] stringByAppendingString:@"/"]; - dataTransferModel->downloadDirectory = QString::fromNSString(path); - downloadFolder.title = [dataTransferModel->downloadDirectory.toNSString() lastPathComponent]; + self.accountModel->downloadDirectory = QString::fromNSString(path); + downloadFolder.title = [self.accountModel->downloadDirectory.toNSString() lastPathComponent]; [[NSUserDefaults standardUserDefaults] setObject:path forKey:Preferences::DownloadFolder]; } diff --git a/src/LrcModelsProtocol.h b/src/LrcModelsProtocol.h index 2d448ed03905a12bd4dae7816b246d8794d52a68..c7b6b23c5813cb5ff088a7f8bc9d186d0c8cd657 100644 --- a/src/LrcModelsProtocol.h +++ b/src/LrcModelsProtocol.h @@ -29,14 +29,12 @@ namespace lrc { @protocol LrcModelsProtocol --(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil dataTransferModel:(const lrc::api::DataTransferModel*) dataTransferModel; --(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil dataTransferModel:(const lrc::api::DataTransferModel*) dataTransferModel avModel:(const lrc::api::AVModel*) avModel; +-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel avModel:(const lrc::api::AVModel*) avModel; -(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil pluginModel:(const lrc::api::PluginModel*) pluginModel; -(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil avModel:(const lrc::api::AVModel*) avModel; -(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(const lrc::api::NewAccountModel*) accountModel; --(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel dataTransferModel:(const lrc::api::DataTransferModel*)dataTransferModel behaviourController:(const lrc::api::BehaviorController*) behaviorController; --(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel dataTransferModel:(const lrc::api::DataTransferModel*)dataTransferModel behaviourController:(const lrc::api::BehaviorController*) behaviorController avModel: (const lrc::api::AVModel*)avModel; --(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel dataTransferModel:(const lrc::api::DataTransferModel*)dataTransferModel behaviourController:(const lrc::api::BehaviorController*) behaviorController avModel: (const lrc::api::AVModel*)avModel pluginModel: (const lrc::api::PluginModel*)pluginModel; +-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(lrc::api::NewAccountModel*)accountModel avModel: ( lrc::api::AVModel*)avModel; +-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel behaviourController:(const lrc::api::BehaviorController*) behaviorController avModel: (const lrc::api::AVModel*)avModel pluginModel: (const lrc::api::PluginModel*)pluginModel; @property lrc::api::DataTransferModel* dataTransferModel; @property lrc::api::NewAccountModel* accountModel; diff --git a/src/PreferencesWC.mm b/src/PreferencesWC.mm index fc236f52a3d07a14f951a08334126eca4763fc40..1ca9fccc3096bb2c39341e61a0e816fa0ad94da6 100644 --- a/src/PreferencesWC.mm +++ b/src/PreferencesWC.mm @@ -34,7 +34,7 @@ NSViewController *currentVC; } -@synthesize dataTransferModel, accountModel, behaviorController, avModel, pluginModel; +@synthesize accountModel, behaviorController, avModel, pluginModel; // Identifiers used in PreferencesWindow.xib for tabs static auto const kGeneralPrefsIdentifier = @"GeneralPrefsIdentifier"; @@ -57,12 +57,11 @@ static auto const kPluginPrefsIdentifer = @"PluginPrefsIdentifer"; [tb setAllowsUserCustomization:NO]; } --(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(lrc::api::NewAccountModel*)accountModel dataTransferModel:(lrc::api::DataTransferModel*)dataTransferModel behaviourController:(lrc::api::BehaviorController*)behaviorController avModel: (lrc::api::AVModel*)avModel pluginModel: (lrc::api::PluginModel*)pluginModel +-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(lrc::api::NewAccountModel*)accountModel behaviourController:(lrc::api::BehaviorController*)behaviorController avModel: (lrc::api::AVModel*)avModel pluginModel: (lrc::api::PluginModel*)pluginModel { if (self = [self initWithWindowNibName:nibNameOrNil]) { self.accountModel = accountModel; - self.dataTransferModel = dataTransferModel; self.behaviorController = behaviorController; self.avModel = avModel; self.pluginModel = pluginModel; @@ -74,7 +73,7 @@ static auto const kPluginPrefsIdentifer = @"PluginPrefsIdentifer"; { [[prefsContainer subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)]; - currentVC = [[GeneralPrefsVC alloc] initWithNibName:@"GeneralPrefs" bundle:nil dataTransferModel: self.dataTransferModel avModel: self.avModel]; + currentVC = [[GeneralPrefsVC alloc] initWithNibName:@"GeneralPrefs" bundle:nil accountModel: self.accountModel avModel: self.avModel]; [self addCurrentVC]; } diff --git a/src/RingWindowController.mm b/src/RingWindowController.mm index 5191229194603da04d39c251ae3cafc0991e08e2..3d4a4ec8d3836929ed9f805fef509e394517ab67 100644 --- a/src/RingWindowController.mm +++ b/src/RingWindowController.mm @@ -87,15 +87,14 @@ typedef NS_ENUM(NSInteger, ViewState) { IBOutlet ChooseAccountVC* chooseAccountVC; } -@synthesize dataTransferModel, accountModel, behaviorController, avModel, pluginModel; +@synthesize accountModel, behaviorController, avModel, pluginModel; @synthesize wizard; --(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:( lrc::api::NewAccountModel*)accountModel dataTransferModel:( lrc::api::DataTransferModel*)dataTransferModel behaviourController:( lrc::api::BehaviorController*) behaviorController avModel: (lrc::api::AVModel*)avModel pluginModel: (lrc::api::PluginModel*)pluginModel +-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:( lrc::api::NewAccountModel*)accountModel behaviourController:( lrc::api::BehaviorController*) behaviorController avModel: (lrc::api::AVModel*)avModel pluginModel: (lrc::api::PluginModel*)pluginModel { if (self = [self initWithWindowNibName:nibNameOrNil]) { self.accountModel = accountModel; - self.dataTransferModel = dataTransferModel; self.behaviorController = behaviorController; self.avModel = avModel; self.pluginModel = pluginModel; @@ -208,7 +207,7 @@ typedef NS_ENUM(NSInteger, ViewState) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); path = [[paths objectAtIndex:0] stringByAppendingString:@"/"]; } - self.dataTransferModel->downloadDirectory = QString::fromNSString(path); + self.accountModel->downloadDirectory = QString::fromNSString(path); if(appSandboxed()) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); avModel->setRecordPath(QString::fromNSString([paths objectAtIndex:0])); @@ -412,7 +411,7 @@ typedef NS_ENUM(NSInteger, ViewState) { [ringIDLabel setStringValue:@""]; - if(account.profileInfo.type != lrc::api::profile::Type::RING) { + if(account.profileInfo.type != lrc::api::profile::Type::JAMI) { self.notRingAccount = YES; self.isSIPAccount = YES; return; @@ -568,7 +567,7 @@ typedef NS_ENUM(NSInteger, ViewState) { return; } - preferencesWC = [[PreferencesWC alloc] initWithWindowNibName: @"PreferencesWindow" bundle: nil accountModel:self.accountModel dataTransferModel:self.dataTransferModel behaviourController:self.behaviorController avModel: self.avModel pluginModel: self.pluginModel]; + preferencesWC = [[PreferencesWC alloc] initWithWindowNibName: @"PreferencesWindow" bundle: nil accountModel:self.accountModel behaviourController:self.behaviorController avModel: self.avModel pluginModel: self.pluginModel]; [preferencesWC.window makeKeyAndOrderFront:preferencesWC.window]; } diff --git a/src/RingWizardLinkAccountVC.mm b/src/RingWizardLinkAccountVC.mm index da9dd315140350c78a2b3eed3df0322da1d260ef..6ba7309d7d7037826c40e84a5f6f242d5ff6041e 100644 --- a/src/RingWizardLinkAccountVC.mm +++ b/src/RingWizardLinkAccountVC.mm @@ -147,7 +147,7 @@ NSString *pin = backupFile ? @"" : (self.pinValue ? self.pinValue : @""); NSString *archivePath = backupFile ? [backupFile path] : @""; NSString *pathword = self.passwordValue ? self.passwordValue : @""; - accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::RING, + accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::JAMI, "", QString::fromNSString(archivePath), QString::fromNSString(pathword), diff --git a/src/RingWizardNewAccountVC.mm b/src/RingWizardNewAccountVC.mm index a63dc1b3ae3bef02190f2032297229ebcf8077d9..4dc1a6e5abde9a81d4df697b1a994f844b4400b9 100644 --- a/src/RingWizardNewAccountVC.mm +++ b/src/RingWizardNewAccountVC.mm @@ -302,7 +302,7 @@ BOOL isRendevous = false; [self display:loadingView]; [progressBar startAnimation:nil]; - accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::RING, QString::fromNSString(displayNameField.stringValue),"",QString::fromNSString(passwordField.stringValue), ""); + accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::JAMI, QString::fromNSString(displayNameField.stringValue),"",QString::fromNSString(passwordField.stringValue), ""); } /** diff --git a/src/SmartViewVC.mm b/src/SmartViewVC.mm index 32820daf43a82c5e498a2110d79c392f4427d831..1a95e3ca7fe6dfd0bce68e2e71ac5d35aa6f85b6 100755 --- a/src/SmartViewVC.mm +++ b/src/SmartViewVC.mm @@ -66,7 +66,7 @@ lrc::api::ConversationModel* convModel_; QString selectedUid_; - lrc::api::profile::Type currentFilterType; + lrc::api::FilterType currentFilterType; __unsafe_unretained IBOutlet RingWindowController *delegate; } @@ -107,7 +107,7 @@ NSInteger const REQUEST_SEG = 1; [smartView setShortcutsDelegate:self]; [smartView setDataSource: self]; - currentFilterType = lrc::api::profile::Type::RING; + currentFilterType = lrc::api::FilterType::JAMI; selectorIsPresent = true; NSFont *searchBarFont = [NSFont systemFontOfSize: 12.0 weight: NSFontWeightLight]; NSColor *color = [NSColor secondaryLabelColor]; @@ -162,16 +162,16 @@ NSInteger const REQUEST_SEG = 1; return; } - auto ringConversations = convModel_->getFilteredConversations(lrc::api::profile::Type::RING); + auto ringConversations = convModel_->getFilteredConversations(lrc::api::FilterType::JAMI); int totalUnreadMessages = 0; std::for_each(ringConversations.get().begin(), ringConversations.get().end(), [&totalUnreadMessages, self] (const auto& conversation) { - totalUnreadMessages += convModel_->getNumberOfUnreadMessagesFor(conversation.get().uid); + totalUnreadMessages += conversation.get().unreadMessages; }); [totalMsgsCount setHidden:(totalUnreadMessages == 0)]; [totalMsgsCount setIntValue:totalUnreadMessages]; - auto totalRequests = [self chosenAccount].contactModel->pendingRequestCount(); + auto totalRequests = [self chosenAccount].conversationModel->pendingRequestCount(); [totalInvites setHidden:(totalRequests == 0)]; [totalInvites setIntValue:totalRequests]; } @@ -192,8 +192,8 @@ NSInteger const REQUEST_SEG = 1; [self reloadSelectorNotifications]; - if (!convModel_->owner.contactModel->hasPendingRequests()) { - if (currentFilterType == lrc::api::profile::Type::PENDING) { + if (!convModel_->owner.conversationModel->hasPendingRequests()) { + if (currentFilterType == lrc::api::FilterType::REQUEST) { [self selectConversationList]; } if (selectorIsPresent) { @@ -304,7 +304,7 @@ NSInteger const REQUEST_SEG = 1; }); newConversationConnection_ = QObject::connect(convModel_, &lrc::api::ConversationModel::newConversation, [self] (const QString& convUid) { - [self reloadData]; + [self reloadData]; [self updateConversationForNewContact:convUid.toNSString()]; }); conversationRemovedConnection_ = QObject::connect(convModel_, &lrc::api::ConversationModel::conversationRemoved, @@ -389,17 +389,17 @@ NSInteger const REQUEST_SEG = 1; NSInteger selectedItem = [sender selectedSegment]; switch (selectedItem) { case CONVERSATION_SEG: - if (currentFilterType != lrc::api::profile::Type::RING) { - convModel_->setFilter(lrc::api::profile::Type::RING); + if (currentFilterType != lrc::api::FilterType::JAMI) { + currentFilterType = lrc::api::FilterType::JAMI; + convModel_->setFilter(currentFilterType); [delegate listTypeChanged]; - currentFilterType = lrc::api::profile::Type::RING; } break; case REQUEST_SEG: - if (currentFilterType != lrc::api::profile::Type::PENDING) { - convModel_->setFilter(lrc::api::profile::Type::PENDING); + if (currentFilterType != lrc::api::FilterType::REQUEST) { + currentFilterType = lrc::api::FilterType::REQUEST; + convModel_->setFilter(currentFilterType); [delegate listTypeChanged]; - currentFilterType = lrc::api::profile::Type::PENDING; } break; default: @@ -409,25 +409,25 @@ NSInteger const REQUEST_SEG = 1; -(void) selectConversationList { - if (currentFilterType == lrc::api::profile::Type::RING) + if (currentFilterType == lrc::api::FilterType::JAMI) return; [listTypeSelector setSelectedSegment:CONVERSATION_SEG]; // Do not invert order of the next two lines or stack overflow // may happen on -(void) reloadData call if filter is currently set to PENDING - currentFilterType = lrc::api::profile::Type::RING; - convModel_->setFilter(lrc::api::profile::Type::RING); + currentFilterType = lrc::api::FilterType::JAMI; + convModel_->setFilter(currentFilterType); convModel_->setFilter(""); } -(void) selectPendingList { - if (currentFilterType == lrc::api::profile::Type::PENDING) + if (currentFilterType == lrc::api::FilterType::REQUEST) return; [listTypeSelector setSelectedSegment:REQUEST_SEG]; - currentFilterType = lrc::api::profile::Type::PENDING; - convModel_->setFilter(lrc::api::profile::Type::PENDING); + currentFilterType = lrc::api::FilterType::REQUEST; + convModel_->setFilter(currentFilterType); convModel_->setFilter(""); } @@ -831,7 +831,7 @@ NSInteger const REQUEST_SEG = 1; return nil; } - else if (contact.profileInfo.type == lrc::api::profile::Type::RING && contact.isTrusted == true) { + else if (contact.profileInfo.type == lrc::api::profile::Type::JAMI && contact.isTrusted == true) { isRingContact = true; } auto conversationUD = conversation.uid; diff --git a/src/delegates/ImageManipulationDelegate.mm b/src/delegates/ImageManipulationDelegate.mm index d1b15f1e2984e8798b90af7f92da89b44ff52dce..cf61adea94452b333fad3cad19a74dfed50767f3 100644 --- a/src/delegates/ImageManipulationDelegate.mm +++ b/src/delegates/ImageManipulationDelegate.mm @@ -112,7 +112,7 @@ namespace Interfaces { { if (!contact.profileInfo.alias.isEmpty()) { return contact.profileInfo.alias.at(0).toUpper(); - } else if((contact.profileInfo.type == lrc::api::profile::Type::RING || + } else if((contact.profileInfo.type == lrc::api::profile::Type::JAMI || contact.profileInfo.type == lrc::api::profile::Type::PENDING) && !contact.registeredName.isEmpty()) { return contact.registeredName.at(0).toUpper(); @@ -193,7 +193,7 @@ namespace Interfaces { auto trimmed = contact.profileInfo.alias.trimmed().replace("\r","").replace("\n",""); if (!trimmed.isEmpty()) { return drawDefaultUserPixmap(size, color.toLatin1(), trimmed.at(0).toUpper().toLatin1()); - } else if((contact.profileInfo.type == lrc::api::profile::Type::RING || + } else if((contact.profileInfo.type == lrc::api::profile::Type::JAMI || contact.profileInfo.type == lrc::api::profile::Type::PENDING) && !contact.registeredName.isEmpty()) { trimmed = contact.registeredName.trimmed().replace("\r","").replace("\n","");