Commit add20a10 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx/eyetv: simplify header and implementation

parent 746edb20
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
BOOL b_eyeTVactive; BOOL b_eyeTVactive;
BOOL b_deviceConnected; BOOL b_deviceConnected;
} }
@property (readonly) BOOL eyeTVRunning;
@property (readonly) BOOL deviceConnected;
@property (readwrite) int channel;
- (void)globalNotificationReceived: (NSNotification *)theNotification; - (void)globalNotificationReceived: (NSNotification *)theNotification;
- (BOOL)isEyeTVrunning;
- (BOOL)isDeviceConnected;
- (void)launchEyeTV; - (void)launchEyeTV;
- (int)currentChannel;
- (int)switchChannelUp:(BOOL)b_yesOrNo; - (int)switchChannelUp:(BOOL)b_yesOrNo;
- (void)selectChannel:(int)theChannelNum;
- (NSEnumerator *)allChannels; - (NSEnumerator *)allChannels;
@end @end
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
@implementation VLCEyeTVController @implementation VLCEyeTVController
@synthesize eyeTVRunning = b_eyeTVactive, deviceConnected = b_deviceConnected;
static VLCEyeTVController *_o_sharedInstance = nil; static VLCEyeTVController *_o_sharedInstance = nil;
+ (VLCEyeTVController *)sharedInstance + (VLCEyeTVController *)sharedInstance
...@@ -70,17 +72,6 @@ static VLCEyeTVController *_o_sharedInstance = nil; ...@@ -70,17 +72,6 @@ static VLCEyeTVController *_o_sharedInstance = nil;
b_eyeTVactive = NO; b_eyeTVactive = NO;
} }
- (BOOL)isEyeTVrunning
{
return b_eyeTVactive;
}
- (BOOL)isDeviceConnected
{
return b_deviceConnected;
}
- (void)launchEyeTV - (void)launchEyeTV
{ {
NSAppleScript *script = [[NSAppleScript alloc] initWithSource: NSAppleScript *script = [[NSAppleScript alloc] initWithSource:
...@@ -97,7 +88,7 @@ static VLCEyeTVController *_o_sharedInstance = nil; ...@@ -97,7 +88,7 @@ static VLCEyeTVController *_o_sharedInstance = nil;
[script release]; [script release];
} }
- (int)currentChannel - (int)channel
{ {
int currentChannel = 0; int currentChannel = 0;
NSAppleScript *script = [[NSAppleScript alloc] initWithSource: NSAppleScript *script = [[NSAppleScript alloc] initWithSource:
...@@ -108,11 +99,8 @@ static VLCEyeTVController *_o_sharedInstance = nil; ...@@ -108,11 +99,8 @@ static VLCEyeTVController *_o_sharedInstance = nil;
{ {
NSString *errorString = [errorDict objectForKey:NSAppleScriptErrorMessage]; NSString *errorString = [errorDict objectForKey:NSAppleScriptErrorMessage];
NSLog( @"EyeTV channel inventory failed with error status '%@'", errorString ); NSLog( @"EyeTV channel inventory failed with error status '%@'", errorString );
} } else
else
{
currentChannel = (int)[descriptor int32Value]; currentChannel = (int)[descriptor int32Value];
}
[script release]; [script release];
return currentChannel; return currentChannel;
} }
...@@ -157,7 +145,7 @@ static VLCEyeTVController *_o_sharedInstance = nil; ...@@ -157,7 +145,7 @@ static VLCEyeTVController *_o_sharedInstance = nil;
return currentChannel; return currentChannel;
} }
- (void)selectChannel: (int)theChannelNum - (void)setChannel: (int)theChannelNum
{ {
NSAppleScript *script; NSAppleScript *script;
switch( theChannelNum ) switch( theChannelNum )
......
...@@ -1346,9 +1346,9 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1346,9 +1346,9 @@ static VLCOpen *_o_sharedMainInstance = nil;
{ {
if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: @"EyeTV"] ) if( [[[o_capture_mode_pop selectedItem] title] isEqualToString: @"EyeTV"] )
{ {
if( [[[VLCMain sharedInstance] eyeTVController] isEyeTVrunning] == YES ) if( [[[VLCMain sharedInstance] eyeTVController] eyeTVRunning] == YES )
{ {
if( [[[VLCMain sharedInstance] eyeTVController] isDeviceConnected] == YES ) if( [[[VLCMain sharedInstance] eyeTVController] deviceConnected] == YES )
{ {
[self showCaptureView: o_eyetv_running_view]; [self showCaptureView: o_eyetv_running_view];
[self setupChannelInfo]; [self setupChannelInfo];
...@@ -1458,7 +1458,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1458,7 +1458,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
else if( sender == o_eyetv_channels_pop ) else if( sender == o_eyetv_channels_pop )
{ {
int chanNum = [[sender selectedItem] tag]; int chanNum = [[sender selectedItem] tag];
[[[VLCMain sharedInstance] eyeTVController] selectChannel:chanNum]; [[[VLCMain sharedInstance] eyeTVController] setChannel:chanNum];
[self setMRL: [NSString stringWithFormat:@"eyetv:// :eyetv-channel=%d", chanNum]]; [self setMRL: [NSString stringWithFormat:@"eyetv:// :eyetv-channel=%d", chanNum]];
} }
else else
...@@ -1536,7 +1536,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1536,7 +1536,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
keyEquivalent: @""] setTag:++x]; keyEquivalent: @""] setTag:++x];
} }
/* make Tuner the default */ /* make Tuner the default */
[o_eyetv_channels_pop selectItemWithTag:[[[VLCMain sharedInstance] eyeTVController] currentChannel]]; [o_eyetv_channels_pop selectItemWithTag:[[[VLCMain sharedInstance] eyeTVController] channel]];
} }
/* clean up GUI */ /* clean up GUI */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment