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>
8 * Felix Paul K
\9fhne <fkuehne -at- videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
30 #include <vlc_intf_strings.h>
31 #include <vlc_about.h>
32 #import <WebKit/WebKit.h>
35 #define PLATFORM "Intel"
37 #define PLATFORM "Intel"
39 #define PLATFORM "PowerPC"
42 /*****************************************************************************
43 * VLAboutBox implementation
44 *****************************************************************************/
45 @implementation VLAboutBox
47 static VLAboutBox *_o_sharedInstance = nil;
49 + (VLAboutBox *)sharedInstance
51 return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
56 if (_o_sharedInstance) {
59 _o_sharedInstance = [super init];
62 return _o_sharedInstance;
65 /*****************************************************************************
67 *****************************************************************************/
73 NSDictionary *o_local_dict;
75 /* Get the localized info dictionary (InfoPlist.strings) */
76 o_local_dict = [[NSBundle mainBundle] localizedInfoDictionary];
78 /* Setup the name field */
79 o_name_field = [o_local_dict objectForKey:@"CFBundleName"];
81 /* Set the about box title */
82 [o_about_window setTitle:_NS("About VLC media player")];
84 /* setup the creator / revision field */
85 if( VLC_Changeset() != "exported" )
86 [o_revision_field setStringValue: [NSString stringWithFormat: \
87 _NS("Compiled by %s, based on SVN revision %s"), VLC_CompileBy(), \
90 [o_revision_field setStringValue: [NSString stringWithFormat: \
91 _NS("Compiled by %s"), VLC_CompileBy()]];
93 /* Setup the nameversion field */
94 [o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VLC_Version(), PLATFORM]];
96 /* setup the authors and thanks field */
97 [o_credits_textview setString: [NSString stringWithFormat: @"%@\n\n\n\n%@\n%@\n\n%@",
99 _NS("VLC was brought to you by:"),
100 [NSString stringWithUTF8String: psz_authors],
101 [NSString stringWithUTF8String: psz_thanks]]];
103 /* Setup the copyright field */
104 [o_copyright_field setStringValue: [o_local_dict objectForKey:@"NSHumanReadableCopyright"]];
106 /* Setup the window */
107 [o_credits_textview setDrawsBackground: NO];
108 [o_credits_scrollview setDrawsBackground: NO];
109 [o_about_window setExcludedFromWindowsMenu:YES];
110 [o_about_window setMenu:nil];
111 [o_about_window center];
112 [o_gpl_btn setTitle: _NS("License")];
117 /* Show the window */
119 [o_about_window makeKeyAndOrderFront: nil];
122 - (void)windowDidBecomeKey:(NSNotification *)notification
124 o_scroll_timer = [NSTimer scheduledTimerWithTimeInterval: 1/6
126 selector:@selector(scrollCredits:)
131 - (void)windowDidResignKey:(NSNotification *)notification
133 [o_scroll_timer invalidate];
136 - (void)scrollCredits:(NSTimer *)timer
140 /* Reset the starttime */
141 i_start = [NSDate timeIntervalSinceReferenceDate] + 3.0;
143 f_end = [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height;
147 if( [NSDate timeIntervalSinceReferenceDate] >= i_start )
149 /* Scroll to the position */
150 [o_credits_textview scrollPoint:NSMakePoint( 0, f_current )];
152 /* Increment the scroll position */
155 /* If at end, restart at the top */
156 if( f_current >= f_end )
163 /*****************************************************************************
164 * VLC GPL Window, action called from the about window and the help menu
165 *****************************************************************************/
167 - (IBAction)showGPL:(id)sender
169 [o_gpl_window setTitle: _NS("License")];
170 [o_gpl_field setString: [NSString stringWithUTF8String: psz_license]];
172 [o_gpl_window center];
173 [o_gpl_window makeKeyAndOrderFront: sender];
176 /*****************************************************************************
177 * VLC Generic Help Window
178 *****************************************************************************/
182 [o_help_window setTitle: _NS("VLC media player Help")];
183 [o_help_window makeKeyAndOrderFront: self];
185 [[o_help_web_view mainFrame] loadHTMLString: [NSString stringWithString: _NS(I_LONGHELP)]
186 baseURL: [NSURL URLWithString:@"http://videolan.org"]];