From 541effd7433929012fa80a8094109421b2b81c02 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 21 Feb 2011 04:18:58 +0000 Subject: [PATCH] slightly simplify filter code --- macosx/Controller.m | 23 ++++++++------- macosx/en.lproj/MainMenu.xib | 56 ++---------------------------------- 2 files changed, 15 insertions(+), 64 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index a5b82a1ab..59c03eb35 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1987,9 +1987,10 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy const NSInteger groupFilterValue = [fDefaults integerForKey: @"FilterGroup"]; const BOOL filterGroup = groupFilterValue != GROUP_FILTER_ALL_TAG; - NSString * searchString = fFilterBar ? [fFilterBar searchString] : @""; - const BOOL filterText = ![searchString isEqualToString: @""], - filterTracker = filterText && [[fDefaults stringForKey: @"FilterSearchType"] isEqualToString: FILTER_TYPE_TRACKER]; + NSString * searchString = [fFilterBar searchString]; + if (searchString && [searchString isEqualToString: @""]) + searchString = nil; + const BOOL filterTracker = searchString && [[fDefaults stringForKey: @"FilterSearchType"] isEqualToString: FILTER_TYPE_TRACKER]; NSMutableArray * allTorrents = [NSMutableArray arrayWithCapacity: [fTorrents count]]; @@ -2001,24 +2002,24 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy { const BOOL isActive = ![torrent isStalled]; if (isActive) - active++; + ++active; if ([torrent isSeeding]) { - seeding++; + ++seeding; if (filterStatus && !((filterActive && isActive) || filterSeed)) continue; } else { - downloading++; + ++downloading; if (filterStatus && !((filterActive && isActive) || filterDownload)) continue; } } else { - paused++; + ++paused; if (filterStatus && !filterPause) continue; } @@ -2029,7 +2030,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy continue; //check text field - if (filterText) + if (searchString) { if (filterTracker) { @@ -2092,7 +2093,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy group = nil; //try to see if the group already exists - for (; currentOldGroupIndex < [oldTorrentGroups count]; currentOldGroupIndex++) + for (; currentOldGroupIndex < [oldTorrentGroups count]; ++currentOldGroupIndex) { TorrentGroup * currentGroup = [oldTorrentGroups objectAtIndex: currentOldGroupIndex]; const NSInteger currentGroupValue = [currentGroup groupIndex]; @@ -2101,7 +2102,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy group = currentGroup; [[currentGroup torrents] removeAllObjects]; - currentOldGroupIndex++; + ++currentOldGroupIndex; } if (currentGroupValue >= groupValue) @@ -2138,7 +2139,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy [fTableView selectValues: selectedValues]; [self resetInfo]; //if group is already selected, but the torrents in it change - [self setBottomCountText: groupRows || filterStatus || filterGroup || filterText]; + [self setBottomCountText: groupRows || filterStatus || filterGroup || searchString]; [self setWindowSizeToFit]; } diff --git a/macosx/en.lproj/MainMenu.xib b/macosx/en.lproj/MainMenu.xib index 027b67918..f88f8e1eb 100644 --- a/macosx/en.lproj/MainMenu.xib +++ b/macosx/en.lproj/MainMenu.xib @@ -12,9 +12,8 @@ YES - - - + + YES @@ -105,28 +104,6 @@ YES - - - Item2 - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - Item3 - - 1048576 - 2147483647 - - - _popUpItemAction: - - YES @@ -5422,27 +5399,15 @@ AAAAAAAAAAAAAAAAA YES - - - - 2686 - - - 2685 - - 2684 - - - 3077 @@ -6087,12 +6052,8 @@ AAAAAAAAAAAAAAAAA 2683.IBEditorWindowLastContentRect 2683.IBPluginDependency 2683.ImportedFromIB2 - 2684.IBPluginDependency - 2684.ImportedFromIB2 2685.IBPluginDependency 2685.ImportedFromIB2 - 2686.IBPluginDependency - 2686.ImportedFromIB2 2690.IBPluginDependency 2690.ImportedFromIB2 2700.IBPluginDependency @@ -6591,11 +6552,7 @@ AAAAAAAAAAAAAAAAA P4AAAL+AAABAwAAAwZgAAA - {{346, 449}, {108, 63}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - + {{66, 710}, {105, 23}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -6809,7 +6766,6 @@ AAAAAAAAAAAAAAAAA revealFile: selectedToolbarClicked: setGroup: - setGroupFilter: setInfoTab: setLimitGlobalEnabled: setQuickLimitGlobal: @@ -6889,7 +6845,6 @@ AAAAAAAAAAAAAAAAA id id id - id @@ -6918,7 +6873,6 @@ AAAAAAAAAAAAAAAAA revealFile: selectedToolbarClicked: setGroup: - setGroupFilter: setInfoTab: setLimitGlobalEnabled: setQuickLimitGlobal: @@ -7037,10 +6991,6 @@ AAAAAAAAAAAAAAAAA setGroup: id - - setGroupFilter: - id - setInfoTab: id