Eliminated annoying flicker in Spotlight interface. Made tiny tweaks to PlaybackController and PlaylistController header to eliminate compiler warnings.

This commit is contained in:
matthewleon 2008-02-14 23:09:51 +00:00
parent b4804ebb5e
commit 387015db22
6 changed files with 559 additions and 531 deletions

View file

@ -198,7 +198,7 @@ double linearToLogarithmic(double linear)
- (IBAction)prev:(id)sender - (IBAction)prev:(id)sender
{ {
if ([playlistController prev] == nil) if ([playlistController prev] == NO)
return; return;
[self stop:self]; [self stop:self];

View file

@ -41,6 +41,9 @@
- (void)setRepeat:(BOOL)r; - (void)setRepeat:(BOOL)r;
- (BOOL)repeat; - (BOOL)repeat;
- (PlaylistEntry *)getNextEntry:(PlaylistEntry *)pe;
- (PlaylistEntry *)getPrevEntry:(PlaylistEntry *)pe;
/* Methods for undoing various actions */ /* Methods for undoing various actions */
- (NSUndoManager *)undoManager; - (NSUndoManager *)undoManager;

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,7 @@
@interface StringToURLTransformer: NSValueTransformer {} @interface StringToURLTransformer: NSValueTransformer {}
@end @end
@implementation StringToURLTransformer @implementation StringToURLTransformer
+ (Class)transformedValueClass { return [NSURL class]; } + (Class)transformedValueClass { return [NSURL class]; }
+ (BOOL)allowsReverseTransformation { return YES; } + (BOOL)allowsReverseTransformation { return YES; }
@ -28,3 +29,5 @@
return [value absoluteString]; return [value absoluteString];
} }
@end @end
@end

View file

@ -17,6 +17,7 @@
NSMetadataQuery *query; NSMetadataQuery *query;
NSString *searchString; NSString *searchString;
NSString *spotlightSearchPath; NSString *spotlightSearchPath;
NSArray *oldResults;
} }
- (IBAction)addToPlaylist:(id)sender; - (IBAction)addToPlaylist:(id)sender;
@ -27,5 +28,6 @@
@property(retain) NSMetadataQuery *query; @property(retain) NSMetadataQuery *query;
@property(copy) NSString *searchString; @property(copy) NSString *searchString;
@property(copy) NSString *spotlightSearchPath; @property(copy) NSString *spotlightSearchPath;
@property(retain) NSArray *oldResults;
@end @end

View file

@ -189,6 +189,7 @@ static NSPredicate * musicOnlyPredicate = nil;
[self.query release]; [self.query release];
[self.searchString release]; [self.searchString release];
[musicOnlyPredicate release]; [musicOnlyPredicate release];
[self.oldResults release];
[super dealloc]; [super dealloc];
} }
@ -202,6 +203,19 @@ static NSPredicate * musicOnlyPredicate = nil;
[self.query enableUpdates]; [self.query enableUpdates];
} }
// Don't update the track list until some results have been gathered
- (id)valueForKeyPath:(NSString *)keyPath
{
if([keyPath isEqualToString:@"query.results"])
{
if(([self.query.results count] == 0) && [self.query isGathering])
return self.oldResults;
self.oldResults = [NSArray arrayWithArray:self.query.results];
return self.oldResults;
}
return [super valueForKeyPath:keyPath];
}
#pragma mark NSMetadataQuery delegate methods #pragma mark NSMetadataQuery delegate methods
// replace the NSMetadataItem with a PlaylistEntry // replace the NSMetadataItem with a PlaylistEntry
@ -249,4 +263,6 @@ replacementObjectForResultObject:(NSMetadataItem*)result
} }
} }
@synthesize oldResults;
@end @end