Move ivars to @implementation.

This commit is contained in:
Dzmitry Neviadomski 2021-01-12 22:06:30 +03:00
parent d499c9c856
commit 18266e080e
10 changed files with 93 additions and 115 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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
{

View File

@ -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;

View File

@ -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

View File

@ -27,11 +27,6 @@
@class Torrent;
@interface TrackerNode : NSObject
{
tr_tracker_stat fStat;
Torrent * __weak fTorrent;
}
@property (nonatomic, weak, readonly) Torrent * torrent;

View File

@ -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;