From d347e428c92b544ed753607a849b78637a98e26b Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 6 Mar 2008 16:13:05 +0000 Subject: [PATCH] with multiple torrents selected, show the latest "last activity" --- macosx/InfoWindowController.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index c6bed0ecc..63d4ce480 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -239,6 +239,7 @@ typedef enum [fDownloadedTotalField setStringValue: @""]; [fUploadedTotalField setStringValue: @""]; [fFailedHashField setStringValue: @""]; + [fDateActivityField setStringValue: @""]; //options fields [fUploadLimitPopUp setEnabled: NO]; @@ -328,7 +329,6 @@ typedef enum [fDateAddedField setStringValue: @""]; [fDateCompletedField setStringValue: @""]; - [fDateActivityField setStringValue: @""]; [fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_AVAILABLE]; [fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_PROGRESS]; @@ -1057,6 +1057,7 @@ typedef enum return; uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0, failedHash = 0; + NSDate * lastActivity = nil; Torrent * torrent; NSEnumerator * enumerator = [fTorrents objectEnumerator]; while ((torrent = [enumerator nextObject])) @@ -1066,6 +1067,10 @@ typedef enum downloadedTotal += [torrent downloadedTotal]; uploadedTotal += [torrent uploadedTotal]; failedHash += [torrent failedHash]; + + NSDate * nextLastActivity; + if ((nextLastActivity = [torrent dateActivity])) + lastActivity = [nextLastActivity laterDate: lastActivity]; } if (have == 0) @@ -1081,6 +1086,8 @@ typedef enum [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]]; [fFailedHashField setStringValue: [NSString stringForFileSize: failedHash]]; + [fDateActivityField setObjectValue: lastActivity]; + if (numberSelected == 1) { torrent = [fTorrents objectAtIndex: 0]; @@ -1099,7 +1106,6 @@ typedef enum } [fDateCompletedField setObjectValue: [torrent dateCompleted]]; - [fDateActivityField setObjectValue: [torrent dateActivity]]; [fPiecesView updateView: NO]; }