- if ([setHotKey isEqualToString:@"PlayPause"]) {
- if (([combo isEqual:nextTrackCombo] || [combo isEqual:prevTrackCombo] ||
- [combo isEqual:trackInfoCombo] || [combo isEqual:upcomingSongsCombo] ||
- [combo isEqual:ratingIncrementCombo] || [combo isEqual:ratingDecrementCombo] ||
- [combo isEqual:volumeIncrementCombo] || [combo isEqual:volumeDecrementCombo] ||
- [combo isEqual:toggleLoopCombo] || [combo isEqual:toggleShuffleCombo]) &&
- !(([combo modifiers] == -1) && ([combo keyCode] == -1))) {
-
- [window setLevel:NSNormalWindowLevel];
- NSRunAlertPanel(@"Duplicate Key Combo", @"Please choose a unique key combo.", @"OK", nil, nil, nil);
- [window setLevel:NSStatusWindowLevel];
- return;
+
+ ITDebugLog(@"Checking for duplicate hot keys.");
+ while ( (enumKey = [enumerator nextObject]) ) {
+ if (![enumKey isEqualToString:currentHotKey]) {
+ if (![combo isEqual:[ITKeyCombo clearKeyCombo]] &&
+ [combo isEqual:[hotKeysDictionary objectForKey:enumKey]]) {
+ [window setLevel:NSNormalWindowLevel];
+ ITDebugLog(@"Duplicate hot key found: %@", enumKey);
+ 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:[ITKeyCombo clearKeyCombo] forKey:currentHotKey];
+ if ([enumKey isEqualToString:@"PlayPause"]) {
+ [playPauseButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"NextTrack"]) {
+ [nextTrackButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"PrevTrack"]) {
+ [previousTrackButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"ShowPlayer"]) {
+ [showPlayerButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"TrackInfo"]) {
+ [trackInfoButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"UpcomingSongs"]) {
+ [upcomingSongsButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"IncrementVolume"]) {
+ [volumeIncrementButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"DecrementVolume"]) {
+ [volumeDecrementButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"IncrementRating"]) {
+ [ratingIncrementButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"DecrementRating"]) {
+ [ratingDecrementButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"ToggleShuffle"]) {
+ [toggleShuffleButton setTitle:@"(None)"];
+ } else if ([enumKey isEqualToString:@"ToggleLoop"]) {
+ [toggleLoopButton setTitle:@"(None)"];
+ }
+ ITDebugLog(@"Saved hot key named %@.", enumKey);
+ [df setObject:[[ITKeyCombo clearKeyCombo] plistRepresentation] forKey:enumKey];
+ [hotKeysDictionary setObject:[ITKeyCombo clearKeyCombo] forKey:enumKey];
+ } else {
+ return;
+ }
+ [window setLevel:NSStatusWindowLevel];
+ }