Commit a55eb27d authored by Jérome Decoodt's avatar Jérome Decoodt

Added setScrollField: and resetScrollField to manage the scroll field.

parent 146736b5
...@@ -247,17 +247,27 @@ ...@@ -247,17 +247,27 @@
{ {
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];
} }
- (void)updateVolumeSlider - (void)updateVolumeSlider
{ {
NSString * o_text;
char * psz_text;
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
audio_volume_t i_volume; audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume ); aout_VolumeGet( p_intf, &i_volume );
psz_text = malloc( 32 * sizeof( char ) );
/*FIXME: do we really need to work with a char * before NSString ? */
if( psz_text )
{
sprintf( psz_text, "Volume: %d", i_volume * 200 / AOUT_VOLUME_MAX );
o_text = [[NSString alloc] initWithCString:psz_text];
[o_main setScrollField:o_text stopAfter:1000000];
free( psz_text );
}
[o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)]; [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
} }
......
...@@ -237,6 +237,7 @@ struct intf_sys_t ...@@ -237,6 +237,7 @@ struct intf_sys_t
bool b_small_window; bool b_small_window;
mtime_t i_end_scroll;
} }
+ (VLCMain *)sharedInstance; + (VLCMain *)sharedInstance;
...@@ -258,6 +259,8 @@ struct intf_sys_t ...@@ -258,6 +259,8 @@ struct intf_sys_t
- (void)manage; - (void)manage;
- (void)manageIntf:(NSTimer *)o_timer; - (void)manageIntf:(NSTimer *)o_timer;
- (void)setupMenus; - (void)setupMenus;
- (void)setScrollField:(NSString *)o_string stopAfter:(int )timeout;
- (void)resetScrollField;
- (void)updateMessageArray; - (void)updateMessageArray;
- (void)playStatusUpdated:(int) i_status; - (void)playStatusUpdated:(int) i_status;
......
...@@ -417,7 +417,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -417,7 +417,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (void)initStrings - (void)initStrings
{ {
[o_window setTitle: _NS("VLC - Controller")]; [o_window setTitle: _NS("VLC - Controller")];
[o_scrollfield setStringValue: _NS("VLC media player")]; [self setScrollField:_NS("VLC media player") stopAfter:-1];
/* button controls */ /* button controls */
[o_btn_prev setToolTip: _NS("Previous")]; [o_btn_prev setToolTip: _NS("Previous")];
...@@ -755,7 +755,6 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -755,7 +755,6 @@ static VLCMain *_o_sharedMainInstance = nil;
{ {
NSDate * o_sleep_date; NSDate * o_sleep_date;
playlist_t * p_playlist; playlist_t * p_playlist;
vlc_value_t val;
/* new thread requires a new pool */ /* new thread requires a new pool */
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
...@@ -797,7 +796,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -797,7 +796,7 @@ static VLCMain *_o_sharedMainInstance = nil;
/* input stopped */ /* input stopped */
p_intf->p_sys->b_intf_update = VLC_TRUE; p_intf->p_sys->b_intf_update = VLC_TRUE;
p_intf->p_sys->i_play_status = END_S; p_intf->p_sys->i_play_status = END_S;
[o_scrollfield setStringValue: _NS("VLC media player") ]; [self setScrollField: _NS("VLC media player") stopAfter:-1];
vlc_object_release( p_input ); vlc_object_release( p_input );
p_input = NULL; p_input = NULL;
} }
...@@ -909,7 +908,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -909,7 +908,7 @@ static VLCMain *_o_sharedMainInstance = nil;
if( o_temp == NULL ) if( o_temp == NULL )
o_temp = [NSString stringWithCString: o_temp = [NSString stringWithCString:
p_playlist->status.p_item->input.psz_name]; p_playlist->status.p_item->input.psz_name];
[o_scrollfield setStringValue: o_temp ]; [self setScrollField: o_temp stopAfter:-1];
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -978,6 +977,9 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -978,6 +977,9 @@ static VLCMain *_o_sharedMainInstance = nil;
[self updateMessageArray]; [self updateMessageArray];
if( (i_end_scroll != -1) && (mdate() > i_end_scroll) )
[self resetScrollField];
[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];
...@@ -1052,6 +1054,41 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1052,6 +1054,41 @@ static VLCMain *_o_sharedMainInstance = nil;
#undef p_input #undef p_input
} }
- (void)setScrollField:(NSString *)o_string stopAfter:(int)timeout
{
if( timeout != -1 )
i_end_scroll = mdate() + timeout;
else
i_end_scroll = -1;
[o_scrollfield setStringValue: o_string];
}
- (void)resetScrollField
{
i_end_scroll = -1;
#define p_input p_intf->p_sys->p_input
if( p_input && !p_input->b_die )
{
NSString *o_temp;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
o_temp = [NSString stringWithUTF8String:
p_playlist->status.p_item->input.psz_name];
if( o_temp == NULL )
o_temp = [NSString stringWithCString:
p_playlist->status.p_item->input.psz_name];
[self setScrollField: o_temp stopAfter:-1];
vlc_object_release( p_playlist );
return;
}
#undef p_input
[self setScrollField: _NS("VLC media player") stopAfter:-1];
}
- (void)updateMessageArray - (void)updateMessageArray
{ {
int i_start, i_stop; int i_start, i_stop;
......
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