[self setupMenuItems]; // Setup the arrays of menu items
[self setupUI]; // Sets up additional UI
[window setDelegate:self];
[self setupMenuItems]; // Setup the arrays of menu items
[self setupUI]; // Sets up additional UI
[window setDelegate:self];
if ( [sender tag] == 1010) {
[self setLaunchesAtLogin:SENDER_STATE];
} else if ( [sender tag] == 1020) {
[df setBool:SENDER_STATE forKey:@"LaunchPlayerWithMT"];
} else if ( [sender tag] == 1030) {
[df setInteger:[sender intValue] forKey:@"SongsInAdvance"];
if ( [sender tag] == 1010) {
[self setLaunchesAtLogin:SENDER_STATE];
} else if ( [sender tag] == 1020) {
[df setBool:SENDER_STATE forKey:@"LaunchPlayerWithMT"];
} else if ( [sender tag] == 1030) {
[df setInteger:[sender intValue] forKey:@"SongsInAdvance"];
} else if ( [sender tag] == 1040) {
// This will not be executed. Song info always shows the title of the song.
// [df setBool:SENDER_STATE forKey:@"showName"];
} else if ( [sender tag] == 1040) {
// This will not be executed. Song info always shows the title of the song.
// [df setBool:SENDER_STATE forKey:@"showName"];
- [self setKeyCombo:[hotKeysDictionary objectForKey:@"ToggleVisualizer"]];
- [self setCurrentHotKey:@"ToggleVisualizer"];
+ [self setKeyCombo:[hotKeysDictionary objectForKey:@"ShowPlayer"]];
+ [self setCurrentHotKey:@"ShowPlayer"];
- if (NSRunInformationalAlertPanel(@"Auto-launch MenuTunes", @"Would you like MenuTunes to automatically launch at login?", @"Yes", @"No", nil) == NSOKButton) {
+ if (NSRunInformationalAlertPanel(NSLocalizedString(@"autolaunch", @"Auto-launch MenuTunes"), NSLocalizedString(@"autolaunch_msg", @"Would you like MenuTunes to automatically launch at login?"), @"Yes", @"No", nil) == NSOKButton) {
AEDesc scriptDesc, resultDesc;
NSString *script = [NSString stringWithFormat:@"tell application \"System Events\"\nmake new login item at end of login items with properties {path:\"%@\", kind:\"APPLICATION\"}\nend tell", [[NSBundle mainBundle] bundlePath]];
ComponentInstance asComponent = OpenDefaultComponent(kOSAComponentType, kAppleScriptSubtype);
AEDesc scriptDesc, resultDesc;
NSString *script = [NSString stringWithFormat:@"tell application \"System Events\"\nmake new login item at end of login items with properties {path:\"%@\", kind:\"APPLICATION\"}\nend tell", [[NSBundle mainBundle] bundlePath]];
ComponentInstance asComponent = OpenDefaultComponent(kOSAComponentType, kAppleScriptSubtype);
if (![combo isEqual:[KeyCombo clearKeyCombo]] &&
[combo isEqual:[hotKeysDictionary objectForKey:enumKey]]) {
[window setLevel:NSNormalWindowLevel];
if (![combo isEqual:[KeyCombo clearKeyCombo]] &&
[combo isEqual:[hotKeysDictionary objectForKey:enumKey]]) {
[window setLevel:NSNormalWindowLevel];
- if ( NSRunAlertPanel(@"Duplicate Key Combo", @"The specified key combo is already in use...", @"Replace", @"Cancel", nil) ) {
+ if ( NSRunAlertPanel(NSLocalizedString(@"duplicateCombo", @"Duplicate Key Combo") , NSLocalizedString(@"duplicateCombo_msg", @"The specified key combo is already in use..."), NSLocalizedString(@"replace", @"Replace"), NSLocalizedString(@"cancel", @"Cancel"), nil) ) {
[hotKeysDictionary setObject:[KeyCombo clearKeyCombo] forKey:currentHotKey];
if ([enumKey isEqualToString:@"PlayPause"]) {
[playPauseButton setTitle:@""];
[hotKeysDictionary setObject:[KeyCombo clearKeyCombo] forKey:currentHotKey];
if ([enumKey isEqualToString:@"PlayPause"]) {
[playPauseButton setTitle:@""];
[nextTrackButton setTitle:@""];
} else if ([enumKey isEqualToString:@"PrevTrack"]) {
[previousTrackButton setTitle:@""];
[nextTrackButton setTitle:@""];
} else if ([enumKey isEqualToString:@"PrevTrack"]) {
[previousTrackButton setTitle:@""];
} else if ([enumKey isEqualToString:@"TrackInfo"]) {
[trackInfoButton setTitle:@""];
} else if ([enumKey isEqualToString:@"UpcomingSongs"]) {
} else if ([enumKey isEqualToString:@"TrackInfo"]) {
[trackInfoButton setTitle:@""];
} else if ([enumKey isEqualToString:@"UpcomingSongs"]) {
- [[HotKeyCenter sharedCenter] addHotKey:@"PrevTrack" combo:combo target:[MainController sharedController] action:@selector(prevSong)];
- } else if ([currentHotKey isEqualToString:@"ToggleVisualizer"]) {
- [visualizerButton setTitle:string];
- //[[HotKeyCenter sharedCenter] addHotKey:@"ToggleVisualizer" combo:combo target:[MainController sharedController] selector:@selector(NULL)];
+ //[[HotKeyCenter sharedCenter] addHotKey:@"PrevTrack" combo:combo target:[MainController sharedController] action:@selector(prevSong)];
+ } else if ([currentHotKey isEqualToString:@"ShowPlayer"]) {
+ [showPlayerButton setTitle:string];
+ //[[HotKeyCenter sharedCenter] addHotKey:@"ShowPlayer" combo:combo target:[MainController sharedController] action:@selector(showPlayer)];
} else if ([currentHotKey isEqualToString:@"UpcomingSongs"]) {
[upcomingSongsButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"UpcomingSongs"]) {
[upcomingSongsButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"IncrementVolume"]) {
[volumeIncrementButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"IncrementVolume"]) {
[volumeIncrementButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"DecrementVolume"]) {
[volumeDecrementButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"DecrementVolume"]) {
[volumeDecrementButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"IncrementRating"]) {
[ratingIncrementButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"IncrementRating"]) {
[ratingIncrementButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"DecrementRating"]) {
[ratingDecrementButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"DecrementRating"]) {
[ratingDecrementButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"ToggleShuffle"]) {
[toggleShuffleButton setTitle:string];
} else if ([currentHotKey isEqualToString:@"ToggleShuffle"]) {
[toggleShuffleButton setTitle:string];
- if ( ! [NSBundle loadNibNamed:@"Preferences" owner:self] ) {
- NSLog( @"Failed to load Preferences.nib" );
+ if (![NSBundle loadNibNamed:@"Preferences" owner:self]) {
+ NSLog(@"MenuTunes: Failed to load Preferences.nib");
// Delete items in the availableItems array that are already part of the menu
itemEnum = [myItems objectEnumerator];
while ( (anItem = [itemEnum nextObject]) ) {
// Delete items in the availableItems array that are already part of the menu
itemEnum = [myItems objectEnumerator];
while ( (anItem = [itemEnum nextObject]) ) {
[availableItems removeObject:anItem];
}
}
// Items that show should a submenu image
submenuItems = [[NSArray alloc] initWithObjects:
[availableItems removeObject:anItem];
}
}
// Items that show should a submenu image
submenuItems = [[NSArray alloc] initWithObjects:
anItem = [df keyComboForKey:@"PlayPause"];
[hotKeysDictionary setObject:anItem forKey:@"PlayPause"];
[playPauseButton setTitle:[anItem userDisplayRep]];
anItem = [df keyComboForKey:@"PlayPause"];
[hotKeysDictionary setObject:anItem forKey:@"PlayPause"];
[playPauseButton setTitle:[anItem userDisplayRep]];
- if ([df objectForKey:@"ToggleVisualizer"]) {
- anItem = [df keyComboForKey:@"ToggleVisualizer"];
- [hotKeysDictionary setObject:anItem forKey:@"ToggleVisualizer"];
- [visualizerButton setTitle:[anItem userDisplayRep]];
+ if ([df objectForKey:@"ShowPlayer"]) {
+ anItem = [df keyComboForKey:@"ShowPlayer"];
+ [hotKeysDictionary setObject:anItem forKey:@"ShowPlayer"];
+ [showPlayerButton setTitle:[anItem userDisplayRep]];
[nameCheckbox setEnabled:NO]; // Song info will ALWAYS show song title.
[artistCheckbox setState:[df boolForKey:@"showArtist"] ? NSOnState : NSOffState];
[trackTimeCheckbox setState:[df boolForKey:@"showTime"] ? NSOnState : NSOffState];
[nameCheckbox setEnabled:NO]; // Song info will ALWAYS show song title.
[artistCheckbox setState:[df boolForKey:@"showArtist"] ? NSOnState : NSOffState];
[trackTimeCheckbox setState:[df boolForKey:@"showTime"] ? NSOnState : NSOffState];
if ([[aTableColumn identifier] isEqualToString:@"name"]) {
NSString *object = [myItems objectAtIndex:rowIndex];
if ([object isEqualToString:@"Show Player"]) {
if ([[aTableColumn identifier] isEqualToString:@"name"]) {
NSString *object = [myItems objectAtIndex:rowIndex];
if ([object isEqualToString:@"Show Player"]) {
- return [NSString stringWithFormat:@"Show %@", [[controller currentRemote] playerSimpleName]];
+ return [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"show", @"Show"), [[controller currentRemote] playerSimpleName]];
} else {
if ([submenuItems containsObject:[availableItems objectAtIndex:rowIndex]]) {
return [NSImage imageNamed:@"submenu"];
} else {
if ([submenuItems containsObject:[availableItems objectAtIndex:rowIndex]]) {
return [NSImage imageNamed:@"submenu"];
dragData = [pb stringForType:@"MenuTableViewPboardType"];
dragRow = [dragData intValue];
temp = [myItems objectAtIndex:dragRow];
dragData = [pb stringForType:@"MenuTableViewPboardType"];
dragRow = [dragData intValue];
temp = [myItems objectAtIndex:dragRow];
}
} else if ([[pb types] containsObject:@"AllTableViewPboardType"]) {
dragData = [pb stringForType:@"AllTableViewPboardType"];
dragRow = [dragData intValue];
temp = [availableItems objectAtIndex:dragRow];
}
} else if ([[pb types] containsObject:@"AllTableViewPboardType"]) {
dragData = [pb stringForType:@"AllTableViewPboardType"];
dragRow = [dragData intValue];
temp = [availableItems objectAtIndex:dragRow];