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

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 @@
#import "controls.h" // TODO: remove me
#import <vlc_playlist.h>
#import <vlc_aout_intf.h>
#import <vlc_url.h>
#import <vlc_strings.h>
@implementation VLCMainWindow
static VLCMainWindow *_o_sharedInstance = nil;
......@@ -453,19 +455,53 @@ static VLCMainWindow *_o_sharedInstance = nil;
if( p_input )
{
NSString *aString;
input_item_t * p_item = input_GetItem( p_input );
char * name = input_item_GetNowPlaying( p_item );
char *format = var_InheritString( VLCIntf, "input-title-format" );
char *formated = str_format_meta( p_input, format );
free( format );
aString = [NSString stringWithUTF8String:formated];
free( formated );
if( !name )
name = input_item_GetName( p_item );
char *uri = input_item_GetURI( input_GetItem( p_input ) );
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];
[[[[VLCMain sharedInstance] controls] fspanel] setStreamTitle: aString];
}
else
{
[self setTitle: _NS("VLC media player")];
[self setRepresentedFilename: @""];
}
}
- (void)updateWindow
......
......@@ -243,7 +243,6 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var,
break;
case INPUT_EVENT_TITLE:
case INPUT_EVENT_CHAPTER:
[[VLCMain sharedInstance] updateTitle];
break;
case INPUT_EVENT_CACHE:
[[VLCMain sharedInstance] updateMainWindow];
......@@ -262,6 +261,7 @@ static int InputEvent( vlc_object_t *p_this, const char *psz_var,
break;
case INPUT_EVENT_ITEM_META:
case INPUT_EVENT_ITEM_INFO:
[[VLCMain sharedInstance] updateTitle];
[[VLCMain sharedInstance] updateInfoandMetaPanel];
break;
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