with multiple torrents selected, show the latest "last activity"

This commit is contained in:
Mitchell Livingston 2008-03-06 16:13:05 +00:00
parent 5e3dcb5f6f
commit d347e428c9
1 changed files with 8 additions and 2 deletions

View File

@ -239,6 +239,7 @@ typedef enum
[fDownloadedTotalField setStringValue: @""]; [fDownloadedTotalField setStringValue: @""];
[fUploadedTotalField setStringValue: @""]; [fUploadedTotalField setStringValue: @""];
[fFailedHashField setStringValue: @""]; [fFailedHashField setStringValue: @""];
[fDateActivityField setStringValue: @""];
//options fields //options fields
[fUploadLimitPopUp setEnabled: NO]; [fUploadLimitPopUp setEnabled: NO];
@ -328,7 +329,6 @@ typedef enum
[fDateAddedField setStringValue: @""]; [fDateAddedField setStringValue: @""];
[fDateCompletedField setStringValue: @""]; [fDateCompletedField setStringValue: @""];
[fDateActivityField setStringValue: @""];
[fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_AVAILABLE]; [fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_AVAILABLE];
[fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_PROGRESS]; [fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_PROGRESS];
@ -1057,6 +1057,7 @@ typedef enum
return; return;
uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0, failedHash = 0; uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0, failedHash = 0;
NSDate * lastActivity = nil;
Torrent * torrent; Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator]; NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))
@ -1066,6 +1067,10 @@ typedef enum
downloadedTotal += [torrent downloadedTotal]; downloadedTotal += [torrent downloadedTotal];
uploadedTotal += [torrent uploadedTotal]; uploadedTotal += [torrent uploadedTotal];
failedHash += [torrent failedHash]; failedHash += [torrent failedHash];
NSDate * nextLastActivity;
if ((nextLastActivity = [torrent dateActivity]))
lastActivity = [nextLastActivity laterDate: lastActivity];
} }
if (have == 0) if (have == 0)
@ -1081,6 +1086,8 @@ typedef enum
[fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]]; [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];
[fFailedHashField setStringValue: [NSString stringForFileSize: failedHash]]; [fFailedHashField setStringValue: [NSString stringForFileSize: failedHash]];
[fDateActivityField setObjectValue: lastActivity];
if (numberSelected == 1) if (numberSelected == 1)
{ {
torrent = [fTorrents objectAtIndex: 0]; torrent = [fTorrents objectAtIndex: 0];
@ -1099,7 +1106,6 @@ typedef enum
} }
[fDateCompletedField setObjectValue: [torrent dateCompleted]]; [fDateCompletedField setObjectValue: [torrent dateCompleted]];
[fDateActivityField setObjectValue: [torrent dateActivity]];
[fPiecesView updateView: NO]; [fPiecesView updateView: NO];
} }