cleanup: remove legacy functions
Change-Id: I928ff8cdd89d6f372632ef6f5f39d85e16d5bb03
diff --git a/src/AppDelegate.h b/src/AppDelegate.h
index f987bef..66ee2d8 100644
--- a/src/AppDelegate.h
+++ b/src/AppDelegate.h
@@ -21,7 +21,6 @@
#import "RingWindowController.h"
#import "PreferencesWindowController.h"
-#import <string>
@interface AppDelegate : NSObject <NSApplicationDelegate, NSUserNotificationCenterDelegate>
diff --git a/src/AppDelegate.mm b/src/AppDelegate.mm
index c94468e..27934c8 100644
--- a/src/AppDelegate.mm
+++ b/src/AppDelegate.mm
@@ -21,7 +21,6 @@
#import "AppDelegate.h"
//lrc
-#import <callmodel.h>
#import <api/lrc.h>
#import <api/newaccountmodel.h>
#import <api/behaviorcontroller.h>
diff --git a/src/ConversationVC.mm b/src/ConversationVC.mm
index 4b3e97c..55e7c1f 100644
--- a/src/ConversationVC.mm
+++ b/src/ConversationVC.mm
@@ -24,8 +24,8 @@
#import <QPixmap>
#import <QtMacExtras/qmacfunctions.h>
#import <QuartzCore/QuartzCore.h>
-
-// LRC
+#import <QuickLook/QuickLook.h>
+#import <Quartz/Quartz.h>
#import "views/IconButton.h"
#import "views/HoverButton.h"
@@ -37,8 +37,6 @@
#import "RingWindowController.h"
#import "NSString+Extensions.h"
#import "LeaveMessageVC.h"
-#import <QuickLook/QuickLook.h>
-#import <Quartz/Quartz.h>
#import "LeaveMessageVC.h"
@interface ConversationVC () <QLPreviewPanelDataSource, QLPreviewPanelDelegate>{
diff --git a/src/CurrentCallVC.mm b/src/CurrentCallVC.mm
index b78a76e..9313a46 100644
--- a/src/CurrentCallVC.mm
+++ b/src/CurrentCallVC.mm
@@ -32,7 +32,6 @@
#import <QUrl>
///LRC
-#import <video/previewmanager.h>
#import <video/renderer.h>
#import <api/newcallmodel.h>
#import <api/call.h>
diff --git a/src/DialpadWC.mm b/src/DialpadWC.mm
index 63b0022..db2a143 100644
--- a/src/DialpadWC.mm
+++ b/src/DialpadWC.mm
@@ -19,12 +19,6 @@
#import "DialpadWC.h"
-///Qt
-#import <QtCore/qitemselectionmodel.h>
-
-///LRC
-#import <callmodel.h>
-
@interface DialpadWC ()
@property (unsafe_unretained) IBOutlet NSTextField* composerField;
diff --git a/src/QNSTreeController.h b/src/QNSTreeController.h
deleted file mode 100644
index 4a82f48..0000000
--- a/src/QNSTreeController.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#import <Cocoa/Cocoa.h>
-#import <qabstractitemmodel.h>
-
-@interface QNSTreeController : NSTreeController {
-
- QAbstractItemModel *privateQModel;
-}
-
-- (id) initWithQModel:(QAbstractItemModel*) model;
-- (QModelIndex) toQIdx:(NSTreeNode*) node;
-- (QModelIndex) indexPathtoQIdx:(NSIndexPath*) path;
-- (void) setSelectionQModelIndex:(QModelIndex) qIdx;
-
-@end
diff --git a/src/QNSTreeController.mm b/src/QNSTreeController.mm
deleted file mode 100644
index cb54146..0000000
--- a/src/QNSTreeController.mm
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2015-2016 Savoir-faire Linux Inc.
- * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#import "QNSTreeController.h"
-
-#import <QDebug>
-
-@interface Node : NSObject {
- NSMutableArray *children;
-}
-@end
-
-@implementation Node
-- (id) init
-{
- if (self = [super init]) {
- children = [[NSMutableArray alloc] init];
- }
- return self;
-}
-
-- (void) addChild:(Node*) child AtIndex:(NSUInteger) idx
-{
- [children insertObject:child atIndex:idx];
-}
-
-- (NSMutableArray*) children
-{
- return children;
-}
-
-@end
-
-
-@implementation QNSTreeController
-
-- (id) initWithQModel:(QAbstractItemModel*) model
-{
- self = [super init];
- self->privateQModel = model;
-
- NSMutableArray* nodes = [[NSMutableArray alloc] init];
- [self populate:nodes];
-
- [self connect];
- return [self initWithContent:nodes];
-}
-
--(void) populate:(NSMutableArray*) nodes
-{
- for (int i = 0 ; i < self->privateQModel->rowCount() ; ++i) {
- Node* n = [[Node alloc] init];
- //qDebug() << "POUPL TOP:"<< self->privateQModel->index(i, 0) ;
- [self populateChild:[n children] withParent:self->privateQModel->index(i, 0)];
- [nodes insertObject:n atIndex:i];
- }
-}
-
-- (void) populateChild:(NSMutableArray*) nodes withParent:(QModelIndex)qIdx
-{
- if (!qIdx.isValid())
- return;
- for (int i = 0 ; i < self->privateQModel->rowCount(qIdx) ; ++i) {
- Node* n = [[Node alloc] init];
- [self populateChild:[n children] withParent:self->privateQModel->index(i, 0, qIdx)];
- [nodes insertObject:n atIndex:i];
- }
-}
-
-- (BOOL)isEditable
-{
- return self->privateQModel->flags(self->privateQModel->index(0, 0)) | Qt::ItemIsEditable;
-}
-
-- (QModelIndex) indexPathtoQIdx:(NSIndexPath*) path
-{
- NSUInteger myArray[[path length]];
- [path getIndexes:myArray];
- QModelIndex toReturn;
-
- for (int i = 0; i < path.length; ++i) {
- toReturn = self->privateQModel->index(myArray[i], 0, toReturn);
- }
-
- return toReturn;
-}
-
-- (QModelIndex) toQIdx:(NSTreeNode*) node
-{
- return [self indexPathtoQIdx:node.indexPath];
-}
-
-- (NSIndexPath*) qIdxToNSIndexPath:(QModelIndex) qIdx
-{
- QModelIndex tmp = qIdx.parent();
- NSMutableArray* allIndexes = [NSMutableArray array];
- while (tmp.isValid()) {
- [allIndexes insertObject:@(tmp.row()) atIndex:0];
- tmp = tmp.parent();
- }
- [allIndexes insertObject:@(qIdx.row()) atIndex:allIndexes.count];
-
- NSUInteger indexes[allIndexes.count];
- for (int i = 0 ; i < allIndexes.count ; ++i) {
- indexes[i] = [[allIndexes objectAtIndex:i] intValue];
- }
- return [[NSIndexPath alloc] initWithIndexes:indexes length:allIndexes.count];
-}
-
-- (void) insertNodeAtQIndex:(QModelIndex) qIdx
-{
- NSIndexPath* path = [self qIdxToNSIndexPath:qIdx];
- //qDebug() << "insertNodeAt" << qIdx;
- //NSLog(@"insertNodeAt index: %@", path);
- if (path.length == 1 && [path indexAtPosition:0] <= [[[self arrangedObjects] childNodes] count])
- [self insertObject:[[Node alloc] init] atArrangedObjectIndexPath:path];
- else if (path.length > 1)
- [self insertObject:[[Node alloc] init] atArrangedObjectIndexPath:path];
-}
-
-- (void) removeNodeAtQIndex:(QModelIndex) qIdx
-{
- NSIndexPath* path = [self qIdxToNSIndexPath:qIdx];
- if ([self.arrangedObjects descendantNodeAtIndexPath:path]) {
- //NSLog(@"removeNodeAt index: %@", path);
- [self removeObjectAtArrangedObjectIndexPath:path];
- }
-}
-
-- (void) setSelectionQModelIndex:(QModelIndex) qIdx
-{
- NSIndexPath* path = [self qIdxToNSIndexPath:qIdx];
- [self setSelectionIndexPath:path];
-}
-
-- (void)connect
-{
- QObject::connect(self->privateQModel,
- &QAbstractItemModel::rowsInserted,
- [=](const QModelIndex & parent, int first, int last) {
- for( int row = first; row <= last; ++row) {
- //qDebug() << "INSERTING:"<< self->privateQModel->index(row, 0, parent) ;
- if(!self->privateQModel->index(row, 0, parent).isValid())
- continue;
-
- [self insertNodeAtQIndex:self->privateQModel->index(row, 0, parent)];
- }
- });
-
- QObject::connect(self->privateQModel,
- &QAbstractItemModel::rowsAboutToBeMoved,
- [=](const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationRow) {
- //NSLog(@"rows about to be moved, start: %d, end: %d, moved to: %d", sourceStart, sourceEnd, destinationRow);
- /* first remove the row from old location
- * then insert them at the new location on the "rowsMoved signal */
- for( int row = sourceStart; row <= sourceEnd; row++) {
- //TODO
- }
- });
-
- QObject::connect(self->privateQModel,
- &QAbstractItemModel::rowsMoved,
- [self](const QModelIndex & sourceParent, int sourceStart, int sourceEnd, const QModelIndex & destinationParent, int destinationRow) {
- for( int row = sourceStart; row <= sourceEnd; row++) {
- NSIndexPath* srcPath = [self qIdxToNSIndexPath:self->privateQModel->index(row, 0, sourceParent)];
- NSIndexPath* destPath = [self qIdxToNSIndexPath:self->privateQModel->index(destinationRow, 0, destinationParent)];
-
- [self moveNode:[self.arrangedObjects descendantNodeAtIndexPath:srcPath] toIndexPath:destPath];
- }
- });
-
- QObject::connect(self->privateQModel,
- &QAbstractItemModel::rowsAboutToBeRemoved,
- [self](const QModelIndex & parent, int first, int last) {
- for( int row = last; row >= first; --row) {
- //qDebug() << "REMOVING:"<< self->privateQModel->index(row, 0, parent) ;
- if (!self->privateQModel->index(row, 0, parent).isValid())
- continue;
-
- [self removeNodeAtQIndex:self->privateQModel->index(row, 0, parent)];
- }
- });
-
- QObject::connect(self->privateQModel,
- &QAbstractItemModel::rowsRemoved,
- [self](const QModelIndex& parent, int first, int last) {
-
- });
-
- QObject::connect(self->privateQModel,
- &QAbstractItemModel::layoutChanged,
- [self]() {
- //NSLog(@"layout changed");
- [self rearrangeObjects];
- });
-
- /* No way to 'update' a row, only insert/remove/move
- QObject::connect(self->privateQModel,
- &QAbstractItemModel::dataChanged,
- [self](const QModelIndex &topLeft, const QModelIndex &bottomRight) {
- });
- */
-}
-
-@end
diff --git a/src/RingWindowController.mm b/src/RingWindowController.mm
index 0fed546..d80e190 100644
--- a/src/RingWindowController.mm
+++ b/src/RingWindowController.mm
@@ -21,12 +21,7 @@
#include <qrencode.h>
#include <memory>
-//Qt
-#import <QItemSelectionModel>
-#import <QItemSelection>
-
//LRC
-#import <AvailableAccountModel.h>
#import <api/lrc.h>
#import <api/account.h>
#import <api/newaccountmodel.h>
@@ -446,49 +441,6 @@
}
}
-#pragma mark - Ring account migration
-
-- (void) migrateRingAccount:(Account*) acc
-{
- self.migrateWC = [[MigrateRingAccountsWC alloc] initWithDelegate:self actionCode:1];
- self.migrateWC.account = acc;
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
- [self.window beginSheet:self.migrateWC.window completionHandler:nil];
-#else
- [NSApp beginSheet: self.migrateWC.window
- modalForWindow: self.window
- modalDelegate: self
- didEndSelector: nil
- contextInfo: nil];
-#endif
-}
-
-// TODO: Reimplement as a blocking loop when new LRC models handle migration
-- (void)checkAccountsToMigrate
-{
- auto ringList = AccountModel::instance().accountsToMigrate();
- if (ringList.length() > 0){
- Account* acc = ringList.value(0);
- [self migrateRingAccount:acc];
- } else {
- // Fresh run, we need to make sure RingID appears
- [shareButton sendActionOn:NSLeftMouseDownMask];
-
- [self connect];
- [self updateRingID];
- }
-}
-
-- (void)migrationDidComplete
-{
- [self checkAccountsToMigrate];
-}
-
-- (void)migrationDidCompleteWithError
-{
- [self checkAccountsToMigrate];
-}
-
- (void) selectAccount:(const lrc::api::account::Info&)accInfo currentRemoved:(BOOL) removed
{
// If the selected account has been changed, we close any open panel
diff --git a/src/SmartViewVC.mm b/src/SmartViewVC.mm
index 8ee3a81..3a88803 100755
--- a/src/SmartViewVC.mm
+++ b/src/SmartViewVC.mm
@@ -27,8 +27,6 @@
//Qt
#import <QtMacExtras/qmacfunctions.h>
#import <QPixmap>
-#import <QIdentityProxyModel>
-#import <QItemSelectionModel>
//LRC
#import <globalinstances.h>
diff --git a/src/delegates/ImageManipulationDelegate.h b/src/delegates/ImageManipulationDelegate.h
index 9f7cf31..79995a2 100644
--- a/src/delegates/ImageManipulationDelegate.h
+++ b/src/delegates/ImageManipulationDelegate.h
@@ -55,8 +55,6 @@
QVariant securityIssueIcon(const QModelIndex& index) override;
QVariant collectionIcon(const CollectionInterface* interface, PixmapManipulatorI::CollectionIconHint hint = PixmapManipulatorI::CollectionIconHint::NONE) const override;
QVariant securityLevelIcon(const SecurityEvaluationModel::SecurityLevel level) const override;
- QVariant historySortingCategoryIcon(const CategorizedHistoryModel::SortedProxy::Categories cat) const override;
- QVariant contactSortingCategoryIcon(const CategorizedContactModel::SortedProxy::Categories cat) const override;
QVariant userActionIcon(const UserActionElement& state) const override;
QVariant decorationRole(const QModelIndex& index) override;
QVariant decorationRole(const Call* c) override;
diff --git a/src/delegates/ImageManipulationDelegate.mm b/src/delegates/ImageManipulationDelegate.mm
index ca2ead4..028f00d 100644
--- a/src/delegates/ImageManipulationDelegate.mm
+++ b/src/delegates/ImageManipulationDelegate.mm
@@ -35,7 +35,6 @@
//LRC
#import <person.h>
-#import <profilemodel.h>
#import <profile.h>
#import <contactmethod.h>
#import <api/conversation.h>
@@ -427,18 +426,6 @@
Q_UNUSED(level)
return QVariant();
}
- QVariant
- ImageManipulationDelegate::historySortingCategoryIcon(const CategorizedHistoryModel::SortedProxy::Categories cat) const
- {
- Q_UNUSED(cat)
- return QVariant();
- }
- QVariant
- ImageManipulationDelegate::contactSortingCategoryIcon(const CategorizedContactModel::SortedProxy::Categories cat) const
- {
- Q_UNUSED(cat)
- return QVariant();
- }
QVariant
ImageManipulationDelegate::userActionIcon(const UserActionElement& state) const