Commit 6ea9ac18 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

cleanup: remove legacy functions

Change-Id: I928ff8cdd89d6f372632ef6f5f39d85e16d5bb03
parent 5d90c3bc
...@@ -114,8 +114,6 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w") ...@@ -114,8 +114,6 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
#Files to compile #Files to compile
SET(ringclient_CONTROLLERS SET(ringclient_CONTROLLERS
src/QNSTreeController.mm
src/QNSTreeController.h
src/CurrentCallVC.mm src/CurrentCallVC.mm
src/CurrentCallVC.h src/CurrentCallVC.h
src/GeneralPrefsVC.mm src/GeneralPrefsVC.mm
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#import "RingWindowController.h" #import "RingWindowController.h"
#import "PreferencesWindowController.h" #import "PreferencesWindowController.h"
#import <string>
@interface AppDelegate : NSObject <NSApplicationDelegate, NSUserNotificationCenterDelegate> @interface AppDelegate : NSObject <NSApplicationDelegate, NSUserNotificationCenterDelegate>
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#import "AppDelegate.h" #import "AppDelegate.h"
//lrc //lrc
#import <callmodel.h>
#import <api/lrc.h> #import <api/lrc.h>
#import <api/newaccountmodel.h> #import <api/newaccountmodel.h>
#import <api/behaviorcontroller.h> #import <api/behaviorcontroller.h>
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#import <QPixmap> #import <QPixmap>
#import <QtMacExtras/qmacfunctions.h> #import <QtMacExtras/qmacfunctions.h>
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
#import <QuickLook/QuickLook.h>
// LRC #import <Quartz/Quartz.h>
#import "views/IconButton.h" #import "views/IconButton.h"
#import "views/HoverButton.h" #import "views/HoverButton.h"
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
#import "RingWindowController.h" #import "RingWindowController.h"
#import "NSString+Extensions.h" #import "NSString+Extensions.h"
#import "LeaveMessageVC.h" #import "LeaveMessageVC.h"
#import <QuickLook/QuickLook.h>
#import <Quartz/Quartz.h>
#import "LeaveMessageVC.h" #import "LeaveMessageVC.h"
@interface ConversationVC () <QLPreviewPanelDataSource, QLPreviewPanelDelegate>{ @interface ConversationVC () <QLPreviewPanelDataSource, QLPreviewPanelDelegate>{
......
...@@ -32,7 +32,6 @@ extern "C" { ...@@ -32,7 +32,6 @@ extern "C" {
#import <QUrl> #import <QUrl>
///LRC ///LRC
#import <video/previewmanager.h>
#import <video/renderer.h> #import <video/renderer.h>
#import <api/newcallmodel.h> #import <api/newcallmodel.h>
#import <api/call.h> #import <api/call.h>
......
...@@ -19,12 +19,6 @@ ...@@ -19,12 +19,6 @@
#import "DialpadWC.h" #import "DialpadWC.h"
///Qt
#import <QtCore/qitemselectionmodel.h>
///LRC
#import <callmodel.h>
@interface DialpadWC () @interface DialpadWC ()
@property (unsafe_unretained) IBOutlet NSTextField* composerField; @property (unsafe_unretained) IBOutlet NSTextField* composerField;
......
/*
* 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
/*
* 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
...@@ -21,12 +21,7 @@ ...@@ -21,12 +21,7 @@
#include <qrencode.h> #include <qrencode.h>
#include <memory> #include <memory>
//Qt
#import <QItemSelectionModel>
#import <QItemSelection>
//LRC //LRC
#import <AvailableAccountModel.h>
#import <api/lrc.h> #import <api/lrc.h>
#import <api/account.h> #import <api/account.h>
#import <api/newaccountmodel.h> #import <api/newaccountmodel.h>
...@@ -446,49 +441,6 @@ typedef NS_ENUM(NSInteger, ViewState) { ...@@ -446,49 +441,6 @@ typedef NS_ENUM(NSInteger, ViewState) {
} }
} }
#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 - (void) selectAccount:(const lrc::api::account::Info&)accInfo currentRemoved:(BOOL) removed
{ {
// If the selected account has been changed, we close any open panel // If the selected account has been changed, we close any open panel
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
//Qt //Qt
#import <QtMacExtras/qmacfunctions.h> #import <QtMacExtras/qmacfunctions.h>
#import <QPixmap> #import <QPixmap>
#import <QIdentityProxyModel>
#import <QItemSelectionModel>
//LRC //LRC
#import <globalinstances.h> #import <globalinstances.h>
......
...@@ -55,8 +55,6 @@ namespace Interfaces { ...@@ -55,8 +55,6 @@ namespace Interfaces {
QVariant securityIssueIcon(const QModelIndex& index) override; QVariant securityIssueIcon(const QModelIndex& index) override;
QVariant collectionIcon(const CollectionInterface* interface, PixmapManipulatorI::CollectionIconHint hint = PixmapManipulatorI::CollectionIconHint::NONE) const override; QVariant collectionIcon(const CollectionInterface* interface, PixmapManipulatorI::CollectionIconHint hint = PixmapManipulatorI::CollectionIconHint::NONE) const override;
QVariant securityLevelIcon(const SecurityEvaluationModel::SecurityLevel level) 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 userActionIcon(const UserActionElement& state) const override;
QVariant decorationRole(const QModelIndex& index) override; QVariant decorationRole(const QModelIndex& index) override;
QVariant decorationRole(const Call* c) override; QVariant decorationRole(const Call* c) override;
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
//LRC //LRC
#import <person.h> #import <person.h>
#import <profilemodel.h>
#import <profile.h> #import <profile.h>
#import <contactmethod.h> #import <contactmethod.h>
#import <api/conversation.h> #import <api/conversation.h>
...@@ -427,18 +426,6 @@ namespace Interfaces { ...@@ -427,18 +426,6 @@ namespace Interfaces {
Q_UNUSED(level) Q_UNUSED(level)
return QVariant(); 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 QVariant
ImageManipulationDelegate::userActionIcon(const UserActionElement& state) const ImageManipulationDelegate::userActionIcon(const UserActionElement& state) const
......
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