diff --git a/macosx/English.lproj/InfoWindow.nib/classes.nib b/macosx/English.lproj/InfoWindow.nib/classes.nib index 8916cf290..8b5f36b3e 100644 --- a/macosx/English.lproj/InfoWindow.nib/classes.nib +++ b/macosx/English.lproj/InfoWindow.nib/classes.nib @@ -12,7 +12,8 @@ fDataLocationField = NSTextField; fDateStartedField = NSTextField; fDownloadRateField = NSTextField; - fDownloadedField = NSTextField; + fDownloadedTotalField = NSTextField; + fDownloadedValidField = NSTextField; fDownloadingFromField = NSTextField; fFileTable = NSTableView; fHashField = NSTextField; @@ -32,7 +33,7 @@ fTorrentLocationField = NSTextField; fTrackerField = NSTextField; fUploadRateField = NSTextField; - fUploadedField = NSTextField; + fUploadedTotalField = NSTextField; fUploadingToField = NSTextField; }; SUPERCLASS = NSWindowController; diff --git a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib index bfb31e9f1..8138d0110 100644 Binary files a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib and b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib differ diff --git a/macosx/InfoWindowController.h b/macosx/InfoWindowController.h index 6aa4de697..f9ab8fd8a 100644 --- a/macosx/InfoWindowController.h +++ b/macosx/InfoWindowController.h @@ -40,8 +40,8 @@ * fDateStartedField, * fStateField, * fPercentField, * fDownloadRateField, * fUploadRateField, - * fDownloadedField, * fUploadedField, * fRatioField, - * fSeedersField, * fLeechersField, + * fDownloadedValidField, * fDownloadedTotalField, * fUploadedTotalField, + * fRatioField, * fSeedersField, * fLeechersField, * fConnectedPeersField, * fDownloadingFromField, * fUploadingToField; IBOutlet NSTableView * fFileTable; diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 657c869e7..2446610e2 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -34,8 +34,9 @@ #define TAB_OPTIONS_IDENT @"Options" #define TAB_FILES_IDENT @"Files" -#define TAB_INFO_HEIGHT 191.0 -#define TAB_STATUS_HEIGHT 241.0 +//15 spacing at the bottom of each tab +#define TAB_INFO_HEIGHT 196.0 +#define TAB_STATUS_HEIGHT 262.0 #define TAB_OPTIONS_HEIGHT 82.0 #define TAB_FILES_HEIGHT 250.0 @@ -105,8 +106,9 @@ [fDownloadRateField setStringValue: @""]; [fUploadRateField setStringValue: @""]; - [fDownloadedField setStringValue: @""]; - [fUploadedField setStringValue: @""]; + [fDownloadedValidField setStringValue: @""]; + [fDownloadedTotalField setStringValue: @""]; + [fUploadedTotalField setStringValue: @""]; } [fImageView setImage: fAppIcon]; @@ -236,8 +238,8 @@ int numberSelected = [fTorrents count]; if (numberSelected > 0) { - float downloadRate = 0, uploadRate = 0; - uint64_t downloaded = 0, uploaded = 0; + float downloadRate = 0, uploadRate = 0, downloadedValid; + uint64_t downloadedTotal = 0, uploadedTotal = 0; Torrent * torrent; NSEnumerator * enumerator = [fTorrents objectEnumerator]; while ((torrent = [enumerator nextObject])) @@ -245,15 +247,17 @@ downloadRate += [torrent downloadRate]; uploadRate += [torrent uploadRate]; - downloaded += [torrent downloaded]; - uploaded += [torrent uploaded]; + downloadedValid += [torrent downloadedValid]; + downloadedTotal += [torrent downloadedTotal]; + uploadedTotal += [torrent uploadedTotal]; } [fDownloadRateField setStringValue: [NSString stringForSpeed: downloadRate]]; [fUploadRateField setStringValue: [NSString stringForSpeed: uploadRate]]; - [fDownloadedField setStringValue: [NSString stringForFileSize: downloaded]]; - [fUploadedField setStringValue: [NSString stringForFileSize: uploaded]]; + [fDownloadedValidField setStringValue: [NSString stringForFileSize: downloadedValid]]; + [fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]]; + [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]]; if (numberSelected == 1) { @@ -279,7 +283,7 @@ stringWithInt: [torrent peersDownloading]] : @"N/A"]; [fRatioField setStringValue: [NSString stringForRatioWithDownload: - downloaded upload: uploaded]]; + downloadedTotal upload: uploadedTotal]]; } } } diff --git a/macosx/Torrent.h b/macosx/Torrent.h index 390b3fcaf..4456f43db 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -107,8 +107,9 @@ - (float) downloadRate; - (float) uploadRate; -- (uint64_t) downloaded; -- (uint64_t) uploaded; +- (float) downloadedValid; +- (uint64_t) downloadedTotal; +- (uint64_t) uploadedTotal; - (NSArray *) fileList; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 878426ffe..03a3a1c33 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -35,7 +35,7 @@ - (id) initForSuccessWithDate: (NSDate *) date stopRatioSetting: (NSNumber *) stopRatioSetting ratioLimit: (NSNumber *) ratioLimit; -- (void) trashPath: (NSString *) path; +- (void) trashFile: (NSString *) path; @end @@ -47,11 +47,8 @@ id torrent = [self initWithPath: path lib: lib date: nil stopRatioSetting: nil ratioLimit: nil]; - if (!torrent) - return nil; - - if (fPrivateTorrent && [fDefaults boolForKey: @"DeleteOriginalTorrent"]) - [self trashPath: path]; + if (torrent && fPrivateTorrent && [fDefaults boolForKey: @"DeleteOriginalTorrent"]) + [self trashFile: path]; return torrent; } @@ -59,19 +56,20 @@ - (id) initWithHistory: (NSDictionary *) history lib: (tr_handle_t *) lib { //load from saved torrent file if set to, otherwise try to load from where torrent file should be + id torrent; NSNumber * privateCopy; if ((privateCopy = [history objectForKey: @"PrivateCopy"]) && [privateCopy boolValue]) - self = [self initWithHash: [history objectForKey: @"TorrentHash"] + torrent = [self initWithHash: [history objectForKey: @"TorrentHash"] lib: lib date: [history objectForKey: @"Date"] stopRatioSetting: [history objectForKey: @"StopRatioSetting"] ratioLimit: [history objectForKey: @"RatioLimit"]]; else - self = [self initWithPath: [history objectForKey: @"TorrentPath"] + torrent = [self initWithPath: [history objectForKey: @"TorrentPath"] lib: lib date: [history objectForKey: @"Date"] stopRatioSetting: [history objectForKey: @"StopRatioSetting"] ratioLimit: [history objectForKey: @"RatioLimit"]]; - if (self) + if (torrent) { NSString * downloadFolder; if (!(downloadFolder = [history objectForKey: @"DownloadFolder"])) @@ -83,7 +81,7 @@ if (!(paused = [history objectForKey: @"Paused"]) || [paused isEqualToString: @"NO"]) [self start]; } - return self; + return torrent; } - (NSDictionary *) history @@ -156,11 +154,11 @@ [fProgressString setString: @""]; if ([self progress] < 1.0) [fProgressString appendFormat: @"%@ of %@ (%.2f%%)", [NSString stringForFileSize: - [self downloaded]], [NSString stringForFileSize: [self size]], 100 * [self progress]]; + [self downloadedValid]], [NSString stringForFileSize: [self size]], 100 * [self progress]]; else [fProgressString appendFormat: @"%@, uploaded %@ (ratio: %@)", [NSString stringForFileSize: - [self size]], [NSString stringForFileSize: [self uploaded]], - [NSString stringForRatioWithDownload: [self downloaded] upload: [self uploaded]]]; + [self size]], [NSString stringForFileSize: [self uploadedTotal]], + [NSString stringForRatioWithDownload: [self downloadedTotal] upload: [self uploadedTotal]]]; switch( fStat->status ) { @@ -265,8 +263,8 @@ - (float) ratio { - float downloaded = [self downloaded]; - return downloaded > 0 ? (float)[self uploaded] / downloaded : -1; + float downloaded = [self downloadedTotal]; + return downloaded > 0 ? (float)[self uploadedTotal] / downloaded : -1; } - (int) stopRatioSetting @@ -298,7 +296,7 @@ - (void) trashData { - [self trashPath: [self dataLocation]]; + [self trashFile: [self dataLocation]]; } - (NSImage *) icon @@ -458,12 +456,17 @@ return fStat->rateUpload; } -- (uint64_t) downloaded +- (float) downloadedValid +{ + return [self progress] * [self size]; +} + +- (uint64_t) downloadedTotal { return fStat->downloaded; } -- (uint64_t) uploaded +- (uint64_t) uploadedTotal { return fStat->uploaded; } @@ -573,7 +576,7 @@ } -- (void) trashPath: (NSString *) path +- (void) trashFile: (NSString *) path { if( ![[NSWorkspace sharedWorkspace] performFileOperation: NSWorkspaceRecycleOperation source: diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index cf929f49d..c3311b888 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -136,11 +136,10 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80 { float completedWidth = [fTorrent progress] * width, remainingWidth = width - completedWidth; - - NSImage * barLeftEnd, * barRightEnd; BOOL isActive = [fTorrent isActive]; //left end + NSImage * barLeftEnd; if (remainingWidth == width) barLeftEnd = fProgressEndWhite; else if (isActive) @@ -159,6 +158,7 @@ static uint32_t kRed = 0xFF6450FF, //255, 100, 80 [self placeBar: fProgressWhite width: remainingWidth point: point]; //right end + NSImage * barRightEnd; if (completedWidth < width) barRightEnd = fProgressEndWhite; else if (isActive)