Added preferences for the file drawer. Fixed bug with sorting added folders.
parent
c0a143e0be
commit
e3d076dbf7
|
@ -12,7 +12,7 @@
|
|||
[p setAllowsMultipleSelection:YES];
|
||||
|
||||
[p beginSheetForDirectory:nil file:nil types:[playlistController acceptableFileTypes] modalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
|
||||
[p beginForDirectory:nil file:nil types:[playlistController acceptableFileTypes] modelessDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:nil];
|
||||
// [p beginForDirectory:nil file:nil types:[playlistController acceptableFileTypes] modelessDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:nil];
|
||||
|
||||
/* if ([p runModalForTypes:[playlistController acceptableFileTypes]] == NSOKButton)
|
||||
{
|
||||
|
@ -218,6 +218,8 @@
|
|||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:(NSControlKeyMask|NSCommandKeyMask)] forKey:@"hotKeyPreviousModifiers"];
|
||||
[userDefaultsValuesDict setObject:[NSNumber numberWithInt:'R'] forKey:@"hotKeyPreviousCharacter"];
|
||||
|
||||
[userDefaultsValuesDict setObject:[@"~/Music" stringByExpandingTildeInPath] forKey:@"fileDrawerRootPath"];
|
||||
|
||||
//Register and sync defaults
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
|
@ -225,6 +227,8 @@
|
|||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPlayKeyCode" options:0 context:nil];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyPreviousKeyCode" options:0 context:nil];
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.hotKeyNextKeyCode" options:0 context:nil];
|
||||
|
||||
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.fileDrawerRootPath" options:0 context:nil];
|
||||
}
|
||||
|
||||
- (void) observeValueForKeyPath:(NSString *)keyPath
|
||||
|
@ -241,6 +245,9 @@
|
|||
else if ([keyPath isEqualToString:@"values.hotKeyNextKeyCode"]) {
|
||||
[self registerHotKeys];
|
||||
}
|
||||
else if ([keyPath isEqualToString:@"values.fileDrawerRootPath"]) {
|
||||
[fileTreeController setRootPath:[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileDrawerRootPath"]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registerHotKeys
|
||||
|
|
|
@ -404,6 +404,10 @@
|
|||
8E75751A09F31D5A0080F1EE /* Custom */,
|
||||
8E75752A09F31D5A0080F1EE /* Playlist */,
|
||||
8E75753509F31D5A0080F1EE /* Sound */,
|
||||
8E75751809F31D5A0080F1EE /* AppController.h */,
|
||||
8E75751909F31D5A0080F1EE /* AppController.m */,
|
||||
8E75752809F31D5A0080F1EE /* PlaybackController.h */,
|
||||
8E75752909F31D5A0080F1EE /* PlaybackController.m */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
|
@ -441,10 +445,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
080E96DDFE201D6D7F000001 /* Classes */,
|
||||
8E75751809F31D5A0080F1EE /* AppController.h */,
|
||||
8E75751909F31D5A0080F1EE /* AppController.m */,
|
||||
8E75752809F31D5A0080F1EE /* PlaybackController.h */,
|
||||
8E75752909F31D5A0080F1EE /* PlaybackController.m */,
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
||||
29B97317FDCFA39411CA2CEA /* Resources */,
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */,
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
id controller;
|
||||
}
|
||||
|
||||
-(id)initWithPath:(NSString *)p controller:(id) c;
|
||||
- (NSArray *)subpaths;
|
||||
|
||||
@end
|
||||
|
|
|
@ -23,7 +23,14 @@
|
|||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[controller watcher] removePath:[self path]];
|
||||
|
||||
NSLog(@"DEALLOC: %@", self);
|
||||
if (subpaths)
|
||||
[subpaths release];
|
||||
|
||||
[controller release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -17,12 +17,16 @@
|
|||
watcher = [[FileTreeWatcher alloc] init];
|
||||
[watcher setDelegate:self];
|
||||
|
||||
[self setRootPath: [@"~/Music" stringByExpandingTildeInPath]];
|
||||
[self setRootPath: [[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileDrawerRootPath"] ];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[rootPath release];
|
||||
[watcher release];
|
||||
|
||||
NSLog(@"DEALLOCATING CONTROLLER");
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -43,10 +47,26 @@
|
|||
- (void) refreshRoot
|
||||
{
|
||||
DirectoryNode *base = [[DirectoryNode alloc] initWithPath:rootPath controller:self];
|
||||
NSLog(@"Subpaths: %i", [[base subpaths] count]);
|
||||
[self setContent: [base subpaths]];
|
||||
NSLog(@"Test: %i", [[self content] retainCount]);
|
||||
|
||||
[base release];
|
||||
}
|
||||
|
||||
//BUG IN NSTREECONTROLLER'S SETCONTENT. FIX YOUR SHIT, APPLE!
|
||||
- (void)setContent:(id)content
|
||||
{
|
||||
if(![content isEqual:[self content]])
|
||||
{
|
||||
NSArray *paths = [[self selectionIndexPaths] retain];
|
||||
[super setContent:nil];
|
||||
[super setContent:content];
|
||||
[self setSelectionIndexPaths:paths];
|
||||
[paths release];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)refreshPath:(NSString *)path
|
||||
{
|
||||
if ([path compare:rootPath] == NSOrderedSame) {
|
||||
|
|
|
@ -16,4 +16,7 @@
|
|||
NSMutableArray *watchedPaths;
|
||||
}
|
||||
|
||||
- (void)addPath: (NSString *)path;
|
||||
- (void)removePath: (NSString *)path;
|
||||
|
||||
@end
|
||||
|
|
|
@ -40,6 +40,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)removePath: (NSString *)path
|
||||
{
|
||||
[watchedPaths removeObject:path];
|
||||
[kqueue removePath:path];
|
||||
}
|
||||
|
||||
-(void) setDelegate: (id)d
|
||||
{
|
||||
delegate = [d retain];
|
||||
|
|
|
@ -25,6 +25,12 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[path release];
|
||||
[icon release];
|
||||
}
|
||||
|
||||
- (NSString *) path
|
||||
{
|
||||
return path;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
- (void)dealloc
|
||||
{
|
||||
[path release];
|
||||
[pathIcon release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -109,21 +109,6 @@
|
|||
8E75712209F319570080F1EE /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E75712109F319570080F1EE /* config.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXBuildStyle section */
|
||||
014CEA440018CDF011CA2923 /* Debug */ = {
|
||||
isa = PBXBuildStyle;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
014CEA450018CDF011CA2923 /* Release */ = {
|
||||
isa = PBXBuildStyle;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End PBXBuildStyle section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
|
@ -574,8 +559,6 @@
|
|||
);
|
||||
buildRules = (
|
||||
);
|
||||
buildSettings = {
|
||||
};
|
||||
dependencies = (
|
||||
);
|
||||
name = TagLib;
|
||||
|
@ -590,12 +573,6 @@
|
|||
0867D690FE84028FC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "TagLib" */;
|
||||
buildSettings = {
|
||||
};
|
||||
buildStyles = (
|
||||
014CEA440018CDF011CA2923 /* Debug */,
|
||||
014CEA450018CDF011CA2923 /* Release */,
|
||||
);
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 0867D691FE84028FC02AAC07 /* TagLib */;
|
||||
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
|
||||
|
|
|
@ -122,10 +122,10 @@
|
|||
{
|
||||
PlaylistEntry *pe = [[PlaylistEntry alloc] init];
|
||||
|
||||
[pe setFilename:[files objectAtIndex:i]];
|
||||
[pe setFilename:[sortedFiles objectAtIndex:i]];
|
||||
[pe setIndex:index+i];
|
||||
[pe setTitle:[[files objectAtIndex:i] lastPathComponent]];
|
||||
[pe setDisplay:[[files objectAtIndex:i] lastPathComponent]];
|
||||
[pe setTitle:[[sortedFiles objectAtIndex:i] lastPathComponent]];
|
||||
[pe setDisplay:[[sortedFiles objectAtIndex:i] lastPathComponent]];
|
||||
// [pe performSelectorOnMainThread:@selector(readTags) withObject:nil waitUntilDone:NO];
|
||||
// [pe performSelectorOnMainThread:@selector(readInfo) withObject:nil waitUntilDone:NO];
|
||||
|
||||
|
|
|
@ -482,4 +482,9 @@
|
|||
waitUntilDone:YES];
|
||||
}
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"PlaylistEntry %i:(%@)",idx, filename];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{CLASS = FileDrawerPane; LANGUAGE = ObjC; SUPERCLASS = PreferencePane; },
|
||||
{
|
||||
ACTIONS = {openSheet = id; };
|
||||
CLASS = FileDrawerPane;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {rootPathTextView = NSTextField; };
|
||||
SUPERCLASS = PreferencePane;
|
||||
},
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{CLASS = HotKeyControl; LANGUAGE = ObjC; SUPERCLASS = NDHotKeyControl; },
|
||||
{
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>69 77 356 240 0 0 1024 746 </string>
|
||||
<string>137 120 356 240 0 0 1680 1028 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>10</key>
|
||||
<string>178 415 668 209 0 0 1024 746 </string>
|
||||
<string>499 669 506 102 0 0 1680 1028 </string>
|
||||
<key>11</key>
|
||||
<string>290 507 273 151 0 0 1024 746 </string>
|
||||
<string>703 634 273 151 0 0 1680 1028 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>446.1</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>10</integer>
|
||||
<integer>11</integer>
|
||||
<integer>10</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8J135</string>
|
||||
<string>8K1106</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Binary file not shown.
|
@ -11,7 +11,9 @@
|
|||
|
||||
|
||||
@interface FileDrawerPane : PreferencePane {
|
||||
|
||||
IBOutlet NSTextField *rootPathTextView;
|
||||
}
|
||||
|
||||
- (IBAction)openSheet:(id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -15,6 +15,31 @@
|
|||
{
|
||||
[self setName:@"File Drawer"];
|
||||
[self setIcon:@"file_drawer"];
|
||||
|
||||
[rootPathTextView setStringValue:[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileDrawerRootPath"]];
|
||||
}
|
||||
|
||||
- (IBAction)openSheet:(id)sender
|
||||
{
|
||||
NSOpenPanel *p;
|
||||
|
||||
p = [NSOpenPanel openPanel];
|
||||
|
||||
[p setCanChooseDirectories:YES];
|
||||
[p setCanChooseFiles:NO];
|
||||
[p setAllowsMultipleSelection:NO];
|
||||
|
||||
[p beginSheetForDirectory:nil file:nil types:nil modalForWindow:[view window] modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
|
||||
|
||||
}
|
||||
|
||||
- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
if (returnCode == NSOKButton)
|
||||
{
|
||||
[rootPathTextView setStringValue:[panel filename]];
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[panel filename] forKey:@"fileDrawerRootPath"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -100,21 +100,11 @@
|
|||
08FB77AFFE84173DC02AAC07 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
17D503410ABDB1660022D1E8 /* Custom */,
|
||||
17D5033F0ABDB1570022D1E8 /* Panes */,
|
||||
8E07AA860AAC8EA200A4B32F /* SS_PreferencePaneProtocol.h */,
|
||||
8E07AA840AAC8EA200A4B32F /* PrefPaneController.h */,
|
||||
8E07AA850AAC8EA200A4B32F /* PrefPaneController.m */,
|
||||
8E07AA820AAC8EA200A4B32F /* PreferencePane.h */,
|
||||
8E07AA830AAC8EA200A4B32F /* PreferencePane.m */,
|
||||
8E07AA7E0AAC8EA200A4B32F /* FileDrawerPane.h */,
|
||||
8E07AA7F0AAC8EA200A4B32F /* FileDrawerPane.m */,
|
||||
8E07AA800AAC8EA200A4B32F /* HotKeyPane.h */,
|
||||
8E07AA810AAC8EA200A4B32F /* HotKeyPane.m */,
|
||||
8E6C12120AACAE4100819171 /* NDHotKeyControl.h */,
|
||||
8E6C12130AACAE4100819171 /* NDHotKeyControl.m */,
|
||||
8E6C12140AACAE4100819171 /* NDHotKeyEvent.h */,
|
||||
8E6C12150AACAE4100819171 /* NDHotKeyEvent.m */,
|
||||
8E6C139E0AACBAB500819171 /* HotKeyControl.h */,
|
||||
8E6C139F0AACBAB500819171 /* HotKeyControl.m */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
|
@ -138,6 +128,32 @@
|
|||
name = "Other Frameworks";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
17D5033F0ABDB1570022D1E8 /* Panes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8E07AA820AAC8EA200A4B32F /* PreferencePane.h */,
|
||||
8E07AA830AAC8EA200A4B32F /* PreferencePane.m */,
|
||||
8E07AA7E0AAC8EA200A4B32F /* FileDrawerPane.h */,
|
||||
8E07AA7F0AAC8EA200A4B32F /* FileDrawerPane.m */,
|
||||
8E07AA800AAC8EA200A4B32F /* HotKeyPane.h */,
|
||||
8E07AA810AAC8EA200A4B32F /* HotKeyPane.m */,
|
||||
);
|
||||
name = Panes;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
17D503410ABDB1660022D1E8 /* Custom */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8E6C12120AACAE4100819171 /* NDHotKeyControl.h */,
|
||||
8E6C12130AACAE4100819171 /* NDHotKeyControl.m */,
|
||||
8E6C12140AACAE4100819171 /* NDHotKeyEvent.h */,
|
||||
8E6C12150AACAE4100819171 /* NDHotKeyEvent.m */,
|
||||
8E6C139E0AACBAB500819171 /* HotKeyControl.h */,
|
||||
8E6C139F0AACBAB500819171 /* HotKeyControl.m */,
|
||||
);
|
||||
name = Custom;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
19C28FB8FE9D52D311CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
|
Loading…
Reference in New Issue