Commit 3a8876ee authored by Jérome Decoodt's avatar Jérome Decoodt

Fix a bug in playlist + delete updateVolumeSlider (closes #93)

parent 2c31c3a3
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
- (IBAction)volumeDown:(id)sender; - (IBAction)volumeDown:(id)sender;
- (IBAction)mute:(id)sender; - (IBAction)mute:(id)sender;
- (IBAction)volumeSliderUpdated:(id)sender; - (IBAction)volumeSliderUpdated:(id)sender;
- (void)updateVolumeSlider;
- (IBAction)windowAction:(id)sender; - (IBAction)windowAction:(id)sender;
......
...@@ -222,7 +222,8 @@ ...@@ -222,7 +222,8 @@
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
val.i_int = config_GetInt( p_intf, "key-vol-up" ); val.i_int = config_GetInt( p_intf, "key-vol-up" );
var_Set( p_intf->p_vlc, "key-pressed", val ); var_Set( p_intf->p_vlc, "key-pressed", val );
[self updateVolumeSlider]; /* Manage volume status */
[o_main manageVolumeSlider];
} }
- (IBAction)volumeDown:(id)sender - (IBAction)volumeDown:(id)sender
...@@ -231,7 +232,8 @@ ...@@ -231,7 +232,8 @@
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
val.i_int = config_GetInt( p_intf, "key-vol-down" ); val.i_int = config_GetInt( p_intf, "key-vol-down" );
var_Set( p_intf->p_vlc, "key-pressed", val ); var_Set( p_intf->p_vlc, "key-pressed", val );
[self updateVolumeSlider]; /* Manage volume status */
[o_main manageVolumeSlider];
} }
- (IBAction)mute:(id)sender - (IBAction)mute:(id)sender
...@@ -240,7 +242,8 @@ ...@@ -240,7 +242,8 @@
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
val.i_int = config_GetInt( p_intf, "key-vol-mute" ); val.i_int = config_GetInt( p_intf, "key-vol-mute" );
var_Set( p_intf->p_vlc, "key-pressed", val ); var_Set( p_intf->p_vlc, "key-pressed", val );
[self updateVolumeSlider]; /* Manage volume status */
[o_main manageVolumeSlider];
} }
- (IBAction)volumeSliderUpdated:(id)sender - (IBAction)volumeSliderUpdated:(id)sender
...@@ -248,21 +251,8 @@ ...@@ -248,21 +251,8 @@
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
audio_volume_t i_volume = (audio_volume_t)[sender intValue]; audio_volume_t i_volume = (audio_volume_t)[sender intValue];
aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_STEP ); aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_STEP );
[self updateVolumeSlider]; /* Manage volume status */
} [o_main manageVolumeSlider];
- (void)updateVolumeSlider
{
NSString * o_text;
intf_thread_t * p_intf = VLCIntf;
audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume );
o_text = [NSString stringWithFormat: _NS("Volume: %d"), i_volume * 200 / AOUT_VOLUME_MAX];
[o_main setScrollField:o_text stopAfter:1000000];
[o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
} }
- (IBAction)windowAction:(id)sender - (IBAction)windowAction:(id)sender
......
...@@ -242,6 +242,7 @@ struct intf_sys_t ...@@ -242,6 +242,7 @@ struct intf_sys_t
NSSize o_size_with_playlist; NSSize o_size_with_playlist;
int i_lastShownVolume;
} }
+ (VLCMain *)sharedInstance; + (VLCMain *)sharedInstance;
......
...@@ -297,6 +297,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -297,6 +297,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_prefs = [[VLCPrefs alloc] init]; o_prefs = [[VLCPrefs alloc] init];
o_open = [[VLCOpen alloc] init]; o_open = [[VLCOpen alloc] init];
i_lastShownVolume = -1;
return _o_sharedMainInstance; return _o_sharedMainInstance;
} }
...@@ -965,9 +966,6 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -965,9 +966,6 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_timefield setStringValue: o_time]; [o_timefield setStringValue: o_time];
} }
/* Manage volume status */
[self manageVolumeSlider];
/* Manage Playing status */ /* Manage Playing status */
var_Get( p_input, "state", &val ); var_Get( p_input, "state", &val );
if( p_intf->p_sys->i_play_status != val.i_int ) if( p_intf->p_sys->i_play_status != val.i_int )
...@@ -991,6 +989,9 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -991,6 +989,9 @@ static VLCMain *_o_sharedMainInstance = nil;
if( (i_end_scroll != -1) && (mdate() > i_end_scroll) ) if( (i_end_scroll != -1) && (mdate() > i_end_scroll) )
[self resetScrollField]; [self resetScrollField];
/* Manage volume status */
[self manageVolumeSlider];
[NSTimer scheduledTimerWithTimeInterval: 0.3 [NSTimer scheduledTimerWithTimeInterval: 0.3
target: self selector: @selector(manageIntf:) target: self selector: @selector(manageIntf:)
userInfo: nil repeats: FALSE]; userInfo: nil repeats: FALSE];
...@@ -1221,11 +1222,19 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1221,11 +1222,19 @@ static VLCMain *_o_sharedMainInstance = nil;
- (void)manageVolumeSlider - (void)manageVolumeSlider
{ {
audio_volume_t i_volume; audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume ); aout_VolumeGet( p_intf, &i_volume );
if( i_volume != i_lastShownVolume )
{
NSString *o_text;
o_text = [NSString stringWithFormat: _NS("Volume: %d"), i_volume * 200 / AOUT_VOLUME_MAX];
if( i_lastShownVolume != -1 )
[self setScrollField:o_text stopAfter:1000000];
[o_volumeslider setFloatValue: (float)i_volume / AOUT_VOLUME_STEP]; [o_volumeslider setFloatValue: (float)i_volume / AOUT_VOLUME_STEP];
[o_volumeslider setEnabled: TRUE]; [o_volumeslider setEnabled: TRUE];
i_lastShownVolume = i_volume;
}
p_intf->p_sys->b_mute = ( i_volume == 0 ); p_intf->p_sys->b_mute = ( i_volume == 0 );
} }
......
...@@ -303,9 +303,11 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -303,9 +303,11 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
for (j = 0 ; j < [o_array count] - 1 ; j++) for (j = 0 ; j < [o_array count] - 1 ; j++)
{ {
[o_outline_view expandItem: [o_outline_dict objectForKey: id o_item;
if( ( o_item = [o_outline_dict objectForKey:
[NSString stringWithFormat: @"%p", [NSString stringWithFormat: @"%p",
[[o_array objectAtIndex:j] pointerValue]]]]; [[o_array objectAtIndex:j] pointerValue]]] ) != nil )
[o_outline_view expandItem: o_item];
} }
......
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