Spotlight is now drag-and-drop compatible. Moved spotlight files where they belong.
parent
010f7de448
commit
037874d654
|
@ -107,8 +107,9 @@
|
|||
5604D4580D603459004F5C5D /* SpotlightPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5604D4570D603459004F5C5D /* SpotlightPanel.xib */; };
|
||||
5604D45B0D60349B004F5C5D /* SpotlightWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4590D60349B004F5C5D /* SpotlightWindowController.m */; };
|
||||
5604D4F60D60726E004F5C5D /* SpotlightPlaylistEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */; };
|
||||
562EA72E0D60CC5B0017B2B7 /* SpotlightTransformers.m in Sources */ = {isa = PBXBuildFile; fileRef = 562EA72D0D60CC5B0017B2B7 /* SpotlightTransformers.m */; };
|
||||
56462DDA0D61D71E000AB68C /* SpotlightPlaylistView.m in Sources */ = {isa = PBXBuildFile; fileRef = 56462DD90D61D71E000AB68C /* SpotlightPlaylistView.m */; };
|
||||
56462EAF0D6341F6000AB68C /* SpotlightTransformers.m in Sources */ = {isa = PBXBuildFile; fileRef = 56462EAE0D6341F6000AB68C /* SpotlightTransformers.m */; };
|
||||
56462EB20D634206000AB68C /* SpotlightPlaylistController.m in Sources */ = {isa = PBXBuildFile; fileRef = 56462EB10D634206000AB68C /* SpotlightPlaylistController.m */; };
|
||||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
|
||||
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
|
@ -598,9 +599,11 @@
|
|||
5604D45A0D60349B004F5C5D /* SpotlightWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightWindowController.h; path = Spotlight/SpotlightWindowController.h; sourceTree = "<group>"; };
|
||||
5604D4F40D60726E004F5C5D /* SpotlightPlaylistEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightPlaylistEntry.h; path = Spotlight/SpotlightPlaylistEntry.h; sourceTree = "<group>"; };
|
||||
5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightPlaylistEntry.m; path = Spotlight/SpotlightPlaylistEntry.m; sourceTree = "<group>"; };
|
||||
562EA72D0D60CC5B0017B2B7 /* SpotlightTransformers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpotlightTransformers.m; sourceTree = "<group>"; };
|
||||
56462DD80D61D71E000AB68C /* SpotlightPlaylistView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightPlaylistView.h; path = Spotlight/SpotlightPlaylistView.h; sourceTree = "<group>"; };
|
||||
56462DD90D61D71E000AB68C /* SpotlightPlaylistView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightPlaylistView.m; path = Spotlight/SpotlightPlaylistView.m; sourceTree = "<group>"; };
|
||||
56462EAE0D6341F6000AB68C /* SpotlightTransformers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightTransformers.m; path = Spotlight/SpotlightTransformers.m; sourceTree = "<group>"; };
|
||||
56462EB00D634206000AB68C /* SpotlightPlaylistController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpotlightPlaylistController.h; path = Spotlight/SpotlightPlaylistController.h; sourceTree = "<group>"; };
|
||||
56462EB10D634206000AB68C /* SpotlightPlaylistController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SpotlightPlaylistController.m; path = Spotlight/SpotlightPlaylistController.m; sourceTree = "<group>"; };
|
||||
566D32160D538550004466A5 /* APL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = APL.xcodeproj; path = Plugins/APL/APL.xcodeproj; sourceTree = "<group>"; };
|
||||
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
8E07AAEE0AAC910500A4B32F /* SS_PreferencePaneProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SS_PreferencePaneProtocol.h; path = Preferences/SS_PreferencePaneProtocol.h; sourceTree = "<group>"; };
|
||||
|
@ -1090,13 +1093,15 @@
|
|||
569C52C50D5F2BD500BDBDC9 /* Spotlight */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56462EB00D634206000AB68C /* SpotlightPlaylistController.h */,
|
||||
56462EB10D634206000AB68C /* SpotlightPlaylistController.m */,
|
||||
56462EAE0D6341F6000AB68C /* SpotlightTransformers.m */,
|
||||
5604D4590D60349B004F5C5D /* SpotlightWindowController.m */,
|
||||
5604D45A0D60349B004F5C5D /* SpotlightWindowController.h */,
|
||||
5604D4510D603430004F5C5D /* SpotlightSearchController.m */,
|
||||
5604D4520D603430004F5C5D /* SpotlightSearchController.h */,
|
||||
5604D4F40D60726E004F5C5D /* SpotlightPlaylistEntry.h */,
|
||||
5604D4F50D60726E004F5C5D /* SpotlightPlaylistEntry.m */,
|
||||
562EA72D0D60CC5B0017B2B7 /* SpotlightTransformers.m */,
|
||||
56462DD80D61D71E000AB68C /* SpotlightPlaylistView.h */,
|
||||
56462DD90D61D71E000AB68C /* SpotlightPlaylistView.m */,
|
||||
);
|
||||
|
@ -1636,8 +1641,9 @@
|
|||
5604D4550D603430004F5C5D /* SpotlightSearchController.m in Sources */,
|
||||
5604D45B0D60349B004F5C5D /* SpotlightWindowController.m in Sources */,
|
||||
5604D4F60D60726E004F5C5D /* SpotlightPlaylistEntry.m in Sources */,
|
||||
562EA72E0D60CC5B0017B2B7 /* SpotlightTransformers.m in Sources */,
|
||||
56462DDA0D61D71E000AB68C /* SpotlightPlaylistView.m in Sources */,
|
||||
56462EAF0D6341F6000AB68C /* SpotlightTransformers.m in Sources */,
|
||||
56462EB20D634206000AB68C /* SpotlightPlaylistController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// SpotlightPlaylistController.h
|
||||
// Cog
|
||||
//
|
||||
// Created by Matthew Grinshpun on 13/02/08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "PlaylistController.h"
|
||||
#import "SpotlightSearchController.h"
|
||||
|
||||
@interface SpotlightPlaylistController : PlaylistController {
|
||||
IBOutlet SpotlightSearchController * spotlightSearchController;
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard;
|
||||
|
||||
@end
|
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// SpotlightPlaylistController.m
|
||||
// Cog
|
||||
//
|
||||
// Created by Matthew Grinshpun on 13/02/08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SpotlightPlaylistController.h"
|
||||
|
||||
@implementation SpotlightPlaylistController
|
||||
|
||||
// Allow drag and drop from Spotlight into main playlist
|
||||
- (BOOL)tableView:(NSTableView *)tv
|
||||
writeRowsWithIndexes:(NSIndexSet *)rowIndexes
|
||||
toPasteboard:(NSPasteboard*)pboard
|
||||
{
|
||||
[spotlightSearchController.query disableUpdates];
|
||||
|
||||
NSArray *urls = [[self selectedObjects]valueForKey:@"url"];
|
||||
[pboard declareTypes:[NSArray arrayWithObjects:CogUrlsPbboardType,nil] owner:nil]; //add it to pboard
|
||||
[pboard setData:[NSArchiver archivedDataWithRootObject:urls] forType:CogUrlsPbboardType];
|
||||
|
||||
[spotlightSearchController.query enableUpdates];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// Do not accept drag operations, necessary as long as this class inherits from PlaylistController
|
||||
- (NSDragOperation)tableView:(NSTableView*)tv
|
||||
validateDrop:(id <NSDraggingInfo>)info
|
||||
proposedRow:(int)row
|
||||
proposedDropOperation:(NSTableViewDropOperation)op
|
||||
{
|
||||
return NSDragOperationNone;
|
||||
}
|
||||
|
||||
@end
|
|
@ -68,8 +68,22 @@ static NSPredicate * musicOnlyPredicate = nil;
|
|||
|
||||
- (NSPredicate *)processSearchString
|
||||
{
|
||||
// a somewhat dumb way to collapse the whitespace in searchString
|
||||
// TODO: write a more elegant way of accomplishing this
|
||||
NSString * compareString = [self.searchString
|
||||
stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
|
||||
NSString * collapsedString = [compareString stringByReplacingOccurrencesOfString:@" "
|
||||
withString:@" "];
|
||||
while (![collapsedString isEqualToString:compareString])
|
||||
{
|
||||
compareString = [collapsedString copy];
|
||||
collapsedString = [compareString stringByReplacingOccurrencesOfString:@" "
|
||||
withString:@" "];
|
||||
}
|
||||
|
||||
// break the string up into an array of each word
|
||||
NSArray * searchComponents = [self.searchString
|
||||
NSArray * searchComponents = [collapsedString
|
||||
componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
|
||||
// create an array of all the predicates to join together
|
||||
|
@ -125,8 +139,8 @@ static NSPredicate * musicOnlyPredicate = nil;
|
|||
{
|
||||
[self.query disableUpdates];
|
||||
|
||||
NSArray *songURLs = [[playlistController selectedObjects]valueForKey:@"url"];
|
||||
[spotlightWindowController.playlistLoader addURLs:songURLs sort:NO];
|
||||
NSArray *urls = [[playlistController selectedObjects]valueForKey:@"url"];
|
||||
[spotlightWindowController.playlistLoader addURLs:urls sort:NO];
|
||||
|
||||
[self.query enableUpdates];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue