From 24acb443106b84ee4d4adb3282cfd9d7976d675e Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 15 Jun 2006 06:24:03 +0000 Subject: [PATCH] Potentially get rid of (unnoticeable) overlap in simple progress bar. --- macosx/Torrent.m | 23 +++++++++++------------ macosx/TorrentCell.m | 6 +++--- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/macosx/Torrent.m b/macosx/Torrent.m index ef782829d..b223bc0e6 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -41,26 +41,29 @@ - (id) initWithPath: (NSString *) path lib: (tr_handle_t *) lib { - if ((self = [self initWithHash: nil path: path lib: lib - privateTorrent: nil publicTorrent: nil - date: nil stopRatioSetting: nil ratioLimit: nil])) + self = [self initWithHash: nil path: path lib: lib + privateTorrent: nil publicTorrent: nil + date: nil stopRatioSetting: nil ratioLimit: nil]; + + if (self) { if (!fPublicTorrent) [self trashFile: path]; } - return self; } - (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib { - if ((self = [self initWithHash: [history objectForKey: @"TorrentHash"] + self = [self initWithHash: [history objectForKey: @"TorrentHash"] path: [history objectForKey: @"TorrentPath"] lib: lib privateTorrent: [history objectForKey: @"PrivateCopy"] publicTorrent: [history objectForKey: @"PublicCopy"] date: [history objectForKey: @"Date"] stopRatioSetting: [history objectForKey: @"StopRatioSetting"] - ratioLimit: [history objectForKey: @"RatioLimit"]])) + ratioLimit: [history objectForKey: @"RatioLimit"]]; + + if (self) { NSString * downloadFolder; if (!(downloadFolder = [history objectForKey: @"DownloadFolder"])) @@ -72,7 +75,6 @@ if (!(paused = [history objectForKey: @"Paused"]) || [paused isEqualToString: @"NO"]) [self start]; } - return self; } @@ -590,11 +592,8 @@ { /* We can't move it to the trash, let's try just to delete it (will work if it is on a remote volume) */ - if( ![[NSFileManager defaultManager] - removeFileAtPath: path handler: nil] ) - { - NSLog( [@"Could not trash " stringByAppendingString: path] ); - } + if (![[NSFileManager defaultManager] removeFileAtPath: path handler: nil]) + NSLog([@"Could not trash " stringByAppendingString: path]); } } diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index c3311b888..9b6565812 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -31,7 +31,7 @@ @interface TorrentCell (Private) - (void) placeBar: (NSImage *) barImage width: (float) width point: (NSPoint) point; -- (void) buildSimpleBar: (int) width point: (NSPoint) point; +- (void) buildSimpleBar: (int) widthInt point: (NSPoint) point; - (void) buildAdvancedBar: (int) width point: (NSPoint) point; @end @@ -119,9 +119,9 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80 operation: NSCompositeSourceOver]; } -- (void) buildSimpleBar: (int) width point: (NSPoint) point +- (void) buildSimpleBar: (int) widthInt point: (NSPoint) point { - width -= 2.0; + float width = (float)widthInt - 2.0; if ([fTorrent isSeeding]) { [fProgressEndGreen compositeToPoint: point operation: NSCompositeSourceOver];