-/*
-Things to do:
-¥ Make preferences window pretty
-¥ Optimize
-¥ Apple Events! Apple Events! Apple Events!
-¥ Manual and webpage
-¥ Finish up registration frontend
-*/
-
#import "MenuTunes.h"
#import "PreferencesController.h"
#import "HotKeyCenter.h"
menu = [[NSMenu alloc] initWithTitle:@""];
- if ([currentRemote isAppRunning]) {
+ if ( ( [currentRemote playerRunningStatus] == ITMTRemotePlayerRunning ) ) {
[self remotePlayerLaunched:nil];
} else {
[self remotePlayerTerminated:nil];
NSMenuItem *menuItem;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- if (!isAppRunning) {
+ if ( ( isAppRunning == ITMTRemotePlayerNotRunning ) ) {
return;
}
if (eqItem) {
[self rebuildEQPresetsMenu];
}
-
if (trackInfoIndex > -1) {
NSString *curSongName, *curAlbumName = @"", *curArtistName = @"";
curSongName = [currentRemote currentSongTitle];
}
[eqItem setSubmenu:eqMenu];
- [[eqMenu itemAtIndex:[currentRemote currentEQPresetIndex] - 1] setState:NSOnState];
+ [[eqMenu itemAtIndex:[currentRemote currentEQPresetIndex] + 1] setState:NSOnState];
}
- (void)clearHotKeys
int playlist = [currentRemote currentPlaylistIndex];
ITMTRemotePlayerState playerState = [currentRemote playerState];
- if ((playlist > 0) || playerState != stopped) {
+ if ((playlist > 0) || playerState != ITMTRemotePlayerStopped) {
int trackPlayingIndex = [currentRemote currentSongIndex];
if (trackPlayingIndex != lastSongIndex) {
}
//Update Play/Pause menu item
if (playPauseMenuItem){
- if (playerState == playing) {
+ if (playerState == ITMTRemotePlayerPlaying) {
[playPauseMenuItem setTitle:@"Pause"];
} else {
[playPauseMenuItem setTitle:@"Play"];
- (void)remotePlayerLaunched:(NSNotification *)note
{
- isAppRunning = YES;
+ isAppRunning = ITMTRemotePlayerRunning;
//Restart the timer
- refreshTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(timerUpdate) userInfo:nil repeats:YES];
+ refreshTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(timerUpdate) userInfo:nil repeats:YES];
[self rebuildMenu]; //Rebuild the menu since no songs will be playing
- [self rebuildPlaylistMenu];
+ if (playlistItem) {
+ [self rebuildPlaylistMenu];
+ }
+ if (eqItem) {
+ [self rebuildEQPresetsMenu];
+ }
[statusItem setMenu:menu]; //Set the menu back to the main one
}
- (void)remotePlayerTerminated:(NSNotification *)note
{
- isAppRunning = NO;
+ isAppRunning = ITMTRemotePlayerNotRunning;
[menu release];
menu = [[NSMenu alloc] initWithTitle:@""];
{
ITMTRemotePlayerState state = [currentRemote playerState];
- if (state == playing) {
+ if (state == ITMTRemotePlayerPlaying) {
[currentRemote pause];
[playPauseMenuItem setTitle:@"Play"];
- } else if ((state == forwarding) || (state == rewinding)) {
+ } else if ((state == ITMTRemotePlayerForwarding) || (state == ITMTRemotePlayerRewinding)) {
[currentRemote pause];
[currentRemote play];
} else {
- (void)fastForward:(id)sender
{
- [currentRemote fastForward];
+ [currentRemote forward];
[playPauseMenuItem setTitle:@"Play"];
}
- (void)closePreferences
{
- if (isAppRunning) {
+ if ( ( isAppRunning == ITMTRemotePlayerRunning) ) {
[self setupHotKeys];
}
[prefsController release];