1
1
/*****************************************************************************
2
2
* about.m: MacOS X About Panel
3
3
*****************************************************************************
4
* Copyright (C) 2001-2005 the VideoLAN team
5
* $Id: 23e169bf3b64ff1e397c5813e4159d429ba1d164 $
4
* Copyright (C) 2001-2007 the VideoLAN team
7
7
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
8
* Felix Paul Kühne <fkuehne -at- videolan.org>
9
10
* This program is free software; you can redistribute it and/or modify
10
11
* it under the terms of the GNU General Public License as published by
11
12
* the Free Software Foundation; either version 2 of the License, or
12
13
* (at your option) any later version.
14
15
* This program is distributed in the hope that it will be useful,
15
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47
50
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
52
55
if (_o_sharedInstance) {
55
58
_o_sharedInstance = [super init];
58
61
return _o_sharedInstance;
64
/*****************************************************************************
66
*****************************************************************************/
66
NSString *o_thanks_path;
68
/* Get the info dictionary (Info.plist) */
69
o_info_dict = [[NSBundle mainBundle] infoDictionary];
72
/* we want to know when VLC wants to quit to prevent a crash while scrolling our credits */
73
[[NSNotificationCenter defaultCenter] addObserver: self
74
selector: @selector(VLCWillTerminate)
75
name: NSApplicationWillTerminateNotification
71
78
/* 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")];
79
NSDictionary *o_local_dict;
80
o_local_dict = [[NSBundle mainBundle] localizedInfoDictionary];
82
/* Setup the copyright field */
83
[o_copyright_field setStringValue: [o_local_dict objectForKey:@"NSHumanReadableCopyright"]];
85
/* Set the box title */
86
[o_about_window setTitle: _NS("About VLC media player")];
82
88
/* setup the creator / revision field */
83
89
if( VLC_Changeset() != "exported" )
90
[o_revision_field setStringValue:
91
[NSString stringWithFormat: _NS("Compiled by %s, based on Git commit %s"),
92
VLC_CompileBy(), VLC_Changeset()]];
84
94
[o_revision_field setStringValue:
85
[NSString stringWithFormat: _NS("Compiled by %s, based on SVN revision %s"), VLC_CompileBy(), VLC_Changeset()]];
87
[o_revision_field setStringValue: [NSString stringWithFormat: _NS("Compiled by %s"), VLC_CompileBy()]];
95
[NSString stringWithFormat: _NS("Compiled by %s"), VLC_CompileBy()]];
89
97
/* Setup the nameversion field */
90
o_name_version = [NSString stringWithFormat:@"Version %s (%s)", VLC_Version(), PLATFORM];
91
[o_name_version_field setStringValue: o_name_version];
93
/* Setup our credits */
94
o_credits_path = [[NSBundle mainBundle] pathForResource:@"AUTHORS" ofType:nil];
95
o_credits = [[NSString alloc] initWithData: [NSData dataWithContentsOfFile: o_credits_path ] encoding:NSUTF8StringEncoding];
97
/* Parse the authors string */
98
NSMutableString *o_outString = [NSMutableString stringWithFormat: @"%@\n\n", _NS(INTF_ABOUT_MSG)];
99
NSScanner *o_scan_credits = [NSScanner scannerWithString: o_credits];
100
NSCharacterSet *o_stopSet = [NSCharacterSet characterSetWithCharactersInString:@"\n\r"];
102
while( ![o_scan_credits isAtEnd] )
105
NSScanner *o_scan_person;
107
[o_scan_credits scanUpToString:@"N:" intoString: nil];
108
[o_scan_credits scanString:@"N:" intoString: nil];
109
[o_scan_credits scanUpToString:@"N:" intoString: &o_person];
110
o_scan_person = [NSScanner scannerWithString: o_person];
114
NSMutableString *o_jobs = [NSMutableString string];
117
[o_scan_person scanUpToCharactersFromSet: o_stopSet intoString: &o_name];
118
[o_scan_person scanString:@"E:" intoString: nil];
119
[o_scan_person scanUpToCharactersFromSet: o_stopSet intoString: &o_email];
120
[o_scan_person scanUpToString:@"D:" intoString: &o_next];
121
[o_scan_person scanUpToString:@":" intoString: &o_next];
122
[o_scan_person scanString:@":" intoString: nil];
124
while ( [o_next characterAtIndex:[o_next length] - 1] == 'D' )
127
[o_scan_person scanUpToCharactersFromSet: o_stopSet intoString: &o_job ];
128
[o_jobs appendFormat: @"%@, ", o_job];
129
[o_scan_person scanUpToString:@":" intoString: &o_next];
130
[o_scan_person scanString:@":" intoString: nil];
133
[o_outString appendFormat: @"%@ <%@>\n%@\n\n", o_name, o_email, o_jobs];
136
/* Parse the thanks string */
137
o_thanks_path = [[NSBundle mainBundle] pathForResource:@"THANKS" ofType:nil];
138
o_thanks = [[NSString alloc] initWithData: [NSData dataWithContentsOfFile:
139
o_thanks_path ] encoding:NSUTF8StringEncoding];
141
NSScanner *o_scan_thanks = [NSScanner scannerWithString: o_thanks];
142
[o_scan_thanks scanUpToCharactersFromSet: o_stopSet intoString: nil];
144
while( ![o_scan_thanks isAtEnd] )
149
[o_scan_thanks scanUpToString:@" - " intoString: &o_person];
150
[o_scan_thanks scanString:@" - " intoString: nil];
151
[o_scan_thanks scanUpToCharactersFromSet: o_stopSet intoString: &o_job];
152
[o_outString appendFormat: @"%@\n%@\n\n", o_person, o_job];
154
[o_credits_textview setString:o_outString];
156
/* Setup the copyright field */
157
o_copyright = [o_local_dict objectForKey:@"NSHumanReadableCopyright"];
158
[o_copyright_field setStringValue:o_copyright];
98
[o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VLC_Version(), 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]]];
160
107
/* Setup the window */
161
108
[o_credits_textview setDrawsBackground: NO];
198
if ([NSDate timeIntervalSinceReferenceDate] >= i_start)
148
if( [NSDate timeIntervalSinceReferenceDate] >= i_start )
200
150
/* Scroll to the position */
201
151
[o_credits_textview scrollPoint:NSMakePoint( 0, f_current )];
203
153
/* Increment the scroll position */
204
154
f_current += 0.005;
206
156
/* If at end, restart at the top */
207
if ( f_current >= f_end )
157
if( f_current >= f_end )
164
- (void)VLCWillTerminate
166
[o_scroll_timer invalidate];
167
[[NSNotificationCenter defaultCenter] removeObserver: self];
170
/*****************************************************************************
171
* VLC GPL Window, action called from the about window and the help menu
172
*****************************************************************************/
174
- (IBAction)showGPL:(id)sender
176
[o_gpl_window setTitle: _NS("License")];
177
[o_gpl_field setString: [NSString stringWithUTF8String: psz_license]];
179
[o_gpl_window center];
180
[o_gpl_window makeKeyAndOrderFront: sender];
183
/*****************************************************************************
184
* VLC Generic Help Window
185
*****************************************************************************/
189
[o_help_window setTitle: _NS("VLC media player Help")];
190
[o_help_fwd_btn setToolTip: _NS("Next")];
191
[o_help_bwd_btn setToolTip: _NS("Previous")];
192
[o_help_home_btn setToolTip: _NS("Index")];
194
[o_help_window makeKeyAndOrderFront: self];
196
[[o_help_web_view mainFrame] loadHTMLString: _NS(I_LONGHELP)
197
baseURL: [NSURL URLWithString:@"http://videolan.org"]];
200
- (IBAction)helpGoHome:(id)sender
202
[[o_help_web_view mainFrame] loadHTMLString: _NS(I_LONGHELP)
203
baseURL: [NSURL URLWithString:@"http://videolan.org"]];
206
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
208
/* delegate to update button states (we're the frameLoadDelegate for our help's webview)« */
209
[o_help_fwd_btn setEnabled: [o_help_web_view canGoForward]];
210
[o_help_bwd_btn setEnabled: [o_help_web_view canGoBack]];