From 18266e080e196c704007b2da4dbf7228be79fe26 Mon Sep 17 00:00:00 2001 From: Dzmitry Neviadomski Date: Tue, 12 Jan 2021 22:06:30 +0300 Subject: [PATCH] Move ivars to @implementation. --- macosx/Controller.h | 42 ---------------------------- macosx/Controller.m | 45 +++++++++++++++++++++++++++++- macosx/FileListNode.h | 11 -------- macosx/FileListNode.m | 12 +++++++- macosx/FileRenameSheetController.h | 11 -------- macosx/FileRenameSheetController.m | 16 ++++------- macosx/Torrent.h | 29 ------------------- macosx/Torrent.m | 29 ++++++++++++++++++- macosx/TrackerNode.h | 5 ---- macosx/TrackerNode.m | 8 +++--- 10 files changed, 93 insertions(+), 115 deletions(-) diff --git a/macosx/Controller.h b/macosx/Controller.h index da856fc24..f294f26de 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -51,34 +51,12 @@ typedef enum @interface Controller : NSObject { - 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; diff --git a/macosx/Controller.m b/macosx/Controller.m index 7df26d436..e3bba4bc7 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -234,8 +234,51 @@ static void removeKeRangerRansomware() } @implementation Controller +{ + tr_session * fLib; + + NSMutableArray * fTorrents, * fDisplayedTorrents; + + PrefsController * fPrefsController; + InfoWindowController * fInfoController; + MessageWindowController * fMessageController; + + NSUserDefaults * fDefaults; + + NSString * fConfigDirectory; + + DragOverlayWindow * fOverlayWindow; + + io_connect_t fRootPort; + NSTimer * fTimer; + + VDKQueue * fFileWatcherQueue; + + 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; +} -#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; diff --git a/macosx/FileListNode.h b/macosx/FileListNode.h index b3f703d95..f8825718a 100644 --- a/macosx/FileListNode.h +++ b/macosx/FileListNode.h @@ -25,17 +25,6 @@ @class Torrent; @interface FileListNode : NSObject -{ - 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; diff --git a/macosx/FileListNode.m b/macosx/FileListNode.m index 4e1a1ceb6..05ef5f28c 100644 --- a/macosx/FileListNode.m +++ b/macosx/FileListNode.m @@ -29,8 +29,18 @@ @end @implementation FileListNode +{ + NSMutableIndexSet * fIndexes; + + NSString * fName; + NSString * fPath; + Torrent * __weak fTorrent; + uint64_t fSize; + NSImage * fIcon; + BOOL fIsFolder; + NSMutableArray * fChildren; +} -#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; diff --git a/macosx/FileRenameSheetController.h b/macosx/FileRenameSheetController.h index a51d4c180..2e230b82f 100644 --- a/macosx/FileRenameSheetController.h +++ b/macosx/FileRenameSheetController.h @@ -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; diff --git a/macosx/FileRenameSheetController.m b/macosx/FileRenameSheetController.m index d43005c5f..d33786eb9 100644 --- a/macosx/FileRenameSheetController.m +++ b/macosx/FileRenameSheetController.m @@ -23,16 +23,12 @@ typedef void (^CompletionBlock)(BOOL); @end @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; +{ + Torrent * _torrent; + FileListNode * _node; + void (^_completionHandler)(BOOL); + NSString * _originalName; +} + (void) presentSheetForTorrent: (Torrent *) torrent modalForWindow: (NSWindow *) window completionHandler: (void (^)(BOOL didRename)) completionHandler { diff --git a/macosx/Torrent.h b/macosx/Torrent.h index 09d8a7103..0b73e4221 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -35,35 +35,6 @@ typedef enum { #define kTorrentDidChangeGroupNotification @"TorrentDidChangeGroup" @interface Torrent : NSObject -{ - 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; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index ba534f457..f9fa0cd73 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -130,8 +130,35 @@ bool trashDataFile(const char * filename, tr_error ** error) } @implementation Torrent +{ + 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; +} -#warning remove ivars in header when 64-bit only (or it compiles in 32-bit mode) @synthesize removeWhenFinishSeeding = fRemoveWhenFinishSeeding; - (id) initWithPath: (NSString *) path location: (NSString *) location deleteTorrentFile: (BOOL) torrentDelete diff --git a/macosx/TrackerNode.h b/macosx/TrackerNode.h index e4002fc8a..6b14ae451 100644 --- a/macosx/TrackerNode.h +++ b/macosx/TrackerNode.h @@ -27,11 +27,6 @@ @class Torrent; @interface TrackerNode : NSObject -{ - tr_tracker_stat fStat; - - Torrent * __weak fTorrent; -} @property (nonatomic, weak, readonly) Torrent * torrent; diff --git a/macosx/TrackerNode.m b/macosx/TrackerNode.m index 27d1dd034..eae4b0d35 100644 --- a/macosx/TrackerNode.m +++ b/macosx/TrackerNode.m @@ -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;