Commit 79597607 authored by Anthony Léonard's avatar Anthony Léonard Committed by Guillaume Roguez

model: init new lrc and clean main function

LRC and daemon initialization is moved into RingWindowController and
is done with new Lrc class (without singleton). main.mm is also
cleaned up so old models (such as RecentModel) are not initialized
anymore.

Change-Id: I0af61a4c36ea612a8f51a7ff60594c34b6699bbe
Reviewed-by: Guillaume Roguez's avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent 643a3901
......@@ -19,6 +19,7 @@
#import "RingWindowController.h"
#import <QuartzCore/QuartzCore.h>
#include <qrencode.h>
#include <memory>
//Qt
#import <QItemSelectionModel>
......@@ -31,7 +32,7 @@
#import <call.h>
#import <recentmodel.h>
#import <AvailableAccountModel.h>
#import <api/lrc.h>
// Ring
#import "AppDelegate.h"
......@@ -64,6 +65,8 @@
__unsafe_unretained IBOutlet NSButton* shareButton;
__unsafe_unretained IBOutlet NSImageView* qrcodeView;
std::unique_ptr<lrc::api::Lrc> lrc_;
PreferencesWC* preferencesWC;
IBOutlet SmartViewVC* smartViewVC;
IBOutlet PersonsVC* personsVC;
......@@ -86,6 +89,8 @@ NSString* const kTrustRequestMenuItemIdentifier = @"TrustRequestMenuItemIde
[self.window setBackgroundColor:[NSColor colorWithRed:242.0/255 green:242.0/255 blue:242.0/255 alpha:1.0]];
self.window.titleVisibility = NSWindowTitleHidden;
lrc_ = std::make_unique<lrc::api::Lrc>();
currentCallVC = [[CurrentCallVC alloc] initWithNibName:@"CurrentCall" bundle:nil];
offlineVC = [[ConversationVC alloc] initWithNibName:@"Conversation" bundle:nil];
// toolbar items
......
......@@ -28,20 +28,11 @@
#import <QLocale>
//LRC
#import <personmodel.h>
#import <recentmodel.h>
#import <categorizedhistorymodel.h>
#import <localhistorycollection.h>
#import <localprofilecollection.h>
#import <peerprofilecollection.h>
#import <numbercategorymodel.h>
#import <callmodel.h>
#import <profilemodel.h>
#import <media/recordingmodel.h>
#import "backends/AddressBookBackend.h"
#import "delegates/ImageManipulationDelegate.h"
#import "AccountSelectionManager.h"
int main(int argc, const char *argv[]) {
......@@ -68,25 +59,9 @@ int main(int argc, const char *argv[]) {
}
}
AccountSelectionManager* manager = [[AccountSelectionManager alloc] init];
manager.selectChosenAccount;
CallModel::instance();
CategorizedHistoryModel::instance().addCollection<LocalHistoryCollection>(LoadOptions::FORCE_ENABLED);
/* make sure basic number categories exist, in case user has no contacts
* from which these would be automatically created
*/
NumberCategoryModel::instance().addCategory("work", QVariant());
NumberCategoryModel::instance().addCategory("home", QVariant());
GlobalInstances::setPixmapManipulator(std::unique_ptr<Interfaces::ImageManipulationDelegate>(new Interfaces::ImageManipulationDelegate()));
PersonModel::instance().addCollection<AddressBookBackend>(LoadOptions::FORCE_ENABLED);
RecentModel::instance(); // Make sure RecentModel is initialized before showing UI
ProfileModel::instance().addCollection<LocalProfileCollection>(LoadOptions::FORCE_ENABLED);
PersonModel::instance().addCollection<PeerProfileCollection>(LoadOptions::FORCE_ENABLED);
Media::RecordingModel::instance();
return NSApplicationMain(argc, argv);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment