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

CQTexperiment
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
{
if ([playlistController prev] == nil)
if ([playlistController prev] == NO)
return;
[self stop:self];

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -189,6 +189,7 @@ static NSPredicate * musicOnlyPredicate = nil;
[self.query release];
[self.searchString release];
[musicOnlyPredicate release];
[self.oldResults release];
[super dealloc];
}
@ -202,6 +203,19 @@ static NSPredicate * musicOnlyPredicate = nil;
[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
// replace the NSMetadataItem with a PlaylistEntry
@ -249,4 +263,6 @@ replacementObjectForResultObject:(NSMetadataItem*)result
}
}
@synthesize oldResults;
@end