Merge pull request #1587 from nevack/nevack/move-ivars-to-impl
Move ivars to @implementation.
This commit is contained in:
commit
7e3068d87a
|
@ -51,34 +51,12 @@ typedef enum
|
|||
|
||||
@interface Controller : NSObject <NSURLDownloadDelegate, NSUserNotificationCenterDelegate, NSPopoverDelegate, NSSharingServiceDelegate, NSSharingServicePickerDelegate, NSSoundDelegate, NSToolbarDelegate, NSWindowDelegate, QLPreviewPanelDataSource, QLPreviewPanelDelegate, VDKQueueDelegate>
|
||||
{
|
||||
tr_session * fLib;
|
||||
|
||||
NSMutableArray * fTorrents, * fDisplayedTorrents;
|
||||
|
||||
PrefsController * fPrefsController;
|
||||
InfoWindowController * fInfoController;
|
||||
MessageWindowController * fMessageController;
|
||||
|
||||
NSUserDefaults * fDefaults;
|
||||
|
||||
NSString * fConfigDirectory;
|
||||
|
||||
IBOutlet NSWindow * fWindow;
|
||||
DragOverlayWindow * fOverlayWindow;
|
||||
IBOutlet TorrentTableView * fTableView;
|
||||
|
||||
io_connect_t fRootPort;
|
||||
NSTimer * fTimer;
|
||||
|
||||
VDKQueue * fFileWatcherQueue;
|
||||
|
||||
IBOutlet NSMenuItem * fOpenIgnoreDownloadFolder;
|
||||
IBOutlet NSButton * fActionButton, * fSpeedLimitButton, * fClearCompletedButton;
|
||||
IBOutlet NSTextField * fTotalTorrentsField;
|
||||
|
||||
StatusBarController * fStatusBar;
|
||||
|
||||
FilterBarController * fFilterBar;
|
||||
IBOutlet NSMenuItem * fNextFilterItem;
|
||||
|
||||
IBOutlet NSMenuItem * fNextInfoTabItem, * fPrevInfoTabItem;
|
||||
|
@ -89,26 +67,6 @@ typedef enum
|
|||
|
||||
IBOutlet NSMenu * fShareMenu, * fShareContextMenu;
|
||||
IBOutlet NSMenuItem * fShareMenuItem, * fShareContextMenuItem; // remove when dropping 10.6
|
||||
|
||||
QLPreviewPanel * fPreviewPanel;
|
||||
BOOL fQuitting;
|
||||
BOOL fQuitRequested;
|
||||
BOOL fPauseOnLaunch;
|
||||
|
||||
Badger * fBadger;
|
||||
|
||||
NSMutableArray * fAutoImportedNames;
|
||||
NSTimer * fAutoImportTimer;
|
||||
|
||||
NSMutableDictionary * fPendingTorrentDownloads;
|
||||
|
||||
NSMutableSet * fAddingTransfers;
|
||||
|
||||
NSMutableSet * fAddWindows;
|
||||
URLSheetWindowController * fUrlSheetController;
|
||||
|
||||
BOOL fGlobalPopoverShown;
|
||||
BOOL fSoundPlaying;
|
||||
}
|
||||
|
||||
- (void) openFiles: (NSArray *) filenames addType: (addType) type forcePath: (NSString *) path;
|
||||
|
|
|
@ -234,11 +234,47 @@ static void removeKeRangerRansomware()
|
|||
}
|
||||
|
||||
@implementation Controller
|
||||
{
|
||||
tr_session * fLib;
|
||||
|
||||
#warning remove ivars in header when 64-bit only (or it compiles in 32-bit mode)
|
||||
@synthesize prefsController = fPrefsController;
|
||||
@synthesize messageWindowController = fMessageController;
|
||||
@synthesize fileWatcherQueue = fFileWatcherQueue;
|
||||
NSMutableArray * fTorrents, * fDisplayedTorrents;
|
||||
|
||||
InfoWindowController * fInfoController;
|
||||
MessageWindowController * fMessageController;
|
||||
|
||||
NSUserDefaults * fDefaults;
|
||||
|
||||
NSString * fConfigDirectory;
|
||||
|
||||
DragOverlayWindow * fOverlayWindow;
|
||||
|
||||
io_connect_t fRootPort;
|
||||
NSTimer * fTimer;
|
||||
|
||||
StatusBarController * fStatusBar;
|
||||
|
||||
FilterBarController * fFilterBar;
|
||||
|
||||
QLPreviewPanel * fPreviewPanel;
|
||||
BOOL fQuitting;
|
||||
BOOL fQuitRequested;
|
||||
BOOL fPauseOnLaunch;
|
||||
|
||||
Badger * fBadger;
|
||||
|
||||
NSMutableArray * fAutoImportedNames;
|
||||
NSTimer * fAutoImportTimer;
|
||||
|
||||
NSMutableDictionary * fPendingTorrentDownloads;
|
||||
|
||||
NSMutableSet * fAddingTransfers;
|
||||
|
||||
NSMutableSet * fAddWindows;
|
||||
URLSheetWindowController * fUrlSheetController;
|
||||
|
||||
BOOL fGlobalPopoverShown;
|
||||
BOOL fSoundPlaying;
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
|
@ -442,10 +478,10 @@ static void removeKeRangerRansomware()
|
|||
fInfoController = [[InfoWindowController alloc] init];
|
||||
|
||||
//needs to be done before init-ing the prefs controller
|
||||
fFileWatcherQueue = [[VDKQueue alloc] init];
|
||||
[fFileWatcherQueue setDelegate: self];
|
||||
_fileWatcherQueue = [[VDKQueue alloc] init];
|
||||
[_fileWatcherQueue setDelegate: self];
|
||||
|
||||
fPrefsController = [[PrefsController alloc] initWithHandle: fLib];
|
||||
_prefsController = [[PrefsController alloc] initWithHandle: fLib];
|
||||
|
||||
fQuitting = NO;
|
||||
fGlobalPopoverShown = NO;
|
||||
|
@ -817,7 +853,7 @@ static void removeKeRangerRansomware()
|
|||
[self updateTorrentHistory];
|
||||
[fTableView saveCollapsedGroups];
|
||||
|
||||
fFileWatcherQueue = nil;
|
||||
_fileWatcherQueue = nil;
|
||||
|
||||
//complete cleanup
|
||||
tr_sessionClose(fLib);
|
||||
|
@ -1799,7 +1835,7 @@ static void removeKeRangerRansomware()
|
|||
|
||||
- (void) showPreferenceWindow: (id) sender
|
||||
{
|
||||
NSWindow * window = [fPrefsController window];
|
||||
NSWindow * window = [_prefsController window];
|
||||
if (![window isVisible])
|
||||
[window center];
|
||||
|
||||
|
@ -4632,7 +4668,7 @@ static void removeKeRangerRansomware()
|
|||
break;
|
||||
|
||||
case TR_RPC_SESSION_CHANGED:
|
||||
[fPrefsController rpcUpdatePrefs];
|
||||
[_prefsController rpcUpdatePrefs];
|
||||
break;
|
||||
|
||||
case TR_RPC_SESSION_CLOSE:
|
||||
|
|
|
@ -25,17 +25,6 @@
|
|||
@class Torrent;
|
||||
|
||||
@interface FileListNode : NSObject <NSCopying>
|
||||
{
|
||||
NSMutableIndexSet * fIndexes;
|
||||
|
||||
NSString * fName;
|
||||
NSString * fPath;
|
||||
Torrent * __weak fTorrent;
|
||||
uint64_t fSize;
|
||||
NSImage * fIcon;
|
||||
BOOL fIsFolder;
|
||||
NSMutableArray * fChildren;
|
||||
}
|
||||
|
||||
@property (nonatomic, copy, readonly) NSString * name;
|
||||
@property (nonatomic, copy, readonly) NSString * path;
|
||||
|
|
|
@ -29,23 +29,18 @@
|
|||
@end
|
||||
|
||||
@implementation FileListNode
|
||||
|
||||
#warning remove ivars in header when 64-bit only (or it compiles in 32-bit mode)
|
||||
@synthesize name = fName;
|
||||
@synthesize path = fPath;
|
||||
@synthesize torrent = fTorrent;
|
||||
@synthesize size = fSize;
|
||||
@synthesize icon = fIcon;
|
||||
@synthesize isFolder = fIsFolder;
|
||||
@synthesize indexes = fIndexes;
|
||||
@synthesize children = fChildren;
|
||||
{
|
||||
NSMutableIndexSet * _indexes;
|
||||
NSImage * _icon;
|
||||
NSMutableArray * _children;
|
||||
}
|
||||
|
||||
- (id) initWithFolderName: (NSString *) name path: (NSString *) path torrent: (Torrent *) torrent
|
||||
{
|
||||
if ((self = [self initWithFolder: YES name: name path: path torrent: torrent]))
|
||||
{
|
||||
fChildren = [[NSMutableArray alloc] init];
|
||||
fSize = 0;
|
||||
_children = [[NSMutableArray alloc] init];
|
||||
_size = 0;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -55,8 +50,8 @@
|
|||
{
|
||||
if ((self = [self initWithFolder: NO name: name path: path torrent: torrent]))
|
||||
{
|
||||
fSize = size;
|
||||
[fIndexes addIndex: index];
|
||||
_size = size;
|
||||
[_indexes addIndex: index];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -64,17 +59,17 @@
|
|||
|
||||
- (void) insertChild: (FileListNode *) child
|
||||
{
|
||||
NSAssert(fIsFolder, @"method can only be invoked on folders");
|
||||
NSAssert(_isFolder, @"method can only be invoked on folders");
|
||||
|
||||
[fChildren addObject: child];
|
||||
[_children addObject: child];
|
||||
}
|
||||
|
||||
- (void) insertIndex: (NSUInteger) index withSize: (uint64_t) size
|
||||
{
|
||||
NSAssert(fIsFolder, @"method can only be invoked on folders");
|
||||
NSAssert(_isFolder, @"method can only be invoked on folders");
|
||||
|
||||
[fIndexes addIndex: index];
|
||||
fSize += size;
|
||||
[_indexes addIndex: index];
|
||||
_size += size;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone *) zone
|
||||
|
@ -86,25 +81,30 @@
|
|||
|
||||
- (NSString *) description
|
||||
{
|
||||
if (!fIsFolder)
|
||||
return [NSString stringWithFormat: @"%@ (%ld)", fName, [fIndexes firstIndex]];
|
||||
if (!_isFolder)
|
||||
return [NSString stringWithFormat: @"%@ (%ld)", _name, [_indexes firstIndex]];
|
||||
else
|
||||
return [NSString stringWithFormat: @"%@ (folder: %@)", fName, fIndexes];
|
||||
return [NSString stringWithFormat: @"%@ (folder: %@)", _name, _indexes];
|
||||
}
|
||||
|
||||
- (NSImage *) icon
|
||||
{
|
||||
if (!fIcon)
|
||||
fIcon = [[NSWorkspace sharedWorkspace] iconForFileType: fIsFolder ? NSFileTypeForHFSTypeCode(kGenericFolderIcon)
|
||||
: [fName pathExtension]];
|
||||
return fIcon;
|
||||
if (!_icon)
|
||||
_icon = [[NSWorkspace sharedWorkspace] iconForFileType: _isFolder ? NSFileTypeForHFSTypeCode(kGenericFolderIcon)
|
||||
: [_name pathExtension]];
|
||||
return _icon;
|
||||
}
|
||||
|
||||
- (NSMutableArray *) children
|
||||
{
|
||||
NSAssert(fIsFolder, @"method can only be invoked on folders");
|
||||
NSAssert(_isFolder, @"method can only be invoked on folders");
|
||||
|
||||
return fChildren;
|
||||
return _children;
|
||||
}
|
||||
|
||||
- (NSIndexSet *) indexes
|
||||
{
|
||||
return _indexes;
|
||||
}
|
||||
|
||||
- (BOOL) updateFromOldName: (NSString *) oldName toNewName: (NSString *) newName inPath: (NSString *) path
|
||||
|
@ -120,8 +120,8 @@
|
|||
{
|
||||
if ([oldName isEqualToString: self.name])
|
||||
{
|
||||
fName = [newName copy];
|
||||
fIcon = nil;
|
||||
_name = [newName copy];
|
||||
_icon = nil;
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@
|
|||
NSString * oldPathPrefix = [path stringByAppendingPathComponent: oldName];
|
||||
NSString * newPathPrefix = [path stringByAppendingPathComponent: newName];
|
||||
|
||||
fPath = [fPath stringByReplacingCharactersInRange: NSMakeRange(0, [oldPathPrefix length]) withString: newPathPrefix];
|
||||
_path = [_path stringByReplacingCharactersInRange: NSMakeRange(0, [oldPathPrefix length]) withString: newPathPrefix];
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
@ -153,13 +153,13 @@
|
|||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
fIsFolder = isFolder;
|
||||
fName = [name copy];
|
||||
fPath = [path copy];
|
||||
_isFolder = isFolder;
|
||||
_name = [name copy];
|
||||
_path = [path copy];
|
||||
|
||||
fIndexes = [[NSMutableIndexSet alloc] init];
|
||||
_indexes = [[NSMutableIndexSet alloc] init];
|
||||
|
||||
fTorrent = torrent;
|
||||
_torrent = torrent;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
|
@ -12,17 +12,6 @@
|
|||
@class Torrent;
|
||||
|
||||
@interface FileRenameSheetController : NSWindowController
|
||||
{
|
||||
Torrent * _torrent;
|
||||
FileListNode * _node;
|
||||
void (^_completionHandler)(BOOL);
|
||||
NSString * _originalName;
|
||||
|
||||
IBOutlet NSTextField * __weak _labelField;
|
||||
IBOutlet NSTextField * __weak _inputField;
|
||||
IBOutlet NSButton * __weak _renameButton;
|
||||
IBOutlet NSButton * __weak _cancelButton;
|
||||
}
|
||||
|
||||
+ (void) presentSheetForTorrent: (Torrent *) torrent modalForWindow: (NSWindow *) window completionHandler: (void (^)(BOOL didRename)) completionHandler;
|
||||
+ (void) presentSheetForFileListNode: (FileListNode *) node modalForWindow: (NSWindow *) window completionHandler: (void (^)(BOOL didRename)) completionHandler;
|
||||
|
|
|
@ -24,16 +24,6 @@ typedef void (^CompletionBlock)(BOOL);
|
|||
|
||||
@implementation FileRenameSheetController
|
||||
|
||||
#warning remove ivars in header when 64-bit only (or it compiles in 32-bit mode)
|
||||
@synthesize torrent = _torrent;
|
||||
@synthesize node = _node;
|
||||
@synthesize completionHandler = _completionHandler;
|
||||
@synthesize originalName = _originalName;
|
||||
@synthesize labelField = _labelField;
|
||||
@synthesize inputField = _inputField;
|
||||
@synthesize renameButton = _renameButton;
|
||||
@synthesize cancelButton = _cancelButton;
|
||||
|
||||
+ (void) presentSheetForTorrent: (Torrent *) torrent modalForWindow: (NSWindow *) window completionHandler: (void (^)(BOOL didRename)) completionHandler
|
||||
{
|
||||
NSParameterAssert(torrent != nil);
|
||||
|
|
|
@ -105,6 +105,7 @@
|
|||
|
||||
//set auto import
|
||||
NSString * autoPath;
|
||||
VDKQueue* x = [(Controller *)[NSApp delegate] fileWatcherQueue];
|
||||
if ([fDefaults boolForKey: @"AutoImport"] && (autoPath = [fDefaults stringForKey: @"AutoImportDirectory"]))
|
||||
[[(Controller *)[NSApp delegate] fileWatcherQueue] addPath: [autoPath stringByExpandingTildeInPath] notifyingAbout: VDKQueueNotifyAboutWrite];
|
||||
|
||||
|
|
|
@ -35,35 +35,6 @@ typedef enum {
|
|||
#define kTorrentDidChangeGroupNotification @"TorrentDidChangeGroup"
|
||||
|
||||
@interface Torrent : NSObject <NSCopying, QLPreviewItem>
|
||||
{
|
||||
tr_torrent * fHandle;
|
||||
const tr_info * fInfo;
|
||||
const tr_stat * fStat;
|
||||
|
||||
NSUserDefaults * fDefaults;
|
||||
|
||||
NSImage * fIcon;
|
||||
|
||||
NSString * fHashString;
|
||||
|
||||
tr_file_stat * fFileStat;
|
||||
NSArray * fFileList, * fFlatFileList;
|
||||
|
||||
NSIndexSet * fPreviousFinishedIndexes;
|
||||
NSDate * fPreviousFinishedIndexesDate;
|
||||
|
||||
BOOL fRemoveWhenFinishSeeding;
|
||||
|
||||
NSInteger fGroupValue;
|
||||
TorrentDeterminationType fGroupValueDetermination;
|
||||
|
||||
TorrentDeterminationType fDownloadFolderDetermination;
|
||||
|
||||
BOOL fResumeOnWake;
|
||||
|
||||
BOOL fTimeMachineExcludeInitialized;
|
||||
}
|
||||
|
||||
- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (BOOL) torrentDelete
|
||||
lib: (tr_session *) lib;
|
||||
- (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib;
|
||||
|
|
|
@ -130,9 +130,32 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
|||
}
|
||||
|
||||
@implementation Torrent
|
||||
{
|
||||
tr_torrent * fHandle;
|
||||
const tr_info * fInfo;
|
||||
const tr_stat * fStat;
|
||||
|
||||
#warning remove ivars in header when 64-bit only (or it compiles in 32-bit mode)
|
||||
@synthesize removeWhenFinishSeeding = fRemoveWhenFinishSeeding;
|
||||
NSUserDefaults * fDefaults;
|
||||
|
||||
NSImage * fIcon;
|
||||
|
||||
NSString * fHashString;
|
||||
|
||||
tr_file_stat * fFileStat;
|
||||
NSArray * fFileList, * fFlatFileList;
|
||||
|
||||
NSIndexSet * fPreviousFinishedIndexes;
|
||||
NSDate * fPreviousFinishedIndexesDate;
|
||||
|
||||
NSInteger fGroupValue;
|
||||
TorrentDeterminationType fGroupValueDetermination;
|
||||
|
||||
TorrentDeterminationType fDownloadFolderDetermination;
|
||||
|
||||
BOOL fResumeOnWake;
|
||||
|
||||
BOOL fTimeMachineExcludeInitialized;
|
||||
}
|
||||
|
||||
- (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (BOOL) torrentDelete
|
||||
lib: (tr_session *) lib
|
||||
|
@ -230,7 +253,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
|||
@"Active": @([self isActive]),
|
||||
@"WaitToStart": @([self waitingToStart]),
|
||||
@"GroupValue": @(fGroupValue),
|
||||
@"RemoveWhenFinishSeeding": @(fRemoveWhenFinishSeeding)};
|
||||
@"RemoveWhenFinishSeeding": @(_removeWhenFinishSeeding)};
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
@ -1717,7 +1740,7 @@ bool trashDataFile(const char * filename, tr_error ** error)
|
|||
fGroupValue = [[GroupsController groups] groupIndexForTorrent: self];
|
||||
}
|
||||
|
||||
fRemoveWhenFinishSeeding = removeWhenFinishSeeding ? [removeWhenFinishSeeding boolValue] : [fDefaults boolForKey: @"RemoveWhenFinishSeeding"];
|
||||
_removeWhenFinishSeeding = removeWhenFinishSeeding ? [removeWhenFinishSeeding boolValue] : [fDefaults boolForKey: @"RemoveWhenFinishSeeding"];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(checkGroupValueForRemoval:)
|
||||
name: @"GroupValueRemoved" object: nil];
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
@class Torrent;
|
||||
|
||||
@interface TrackerNode : NSObject
|
||||
{
|
||||
tr_tracker_stat fStat;
|
||||
|
||||
Torrent * __weak fTorrent;
|
||||
}
|
||||
|
||||
@property (nonatomic, weak, readonly) Torrent * torrent;
|
||||
|
||||
|
|
|
@ -25,16 +25,16 @@
|
|||
#import "NSStringAdditions.h"
|
||||
|
||||
@implementation TrackerNode
|
||||
|
||||
#warning remove ivars in header when 64-bit only (or it compiles in 32-bit mode)
|
||||
@synthesize torrent = fTorrent;
|
||||
{
|
||||
tr_tracker_stat fStat;
|
||||
}
|
||||
|
||||
- (id) initWithTrackerStat: (tr_tracker_stat *) stat torrent: (Torrent *) torrent
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
fStat = *stat;
|
||||
fTorrent = torrent; //weak reference
|
||||
_torrent = torrent; //weak reference
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
Loading…
Reference in New Issue