From 1ed383776f482f2880133c2d4a858269034ae2ca Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 15 Feb 2010 19:26:23 +0000 Subject: [PATCH] when adding a new tracker, display tier as "New Tier" --- macosx/InfoWindowController.m | 11 +++++------ macosx/Torrent.h | 1 - macosx/Torrent.m | 8 -------- macosx/en.lproj/Localizable.strings | Bin 67952 -> 68070 bytes 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index d7e33f664..7dd00a890 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -683,8 +683,10 @@ typedef enum if ([item isKindOfClass: [NSDictionary class]]) { - NSString * tierString = [NSString stringWithFormat: NSLocalizedString(@"Tier %d", "Inspector -> tracker table"), - [[item objectForKey: @"Tier"] integerValue]]; + const NSInteger tier = [[item objectForKey: @"Tier"] integerValue]; + NSString * tierString = tier == -1 ? NSLocalizedString(@"New Tier", "Inspector -> tracker table") + : [NSString stringWithFormat: NSLocalizedString(@"Tier %d", "Inspector -> tracker table"), tier]; + if ([fTorrents count] > 1) tierString = [tierString stringByAppendingFormat: @" - %@", [item objectForKey: @"Name"]]; return tierString; @@ -1785,10 +1787,7 @@ typedef enum NSAssert1([fTorrents count] == 1, @"Attempting to add tracker with %d transfers selected", [fTorrents count]); - Torrent * torrent = [fTorrents objectAtIndex: 0]; - - [fTrackers addObject: [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger: [torrent numberOfTrackerTiers]+1] - forKey: @"Tier"]]; + [fTrackers addObject: [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger: -1] forKey: @"Tier"]]; [fTrackers addObject: @""]; [fTrackerTable setTrackers: fTrackers]; diff --git a/macosx/Torrent.h b/macosx/Torrent.h index 5e83f1f96..8293c878d 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -130,7 +130,6 @@ - (NSMutableArray *) allTrackerStats; - (NSArray *) allTrackersFlat; //used by GroupRules -- (NSUInteger) numberOfTrackerTiers; - (BOOL) addTrackerToNewTier: (NSString *) tracker; - (void) removeTrackersWithIdentifiers: (NSIndexSet *) removeIdentifiers; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index ca8a7530a..f72bc25ab 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -624,14 +624,6 @@ int trashDataFile(const char * filename) return allTrackers; } -- (NSUInteger) numberOfTrackerTiers -{ - if (fInfo->trackerCount == 0) - return 0; - - return fInfo->trackers[fInfo->trackerCount-1].tier + 1; -} - - (BOOL) addTrackerToNewTier: (NSString *) tracker { tracker = [tracker stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]]; diff --git a/macosx/en.lproj/Localizable.strings b/macosx/en.lproj/Localizable.strings index 90668de17ebe5fe82be38ad90fa44ead43024445..9ce09ac18fe1207e1fab40f9dfc794accd583f41 100644 GIT binary patch delta 63 zcmew`iRIa3mJLhFCx3{PnVeR}H@V@3$fR->#c~D(h7g8KhE#?k1|=Zd7KoJ?{D6F@ L%;t&Z_a_1X(nJ%V delta 18 acmaDhndQSImJLhFCpX+;+pJJ=Y$5<#JPBj~