1 /*****************************************************************************
2 * about.m: MacOS X About Panel
3 *****************************************************************************
4 * Copyright (C) 2001-2007 the VideoLAN team
7 * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
29 #include <vlc_intf_strings.h>
30 #include <vlc_about.h>
31 #import <WebKit/WebKit.h>
33 /*****************************************************************************
34 * VLAboutBox implementation
35 *****************************************************************************/
36 @implementation VLAboutBox
38 static VLAboutBox *_o_sharedInstance = nil;
40 + (VLAboutBox *)sharedInstance
42 return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
47 if (_o_sharedInstance) {
50 _o_sharedInstance = [super init];
53 return _o_sharedInstance;
56 /*****************************************************************************
58 *****************************************************************************/
68 /* Get the info dictionary (Info.plist) */
69 o_info_dict = [[NSBundle mainBundle] infoDictionary];
71 /* Get the localized info dictionary (InfoPlist.strings) */
72 localInfoBundle = CFBundleGetMainBundle();
73 o_local_dict = (NSDictionary *)
74 CFBundleGetLocalInfoDictionary( localInfoBundle );
76 /* Setup the name field */
77 o_name = [o_local_dict objectForKey:@"CFBundleName"];
79 /* Set the about box title */
80 [o_about_window setTitle:_NS("About VLC media player")];
82 #ifdef __powerpc__ || __ppc__ || __ppc64__
83 o_platform = @"PowerPC";
85 o_platform = @"Intel";
88 /* setup the creator / revision field */
89 if( VLC_Changeset() != "exported" )
90 [o_revision_field setStringValue: [NSString stringWithFormat: \
91 _NS("Compiled by %s, based on SVN revision %s"), VLC_CompileBy(), \
94 [o_revision_field setStringValue: [NSString stringWithFormat: \
95 _NS("Compiled by %s"), VLC_CompileBy()]];
97 /* Setup the nameversion field */
98 [o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%@)", VLC_Version(), o_platform]];
100 /* setup the authors and thanks field */
101 [o_credits_textview setString: [NSString stringWithFormat: @"%@\n\n\n\n%@\n%@\n\n%@",
103 _NS("VLC was brought to you by:"),
104 [NSString stringWithUTF8String: psz_authors],
105 [NSString stringWithUTF8String: psz_thanks]]];
107 /* Setup the copyright field */
108 o_copyright = [o_local_dict objectForKey:@"NSHumanReadableCopyright"];
109 [o_copyright_field setStringValue:o_copyright];
111 /* Setup the window */
112 [o_credits_textview setDrawsBackground: NO];
113 [o_credits_scrollview setDrawsBackground: NO];
114 [o_about_window setExcludedFromWindowsMenu:YES];
115 [o_about_window setMenu:nil];
116 [o_about_window center];
119 /* Show the window */
121 [o_about_window makeKeyAndOrderFront:nil];
124 - (void)windowDidBecomeKey:(NSNotification *)notification
126 o_scroll_timer = [NSTimer scheduledTimerWithTimeInterval:1/6
128 selector:@selector(scrollCredits:)
133 - (void)windowDidResignKey:(NSNotification *)notification
135 [o_scroll_timer invalidate];
138 - (void)scrollCredits:(NSTimer *)timer
142 /* Reset the starttime */
143 i_start = [NSDate timeIntervalSinceReferenceDate] + 3.0;
145 f_end = [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height;
149 if ([NSDate timeIntervalSinceReferenceDate] >= i_start)
151 /* Scroll to the position */
152 [o_credits_textview scrollPoint:NSMakePoint( 0, f_current )];
154 /* Increment the scroll position */
157 /* If at end, restart at the top */
158 if ( f_current >= f_end )
165 /*****************************************************************************
166 * VLC Generic Help Window
167 *****************************************************************************/
171 [o_help_window setTitle: _NS("VLC media player Help")];
172 [o_help_window makeKeyAndOrderFront: self];
174 [[o_help_web_view mainFrame] loadHTMLString: [NSString stringWithString: _NS(I_LONGHELP)]
175 baseURL: [NSURL URLWithString:@"http://videolan.org"]];