- //Set the list of items you can have.
- availableItems = [[NSMutableArray alloc] initWithObjects:@"Current Track Info", @"Upcoming Songs", @"Playlists", @"EQ Presets", @"Play/Pause", @"Next Track", @"Previous Track", @"Fast Forward", @"Rewind", @"<separator>", nil];
-
- //Get our preferred menu
- myItems = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"menu"] mutableCopy];
+ [self setupWindow]; // Load in the nib, and perform any initial setup.
+ [[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
+ }
+ return self;
+}
+
+
+/*************************************************************************/
+#pragma mark -
+#pragma mark ACCESSOR METHODS
+/*************************************************************************/
+
+- (id)controller
+{
+ return controller;
+}
+
+- (void)setController:(id)object
+{
+ [controller autorelease];
+ controller = [object retain];
+}
+
+
+/*************************************************************************/
+#pragma mark -
+#pragma mark INSTANCE METHODS
+/*************************************************************************/
+
+- (BOOL)showPasswordPanel
+{
+ [passwordPanel setLevel:NSStatusWindowLevel];
+ [passwordPanelOKButton setTitle:@"Connect"];
+ [passwordPanelTitle setStringValue:@"Password Required"];
+ [passwordPanelMessage setStringValue:[NSString stringWithFormat:@"Please enter a password for access to the MenuTunes player named %@ at %@.", [[[NetworkController sharedController] networkObject] serverName], [[NetworkController sharedController] remoteHost]]];
+ [passwordPanel setLevel:NSStatusWindowLevel];
+ [NSApp activateIgnoringOtherApps:YES];
+ [passwordPanel center];
+ [passwordPanel orderFrontRegardless];
+ [passwordPanel makeKeyWindow];
+ if ([NSApp runModalForWindow:passwordPanel]) {
+ return YES;
+ } else {
+ return NO;
+ }
+}
+
+- (BOOL)showInvalidPasswordPanel
+{
+ [passwordPanel setLevel:NSStatusWindowLevel];
+ [passwordPanelOKButton setTitle:@"Retry"];
+ [passwordPanelTitle setStringValue:@"Invalid Password"];
+ [passwordPanelMessage setStringValue:[NSString stringWithFormat:@"The password entered for access to the MenuTunes player named %@ at %@ is invalid. Please provide a new password.", [[[NetworkController sharedController] networkObject] serverName], [[NetworkController sharedController] remoteHost]]];
+ [passwordPanel setLevel:NSStatusWindowLevel];
+ [NSApp activateIgnoringOtherApps:YES];
+ [passwordPanel center];
+ [passwordPanel orderFrontRegardless];
+ [passwordPanel makeKeyWindow];
+ if ([NSApp runModalForWindow:passwordPanel]) {
+ return YES;
+ } else {
+ return NO;
+ }
+}
+
+- (IBAction)showPrefsWindow:(id)sender
+{
+ ITDebugLog(@"Showing preferences window.");
+ if (!myItems) { // If menu array does not exist yet, then the window hasn't been setup.
+ ITDebugLog(@"Window doesn't exist, initial setup.");
+ [self setupCustomizationTables]; // Setup the DnD manu config tables.
+ [self setupMenuItems]; // Setup the arrays of menu items
+ [self setupUI]; // Sets up additional UI
+ [window setDelegate:self];
+ [menuTableView reloadData];
+ [hotKeysTableView setDoubleAction:@selector(hotKeysTableViewDoubleClicked:)];