mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
small search field in filter
This commit is contained in:
parent
b81f910a72
commit
dc18992d4a
6 changed files with 36 additions and 18 deletions
|
@ -69,6 +69,7 @@
|
|||
NSString * fFilterType;
|
||||
IBOutlet BarButton * fNoFilterButton, * fPauseFilterButton,
|
||||
* fSeedFilterButton, * fDownloadFilterButton;
|
||||
IBOutlet NSSearchField * fSearchFilterField;
|
||||
|
||||
IBOutlet NSMenuItem * fNextInfoTabItem, * fPrevInfoTabItem;
|
||||
|
||||
|
@ -133,7 +134,7 @@
|
|||
- (void) sortTorrents;
|
||||
- (void) sortTorrentsIgnoreSelected;
|
||||
- (void) setSort: (id) sender;
|
||||
- (void) applyFilter;
|
||||
- (void) applyFilter: (id) sender;
|
||||
- (void) setFilter: (id) sender;
|
||||
|
||||
- (void) toggleSpeedLimit: (id) sender;
|
||||
|
|
|
@ -314,7 +314,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
selector: @selector(checkAutoImportDirectory:) userInfo: nil repeats: YES];
|
||||
[[NSRunLoop currentRunLoop] addTimer: fAutoImportTimer forMode: NSDefaultRunLoopMode];
|
||||
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
|
||||
[fWindow makeKeyAndOrderFront: nil];
|
||||
|
||||
|
@ -474,7 +474,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
[self torrentNumberChanged];
|
||||
|
||||
[self updateUI: nil];
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
[self updateTorrentHistory];
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
[torrents makeObjectsPerformSelector: @selector(startTransfer)];
|
||||
|
||||
[self updateUI: nil];
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
[fInfoController updateInfoStatsAndSettings];
|
||||
[self updateTorrentHistory];
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
[torrents makeObjectsPerformSelector: @selector(stopTransfer)];
|
||||
|
||||
[self updateUI: nil];
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
[fInfoController updateInfoStatsAndSettings];
|
||||
[self updateTorrentHistory];
|
||||
}
|
||||
|
@ -840,7 +840,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
|
||||
if ([torrent justFinished])
|
||||
{
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
[self checkToStartWaiting: torrent];
|
||||
|
||||
[GrowlApplicationBridge notifyWithTitle: @"Download Complete"
|
||||
|
@ -991,7 +991,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
[self sortTorrents];
|
||||
}
|
||||
|
||||
- (void) applyFilter
|
||||
- (void) applyFilter: (id) sender
|
||||
{
|
||||
//remember selected rows if needed
|
||||
NSArray * selectedTorrents = [fTableView numberOfSelectedRows] > 0
|
||||
|
@ -1026,6 +1026,16 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
else
|
||||
[tempTorrents setArray: fTorrents];
|
||||
|
||||
NSString * searchString = [fSearchFilterField stringValue];
|
||||
if (![searchString isEqualToString: @""])
|
||||
{
|
||||
int i;
|
||||
for (i = [tempTorrents count] - 1; i >= 0; i--)
|
||||
if ([[[tempTorrents objectAtIndex: i] name] rangeOfString: searchString
|
||||
options: NSCaseInsensitiveSearch].location == NSNotFound)
|
||||
[tempTorrents removeObjectAtIndex: i];
|
||||
}
|
||||
|
||||
[fFilteredTorrents setArray: tempTorrents];
|
||||
[tempTorrents release];
|
||||
|
||||
|
@ -1078,7 +1088,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
[fDefaults setObject: fFilterType forKey: @"Filter"];
|
||||
}
|
||||
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
}
|
||||
|
||||
- (void) toggleSpeedLimit: (id) sender
|
||||
|
@ -1198,7 +1208,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
{
|
||||
[torrentToStart startTransfer];
|
||||
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
[self updateUI: nil];
|
||||
[fInfoController updateInfoStatsAndSettings];
|
||||
[self updateTorrentHistory];
|
||||
|
@ -1209,7 +1219,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
{
|
||||
[self attemptToStartMultipleAuto: [notification object]];
|
||||
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
[self updateUI: nil];
|
||||
[fInfoController updateInfoStatsAndSettings];
|
||||
[self updateTorrentHistory];
|
||||
|
@ -1219,7 +1229,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
{
|
||||
[self attemptToStartMultipleAuto: fTorrents];
|
||||
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
[self updateUI: nil];
|
||||
[fInfoController updateInfoStatsAndSettings];
|
||||
[self updateTorrentHistory];
|
||||
|
@ -1227,7 +1237,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
|
||||
- (void) torrentStoppedForRatio: (NSNotification *) notification
|
||||
{
|
||||
[self applyFilter];
|
||||
[self applyFilter: nil];
|
||||
[fInfoController updateInfoStatsAndSettings];
|
||||
|
||||
[GrowlApplicationBridge notifyWithTitle: @"Seeding Complete"
|
||||
|
@ -1561,12 +1571,19 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
|
||||
- (void) toggleFilterBar: (id) sender
|
||||
{
|
||||
if (!fFilterBarVisible)
|
||||
[fSearchFilterField setEnabled: YES];
|
||||
|
||||
[self showFilterBar: !fFilterBarVisible animate: YES];
|
||||
[fDefaults setBool: fFilterBarVisible forKey: @"FilterBar"];
|
||||
|
||||
//disable filtering when hiding
|
||||
if (!fFilterBarVisible)
|
||||
{
|
||||
[fSearchFilterField setEnabled: NO];
|
||||
[fSearchFilterField setStringValue: @""];
|
||||
[self setFilter: fNoFilterButton];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) showFilterBar: (BOOL) show animate: (BOOL) animate
|
||||
|
|
2
macosx/English.lproj/MainMenu.nib/classes.nib
generated
2
macosx/English.lproj/MainMenu.nib/classes.nib
generated
|
@ -3,6 +3,7 @@
|
|||
{CLASS = BarButton; LANGUAGE = ObjC; SUPERCLASS = NSImageView; },
|
||||
{
|
||||
ACTIONS = {
|
||||
applyFilter = id;
|
||||
checkUpdate = id;
|
||||
copyTorrentFile = id;
|
||||
linkForums = id;
|
||||
|
@ -54,6 +55,7 @@
|
|||
fRatioNotSetItem = NSMenuItem;
|
||||
fRatioSetItem = NSMenuItem;
|
||||
fScrollView = NSScrollView;
|
||||
fSearchFilterField = NSSearchField;
|
||||
fSeedFilterButton = BarButton;
|
||||
fSmallViewItem = NSMenuItem;
|
||||
fSpeedLimitButton = NSButton;
|
||||
|
|
4
macosx/English.lproj/MainMenu.nib/info.nib
generated
4
macosx/English.lproj/MainMenu.nib/info.nib
generated
|
@ -11,7 +11,7 @@
|
|||
<key>1480</key>
|
||||
<string>364 490 420 60 0 0 1152 842 </string>
|
||||
<key>1603</key>
|
||||
<string>188 407 477 65 0 0 1152 842 </string>
|
||||
<string>241 540 477 65 0 0 1152 842 </string>
|
||||
<key>29</key>
|
||||
<string>9 780 451 44 0 0 1152 842 </string>
|
||||
<key>456</key>
|
||||
|
@ -31,8 +31,8 @@
|
|||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
<integer>1603</integer>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8J135</string>
|
||||
|
|
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -285,12 +285,10 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
BOOL highlighted = [self isHighlighted] && [[self highlightColorWithFrame: cellFrame inView: view]
|
||||
isEqual: [NSColor alternateSelectedControlColor]];
|
||||
NSDictionary * nameAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
highlighted ? [NSColor whiteColor] : [NSColor blackColor],
|
||||
NSForegroundColorAttributeName,
|
||||
highlighted ? [NSColor whiteColor] : [NSColor blackColor], NSForegroundColorAttributeName,
|
||||
[NSFont messageFontOfSize: 12.0], NSFontAttributeName, nil];
|
||||
NSDictionary * statusAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
highlighted ? [NSColor whiteColor] : [NSColor darkGrayColor],
|
||||
NSForegroundColorAttributeName,
|
||||
highlighted ? [NSColor whiteColor] : [NSColor darkGrayColor], NSForegroundColorAttributeName,
|
||||
[NSFont messageFontOfSize: 9.0], NSFontAttributeName, nil];
|
||||
|
||||
NSPoint pen = cellFrame.origin;
|
||||
|
|
Loading…
Reference in a new issue