diff --git a/Quicksilver/Code-QuickStepCore/QSPreferenceKeys.h b/Quicksilver/Code-QuickStepCore/QSPreferenceKeys.h index 774e65c1c..cb79de04f 100644 --- a/Quicksilver/Code-QuickStepCore/QSPreferenceKeys.h +++ b/Quicksilver/Code-QuickStepCore/QSPreferenceKeys.h @@ -31,6 +31,7 @@ Following lines are no longer used in this project. #define kDelayQuit @"Delay Before Quitting" #define kResetDelay @"Reset Delay" +#define kSearchDelay @"Search Delay" #define kActivationHotKey @"ActivationHotKey" #define kHideDockIcon @"Hide Dock Icon" @@ -76,4 +77,4 @@ Following lines are no longer used in this project. #define kQSShowTaskViewerAutomatically @"QSShowTaskViewerAutomatically" // A boolean indicating whether the task viewer resizes automatically -#define kQSResizeTaskViewerAutomatically @"QSResizeTaskViewerAutomatically" +#define kQSResizeTaskViewerAutomatically @"QSResizeTaskViewerAutomatically" \ No newline at end of file diff --git a/Quicksilver/Code-QuickStepInterface/QSSearchObjectView.h b/Quicksilver/Code-QuickStepInterface/QSSearchObjectView.h index f92c88fae..6e12b2c20 100644 --- a/Quicksilver/Code-QuickStepInterface/QSSearchObjectView.h +++ b/Quicksilver/Code-QuickStepInterface/QSSearchObjectView.h @@ -30,6 +30,7 @@ typedef NS_ENUM(NSUInteger, QSSearchMode) { BOOL validSearch; NSTimer *resetTimer; + NSTimer *searchTimer; NSTimer *resultTimer; NSTimeInterval lastTime; diff --git a/Quicksilver/Code-QuickStepInterface/QSSearchObjectView.m b/Quicksilver/Code-QuickStepInterface/QSSearchObjectView.m index 9711c4a88..36d7b22f5 100644 --- a/Quicksilver/Code-QuickStepInterface/QSSearchObjectView.m +++ b/Quicksilver/Code-QuickStepInterface/QSSearchObjectView.m @@ -70,6 +70,7 @@ + (void)initialize { - (void)awakeFromNib { [super awakeFromNib]; resetTimer = nil; + searchTimer = nil; resultTimer = nil; preferredEdge = NSMaxXEdge; partialString = [[NSMutableString alloc] initWithCapacity:1]; @@ -874,6 +875,13 @@ - (void)performSearchFor:(NSString *)string from:(id)sender { [resultController.searchStringField setTextColor:[NSColor redColor]]; } + // Extend Timers + if ([searchTimer isValid]) { + // NSLog(@"extend"); + [searchTimer setFireDate:[NSDate dateWithTimeIntervalSinceNow:[[NSUserDefaults standardUserDefaults] floatForKey:kSearchDelay]]]; + + } + if ([resetTimer isValid]) { CGFloat resetDelay = [[NSUserDefaults standardUserDefaults] floatForKey:kResetDelay]; if (resetDelay) [resetTimer setFireDate:[NSDate dateWithTimeIntervalSinceNow:resetDelay]]; @@ -890,8 +898,19 @@ - (void)resetString { - (void)partialStringChanged { [self setSearchString:[partialString copy]]; - - [self performSearch:nil]; + + double searchDelay = [[NSUserDefaults standardUserDefaults] floatForKey:kSearchDelay]; + + // only wait for 'search delay' if we're searching all objects + if ([self searchMode] != SearchFilterAll) { + [searchTimer invalidate]; + [self performSearch:nil]; + } else { + if (![searchTimer isValid]) { + searchTimer = [NSTimer scheduledTimerWithTimeInterval:searchDelay target:self selector:@selector(performSearch:) userInfo:nil repeats:NO]; + } + [searchTimer setFireDate:[NSDate dateWithTimeIntervalSinceNow:searchDelay]]; + } if (validSearch) { NSColor *color = [[NSUserDefaults standardUserDefaults] colorForKey:@"QSAppearance2T"]; @@ -912,8 +931,11 @@ - (void)partialStringChanged { - (void)executeCommand:(id)sender { [resultTimer invalidate]; - [self performSearchFor:partialString from:self]; - [self display]; + if ([searchTimer isValid]) { + [searchTimer invalidate]; + [self performSearchFor:partialString from:self]; + [self display]; + } [resetTimer fire]; [[self controller] executeCommand:self]; } @@ -1455,6 +1477,7 @@ - (void)deleteBackward:(id)sender { [self clearTextView]; return; } + [searchTimer invalidate]; // reset the search array [self setSearchArray:nil]; if (!partialString || partialString.length <= 1) { diff --git a/Quicksilver/Nibs/QSSearchPrefPane.xib b/Quicksilver/Nibs/QSSearchPrefPane.xib index 7eddc4cc4..e195536ec 100644 --- a/Quicksilver/Nibs/QSSearchPrefPane.xib +++ b/Quicksilver/Nibs/QSSearchPrefPane.xib @@ -1,9 +1,8 @@ - - + + - - + @@ -14,22 +13,22 @@ - + - + - + - + @@ -41,7 +40,7 @@ - - + @@ -75,7 +74,7 @@ - + @@ -84,7 +83,17 @@ - - - + @@ -115,7 +124,30 @@ - + + + + + + + + + + + + + + + + + + + + + + + + @@ -126,7 +158,16 @@ - + + + + + + + + + + @@ -162,7 +203,7 @@ - + @@ -171,7 +212,7 @@ - + @@ -208,7 +249,7 @@ - + @@ -233,11 +274,21 @@ - + + + + - - - + @@ -268,7 +319,7 @@ - + @@ -277,7 +328,7 @@ - + @@ -286,16 +337,16 @@ - - + + - - + + @@ -303,8 +354,8 @@ - - + + @@ -315,8 +366,8 @@ - - + + @@ -333,8 +384,8 @@ - - + + @@ -342,8 +393,8 @@ - - - + + @@ -362,8 +413,8 @@ - - + @@ -397,13 +448,8 @@ - - - - - diff --git a/Quicksilver/Resources/QSDefaults.plist b/Quicksilver/Resources/QSDefaults.plist index 4e6eb6e88..e522a4fb4 100644 --- a/Quicksilver/Resources/QSDefaults.plist +++ b/Quicksilver/Resources/QSDefaults.plist @@ -67,6 +67,8 @@ Result Window Behavior 1 + Search Delay + 0.05 Show Release Notes on Upgrade Use Effects