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

macosx: white space and minor coding style fixes

parent 94d4f4a6
......@@ -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;
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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
\ No newline at end of file
@end
......@@ -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
\ No newline at end of file
@end
......@@ -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();
......
......@@ -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.;
......
......@@ -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
......
This diff is collapsed.
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