Commit 1ace73b7 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: modernize the about dialog to match the Qt intf

parent 68236bf6
...@@ -1046,7 +1046,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -1046,7 +1046,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (IBAction)showLicense:(id)sender - (IBAction)showLicense:(id)sender
{ {
[self initAbout]; [self initAbout];
[o_about showGPL: sender]; [o_about showGPL];
} }
- (IBAction)viewHelp:(id)sender - (IBAction)viewHelp:(id)sender
......
/***************************************************************************** /*****************************************************************************
* about.h: MacOS X About Panel * about.h: MacOS X About Panel
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2012 VLC authors and VideoLAN * Copyright (C) 2001-2013 VLC authors and VideoLAN
* $Id$ * $Id$
* *
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net> * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
...@@ -37,8 +37,11 @@ ...@@ -37,8 +37,11 @@
IBOutlet id o_credits_textview; IBOutlet id o_credits_textview;
IBOutlet id o_credits_scrollview; IBOutlet id o_credits_scrollview;
IBOutlet id o_gpl_btn; IBOutlet id o_gpl_btn;
IBOutlet id o_credits_btn;
IBOutlet id o_authors_btn;
IBOutlet id o_name_field; IBOutlet id o_name_field;
id o_color_backdrop; IBOutlet id o_icon_view;
IBOutlet id o_joinus_txt;
NSTimer *o_scroll_timer; NSTimer *o_scroll_timer;
float f_current; float f_current;
...@@ -47,26 +50,21 @@ ...@@ -47,26 +50,21 @@
BOOL b_restart; BOOL b_restart;
BOOL b_isSetUp; BOOL b_isSetUp;
NSString *o_authors;
/* generic help window */ /* generic help window */
IBOutlet id o_help_window; IBOutlet id o_help_window;
IBOutlet WebView *o_help_web_view; //we may _not_ use id here because of method name collisions IBOutlet WebView *o_help_web_view; //we may _not_ use id here because of method name collisions
IBOutlet id o_help_bwd_btn; IBOutlet id o_help_bwd_btn;
IBOutlet id o_help_fwd_btn; IBOutlet id o_help_fwd_btn;
IBOutlet id o_help_home_btn; IBOutlet id o_help_home_btn;
/* licence window */
IBOutlet id o_gpl_window;
IBOutlet id o_gpl_field;
} }
+ (VLAboutBox *)sharedInstance; + (VLAboutBox *)sharedInstance;
- (void)showAbout; - (void)showAbout;
- (void)showHelp; - (void)showHelp;
- (IBAction)showGPL:(id)sender; - (void)showGPL;
- (IBAction)buttonAction:(id)sender;
- (IBAction)helpGoHome:(id)sender; - (IBAction)helpGoHome:(id)sender;
@end @end
@interface VLAboutColoredBackdrop : NSView
@end
/***************************************************************************** /*****************************************************************************
* about.m: MacOS X About Panel * about.m: MacOS X About Panel
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2012 VLC authors and VideoLAN * Copyright (C) 2001-2013 VLC authors and VideoLAN
* $Id$ * $Id$
* *
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net> * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
...@@ -63,8 +63,8 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -63,8 +63,8 @@ static VLAboutBox *_o_sharedInstance = nil;
- (void) dealloc - (void) dealloc
{ {
[o_authors release];
[[NSNotificationCenter defaultCenter] removeObserver: self]; [[NSNotificationCenter defaultCenter] removeObserver: self];
[o_color_backdrop release];
[super dealloc]; [super dealloc];
} }
...@@ -72,10 +72,6 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -72,10 +72,6 @@ static VLAboutBox *_o_sharedInstance = nil;
{ {
if (!OSX_SNOW_LEOPARD) if (!OSX_SNOW_LEOPARD)
[o_about_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary]; [o_about_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
/* add a colored backdrop to get a white window background */
o_color_backdrop = [[VLAboutColoredBackdrop alloc] initWithFrame: [[o_about_window contentView] frame]];
[[o_about_window contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: nil];
} }
/***************************************************************************** /*****************************************************************************
...@@ -104,7 +100,7 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -104,7 +100,7 @@ static VLAboutBox *_o_sharedInstance = nil;
#else #else
compiler = [NSString stringWithFormat:@"gcc %s", __VERSION__]; compiler = [NSString stringWithFormat:@"gcc %s", __VERSION__];
#endif #endif
[o_revision_field setStringValue: [NSString stringWithFormat: _NS("Compiled by %@ with %@"), [NSString stringWithUTF8String:VLC_CompileBy()], compiler]]; [o_revision_field setStringValue: [NSString stringWithFormat: _NS("Compiled by %s with %@"), VLC_CompileBy(), compiler]];
/* Setup the nameversion field */ /* Setup the nameversion field */
[o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VERSION_MESSAGE, PLATFORM]]; [o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VERSION_MESSAGE, PLATFORM]];
...@@ -117,13 +113,23 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -117,13 +113,23 @@ static VLAboutBox *_o_sharedInstance = nil;
[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:@","]]]; [tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]]];
} }
NSString *authors = [tmpArray componentsJoinedByString:@"\n\n"]; o_authors = [tmpArray componentsJoinedByString:@"\n\n"];
[o_authors retain];
/* setup the authors and thanks field */
[o_credits_textview setString: [NSString stringWithFormat: @"%@\n\n\n\n\n\n%@\n\n%@\n\n", /* setup join us! */
[_NS(INTF_ABOUT_MSG) stringByReplacingOccurrencesOfString:@"\n" withString:@" "], NSString *joinus = [NSString stringWithString:_NS("<p>VLC media player is a free and open source media player, encoder and streamer made by the volunteers of the "
authors, "<a href=\"http://www.videolan.org/\"><span style=\" text-decoration: underline; color:#0057ae;\">VideoLAN</span>"
[[NSString stringWithUTF8String: psz_thanks] stringByReplacingOccurrencesOfString:@"\n" withString:@" " options:0 range:NSRangeFromString(@"680 2")]]]; "</a> community.</p><p>VLC uses its internal codecs and works on essentially every popular platform and can read"
"almost every files, CDs, DVDs, network streams, capture cards and other media formats!</p><p>"
"<a href=\"http://www.videolan.org/contribute/\"><span style=\" text-decoration: underline; color:#0057ae;\">Help "
"and join us!</span></a>")];
NSAttributedString *joinus_readytorender = [[NSAttributedString alloc] initWithHTML:[joinus dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES] documentAttributes:NULL];
[o_joinus_txt setAllowsEditingTextAttributes: YES];
[o_joinus_txt setSelectable: YES];
[o_joinus_txt setAttributedStringValue:joinus_readytorender];
[joinus_readytorender release];
[o_credits_textview setString: @""];
/* Setup the window */ /* Setup the window */
[o_credits_textview setDrawsBackground: NO]; [o_credits_textview setDrawsBackground: NO];
...@@ -133,11 +139,31 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -133,11 +139,31 @@ static VLAboutBox *_o_sharedInstance = nil;
[o_about_window center]; [o_about_window center];
[o_gpl_btn setTitle: _NS("License")]; [o_gpl_btn setTitle: _NS("License")];
if (config_GetInt(VLCIntf, "macosx-icon-change")) {
/* After day 354 of the year, the usual VLC cone is replaced by another cone
* wearing a Father Xmas hat.
* Note: this icon doesn't represent an endorsement of The Coca-Cola Company.
*/
NSCalendar *gregorian =
[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSUInteger dayOfYear = [gregorian ordinalityOfUnit:NSDayCalendarUnit inUnit:NSYearCalendarUnit forDate:[NSDate date]];
[gregorian release];
if (dayOfYear >= 354)
[o_icon_view setImage: [NSImage imageNamed:@"vlc-xmas"]];
}
b_isSetUp = YES; b_isSetUp = YES;
} }
/* Show the window */ /* Show the window */
b_restart = YES; b_restart = YES;
[o_credits_scrollview setHidden:YES];
[o_credits_textview setHidden:YES];
[o_joinus_txt setHidden:NO];
[o_copyright_field setHidden:NO];
[o_revision_field setHidden:NO];
[o_name_version_field setHidden:NO];
[o_credits_textview scrollPoint:NSMakePoint(0, 0)]; [o_credits_textview scrollPoint:NSMakePoint(0, 0)];
[o_about_window makeKeyAndOrderFront: nil]; [o_about_window makeKeyAndOrderFront: nil];
} }
...@@ -177,6 +203,7 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -177,6 +203,7 @@ static VLAboutBox *_o_sharedInstance = nil;
if (f_current >= f_end) { if (f_current >= f_end) {
/* f_end may be wrong on first run, so don't trust it too much */ /* 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) { if (f_end == [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height) {
sleep(2);
b_restart = YES; b_restart = YES;
[o_credits_textview scrollPoint:NSMakePoint(0, 0)]; [o_credits_textview scrollPoint:NSMakePoint(0, 0)];
} else } else
...@@ -185,17 +212,41 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -185,17 +212,41 @@ static VLAboutBox *_o_sharedInstance = nil;
} }
} }
- (IBAction)buttonAction:(id)sender
{
[o_credits_scrollview setHidden:NO];
[o_credits_textview setHidden:NO];
[o_joinus_txt setHidden:YES];
[o_copyright_field setHidden:YES];
[o_revision_field setHidden:YES];
[o_name_version_field setHidden:YES];
if (sender == o_authors_btn)
[o_credits_textview setString:o_authors];
else if (sender == o_credits_btn)
[o_credits_textview setString:[[NSString stringWithUTF8String: psz_thanks] stringByReplacingOccurrencesOfString:@"\n" withString:@" " options:0 range:NSRangeFromString(@"680 2")]];
else
[o_credits_textview setString:[NSString stringWithUTF8String: psz_license]];
[o_credits_textview scrollPoint:NSMakePoint(0, 0)];
b_restart = YES;
}
/***************************************************************************** /*****************************************************************************
* VLC GPL Window, action called from the about window and the help menu * VLC GPL Window, action called from the about window and the help menu
*****************************************************************************/ *****************************************************************************/
- (IBAction)showGPL:(id)sender - (void)showGPL
{ {
[o_gpl_window setTitle: _NS("License")]; [self showAbout];
[o_gpl_field setString: [NSString stringWithUTF8String: psz_license]]; [o_credits_scrollview setHidden:NO];
[o_credits_textview setHidden:NO];
[o_joinus_txt setHidden:YES];
[o_credits_textview setString:[NSString stringWithUTF8String: psz_license]];
[o_gpl_window center]; [o_credits_textview scrollPoint:NSMakePoint(0, 0)];
[o_gpl_window makeKeyAndOrderFront: sender]; b_restart = YES;
} }
/***************************************************************************** /*****************************************************************************
...@@ -229,12 +280,3 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -229,12 +280,3 @@ static VLAboutBox *_o_sharedInstance = nil;
} }
@end @end
@implementation VLAboutColoredBackdrop
- (void)drawRect:(NSRect)rect {
[[NSColor whiteColor] setFill];
NSRectFill(rect);
}
@end
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