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

macosx: fixed updateTitle as suggested by j-b and made sure to the represented...

macosx: fixed updateTitle as suggested by j-b and made sure to the represented filename correctly, if applicable
parent e5d609fd
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#import "controls.h" // TODO: remove me #import "controls.h" // TODO: remove me
#import <vlc_playlist.h> #import <vlc_playlist.h>
#import <vlc_aout_intf.h> #import <vlc_aout_intf.h>
#import <vlc_url.h>
#import <vlc_strings.h>
@implementation VLCMainWindow @implementation VLCMainWindow
static VLCMainWindow *_o_sharedInstance = nil; static VLCMainWindow *_o_sharedInstance = nil;
...@@ -453,19 +455,53 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -453,19 +455,53 @@ static VLCMainWindow *_o_sharedInstance = nil;
if( p_input ) if( p_input )
{ {
NSString *aString; NSString *aString;
input_item_t * p_item = input_GetItem( p_input ); char *format = var_InheritString( VLCIntf, "input-title-format" );
char * name = input_item_GetNowPlaying( p_item ); char *formated = str_format_meta( p_input, format );
free( format );
aString = [NSString stringWithUTF8String:formated];
free( formated );
if( !name ) char *uri = input_item_GetURI( input_GetItem( p_input ) );
name = input_item_GetName( p_item );
aString = [NSString stringWithUTF8String:name]; if ([aString isEqualToString:@""])
{
char *file = uri ? strrchr( uri, '/' ) : NULL;
if( file != NULL )
{
decode_URI( ++file );
aString = [NSString stringWithUTF8String:file];
}
else
aString = [NSString stringWithUTF8String:uri];
}
free(name); NSMutableString *o_mrl = [NSMutableString stringWithUTF8String: decode_URI(uri)];
free( uri );
NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
if( prefix_range.location != NSNotFound )
[o_mrl deleteCharactersInRange: prefix_range];
if( [o_mrl characterAtIndex:0] == '/' )
{
/* it's a local file */
[self setRepresentedFilename: o_mrl];
}
else
{
/* it's from the network or somewhere else,
* we clear the previous path */
[self setRepresentedFilename: @""];
}
[self setTitle: aString]; [self setTitle: aString];
[[[[VLCMain sharedInstance] controls] fspanel] setStreamTitle: aString]; [[[[VLCMain sharedInstance] controls] fspanel] setStreamTitle: aString];
} }
else
{
[self setTitle: _NS("VLC media player")];
[self setRepresentedFilename: @""];
}
} }
- (void)updateWindow - (void)updateWindow
......
...@@ -243,7 +243,6 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var, ...@@ -243,7 +243,6 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var,
break; break;
case INPUT_EVENT_TITLE: case INPUT_EVENT_TITLE:
case INPUT_EVENT_CHAPTER: case INPUT_EVENT_CHAPTER:
[[VLCMain sharedInstance] updateTitle];
break; break;
case INPUT_EVENT_CACHE: case INPUT_EVENT_CACHE:
[[VLCMain sharedInstance] updateMainWindow]; [[VLCMain sharedInstance] updateMainWindow];
...@@ -262,6 +261,7 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var, ...@@ -262,6 +261,7 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var,
break; break;
case INPUT_EVENT_ITEM_META: case INPUT_EVENT_ITEM_META:
case INPUT_EVENT_ITEM_INFO: case INPUT_EVENT_ITEM_INFO:
[[VLCMain sharedInstance] updateTitle];
[[VLCMain sharedInstance] updateInfoandMetaPanel]; [[VLCMain sharedInstance] updateInfoandMetaPanel];
break; break;
case INPUT_EVENT_BOOKMARK: case INPUT_EVENT_BOOKMARK:
......
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