macosx: white space and minor coding style fixes

This commit is contained in:
Felix Paul Kühne 2012-11-15 19:45:00 +01:00
parent 94d4f4a69c
commit 2974427561
9 changed files with 150 additions and 162 deletions

View File

@ -49,12 +49,9 @@
IBOutlet id o_progress_bar;
IBOutlet id o_time_fld;
IBOutlet id o_fullscreen_btn;
IBOutlet id o_resize_view;
NSImage * o_pause_img;
NSImage * o_pause_pressed_img;
NSImage * o_play_img;
@ -67,7 +64,7 @@
BOOL b_nativeFullscreenMode;
BOOL b_dark_interface;
}
@property (readonly) id bottomBarView;

View File

@ -52,26 +52,23 @@
[o_play_btn setToolTip: _NS("Play/Pause")];
[[o_play_btn cell] accessibilitySetOverrideValue:_NS("Click to play or pause the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_play_btn cell] accessibilitySetOverrideValue:[o_play_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_bwd_btn setToolTip: _NS("Backward")];
[[o_bwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item. Hold to skip backward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_bwd_btn cell] accessibilitySetOverrideValue:[o_bwd_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_fwd_btn setToolTip: _NS("Forward")];
[[o_fwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item. Hold to skip forward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_fwd_btn cell] accessibilitySetOverrideValue:[o_fwd_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_time_sld setToolTip: _NS("Position")];
[[o_time_sld cell] accessibilitySetOverrideValue:_NS("Click and move the mouse while keeping the button pressed to use this slider to change current playback position.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_time_sld cell] accessibilitySetOverrideValue:[o_time_sld toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_fullscreen_btn setToolTip: _NS("Toggle Fullscreen mode")];
[[o_fullscreen_btn cell] accessibilitySetOverrideValue:_NS("Click to enable fullscreen video playback.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_fullscreen_btn cell] accessibilitySetOverrideValue:[o_fullscreen_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
if (!b_dark_interface) {
[o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottom-background"] middle: [NSImage imageNamed:@"bottom-background"] right: [NSImage imageNamed:@"bottom-background"]];
@ -83,13 +80,12 @@
o_pause_pressed_img = [[NSImage imageNamed:@"pause-pressed"] retain];
[o_fwd_btn setImage: [NSImage imageNamed:@"forward-3btns"]];
[o_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-3btns-pressed"]];
[o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle"] right: [NSImage imageNamed:@"progression-track-wrapper-right"]];
[o_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progression-fill-left"] middle:[NSImage imageNamed:@"progression-fill-middle"] right:[NSImage imageNamed:@"progression-fill-right"]];
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-one-button"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-one-button-pressed"]];
} else {
[o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottomdark-left"] middle: [NSImage imageNamed:@"bottom-background_dark"] right: [NSImage imageNamed:@"bottomdark-right"]];
@ -107,7 +103,6 @@
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-one-button-pressed_dark"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-one-button-pressed_dark"]];
}
[o_play_btn setImage: o_play_img];
@ -304,14 +299,12 @@
[o_time_sld_fancygradient_view setHidden: NO];
[o_time_sld_fancygradient_view setFrame: NSMakeRect(oldFrame.origin.x, oldFrame.origin.y, f_value, oldFrame.size.height)];
}
} else {
NSRect frame;
frame = [o_time_sld_fancygradient_view frame];
if (frame.size.width > 0) {
frame.size.width = 0;
[o_time_sld_fancygradient_view setFrame: frame];
}
[o_time_sld_fancygradient_view setHidden: YES];
}
@ -339,7 +332,7 @@
/* chapters & titles */
//FIXME! b_chapters = p_input->stream.i_area_nb > 1;
vlc_object_release(p_input);
}
@ -385,7 +378,6 @@
[[o_stop_btn cell] accessibilitySetOverrideValue:_NS("Click to stop playback.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_stop_btn cell] accessibilitySetOverrideValue:[o_stop_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_playlist_btn setToolTip: _NS("Show/Hide Playlist")];
[[o_playlist_btn cell] accessibilitySetOverrideValue:_NS("Click to switch between video output and playlist. If no video is shown in the main window, this allows you to hide the playlist.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_playlist_btn cell] accessibilitySetOverrideValue:[o_playlist_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
@ -407,7 +399,7 @@
[o_volume_up_btn setToolTip: _NS("Full Volume")];
[[o_volume_up_btn cell] accessibilitySetOverrideValue:_NS("Click to play the audio at maximum volume.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_volume_up_btn cell] accessibilitySetOverrideValue:[o_volume_up_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_effects_btn setToolTip: _NS("Effects")];
[[o_effects_btn cell] accessibilitySetOverrideValue:_NS("Click to show an Audio Effects panel featuring an equalizer and further filters.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_effects_btn cell] accessibilitySetOverrideValue:[o_effects_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
@ -432,7 +424,7 @@
[o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low"]];
[o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track"]];
[o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high"]];
if (b_nativeFullscreenMode) {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-one-button"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-one-button-pressed"]];
@ -443,11 +435,10 @@
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed"]];
} else {
[o_stop_btn setImage: [NSImage imageNamed:@"stop_dark"]];
[o_stop_btn setAlternateImage: [NSImage imageNamed:@"stop-pressed_dark"]];
[o_playlist_btn setImage: [NSImage imageNamed:@"playlist_dark"]];
[o_playlist_btn setAlternateImage: [NSImage imageNamed:@"playlist-pressed_dark"]];
o_repeat_img = [[NSImage imageNamed:@"repeat_dark"] retain];
@ -464,7 +455,7 @@
[o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low_dark"]];
[o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track_dark"]];
[o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high_dark"]];
if (b_nativeFullscreenMode) {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-one-button_dark"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-one-button-pressed-dark"]];
@ -487,7 +478,6 @@
// remove fullscreen button for lion fullscreen
if (b_nativeFullscreenMode) {
NSRect frame;
float f_width = [o_fullscreen_btn frame].size.width;
@ -894,9 +884,9 @@ else \
int i_volume = [[VLCCoreInteraction sharedInstance] volume];
BOOL b_muted = [[VLCCoreInteraction sharedInstance] mute];
if (!b_muted) {
if (!b_muted)
[o_volume_sld setIntValue: i_volume];
} else
else
[o_volume_sld setIntValue: 0];
[o_volume_sld setEnabled: !b_muted];
@ -937,7 +927,7 @@ else \
/* chapters & titles */
//FIXME! b_chapters = p_input->stream.i_area_nb > 1;
vlc_object_release(p_input);
}

View File

@ -87,12 +87,12 @@
NSMutableArray *o_sidebaritems;
/* this is only true, when we have NO video playing inside the main window */
BOOL b_nonembedded;
BOOL b_nonembedded;
BOOL b_podcastView_displayed;
BOOL b_podcastView_displayed;
/* set to yes if we are fullscreen and all animations are over */
BOOL b_fullscreen;
BOOL b_fullscreen;
NSTimer *t_hide_mouse_timer;

View File

@ -156,7 +156,7 @@
[o_vout_view setVoutThread:(vout_thread_t *)p_wnd->p_parent];
[o_vout_dict setObject:[o_new_video_window autorelease] forKey:[NSValue valueWithPointer:p_wnd]];
if(b_nonembedded) {
if (b_nonembedded) {
// event occurs before window is created, so call again
[[VLCMain sharedInstance] playlistUpdated];
}
@ -167,7 +167,7 @@
- (void)removeVoutforDisplay:(NSValue *)o_key
{
VLCVideoWindowCommon *o_window = [o_vout_dict objectForKey:o_key];
if(!o_window) {
if (!o_window) {
msg_Err(VLCIntf, "Cannot close nonexisting window");
return;
}
@ -200,7 +200,7 @@
- (void)updateWindow:(vout_window_t *)p_wnd withSelector:(SEL)aSel;
{
VLCVideoWindowCommon *o_window = [o_vout_dict objectForKey:[NSValue valueWithPointer:p_wnd]];
if(!o_window) {
if (!o_window) {
msg_Err(VLCIntf, "Cannot call selector for nonexisting window");
return;
}
@ -219,7 +219,7 @@
- (void)setNativeVideoSize:(NSSize)size forWindow:(vout_window_t *)p_wnd
{
VLCVideoWindowCommon *o_window = [o_vout_dict objectForKey:[NSValue valueWithPointer:p_wnd]];
if(!o_window) {
if (!o_window) {
msg_Err(VLCIntf, "Cannot set size for nonexisting window");
return;
}
@ -227,4 +227,4 @@
[o_window setNativeVideoSize:size];
}
@end
@end

View File

@ -25,7 +25,6 @@
#import <Cocoa/Cocoa.h>
#import "CompatibilityFixes.h"
/*****************************************************************************
* VLCWindow
*
@ -113,4 +112,4 @@ static const float f_min_video_height = 70.0;
- (void)enterFullscreen;
- (void)leaveFullscreen;
@end
@end

View File

@ -806,7 +806,7 @@
- (void)hasEndedFullscreen
{
[[VLCMainWindow sharedInstance] setFullscreen:NO];
/* This function is private and should be only triggered at the end of the fullscreen change animation */
/* Make sure we don't see the o_video_view disappearing of the screen during this operation */
NSDisableScreenUpdates();

View File

@ -103,7 +103,7 @@
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
if(hideAgainTimer) {
if (hideAgainTimer) {
[hideAgainTimer invalidate];
[hideAgainTimer release];
}
@ -190,18 +190,18 @@
- (void)focus:(NSTimer *)timer
{
/* we need to push ourselves to front if the vout window was closed since our last display */
if(b_voutWasUpdated) {
if (b_voutWasUpdated) {
[self orderFront: self];
b_voutWasUpdated = NO;
}
if([self alphaValue] < 1.0)
if ([self alphaValue] < 1.0)
[self setAlphaValue:[self alphaValue]+0.1];
if([self alphaValue] >= 1.0) {
if ([self alphaValue] >= 1.0) {
b_displayed = YES;
[self setAlphaValue: 1.0];
[self setFadeTimer:nil];
if(b_fadeQueued) {
if (b_fadeQueued) {
b_fadeQueued=NO;
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(unfocus:) userInfo:NULL repeats:YES]];
}
@ -211,20 +211,20 @@
/* This routine is called repeatedly to hide the window */
- (void)unfocus:(NSTimer *)timer
{
if(b_keptVisible) {
if (b_keptVisible) {
b_keptVisible = NO;
b_fadeQueued = NO;
[self setFadeTimer: NULL];
[self fadeIn];
return;
}
if([self alphaValue] > 0.0)
if ([self alphaValue] > 0.0)
[self setAlphaValue:[self alphaValue]-0.05];
if([self alphaValue] <= 0.05) {
if ([self alphaValue] <= 0.05) {
b_displayed = NO;
[self setAlphaValue:0.0];
[self setFadeTimer:nil];
if(b_fadeQueued) {
if (b_fadeQueued) {
b_fadeQueued=NO;
[self setFadeTimer:
[NSTimer scheduledTimerWithTimeInterval:0.1
@ -252,18 +252,18 @@
{
/* in case that the user don't want us to appear, make sure we hide the mouse */
if(!config_GetInt(VLCIntf, "macosx-fspanel")) {
if (!config_GetInt(VLCIntf, "macosx-fspanel")) {
float time = (float)var_CreateGetInteger(VLCIntf, "mouse-hide-timeout") / 1000.;
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:time target:self selector:@selector(hideMouse) userInfo:nil repeats:NO]];
return;
}
if(b_nonActive)
if (b_nonActive)
return;
[self orderFront: nil];
if([self alphaValue] < 1.0 || b_displayed != YES) {
if ([self alphaValue] < 1.0 || b_displayed != YES) {
if (![self fadeTimer])
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(focus:) userInfo:[NSNumber numberWithShort:1] repeats:YES]];
else if ([[[self fadeTimer] userInfo] shortValue]==0)
@ -274,10 +274,10 @@
- (void)fadeOut
{
if(NSPointInRect([NSEvent mouseLocation],[self frame]))
if (NSPointInRect([NSEvent mouseLocation],[self frame]))
return;
if(([self alphaValue] > 0.0)) {
if (([self alphaValue] > 0.0)) {
if (![self fadeTimer])
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(unfocus:) userInfo:[NSNumber numberWithShort:0] repeats:YES]];
else if ([[[self fadeTimer] userInfo] shortValue]==1)
@ -292,9 +292,9 @@
b_keptVisible = YES;
/* get us a valid timer */
if(! b_alreadyCounting) {
if (! b_alreadyCounting) {
i_timeToKeepVisibleInSec = var_CreateGetInteger(VLCIntf, "mouse-hide-timeout") / 500;
if(hideAgainTimer) {
if (hideAgainTimer) {
[hideAgainTimer invalidate];
[hideAgainTimer autorelease];
}
@ -311,11 +311,11 @@
- (void)keepVisible:(NSTimer *)timer
{
/* if the user triggered an action, start over again */
if(b_keptVisible)
if (b_keptVisible)
b_keptVisible = NO;
/* count down until we hide ourselfes again and do so if necessary */
if(--i_timeToKeepVisibleInSec < 1) {
if (--i_timeToKeepVisibleInSec < 1) {
[self hideMouse];
[self fadeOut];
[hideAgainTimer invalidate]; /* released in -autoHide and -dealloc */
@ -357,7 +357,7 @@
[o_vout_window release];
o_vout_window = [o_window retain];
int i_newdevice = (int)[[o_vout_window screen] displayID];
if(i_newdevice != i_device) {
if (i_newdevice != i_device) {
i_device = i_newdevice;
[self center];
}
@ -568,7 +568,7 @@
{
input_thread_t * p_input;
p_input = pl_CurrentInput(VLCIntf);
if(p_input != NULL) {
if (p_input != NULL) {
vlc_value_t pos;
pos.f_float = [o_fs_timeSlider floatValue] / 10000.;

View File

@ -47,12 +47,12 @@ static VLCInfo *_o_sharedInstance = nil;
- (id)init
{
if( _o_sharedInstance )
if (_o_sharedInstance)
[self dealloc];
else {
_o_sharedInstance = [super init];
if( _o_sharedInstance != nil ) {
if (_o_sharedInstance != nil) {
p_item = NULL;
[self updatePanelWithItem: NULL];
rootItem = [[VLCInfoTreeItem alloc] init];
@ -73,7 +73,7 @@ static VLCInfo *_o_sharedInstance = nil;
[o_uri_lbl setStringValue: _NS("Location")];
[o_title_lbl setStringValue: _NS("Title")];
[o_author_lbl setStringValue: _NS("Artist")];
[o_saveMetaData_btn setStringValue: _NS("Save Metadata" )];
[o_saveMetaData_btn setStringValue: _NS("Save Metadata")];
[[o_tab_view tabViewItemAtIndex: 0] setLabel: _NS("General")];
[[o_tab_view tabViewItemAtIndex: 1] setLabel: _NS("Codec Details")];
@ -129,8 +129,8 @@ static VLCInfo *_o_sharedInstance = nil;
{
[rootItem release];
if( p_item )
vlc_gc_decref( p_item );
if (p_item)
vlc_gc_decref(p_item);
[super dealloc];
}
@ -138,8 +138,8 @@ static VLCInfo *_o_sharedInstance = nil;
- (void)initPanel
{
b_stats = config_GetInt(VLCIntf, "stats");
if( !b_stats ) {
if( [o_tab_view numberOfTabViewItems] > 2 )
if (!b_stats) {
if ([o_tab_view numberOfTabViewItems] > 2)
[o_tab_view removeTabViewItem: [o_tab_view tabViewItemAtIndex: 2]];
}
else
@ -176,14 +176,14 @@ static VLCInfo *_o_sharedInstance = nil;
- (void)updatePanelWithItem:(input_item_t *)_p_item;
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
if( _p_item != p_item ) {
if( p_item ) vlc_gc_decref( p_item );
if (_p_item != p_item) {
if (p_item) vlc_gc_decref(p_item);
[o_saveMetaData_btn setEnabled: NO];
if( _p_item ) vlc_gc_incref( _p_item );
if (_p_item) vlc_gc_incref(_p_item);
p_item = _p_item;
}
if( !p_item ) {
if (!p_item) {
/* Erase */
#define SET( foo ) \
[self setMeta: "" forLabel: o_##foo##_txt];
@ -203,20 +203,20 @@ static VLCInfo *_o_sharedInstance = nil;
#undef SET
[o_image_well setImage: [NSImage imageNamed: @"noart.png"]];
} else {
if( !input_item_IsPreparsed( p_item ) )
playlist_PreparseEnqueue( pl_Get( VLCIntf ), p_item );
if (!input_item_IsPreparsed(p_item))
playlist_PreparseEnqueue(pl_Get(VLCIntf), p_item);
/* fill uri info */
char * psz_url = decode_URI( input_item_GetURI( p_item ) );
char * psz_url = decode_URI(input_item_GetURI(p_item));
[o_uri_txt setStringValue: [NSString stringWithUTF8String: psz_url ? psz_url : ""]];
free( psz_url );
free(psz_url);
/* fill title info */
char * psz_title = input_item_GetTitle( p_item );
if( !psz_title )
psz_title = input_item_GetName( p_item );
char * psz_title = input_item_GetTitle(p_item);
if (!psz_title)
psz_title = input_item_GetName(p_item);
[o_title_txt setStringValue: [NSString stringWithUTF8String: psz_title ? : "" ]];
free( psz_title );
free(psz_title);
#define SET( foo, bar ) \
char *psz_##foo = input_item_Get##bar ( p_item ); \
@ -240,16 +240,16 @@ static VLCInfo *_o_sharedInstance = nil;
char *psz_meta;
NSImage *o_image;
psz_meta = input_item_GetArtURL( p_item );
psz_meta = input_item_GetArtURL(p_item);
/* FIXME Can also be attachment:// */
if( psz_meta && strncmp( psz_meta, "attachment://", 13 ) )
if (psz_meta && strncmp(psz_meta, "attachment://", 13))
o_image = [[NSImage alloc] initWithContentsOfURL: [NSURL URLWithString:[NSString stringWithUTF8String: psz_meta]]];
else
o_image = [[NSImage imageNamed: @"noart.png"] retain];
[o_image_well setImage: o_image];
[o_image release];
FREENULL( psz_meta );
FREENULL(psz_meta);
}
/* reload the advanced table */
@ -263,7 +263,7 @@ static VLCInfo *_o_sharedInstance = nil;
- (void)setMeta: (char *)psz_meta forLabel: (id)theItem
{
if( psz_meta != NULL && *psz_meta)
if (psz_meta != NULL && *psz_meta)
[theItem setStringValue: [NSString stringWithUTF8String:psz_meta]];
else
[theItem setStringValue: @""];
@ -275,12 +275,12 @@ static VLCInfo *_o_sharedInstance = nil;
return;
if ([o_info_window isVisible]) {
if( !p_item || !p_item->p_stats ) {
if (!p_item || !p_item->p_stats) {
[self initMediaPanelStats];
return;
}
vlc_mutex_lock( &p_item->p_stats->lock );
vlc_mutex_lock(&p_item->p_stats->lock);
/* input */
[o_read_bytes_txt setStringValue: [NSString stringWithFormat:
@ -309,7 +309,7 @@ static VLCInfo *_o_sharedInstance = nil;
[o_played_abuffers_txt setIntValue: p_item->p_stats->i_played_abuffers];
[o_lost_abuffers_txt setIntValue: p_item->p_stats->i_lost_abuffers];
vlc_mutex_unlock( &p_item->p_stats->lock );
vlc_mutex_unlock(&p_item->p_stats->lock);
}
}
@ -320,7 +320,7 @@ static VLCInfo *_o_sharedInstance = nil;
- (IBAction)saveMetaData:(id)sender
{
if( !p_item )
if (!p_item)
goto error;
#define utf8( o_blub ) \
@ -338,10 +338,10 @@ static VLCInfo *_o_sharedInstance = nil;
input_item_SetDescription( p_item, utf8( o_description_txt ) );
input_item_SetLanguage( p_item, utf8( o_language_txt ) );
playlist_t * p_playlist = pl_Get( VLCIntf );
input_item_WriteMeta( VLC_OBJECT(p_playlist), p_item );
playlist_t * p_playlist = pl_Get(VLCIntf);
input_item_WriteMeta(VLC_OBJECT(p_playlist), p_item);
var_SetBool( p_playlist, "intf-change", true );
var_SetBool(p_playlist, "intf-change", true);
[self updatePanelWithItem: p_item];
[o_saveMetaData_btn setEnabled: NO];
@ -355,13 +355,13 @@ error:
- (IBAction)downloadCoverArt:(id)sender
{
playlist_t * p_playlist = pl_Get( VLCIntf );
if( p_item) playlist_AskForArtEnqueue( p_playlist, p_item );
playlist_t * p_playlist = pl_Get(VLCIntf);
if (p_item) playlist_AskForArtEnqueue(p_playlist, p_item);
}
- (input_item_t *)item
{
if( p_item ) vlc_gc_incref( p_item );
if (p_item) vlc_gc_incref(p_item);
return p_item;
}
@ -373,7 +373,7 @@ error:
{
BOOL bEnabled = TRUE;
if( [[o_mi title] isEqualToString: _NS("Information")] ) {
if ([[o_mi title] isEqualToString: _NS("Information")]) {
return ![[[VLCMain sharedInstance] playlist] isSelectionEmpty];
}
@ -419,7 +419,7 @@ error:
{
self = [super init];
if( self != nil ) {
if (self != nil) {
o_name = [o_item_name copy];
o_value = [o_item_value copy];
i_object_id = i_id;
@ -427,7 +427,7 @@ error:
p_item = [(VLCInfo *)[[VLCMain sharedInstance] info] item];
o_children = nil;
}
return( self );
return self;
}
- (id)init
@ -437,10 +437,10 @@ error:
- (void)dealloc
{
if( o_children != IsALeafNode ) [o_children release];
if (o_children != IsALeafNode) [o_children release];
[o_name release];
[o_value release];
if( p_item ) vlc_gc_decref( p_item );
if (p_item) vlc_gc_decref(p_item);
[super dealloc];
}
@ -448,11 +448,12 @@ error:
* Loads children incrementally */
- (NSArray *)children
{
if( !p_item ) return nil;
if (!p_item)
return nil;
if (o_children == NULL) {
if( i_object_id == -1 ) {
vlc_mutex_lock( &p_item->lock );
if (i_object_id == -1) {
vlc_mutex_lock(&p_item->lock);
o_children = [[NSMutableArray alloc] initWithCapacity: p_item->i_categories];
for (int i = 0 ; i < p_item->i_categories ; i++) {
NSString * name = [NSString stringWithUTF8String: p_item->pp_categories[i]->psz_name];
@ -460,10 +461,10 @@ error:
[item autorelease];
[o_children addObject:item];
}
vlc_mutex_unlock( &p_item->lock );
vlc_mutex_unlock(&p_item->lock);
}
else if( o_parent->i_object_id == -1 ) {
vlc_mutex_lock( &p_item->lock );
else if (o_parent->i_object_id == -1) {
vlc_mutex_lock(&p_item->lock);
info_category_t * cat = p_item->pp_categories[i_object_id];
o_children = [[NSMutableArray alloc] initWithCapacity: cat->i_infos];
for (int i = 0 ; i < cat->i_infos ; i++) {
@ -473,7 +474,7 @@ error:
[item autorelease];
[o_children addObject:item];
}
vlc_mutex_unlock( &p_item->lock );
vlc_mutex_unlock(&p_item->lock);
}
else
o_children = IsALeafNode;
@ -485,7 +486,8 @@ error:
{
input_item_t * oldItem = p_item;
p_item = [(VLCInfo *)[[VLCMain sharedInstance] info] item];
if( oldItem && oldItem != p_item ) vlc_gc_decref( oldItem );
if (oldItem && oldItem != p_item)
vlc_gc_decref(oldItem);
[o_children release];
o_children = nil;
@ -498,7 +500,7 @@ error:
- (int)numberOfChildren {
id i_tmp = [self children];
return ( i_tmp == IsALeafNode ) ? (-1) : (int)[i_tmp count];
return (i_tmp == IsALeafNode) ? (-1) : (int)[i_tmp count];
}
@end

View File

@ -272,7 +272,7 @@ static VLCWizard *_o_sharedInstance = nil;
"computers using the Microsoft MMS protocol. This protocol is used as "
"transport method by many Microsoft's softwares. Note that only a "
"small part of the MMS protocol is supported (MMS encapsulated in "
"HTTP)." ), nil];
"HTTP)."), nil];
o_udp_uni = [NSArray arrayWithObjects: @"udp", @"UDP-Unicast", _NS("Enter "
"the address of the computer to stream to."), _NS("Use this to stream "
"to a single computer."), nil];
@ -494,7 +494,7 @@ static VLCWizard *_o_sharedInstance = nil;
* store information for later usage */
NSString *o_mode;
o_mode = [[o_t1_matrix_strmgOrTrnscd selectedCell] title];
if( [o_mode isEqualToString: _NS("Stream to network")] )
if ([o_mode isEqualToString: _NS("Stream to network")])
{
/* we will be streaming */
[o_userSelections setObject:@"strmg" forKey:@"trnscdOrStrmg"];
@ -532,7 +532,7 @@ static VLCWizard *_o_sharedInstance = nil;
BOOL stop;
stop = NO;
o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
if( [o_mode isEqualToString: _NS("Select a stream")] )
if ([o_mode isEqualToString: _NS("Select a stream")])
{
[o_userSelections setObject:@"YES" forKey:@"newStrm"];
if ([[o_t2_fld_pathToNewStrm stringValue] isEqualToString: @""])
@ -553,15 +553,15 @@ static VLCWizard *_o_sharedInstance = nil;
NSIndexSet * selectedIndexes = [o_t2_tbl_plst selectedRowIndexes];
NSUInteger count = [selectedIndexes count];
NSMutableArray * tempArray = [[NSMutableArray alloc] init];
for( NSUInteger x = 0; x < count; x++ )
for( NSUInteger x = 0; x < count; x++)
{
playlist_item_t *p_item = [[o_t2_tbl_plst itemAtRow: [selectedIndexes indexGreaterThanOrEqualToIndex: x]] pointerValue];
if( p_item->i_children <= 0 )
if (p_item->i_children <= 0)
{
char *psz_uri = input_item_GetURI( p_item->p_input );
char *psz_uri = input_item_GetURI( p_item->p_input);
[tempArray addObject: [NSString stringWithUTF8String: psz_uri]];
free( psz_uri );
free( psz_uri);
stop = NO;
}
else
@ -609,7 +609,7 @@ static VLCWizard *_o_sharedInstance = nil;
/* check which streaming method is selected and store it */
int mode;
mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
if( mode == 0 )
if (mode == 0)
{
/* HTTP Streaming */
[o_userSelections setObject:@"0" forKey:@"stmgMhd"];
@ -619,7 +619,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, integer"];
[o_t4_pop_audioCodec removeItemWithTitle:@"Uncompressed, floating point"];
} else if ( mode == 1 )
} else if ( mode == 1)
{
/* MMS Streaming */
[o_userSelections setObject:@"1" forKey:@"stmgMhd"];
@ -651,10 +651,10 @@ static VLCWizard *_o_sharedInstance = nil;
}
/* store the destination and check whether is it empty */
if([[o_userSelections objectForKey:@"stmgMhd"] intValue] >=2 )
if([[o_userSelections objectForKey:@"stmgMhd"] intValue] >=2)
{
/* empty field is valid for HTTP and MMS */
if( [[o_t3_fld_address stringValue] isEqualToString: @""] )
if ([[o_t3_fld_address stringValue] isEqualToString: @""])
{
/* complain to the user that "" is no valid dest. */
NSBeginInformationalAlertSheet(_NS("No valid destination"),
@ -938,7 +938,7 @@ static VLCWizard *_o_sharedInstance = nil;
}
NSInteger i_streamingMethod = [[o_userSelections objectForKey:@"stmgMhd"] intValue];
if ( i_streamingMethod == 1 )
if ( i_streamingMethod == 1)
{
/* if MMS is the streaming protocol, only ASFH is available */
[[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
@ -953,7 +953,7 @@ static VLCWizard *_o_sharedInstance = nil;
[[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:YES];
[o_t5_matrix_encap selectCellAtRow:9 column:0];
}
else if ( i_streamingMethod == 0 )
else if ( i_streamingMethod == 0)
{
/* if HTTP is the streaming protocol, disable all unsupported
* encap-formats, but don't touch the other ones selected above */
@ -962,7 +962,7 @@ static VLCWizard *_o_sharedInstance = nil;
[[o_t5_matrix_encap cellAtRow:8 column:0] setEnabled:NO];
[[o_t5_matrix_encap cellAtRow:9 column:0] setEnabled:NO];
}
else if ( i_streamingMethod >= 2 )
else if ( i_streamingMethod >= 2)
{
/* if UDP/RTP is the streaming protocol, only MPEG-TS is available */
[[o_t5_matrix_encap cellAtRow:0 column:0] setEnabled:NO];
@ -981,7 +981,7 @@ static VLCWizard *_o_sharedInstance = nil;
BOOL anythingEnabled;
anythingEnabled = NO;
NSUInteger count = [o_t5_matrix_encap numberOfRows];
for (NSUInteger x = 0; x < count; x++ )
for (NSUInteger x = 0; x < count; x++)
{
if ([[o_t5_matrix_encap cellAtRow:x column:0] isEnabled])
anythingEnabled = YES;
@ -990,7 +990,7 @@ static VLCWizard *_o_sharedInstance = nil;
if (anythingEnabled == YES)
{
/* re-select the previously chosen item, if available */
if( [[o_t5_matrix_encap cellWithTag: i_temp] isEnabled] )
if ([[o_t5_matrix_encap cellWithTag: i_temp] isEnabled])
[o_t5_matrix_encap selectCellWithTag: i_temp];
/* go the encap-tab */
@ -1022,7 +1022,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_tab_pageHolder selectTabViewItemAtIndex:6];
/* in case that we are processing multiple items, let the user
* select a folder instead of a localtion for a single item */
if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
{
[o_t7_txt_saveFileTo setStringValue:
_NS("Select the directory to save to")];
@ -1075,10 +1075,10 @@ static VLCWizard *_o_sharedInstance = nil;
}
/* check whether the path != "" and store it */
if( [[o_t7_fld_filePath stringValue] isEqualToString: @""] )
if ([[o_t7_fld_filePath stringValue] isEqualToString: @""])
{
/* complain to the user that "" is no valid path for a folder/file */
if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
NSBeginInformationalAlertSheet(_NS("No folder selected"),
_NS("OK"), @"", @"", o_wizard_window, nil, nil, nil, nil,
@"%@\n\n%@", _NS("A directory "
@ -1097,27 +1097,27 @@ static VLCWizard *_o_sharedInstance = nil;
NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
[[o_userSelections objectForKey:@"encapFormat"] intValue]]
objectAtIndex:0];
if( theEncapFormat == @"ps" )
if (theEncapFormat == @"ps")
theEncapFormat = @"mpg";
/* look whether we need to process multiple items or not.
* choose a faster variant if we just want a single item */
if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
{
NSMutableArray * tempArray = [[NSMutableArray alloc] init];
int x = 0;
int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
NSMutableString * tempString = [[NSMutableString alloc] init];
while( x != y )
while( x != y)
{
NSString * fileNameToUse;
/* check whether the extension is hidden or not.
* if not, remove it
* we need the casting to make GCC4 happy */
if( [[[NSFileManager defaultManager] attributesOfItemAtPath:
if ([[[NSFileManager defaultManager] attributesOfItemAtPath:
[[o_userSelections objectForKey:@"pathToStrm"]
objectAtIndex: x] error:nil] objectForKey:
NSFileExtensionHidden] )
NSFileExtensionHidden])
fileNameToUse = [NSString stringWithString:
[[NSFileManager defaultManager] displayNameAtPath:
[[o_userSelections objectForKey:@"pathToStrm"]
@ -1131,7 +1131,7 @@ static VLCWizard *_o_sharedInstance = nil;
objectAtIndex: x]]
componentsSeparatedByString: @"."] count];
fileNameToUse = @"";
while( z < (count - 1) )
while( z < (count - 1))
{
fileNameToUse = [fileNameToUse stringByAppendingString:
[[[[NSFileManager defaultManager]
@ -1146,26 +1146,26 @@ static VLCWizard *_o_sharedInstance = nil;
tempString = [NSString stringWithFormat: @"%@%@.%@",
[o_t7_fld_filePath stringValue],
fileNameToUse, theEncapFormat];
if( [[NSFileManager defaultManager] fileExistsAtPath:
tempString] )
if ([[NSFileManager defaultManager] fileExistsAtPath:
tempString])
{
/* we don't wanna overwrite existing files, so add an
* int to the file-name */
int additionalInt = 1;
while( additionalInt < 100 )
while( additionalInt < 100)
{
tempString = [NSString stringWithFormat:@"%@%@ %i.%@",
[o_t7_fld_filePath stringValue],
fileNameToUse, additionalInt, theEncapFormat];
if(! [[NSFileManager defaultManager]
fileExistsAtPath: tempString] )
fileExistsAtPath: tempString])
break;
additionalInt += 1;
}
if( additionalInt >= 100 )
if (additionalInt >= 100)
msg_Err( VLCIntf, "Files with the same name are "
"already present in the destination directory. "
"Delete these files or choose a different directory." );
"Delete these files or choose a different directory.");
}
[tempArray addObject: [tempString retain]];
x += 1;
@ -1197,24 +1197,24 @@ static VLCWizard *_o_sharedInstance = nil;
{
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( p_intf );
playlist_t * p_playlist = pl_Get( p_intf);
int x = 0;
int y = [[o_userSelections objectForKey:@"pathToStrm"] count];
while( x != y )
while( x != y)
{
/* we need a temp. variable here to work-around a GCC4-bug */
NSString *tempString = [NSString stringWithFormat:
@"%@ (%i/%i)", _NS("Streaming/Transcoding Wizard"),
( x + 1 ), y];
( x + 1), y];
input_item_t *p_input = input_item_New(
[[[o_userSelections objectForKey:@"pathToStrm"]
objectAtIndex:x] UTF8String],
[tempString UTF8String] );
[tempString UTF8String]);
/* use the MRL from the text field, in case the user
* modified it */
input_item_AddOption( p_input, [[o_t8_fld_mrl stringValue] UTF8String], VLC_INPUT_OPTION_TRUSTED );
input_item_AddOption( p_input, [[o_t8_fld_mrl stringValue] UTF8String], VLC_INPUT_OPTION_TRUSTED);
if(! [[o_userSelections objectForKey:@"partExtractFrom"]
isEqualToString:@""]) {
@ -1251,21 +1251,21 @@ static VLCWizard *_o_sharedInstance = nil;
input_item_AddOption( p_input, [[NSString stringWithFormat:
@"ttl=%@", [o_userSelections objectForKey:@"ttl"]]
UTF8String],
VLC_INPUT_OPTION_TRUSTED );
VLC_INPUT_OPTION_TRUSTED);
int returnValue = playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked );
int returnValue = playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked);
if( x == 0 && returnValue != VLC_SUCCESS)
if (x == 0 && returnValue != VLC_SUCCESS)
{
/* play the first item and add the others afterwards */
PL_LOCK;
playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input );
playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input);
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
p_item );
p_item);
PL_UNLOCK;
}
vlc_gc_decref( p_input );
vlc_gc_decref( p_input);
x += 1;
}
@ -1280,13 +1280,13 @@ static VLCWizard *_o_sharedInstance = nil;
savePreviousSel = [o_t4_pop_videoCodec indexOfSelectedItem];
[o_t4_pop_videoCodec removeAllItems];
NSUInteger count = [o_videoCodecs count];
for (NSUInteger x = 0; x < count; x++ )
for (NSUInteger x = 0; x < count; x++)
{
[o_t4_pop_videoCodec addItemWithTitle:[[o_videoCodecs objectAtIndex:x]
objectAtIndex:0]];
[[o_t4_pop_videoCodec lastItem] setTag:x];
}
if( savePreviousSel >= 0 )
if (savePreviousSel >= 0)
[o_t4_pop_videoCodec selectItemAtIndex: savePreviousSel];
savePreviousSel = [o_t4_pop_audioCodec indexOfSelectedItem];
@ -1298,7 +1298,7 @@ static VLCWizard *_o_sharedInstance = nil;
objectAtIndex:0]];
[[o_t4_pop_audioCodec lastItem] setTag:x];
}
if( savePreviousSel >= 0 )
if (savePreviousSel >= 0)
[o_t4_pop_audioCodec selectItemAtIndex: savePreviousSel];
}
@ -1307,7 +1307,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_btn_forward setTitle: _NS("Finish")];
/* if we will transcode multiple items, just give their number; otherwise
* print the URI of the single item */
if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
[o_t8_fld_inptStream setStringValue: [NSString stringWithFormat:
_NS("%i items"),
[[o_userSelections objectForKey:@"pathToStrm"] count]]];
@ -1388,7 +1388,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_t8_fld_ttl setStringValue: @"-"];
[o_t8_fld_sap setStringValue: @"-"];
/* do only show the destination of the first item and add a counter, if needed */
if( [[o_userSelections objectForKey: @"trnscdFilePath"] count] > 1 )
if ([[o_userSelections objectForKey: @"trnscdFilePath"] count] > 1)
[o_t8_fld_saveFileTo setStringValue:
[NSString stringWithFormat: @"%@ (+%li)",
[[o_userSelections objectForKey: @"trnscdFilePath"] objectAtIndex:0],
@ -1417,7 +1417,7 @@ static VLCWizard *_o_sharedInstance = nil;
NSMutableArray * tempArray = [[NSMutableArray alloc] init];
/* loop to create an opt-string for each item we're processing */
while( x != y )
while( x != y)
{
/* check whether we transcode the audio and/or the video and compose a
* string reflecting the settings, if needed */
@ -1483,7 +1483,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_sap_option appendFormat: @"sap,name=\"%@\"",
[o_userSelections objectForKey:@"sapText"]];
}
if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
if ([[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp")
{
/* RTP is no access out, but a stream out module */
[o_opts_string appendFormat:
@ -1507,7 +1507,7 @@ static VLCWizard *_o_sharedInstance = nil;
else
{
/* no SAP, just streaming */
if( [[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp" )
if ([[o_strmgMthds objectAtIndex: [[o_userSelections objectForKey: @"stmgMhd"] intValue]] objectAtIndex:0] == @"rtp")
{
/* RTP is different from the other protocols, as it isn't provided through an access out module anymore */
[o_opts_string appendFormat:
@ -1650,7 +1650,7 @@ static VLCWizard *_o_sharedInstance = nil;
NSString *o_mode;
o_mode = [[o_t2_matrix_inputSourceType selectedCell] title];
if( [o_mode isEqualToString: _NS("Select a stream")] )
if ([o_mode isEqualToString: _NS("Select a stream")])
{
[o_t2_btn_chooseFile setEnabled:YES];
[o_t2_fld_pathToNewStrm setEnabled:YES];
@ -1683,7 +1683,7 @@ static VLCWizard *_o_sharedInstance = nil;
* streaming method */
int mode;
mode = [[o_t3_matrix_stmgMhd selectedCell] tag];
if( mode == 0 )
if (mode == 0)
{
/* HTTP */
[o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
@ -1691,7 +1691,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:0]
objectAtIndex:3]];
}
else if( mode == 1 )
else if (mode == 1)
{
/* MMS */
[o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
@ -1699,7 +1699,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:1]
objectAtIndex:3]];
}
else if( mode == 2 )
else if (mode == 2)
{
/* UDP-Unicast */
[o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
@ -1707,7 +1707,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:2]
objectAtIndex:3]];
}
else if( mode == 3 )
else if (mode == 3)
{
/* UDP-Multicast */
[o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
@ -1715,7 +1715,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:3]
objectAtIndex:3]];
}
else if( mode == 4 )
else if (mode == 4)
{
/* RTP-Unicast */
[o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
@ -1723,7 +1723,7 @@ static VLCWizard *_o_sharedInstance = nil;
[o_t3_txt_strgMthdInfo setStringValue: [[o_strmgMthds objectAtIndex:4]
objectAtIndex:3]];
}
else if( mode == 5 )
else if (mode == 5)
{
/* RTP-Multicast */
[o_t3_txt_destInfo setStringValue: [[o_strmgMthds objectAtIndex:5]
@ -1834,7 +1834,7 @@ static VLCWizard *_o_sharedInstance = nil;
* his/her new file. We take a modified NSOpenPanel to select a folder
* and a plain NSSavePanel to save a single file. */
if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
if ([[o_userSelections objectForKey:@"pathToStrm"] count] > 1)
{
NSOpenPanel * saveFolderPanel = [[NSOpenPanel alloc] init];
@ -1858,7 +1858,7 @@ static VLCWizard *_o_sharedInstance = nil;
NSString * theEncapFormat = [[o_encapFormats objectAtIndex:
[[o_userSelections objectForKey:@"encapFormat"] intValue]]
objectAtIndex:0];
if( theEncapFormat != @"ps" )
if (theEncapFormat != @"ps")
[saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:theEncapFormat]];
else
[saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:@"mpg"]];