- NSString *string = [combo userDisplayRep];
-
- if (string == nil) {
- string = @"";
- }
- 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;
- }
- playPauseCombo = [combo copy];
- [playPauseButton setTitle:string];
- } else if ([setHotKey isEqualToString:@"NextTrack"]) {
- if (([combo isEqual:playPauseCombo] || [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;
- }
- nextTrackCombo = [combo copy];
- [nextTrackButton setTitle:string];
- } else if ([setHotKey isEqualToString:@"PrevTrack"]) {
- if (([combo isEqual:nextTrackCombo] || [combo isEqual:playPauseCombo] ||
- [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;
- }
- prevTrackCombo = [combo copy];
- [previousTrackButton setTitle:string];
- } else if ([setHotKey isEqualToString:@"TrackInfo"]) {
- if (([combo isEqual:nextTrackCombo] || [combo isEqual:prevTrackCombo] ||
- [combo isEqual:playPauseCombo] || [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;
- }
- trackInfoCombo = [combo copy];
- [trackInfoButton setTitle:string];
- } else if ([setHotKey isEqualToString:@"UpcomingSongs"]) {
- if (([combo isEqual:nextTrackCombo] || [combo isEqual:prevTrackCombo] ||
- [combo isEqual:trackInfoCombo] || [combo isEqual:playPauseCombo] ||
- [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;
- }
- upcomingSongsCombo = [combo copy];
- [upcomingSongsButton setTitle:string];
- //THE NEW COMBOS!
- } else if ([setHotKey isEqualToString:@"IncrementVolume"]) {
- if (([combo isEqual:nextTrackCombo] || [combo isEqual:prevTrackCombo] ||
- [combo isEqual:trackInfoCombo] || [combo isEqual:playPauseCombo] ||
- [combo isEqual:ratingIncrementCombo] || [combo isEqual:ratingDecrementCombo] ||
- [combo isEqual:upcomingSongsCombo] || [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;
- }
- volumeIncrementCombo = [combo copy];
- [volumeIncrementButton setTitle:string];
- } else if ([setHotKey isEqualToString:@"DecrementVolume"]) {
- if (([combo isEqual:nextTrackCombo] || [combo isEqual:prevTrackCombo] ||
- [combo isEqual:trackInfoCombo] || [combo isEqual:playPauseCombo] ||
- [combo isEqual:ratingIncrementCombo] || [combo isEqual:ratingDecrementCombo] ||
- [combo isEqual:volumeIncrementCombo] || [combo isEqual:upcomingSongsCombo] ||
- [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;
- }
- volumeDecrementCombo = [combo copy];
- [volumeDecrementButton setTitle:string];
- } else if ([setHotKey isEqualToString:@"IncrementRating"]) {
- if (([combo isEqual:nextTrackCombo] || [combo isEqual:prevTrackCombo] ||
- [combo isEqual:trackInfoCombo] || [combo isEqual:playPauseCombo] ||
- [combo isEqual:upcomingSongsCombo] || [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;
- }
- ratingIncrementCombo = [combo copy];
- [ratingIncrementButton setTitle:string];
- } else if ([setHotKey isEqualToString:@"DecrementRating"]) {
- if (([combo isEqual:nextTrackCombo] || [combo isEqual:prevTrackCombo] ||
- [combo isEqual:trackInfoCombo] || [combo isEqual:playPauseCombo] ||
- [combo isEqual:ratingIncrementCombo] || [combo isEqual:upcomingSongsCombo] ||
- [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;
- }
- ratingDecrementCombo = [combo copy];
- [ratingDecrementButton setTitle:string];
- } else if ([setHotKey isEqualToString:@"ToggleLoop"]) {
- if (([combo isEqual:nextTrackCombo] || [combo isEqual:prevTrackCombo] ||
- [combo isEqual:trackInfoCombo] || [combo isEqual:playPauseCombo] ||
- [combo isEqual:ratingIncrementCombo] || [combo isEqual:ratingDecrementCombo] ||
- [combo isEqual:volumeIncrementCombo] || [combo isEqual:volumeDecrementCombo] ||
- [combo isEqual:upcomingSongsCombo] || [combo isEqual:toggleShuffleCombo]) &&
- !(([combo modifiers] == -1) && ([combo keyCode] == -1))) {