~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to modules/gui/macosx/about.m

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
5
 * $Id$
6
6
 *
7
7
 * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
 
8
 *          Felix Paul Kühne <fkuehne -at- videolan.org>
8
9
 *
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.
13
 
 * 
 
14
 *
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
24
25
/*****************************************************************************
25
26
 * Preamble
26
27
 *****************************************************************************/
27
 
#include "intf.h"
28
 
#include "about.h"
 
28
#import "intf.h"
 
29
#import "about.h"
 
30
#import <vlc_intf_strings.h>
 
31
#import <vlc_about.h>
29
32
 
30
33
#ifdef __x86_64__
31
34
#define PLATFORM "Intel"
36
39
#endif
37
40
 
38
41
/*****************************************************************************
39
 
 * VLAboutBox implementation 
 
42
 * VLAboutBox implementation
40
43
 *****************************************************************************/
41
44
@implementation VLAboutBox
42
45
 
47
50
    return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
48
51
}
49
52
 
50
 
- (id)init 
 
53
- (id)init
51
54
{
52
55
    if (_o_sharedInstance) {
53
56
        [self dealloc];
54
57
    } else {
55
58
        _o_sharedInstance = [super init];
56
59
    }
57
 
    
 
60
 
58
61
    return _o_sharedInstance;
59
62
}
60
63
 
61
 
- (void)showPanel
62
 
{    
63
 
    if (!o_credits_path)
 
64
/*****************************************************************************
 
65
* VLC About Window
 
66
*****************************************************************************/
 
67
 
 
68
- (void)showAbout
 
69
{
 
70
    if(! b_isSetUp )
64
71
    {
65
 
        NSString *o_name;
66
 
        NSString *o_thanks_path;
67
 
 
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
 
76
                                                   object: nil];
70
77
        
71
78
        /* Get the localized info dictionary (InfoPlist.strings) */
72
 
        localInfoBundle = CFBundleGetMainBundle();
73
 
        o_local_dict = (NSDictionary *)
74
 
                        CFBundleGetLocalInfoDictionary( localInfoBundle );
75
 
        
76
 
        /* Setup the name field */
77
 
        o_name = [o_local_dict objectForKey:@"CFBundleName"];
78
 
 
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];
 
81
 
 
82
        /* Setup the copyright field */
 
83
        [o_copyright_field setStringValue: [o_local_dict objectForKey:@"NSHumanReadableCopyright"]];
 
84
 
 
85
        /* Set the box title */
 
86
        [o_about_window setTitle: _NS("About VLC media player")];
81
87
 
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()]];
 
93
        else
84
94
            [o_revision_field setStringValue: 
85
 
                [NSString stringWithFormat: _NS("Compiled by %s, based on SVN revision %s"), VLC_CompileBy(), VLC_Changeset()]];
86
 
        else
87
 
            [o_revision_field setStringValue: [NSString stringWithFormat: _NS("Compiled by %s"), VLC_CompileBy()]];
88
 
 
 
95
                [NSString stringWithFormat: _NS("Compiled by %s"), VLC_CompileBy()]];
 
96
 
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];
92
 
 
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];
96
 
 
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"];
101
 
 
102
 
        while( ![o_scan_credits isAtEnd] )
103
 
        {
104
 
            NSString *o_person;
105
 
            NSScanner *o_scan_person;
106
 
    
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];
111
 
 
112
 
            NSString *o_name;
113
 
            NSString *o_email;
114
 
            NSMutableString *o_jobs = [NSMutableString string];
115
 
            NSString *o_next;
116
 
 
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];
123
 
   
124
 
            while ( [o_next characterAtIndex:[o_next length] - 1] == 'D' )
125
 
            {
126
 
                NSString *o_job;
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];
131
 
            }
132
 
           
133
 
            [o_outString appendFormat: @"%@ <%@>\n%@\n\n", o_name, o_email, o_jobs];
134
 
        }
135
 
       
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];
140
 
       
141
 
        NSScanner *o_scan_thanks = [NSScanner scannerWithString: o_thanks];
142
 
        [o_scan_thanks scanUpToCharactersFromSet: o_stopSet intoString: nil];
143
 
       
144
 
        while( ![o_scan_thanks isAtEnd] )
145
 
        {
146
 
            NSString *o_person;
147
 
            NSString *o_job;
148
 
           
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];
153
 
        }
154
 
        [o_credits_textview setString:o_outString];
155
 
       
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]];
 
99
 
 
100
        /* setup the authors and thanks field */
 
