]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/about.m
macosx: let the about window show whether VLC runs in 32 or 64 bit mode
[vlc] / modules / gui / macosx / about.m
index f2e236cfb7c314a9303732b1fc9970054eba27a1..dc0ef540d7745ef432cf48cc9c48c0384e37c34a 100644 (file)
@@ -5,7 +5,7 @@
  * $Id$
  *
  * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
- *          Felix Paul K\9fhne <fkuehne -at- videolan.org>
+ *          Felix Paul Kühne <fkuehne -at- videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include "intf.h"
-#include "about.h"
-#include <vlc_intf_strings.h>
-#include <vlc_about.h>
-#import <WebKit/WebKit.h>
+#import "intf.h"
+#import "about.h"
+#import <vlc_intf_strings.h>
+#import <vlc_about.h>
 
 #ifdef __x86_64__
-#define PLATFORM "Intel"
+#define PLATFORM "Intel 64bit"
 #elif __i386__
-#define PLATFORM "Intel"
+#define PLATFORM "Intel 32bit"
 #else
-#define PLATFORM "PowerPC"
+#define PLATFORM "PowerPC 32bit"
 #endif
 
 /*****************************************************************************
@@ -70,25 +69,25 @@ static VLAboutBox *_o_sharedInstance = nil;
 {
     if(! b_isSetUp )
     {
-        NSDictionary *o_local_dict;
-
+        /* we want to know when VLC wants to quit to prevent a crash while scrolling our credits */
+        [[NSNotificationCenter defaultCenter] addObserver: self
+                                                 selector: @selector(VLCWillTerminate)
+                                                     name: NSApplicationWillTerminateNotification
+                                                   object: nil];
+        
         /* Get the localized info dictionary (InfoPlist.strings) */
+        NSDictionary *o_local_dict;
         o_local_dict = [[NSBundle mainBundle] localizedInfoDictionary];
 
-        /* Setup the name field */
-        [o_name_field setStringValue: [o_local_dict objectForKey:@"CFBundleName"]];
-        /* Set the about box title */
+        /* Setup the copyright field */
+        [o_copyright_field setStringValue: [o_local_dict objectForKey:@"NSHumanReadableCopyright"]];
+
+        /* Set the box title */
         [o_about_window setTitle: _NS("About VLC media player")];
 
         /* setup the creator / revision field */
-        if( VLC_Changeset() != "exported" )
-            [o_revision_field setStringValue:
-                [NSString stringWithFormat: _NS("Compiled by %s, based on SVN revision %s"), 
-                    VLC_CompileBy(), VLC_Changeset()]];
-        else
-        [o_revision_field setStringValue: [NSString stringWithFormat:
-            _NS("Compiled by %s"), VLC_CompileBy()]];
+        [o_revision_field setStringValue: 
+            [NSString stringWithFormat: _NS("Compiled by %s"), VLC_CompileBy()]];
  
         /* Setup the nameversion field */
         [o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VLC_Version(), PLATFORM]];
@@ -99,9 +98,6 @@ static VLAboutBox *_o_sharedInstance = nil;
                                             _NS("VLC was brought to you by:"),
                                             [NSString stringWithUTF8String: psz_authors], 
                                             [NSString stringWithUTF8String: psz_thanks]]];
-        /* Setup the copyright field */
-        [o_copyright_field setStringValue: [o_local_dict objectForKey:@"NSHumanReadableCopyright"]];
 
         /* Setup the window */
         [o_credits_textview setDrawsBackground: NO];
@@ -160,6 +156,12 @@ static VLAboutBox *_o_sharedInstance = nil;
     }
 }
 
+- (void)VLCWillTerminate
+{
+    [o_scroll_timer invalidate];
+    [[NSNotificationCenter defaultCenter] removeObserver: self];
+}
+
 /*****************************************************************************
 * VLC GPL Window, action called from the about window and the help menu
 *****************************************************************************/
@@ -180,10 +182,27 @@ static VLAboutBox *_o_sharedInstance = nil;
 - (void)showHelp
 {
     [o_help_window setTitle: _NS("VLC media player Help")];
+    [o_help_fwd_btn setToolTip: _NS("Next")];
+    [o_help_bwd_btn setToolTip: _NS("Previous")];
+    [o_help_home_btn setToolTip: _NS("Index")];
+
     [o_help_window makeKeyAndOrderFront: self];
+    
+    [[o_help_web_view mainFrame] loadHTMLString: _NS(I_LONGHELP)
+                                        baseURL: [NSURL URLWithString:@"http://videolan.org"]];
+}
 
-    [[o_help_web_view mainFrame] loadHTMLString: [NSString stringWithString: _NS(I_LONGHELP)]
+- (IBAction)helpGoHome:(id)sender
+{
+    [[o_help_web_view mainFrame] loadHTMLString: _NS(I_LONGHELP)
                                         baseURL: [NSURL URLWithString:@"http://videolan.org"]];
 }
 
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+    /* delegate to update button states (we're the frameLoadDelegate for our help's webview)« */
+    [o_help_fwd_btn setEnabled: [o_help_web_view canGoForward]]; 
+    [o_help_bwd_btn setEnabled: [o_help_web_view canGoBack]];
+}
+
 @end