Skip to content
Snippets Groups Projects
Commit f38e13ca authored by Claudio Cambra's avatar Claudio Cambra Committed by Felix Paul Kühne
Browse files

macosx: Start timer during library window search field input to wait for...

macosx: Start timer during library window search field input to wait for further keystrokes, easing up load

Signed-off-by: default avatarClaudio Cambra <developer@claudiocambra.com>
parent 791d328a
No related branches found
No related tags found
1 merge request!4985macosx: Fix continuous lock ups when using library search field
Pipeline #441039 passed with warnings with stage
in 20 minutes and 43 seconds
......@@ -89,6 +89,8 @@ const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier = @"VLCLibraryWin
NSInteger _currentSelectedViewModeSegment;
}
@property NSTimer *searchInputTimer;
- (IBAction)goToBrowseSection:(id)sender;
@end
......@@ -567,8 +569,9 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
{
if (!visible) {
[self hideToolbarItem:_librarySearchToolbarItem];
[self stopSearchTimer];
_librarySearchField.stringValue = @"";
[VLCMain.sharedInstance.libraryController filterByString:@""];
[self updateFilterString];
return;
}
......@@ -716,15 +719,32 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
[NSMenu popUpContextMenu:_librarySortingMenuController.librarySortingMenu withEvent:[NSApp currentEvent] forView:sender];
}
- (void)stopSearchTimer
{
[self.searchInputTimer invalidate];
self.searchInputTimer = nil;
}
- (IBAction)filterLibrary:(id)sender
{
[self stopSearchTimer];
self.searchInputTimer = [NSTimer scheduledTimerWithTimeInterval:0.3
target:self
selector:@selector(updateFilterString)
userInfo:nil
repeats:NO];
}
- (void)updateFilterString
{
[VLCMain.sharedInstance.libraryController filterByString:_librarySearchField.stringValue];
}
- (void)clearLibraryFilterString
{
[self stopSearchTimer];
_librarySearchField.stringValue = @"";
[self filterLibrary:self];
[self updateFilterString];
}
- (IBAction)openMedia:(id)sender
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment