Moved File Tree preferences to use a NSPathControl.

CQTexperiment
vspader 2008-02-17 21:04:36 +00:00
parent eb84d83c8e
commit 3ba929f51a
9 changed files with 1113 additions and 1176 deletions

View File

@ -107,6 +107,7 @@
17D1B2830CF8B2830028F5B5 /* xm.icns in Resources */ = {isa = PBXBuildFile; fileRef = 17D1B27C0CF8B2830028F5B5 /* xm.icns */; };
17E41E070C130DFF00AC744D /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 17E41E060C130DFF00AC744D /* Credits.html */; };
17E41E230C130EE200AC744D /* Help in Resources */ = {isa = PBXBuildFile; fileRef = 17E41E220C130EE200AC744D /* Help */; };
17E78CB10D68D46F005C5A59 /* StringToURLTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E78CB00D68D46F005C5A59 /* StringToURLTransformer.m */; };
17F3BB890CBC565900864489 /* CueSheet.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17F3BB880CBC565100864489 /* CueSheet.bundle */; };
17F561400C3BD4F30019975C /* CogAudio.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17F561330C3BD4DC0019975C /* CogAudio.framework */; };
17F562390C3BD91B0019975C /* General.preferencePane in Resources */ = {isa = PBXBuildFile; fileRef = 17F5622E0C3BD8FB0019975C /* General.preferencePane */; };
@ -603,6 +604,8 @@
17D1B27A0CF8B2830028F5B5 /* song.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = song.icns; sourceTree = "<group>"; };
17D1B27B0CF8B2830028F5B5 /* vg.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = vg.icns; sourceTree = "<group>"; };
17D1B27C0CF8B2830028F5B5 /* xm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = xm.icns; sourceTree = "<group>"; };
17E78CAF0D68D46F005C5A59 /* StringToURLTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringToURLTransformer.h; sourceTree = "<group>"; };
17E78CB00D68D46F005C5A59 /* StringToURLTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StringToURLTransformer.m; sourceTree = "<group>"; };
17F3BB830CBC565100864489 /* CueSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CueSheet.xcodeproj; path = Plugins/CueSheet/CueSheet.xcodeproj; sourceTree = "<group>"; };
17F5612A0C3BD4DC0019975C /* CogAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CogAudio.xcodeproj; path = Audio/CogAudio.xcodeproj; sourceTree = "<group>"; };
17F562260C3BD8FB0019975C /* General.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = General.xcodeproj; path = Preferences/General/General.xcodeproj; sourceTree = "<group>"; };
@ -854,6 +857,8 @@
8E9A30140BA792DC0091081B /* NSFileHandle+CreateFile.m */,
07E18DF10D62B38400BB0E11 /* NSArray+ShuffleUtils.h */,
07E18DF20D62B38400BB0E11 /* NSArray+ShuffleUtils.m */,
17E78CAF0D68D46F005C5A59 /* StringToURLTransformer.h */,
17E78CB00D68D46F005C5A59 /* StringToURLTransformer.m */,
);
path = Utils;
sourceTree = "<group>";
@ -1682,6 +1687,7 @@
17211A770D68B79700911CA9 /* FileTreeWindowController.m in Sources */,
17211A780D68B79700911CA9 /* PathNode.m in Sources */,
17211A790D68B79700911CA9 /* SmartFolderNode.m in Sources */,
17E78CB10D68D46F005C5A59 /* StringToURLTransformer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -16,8 +16,8 @@
IBOutlet NSOutlineView *outlineView;
}
- (NSString *)rootPath;
- (void)setRootPath:(NSString *)rootPath;
- (NSURL *)rootURL;
- (void)setRootURL:(NSURL *)rootURL;
- (void)reloadPathNode:(PathNode *)item;

View File

@ -18,18 +18,18 @@
{
NSMutableDictionary *userDefaultsValuesDict = [NSMutableDictionary dictionary];
[userDefaultsValuesDict setObject:[@"~/Music" stringByExpandingTildeInPath] forKey:@"fileTreeRootPath"];
[userDefaultsValuesDict setObject:[[NSURL fileURLWithPath:[@"~/Music" stringByExpandingTildeInPath]] absoluteString] forKey:@"fileTreeRootURL"];
[[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict];
[[NSUserDefaults standardUserDefaults] synchronize];
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.fileTreeRootPath" options:0 context:nil];
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.fileTreeRootURL" options:0 context:nil];
}
- (void)awakeFromNib
{
[self initDefaults];
[self setRootPath: [[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootPath"] ];
[self setRootURL: [NSURL URLWithString:[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootURL"]]];
}
- (void) observeValueForKeyPath:(NSString *)keyPath
@ -37,23 +37,23 @@
change:(NSDictionary *)change
context:(void *)context
{
if ([keyPath isEqualToString:@"values.fileTreeRootPath"]) {
[self setRootPath:[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootPath"]];
if ([keyPath isEqualToString:@"values.fileTreeRootURL"]) {
[self setRootURL:[NSURL URLWithString:[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootURL"]]];
}
}
- (NSString *)rootPath
- (NSURL *)rootURL
{
return [[rootNode url] path];
return [rootNode url];
}
- (void)setRootPath: (NSString *)rootPath
- (void)setRootURL: (NSURL *)rootURL
{
[[[[outlineView tableColumns] objectAtIndex:0] headerCell] setStringValue:[[NSFileManager defaultManager] displayNameAtPath:rootPath]];
[[[[outlineView tableColumns] objectAtIndex:0] headerCell] setStringValue:[[NSFileManager defaultManager] displayNameAtPath:[rootURL path]]];
[rootNode release];
rootNode = [[DirectoryNode alloc] initWithDataSource:self url:[NSURL fileURLWithPath:rootPath]];
rootNode = [[DirectoryNode alloc] initWithDataSource:self url:rootURL];
[self reloadPathNode:rootNode];
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
//
// FileTreePane.h
// Preferences
//
// Created by Vincent Spader on 9/4/06.
// Copyright 2006 Vincent Spader. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "PreferencePane.h"
@interface FileTreePane : PreferencePane {
IBOutlet NSTextField *rootPathTextView;
}
- (IBAction)openSheet:(id)sender;
@end

View File

@ -1,45 +0,0 @@
//
// FileTreePane.m
// Preferences
//
// Created by Vincent Spader on 9/4/06.
// Copyright 2006 Vincent Spader. All rights reserved.
//
#import "FileTreePane.h"
@implementation FileTreePane
- (void)awakeFromNib
{
[self setName:NSLocalizedStringFromTableInBundle(@"File Tree", nil, [NSBundle bundleForClass:[self class]], @"") ];
[self setIcon:@"file_tree"];
[rootPathTextView setStringValue:[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootPath"]];
}
- (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:@"fileTreeRootPath"];
}
}
@end

View File

@ -16,7 +16,6 @@
17C643690B8A788000C53518 /* output.png in Resources */ = {isa = PBXBuildFile; fileRef = 17C643680B8A788000C53518 /* output.png */; };
17C644330B8A791D00C53518 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17C644310B8A791D00C53518 /* CoreAudio.framework */; };
17E41DB80C130AA500AC744D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 17E41DB70C130AA500AC744D /* Localizable.strings */; };
17E78A7B0D68BE1E005C5A59 /* FileTreePane.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E78A7A0D68BE1E005C5A59 /* FileTreePane.m */; };
17E78A7E0D68BE3C005C5A59 /* file_tree.png in Resources */ = {isa = PBXBuildFile; fileRef = 17E78A7D0D68BE3C005C5A59 /* file_tree.png */; };
17E78B6A0D68C1E3005C5A59 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 17E78B680D68C1E3005C5A59 /* Preferences.xib */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
@ -47,8 +46,6 @@
17C643680B8A788000C53518 /* output.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = output.png; path = Icons/output.png; sourceTree = "<group>"; };
17C644310B8A791D00C53518 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
17E41DB50C130A9D00AC744D /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
17E78A790D68BE1E005C5A59 /* FileTreePane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileTreePane.h; sourceTree = "<group>"; };
17E78A7A0D68BE1E005C5A59 /* FileTreePane.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FileTreePane.m; sourceTree = "<group>"; };
17E78A7D0D68BE3C005C5A59 /* file_tree.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = file_tree.png; path = Icons/file_tree.png; sourceTree = "<group>"; };
17E78B690D68C1E3005C5A59 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Preferences.xib; sourceTree = "<group>"; };
32DBCF630370AF2F00C91783 /* General_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = General_Prefix.pch; sourceTree = "<group>"; };
@ -153,8 +150,6 @@
17D5033F0ABDB1570022D1E8 /* Panes */ = {
isa = PBXGroup;
children = (
17E78A790D68BE1E005C5A59 /* FileTreePane.h */,
17E78A7A0D68BE1E005C5A59 /* FileTreePane.m */,
8E07AA820AAC8EA200A4B32F /* PreferencePane.h */,
8E07AA830AAC8EA200A4B32F /* PreferencePane.m */,
8E07AA800AAC8EA200A4B32F /* HotKeyPane.h */,
@ -292,7 +287,6 @@
17C643380B8A77CC00C53518 /* OutputsArrayController.m in Sources */,
17C6433F0B8A783F00C53518 /* OutputPane.m in Sources */,
170744AD0BFF3938002475C9 /* AppcastArrayController.m in Sources */,
17E78A7B0D68BE1E005C5A59 /* FileTreePane.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -10,23 +10,22 @@
#import "SS_PreferencePaneProtocol.h"
#import "HotKeyPane.h"
#import "FileTreePane.h"
#import "OutputPane.h"
@interface PrefPaneController : NSObject <SS_PreferencePaneProtocol> {
IBOutlet HotKeyPane *hotKeyPane;
IBOutlet FileTreePane *fileTreePane;
IBOutlet OutputPane *outputPane;
IBOutlet NSView *fileTreeView;
IBOutlet NSView *scrobblerView;
IBOutlet NSView *remoteView;
IBOutlet NSView *updatesView;
}
- (HotKeyPane *)hotKeyPane;
- (FileTreePane *)fileTreePane;
- (OutputPane *)outputPane;
- (PreferencePane *)fileTreePane;
- (PreferencePane *)remotePane;
- (PreferencePane *)updatesPane;
- (PreferencePane *)scrobblerPane;

View File

@ -18,7 +18,14 @@
PrefPaneController *prefPaneController = [[PrefPaneController alloc] init];
loaded = [NSBundle loadNibNamed:@"Preferences" owner:prefPaneController];
return [NSArray arrayWithObjects: [prefPaneController hotKeyPane], [prefPaneController fileTreePane], [prefPaneController remotePane], [prefPaneController updatesPane], [prefPaneController outputPane], [prefPaneController scrobblerPane], nil];
return [NSArray arrayWithObjects:
[prefPaneController hotKeyPane],
[prefPaneController fileTreePane],
[prefPaneController remotePane],
[prefPaneController updatesPane],
[prefPaneController outputPane],
[prefPaneController scrobblerPane],
nil];
}
- (HotKeyPane *)hotKeyPane
@ -26,9 +33,9 @@
return hotKeyPane;
}
- (FileTreePane *)fileTreePane
- (PreferencePane *)fileTreePane
{
return fileTreePane;
return [PreferencePane preferencePaneWithView:fileTreeView name:NSLocalizedStringFromTableInBundle(@"File Tree", nil, [NSBundle bundleForClass:[self class]], @"") icon:@"file_tree"];
}
- (OutputPane *)outputPane