git.ithinksw.org
/
MenuTunes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More bugfixes to networking. Small fix in Preferences. Show Player app launch is...
[MenuTunes.git]
/
MainController.m
diff --git
a/MainController.m
b/MainController.m
index
9d2e3cc
..
c4fd253
100755
(executable)
--- a/
MainController.m
+++ b/
MainController.m
@@
-334,10
+334,6
@@
static MainController *sharedController;
- (void)timerUpdate
{
- (void)timerUpdate
{
- if ([networkController isConnectedToServer]) {
- [statusItem setMenu:[menuController menu]];
- }
-
if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) {
ITDebugLog(@"The song changed.");
if ( [self songChanged] && (timerUpdating != YES) && (playerRunningState == ITMTRemotePlayerRunning) ) {
ITDebugLog(@"The song changed.");
@@
-358,6
+354,7
@@
static MainController *sharedController;
}
timerUpdating = YES;
}
timerUpdating = YES;
+ [statusItem setEnabled:NO];
NS_DURING
latestPlaylistClass = [[self currentRemote] currentPlaylistClass];
NS_DURING
latestPlaylistClass = [[self currentRemote] currentPlaylistClass];
@@
-391,6
+388,11
@@
static MainController *sharedController;
NS_ENDHANDLER
timerUpdating = NO;
NS_ENDHANDLER
timerUpdating = NO;
+ [statusItem setEnabled:YES];
+ }
+
+ if ([networkController isConnectedToServer]) {
+ [statusItem setMenu:([[self currentRemote] playerRunningState] == ITMTRemotePlayerRunning) ? [menuController menu] : [menuController menuForNoPlayer]];
}
}
}
}
@@
-531,14
+533,14
@@
static MainController *sharedController;
- (void)showPlayer
{
ITDebugLog(@"Beginning show player.");
- (void)showPlayer
{
ITDebugLog(@"Beginning show player.");
- if ( ( playerRunningState == ITMTRemotePlayerRunning) ) {
+
//
if ( ( playerRunningState == ITMTRemotePlayerRunning) ) {
ITDebugLog(@"Showing player interface.");
NS_DURING
[[self currentRemote] showPrimaryInterface];
NS_HANDLER
[self networkError:localException];
NS_ENDHANDLER
ITDebugLog(@"Showing player interface.");
NS_DURING
[[self currentRemote] showPrimaryInterface];
NS_HANDLER
[self networkError:localException];
NS_ENDHANDLER
- } else {
+
/*
} else {
ITDebugLog(@"Launching player.");
NS_DURING
NSString *path;
ITDebugLog(@"Launching player.");
NS_DURING
NSString *path;
@@
-552,7
+554,7
@@
static MainController *sharedController;
NS_HANDLER
[self networkError:localException];
NS_ENDHANDLER
NS_HANDLER
[self networkError:localException];
NS_ENDHANDLER
- }
+ }
*/
ITDebugLog(@"Finished show player.");
}
ITDebugLog(@"Finished show player.");
}
@@
-1089,6
+1091,11
@@
static MainController *sharedController;
if (result == 1) {
[[PreferencesController sharedPrefs] resetRemotePlayerTextFields];
currentRemote = [[[networkController networkObject] remote] retain];
if (result == 1) {
[[PreferencesController sharedPrefs] resetRemotePlayerTextFields];
currentRemote = [[[networkController networkObject] remote] retain];
+
+ [self setupHotKeys];
+ //playerRunningState = ITMTRemotePlayerRunning;
+ playerRunningState = [[self currentRemote] playerRunningState];
+
[refreshTimer invalidate];
refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:([networkController isConnectedToServer] ? 10.0 : 0.5)
target:self
[refreshTimer invalidate];
refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:([networkController isConnectedToServer] ? 10.0 : 0.5)
target:self
@@
-1117,6
+1124,12
@@
static MainController *sharedController;
[currentRemote release];
currentRemote = [remoteArray objectAtIndex:0];
[networkController disconnect];
[currentRemote release];
currentRemote = [remoteArray objectAtIndex:0];
[networkController disconnect];
+
+ if ([[self currentRemote] playerRunningState] == ITMTRemotePlayerRunning) {
+ [self applicationLaunched:nil];
+ } else {
+ [self applicationTerminated:nil];
+ }
[self timerUpdate];
return YES;
}
[self timerUpdate];
return YES;
}
@@
-1174,7
+1187,7
@@
static MainController *sharedController;
- (void)applicationLaunched:(NSNotification *)note
{
NS_DURING
- (void)applicationLaunched:(NSNotification *)note
{
NS_DURING
- if (!note ||
[[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]]
) {
+ if (!note ||
([[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]] && ![[NetworkController sharedController] isConnectedToServer])
) {
ITDebugLog(@"Remote application launched.");
playerRunningState = ITMTRemotePlayerRunning;
[[self currentRemote] begin];
ITDebugLog(@"Remote application launched.");
playerRunningState = ITMTRemotePlayerRunning;
[[self currentRemote] begin];
@@
-1196,7
+1209,7
@@
static MainController *sharedController;
- (void)applicationTerminated:(NSNotification *)note
{
NS_DURING
- (void)applicationTerminated:(NSNotification *)note
{
NS_DURING
- if (!note || [[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]]) {
+ if (!note || [[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[[self currentRemote] playerFullName]]
&& ![[NetworkController sharedController] isConnectedToServer]
) {
ITDebugLog(@"Remote application terminated.");
playerRunningState = ITMTRemotePlayerNotRunning;
[[self currentRemote] halt];
ITDebugLog(@"Remote application terminated.");
playerRunningState = ITMTRemotePlayerNotRunning;
[[self currentRemote] halt];