From 9c21268250d5eed3d458e3d712d6cfc34f3b28c0 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 22 Oct 2009 00:10:41 +0000 Subject: [PATCH] fix Quick Look from the file inspector --- macosx/Controller.m | 2 +- macosx/InfoWindowController.m | 4 ++-- macosx/Torrent.m | 23 +++++++++++------------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index e171bc061..cab73ad5a 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -318,7 +318,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy tr_bencDictAddReal(&settings, TR_PREFS_KEY_RATIO, [fDefaults floatForKey: @"RatioLimit"]); tr_bencDictAddBool(&settings, TR_PREFS_KEY_RATIO_ENABLED, [fDefaults boolForKey: @"RatioCheck"]); tr_bencDictAddBool(&settings, TR_PREFS_KEY_RPC_ENABLED, [fDefaults boolForKey: @"RPC"]); - tr_bencDictAddInt(&settings, TR_PREFS_KEY_RPC_PORT, [fDefaults integerForKey: @"RPCPort"]); + tr_bencDictAddInt(&settings, TR_PREFS_KEY_RPC_PORT, [fDefaults integerForKey: @"RPCPort"]); tr_bencDictAddStr(&settings, TR_PREFS_KEY_RPC_USERNAME, [[fDefaults stringForKey: @"RPCUsername"] UTF8String]); tr_bencDictAddBool(&settings, TR_PREFS_KEY_RPC_WHITELIST_ENABLED, [fDefaults boolForKey: @"RPCUseWhitelist"]); diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 36a946eac..24caf2f8a 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -1136,7 +1136,7 @@ typedef enum { FileListNode * item = [fileOutlineView itemAtRow: i]; if ([self canQuickLookFile: item]) - [urlArray addObject: [torrent fileLocation: item]]; + [urlArray addObject: [NSURL fileURLWithPath: [torrent fileLocation: item]]]; } return urlArray; @@ -1665,7 +1665,7 @@ typedef enum - (BOOL) canQuickLookFile: (FileListNode *) item { Torrent * torrent = [fTorrents objectAtIndex: 0]; - return [torrent fileLocation: item] != nil && ([item isFolder] || [torrent fileProgress: item] >= 1.0); + return ([item isFolder] || [torrent fileProgress: item] >= 1.0) && [torrent fileLocation: item]; } #warning doesn't like blank addresses diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 7e66beea4..312027e3b 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -32,9 +32,9 @@ @interface Torrent (Private) - (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct lib: (tr_session *) lib - downloadFolder: (NSString *) downloadFolder incompleteFolder: (NSString *) incompleteFolder waitToStart: (NSNumber *) waitToStart - groupValue: (NSNumber *) groupValue; + groupValue: (NSNumber *) groupValue + legacyDownloadFolder: (NSString *) downloadFolder legacyIncompleteFolder: (NSString *) incompleteFolder; - (void) createFileList; - (void) insertPath: (NSMutableArray *) components forParent: (FileListNode *) parent fileSize: (uint64_t) size @@ -73,8 +73,8 @@ int trashDataFile(const char * filename) lib: (tr_session *) lib { self = [self initWithPath: path hash: nil torrentStruct: NULL lib: lib - downloadFolder: location incompleteFolder: nil - waitToStart: nil groupValue: nil]; + waitToStart: nil groupValue: nil + legacyDownloadFolder: location legacyIncompleteFolder: nil]; if (self) { @@ -87,8 +87,8 @@ int trashDataFile(const char * filename) - (id) initWithTorrentStruct: (tr_torrent *) torrentStruct location: (NSString *) location lib: (tr_session *) lib { self = [self initWithPath: nil hash: nil torrentStruct: torrentStruct lib: lib - downloadFolder: location incompleteFolder: nil - waitToStart: nil groupValue: nil]; + waitToStart: nil groupValue: nil + legacyDownloadFolder: location legacyIncompleteFolder: nil]; return self; } @@ -98,11 +98,11 @@ int trashDataFile(const char * filename) self = [self initWithPath: [history objectForKey: @"InternalTorrentPath"] hash: [history objectForKey: @"TorrentHash"] torrentStruct: NULL lib: lib - downloadFolder: [history objectForKey: @"DownloadFolder"] //upgrading from versions < 1.80 - incompleteFolder: [[history objectForKey: @"UseIncompleteFolder"] boolValue] //upgrading from versions < 1.80 - ? [history objectForKey: @"IncompleteFolder"] : nil waitToStart: [history objectForKey: @"WaitToStart"] - groupValue: [history objectForKey: @"GroupValue"]]; + groupValue: [history objectForKey: @"GroupValue"] + legacyDownloadFolder: [history objectForKey: @"DownloadFolder"] //upgrading from versions < 1.80 + legacyIncompleteFolder: [[history objectForKey: @"UseIncompleteFolder"] boolValue] //upgrading from versions < 1.80 + ? [history objectForKey: @"IncompleteFolder"] : nil]; if (self) { @@ -1546,9 +1546,9 @@ int trashDataFile(const char * filename) @implementation Torrent (Private) - (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct lib: (tr_session *) lib - downloadFolder: (NSString *) downloadFolder incompleteFolder: (NSString *) incompleteFolder waitToStart: (NSNumber *) waitToStart groupValue: (NSNumber *) groupValue + legacyDownloadFolder: (NSString *) downloadFolder legacyIncompleteFolder: (NSString *) incompleteFolder { if (!(self = [super init])) return nil; @@ -1565,7 +1565,6 @@ int trashDataFile(const char * filename) //set libtransmission settings for initialization tr_ctor * ctor = tr_ctorNew(lib); tr_ctorSetPaused(ctor, TR_FORCE, YES); - tr_ctorSetPeerLimit(ctor, TR_FALLBACK, [fDefaults integerForKey: @"PeersTorrent"]); int result = TR_PARSE_ERR; if (path)