101
        [o_credits_textview setString: [NSString stringWithFormat: @"%@\n\n\n\n%@\n%@\n\n%@", 
 
102
                                            _NS(INTF_ABOUT_MSG), 
 
103
                                            _NS("VLC was brought to you by:"),
 
104
                                            [NSString stringWithUTF8String: psz_authors], 
 
105
                                            [NSString stringWithUTF8String: psz_thanks]]];
159
106
 
160
107
        /* Setup the window */
161
108
        [o_credits_textview setDrawsBackground: NO];
163
110
        [o_about_window setExcludedFromWindowsMenu:YES];
164
111
        [o_about_window setMenu:nil];
165
112
        [o_about_window center];
 
113
        [o_gpl_btn setTitle: _NS("License")];
 
114
        
 
115
        b_isSetUp = YES;
166
116
    }
167
 
 
 
117
 
168
118
    /* Show the window */
169
119
    b_restart = YES;
170
 
    [o_about_window makeKeyAndOrderFront:nil];
 
120
    [o_about_window makeKeyAndOrderFront: nil];
171
121
}
172
122
 
173
123
- (void)windowDidBecomeKey:(NSNotification *)notification
174
124
{
175
 
    o_scroll_timer = [NSTimer scheduledTimerWithTimeInterval:1/6
176
 
                           target:self 
177
 
                           selector:@selector(scrollCredits:) 
178
 
                           userInfo:nil 
179
 
                           repeats:YES];
 
125
    o_scroll_timer = [NSTimer scheduledTimerWithTimeInterval: 1/6
 
126
                                                      target:self
 
127
                                                    selector:@selector(scrollCredits:)
 
128
                                                    userInfo:nil
 
129
                                                     repeats:YES];
180
130
}
181
131
 
182
132
- (void)windowDidResignKey:(NSNotification *)notification
186
136
 
187
137
- (void)scrollCredits:(NSTimer *)timer
188
138
{
189
 
    if (b_restart)
 
139
    if( b_restart )
190
140
    {
191
141
        /* Reset the starttime */
192
142
        i_start = [NSDate timeIntervalSinceReferenceDate] + 3.0;
195
145
        b_restart = NO;
196
146
    }
197
147
 
198
 
    if ([NSDate timeIntervalSinceReferenceDate] >= i_start)
 
148
    if( [NSDate timeIntervalSinceReferenceDate] >= i_start )
199
149
    {
200
150
        /* Scroll to the position */
201
151
        [o_credits_textview scrollPoint:NSMakePoint( 0, f_current )];
202
 
        
 
152
 
203
153
        /* Increment the scroll position */
204
154
        f_current += 0.005;
205
 
        
 
155
 
206
156
        /* If at end, restart at the top */
207
 
        if ( f_current >= f_end )
 
157
        if( f_current >= f_end )
208
158
        {
209
159
            b_restart = YES;
210
160
        }
211
161
    }
212
162
}
213
163
 
 
164
- (void)VLCWillTerminate
 
165
{
 
166
    [o_scroll_timer invalidate];
 
167
    [[NSNotificationCenter defaultCenter] removeObserver: self];
 
168
}
 
169
 
 
170
/*****************************************************************************
 
171
* VLC GPL Window, action called from the about window and the help menu
 
172
*****************************************************************************/
 
173
 
 
174
- (IBAction)showGPL:(id)sender
 
175
{
 
176
    [o_gpl_window setTitle: _NS("License")];
 
177
    [o_gpl_field setString: [NSString stringWithUTF8String: psz_license]];
 
178
    
 
179
    [o_gpl_window center];
 
180
    [o_gpl_window makeKeyAndOrderFront: sender];
 
181
}
 
182
 
 
183
/*****************************************************************************
 
184
* VLC Generic Help Window
 
185
*****************************************************************************/
 
186
 
 
187
- (void)showHelp
 
188
{
 
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")];
 
193
 
 
194
    [o_help_window makeKeyAndOrderFront: self];
 
195
    
 
196
    [[o_help_web_view mainFrame] loadHTMLString: _NS(I_LONGHELP)
 
197
                                        baseURL: [NSURL URLWithString:@"http://videolan.org"]];
 
198
}
 
199
 
 
200
- (IBAction)helpGoHome:(id)sender
 
201
{
 
202
    [[o_help_web_view mainFrame] loadHTMLString: _NS(I_LONGHELP)
 
203
                                        baseURL: [NSURL URLWithString:@"http://videolan.org"]];
 
204
}
 
205
 
 
206
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
 
207
{
 
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]];
 
211
}
 
212
 
214
213
@end