Commit 371b0ddd authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: reworked the about dialog

added used CC, added text operations on psz_authors to keep scrolling times reasonable and fixed a scrolling bug
parent 6a4e3d34
This source diff could not be displayed because it is too large. You can view the blob instead.
/*****************************************************************************
* about.m: MacOS X About Panel
*****************************************************************************
* Copyright (C) 2001-2009 the VideoLAN team
* Copyright (C) 2001-2011 the VideoLAN team
* $Id$
*
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
......@@ -80,7 +80,7 @@ static VLAboutBox *_o_sharedInstance = nil;
selector: @selector(VLCWillTerminate)
name: NSApplicationWillTerminateNotification
object: nil];
/* Get the localized info dictionary (InfoPlist.strings) */
NSDictionary *o_local_dict;
o_local_dict = [[NSBundle mainBundle] localizedInfoDictionary];
......@@ -92,18 +92,34 @@ static VLAboutBox *_o_sharedInstance = nil;
[o_about_window setTitle: _NS("About VLC media player")];
/* setup the creator / revision field */
[o_revision_field setStringValue:
[NSString stringWithFormat: _NS("Compiled by %s"), VLC_CompileBy()]];
NSString *compiler;
#ifdef __clang__
compiler = [NSString stringWithFormat:@"clang %s", __clang_version__];
#elif __llvm__
compiler = [NSString stringWithFormat:@"llvm-gcc %s", __VERSION__];
#else
compiler = [NSString stringWithFormat:@"gcc %s", __VERSION__];
#endif
[o_revision_field setStringValue: [NSString stringWithFormat: _NS("Compiled by %s with %@"), VLC_CompileBy(), compiler]];
/* Setup the nameversion field */
[o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VERSION_MESSAGE, PLATFORM]];
NSMutableArray *tmpArray = [NSMutableArray arrayWithArray: [[NSString stringWithUTF8String: psz_authors]componentsSeparatedByString:@"\n\n"]];
for( int i = 0; i < [tmpArray count]; i++ )
{
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@"\n" withString:@", "]];
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@", -" withString:@"\n-" options:0 range:NSRangeFromString(@"0 30")]];
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@"-, " withString:@"-\n" options:0 range:NSRangeFromString(@"0 30")]];
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]]];
}
NSString *authors = [tmpArray componentsJoinedByString:@"\n\n"];
/* setup the authors and thanks field */
[o_credits_textview setString: [NSString stringWithFormat: @"%@\n\n\n\n%@\n%@\n\n%@",
_NS(INTF_ABOUT_MSG),
_NS("VLC was brought to you by:"),
[NSString stringWithUTF8String: psz_authors],
[NSString stringWithUTF8String: psz_thanks]]];
[o_credits_textview setString: [NSString stringWithFormat: @"%@\n\n\n\n\n\n%@\n\n%@\n\n",
[_NS(INTF_ABOUT_MSG) stringByReplacingOccurrencesOfString:@"\n" withString:@" "],
authors,
[[NSString stringWithUTF8String: psz_thanks] stringByReplacingOccurrencesOfString:@"\n" withString:@" " options:0 range:NSRangeFromString(@"680 2")]]];
/* Setup the window */
[o_credits_textview setDrawsBackground: NO];
......@@ -112,10 +128,10 @@ static VLAboutBox *_o_sharedInstance = nil;
[o_about_window setMenu:nil];
[o_about_window center];
[o_gpl_btn setTitle: _NS("License")];
b_isSetUp = YES;
}
/* Show the window */
b_restart = YES;
[o_credits_textview scrollPoint:NSMakePoint( 0, 0 )];
......@@ -141,7 +157,7 @@ static VLAboutBox *_o_sharedInstance = nil;
if( b_restart )
{
/* Reset the starttime */
i_start = [NSDate timeIntervalSinceReferenceDate] + 5.0;
i_start = [NSDate timeIntervalSinceReferenceDate] + 4.0;
f_current = 0;
f_end = [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height;
b_restart = NO;
......@@ -149,17 +165,23 @@ static VLAboutBox *_o_sharedInstance = nil;
if( [NSDate timeIntervalSinceReferenceDate] >= i_start )
{
/* Scroll to the position */
[o_credits_textview scrollPoint:NSMakePoint( 0, f_current )];
/* Increment the scroll position */
f_current += 0.005;
/* Scroll to the position */
[o_credits_textview scrollPoint:NSMakePoint( 0, f_current )];
/* If at end, restart at the top */
if( f_current >= f_end )
{
[o_credits_textview scrollPoint:NSMakePoint( 0, 0 )];
b_restart = YES;
/* f_end may be wrong on first run, so don't trust it too much */
if( f_end == [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height )
{
b_restart = YES;
[o_credits_textview scrollPoint:NSMakePoint( 0, 0 )];
}
else
f_end = [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height;
}
}
}
......
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