]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/about.m
macosx: avoid possible index out of range problem in bookmarks table view
[vlc] / modules / gui / macosx / about.m
index 66221b56521981410b33c342fec9353b5e1e566d..391d6a36148561ee04fcf1bb6be805f29f89686c 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * about.m: MacOS X About Panel
  *****************************************************************************
- * Copyright (C) 2001-2013 VLC authors and VideoLAN
+ * Copyright (C) 2001-2014 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
 #import <vlc_about.h>
 #import "CompatibilityFixes.h"
 
-#ifdef __x86_64__
+/* this is a bit weird, but we should be confident that there will be more than
+ * one arch to support again one day */
 #define PLATFORM "Intel 64bit"
-#elif __i386__
-#define PLATFORM "Intel 32bit"
-#else
-#define PLATFORM "PowerPC 32bit"
-#endif
 
 /*****************************************************************************
  * VLAboutBox implementation
@@ -90,7 +86,7 @@ static VLAboutBox *_o_sharedInstance = nil;
 
         /* l10n */
         [o_about_window setTitle: _NS("About VLC media player")];
-        NSDictionary *stringAttributes = [NSDictionary dictionaryWithObjectsAndKeys:@(NSUnderlineStyleSingle), NSUnderlineStyleAttributeName, [NSColor colorWithCalibratedRed:0. green:0.3411 blue:0.6824 alpha:1.], NSForegroundColorAttributeName, [NSFont systemFontOfSize:13], NSFontAttributeName, nil];
+        NSDictionary *stringAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:NSUnderlineStyleSingle], NSUnderlineStyleAttributeName, [NSColor colorWithCalibratedRed:0. green:0.3411 blue:0.6824 alpha:1.], NSForegroundColorAttributeName, [NSFont systemFontOfSize:13], NSFontAttributeName, nil];
         NSAttributedString *attrStr;
         attrStr = [[NSAttributedString alloc] initWithString:_NS("Credits") attributes:stringAttributes];
         [o_credits_btn setAttributedTitle:attrStr];
@@ -107,17 +103,15 @@ static VLAboutBox *_o_sharedInstance = nil;
         NSString *compiler;
 #ifdef __clang__
         compiler = [NSString stringWithFormat:@"clang %s", __clang_version__];
-#elif __llvm__
-        compiler = [NSString stringWithFormat:@"llvm-gcc %s", __VERSION__];
 #else
-        compiler = [NSString stringWithFormat:@"gcc %s", __VERSION__];
+        compiler = [NSString stringWithFormat:@"llvm-gcc %s", __VERSION__];
 #endif
         [o_revision_field setStringValue: [NSString stringWithFormat: _NS("Compiled by %s with %@"), VLC_CompileBy(), compiler]];
 
         /* Setup the nameversion field */
         [o_name_version_field setStringValue: [NSString stringWithFormat:@"Version %s (%s)", VERSION_MESSAGE, PLATFORM]];
 
-        NSMutableArray *tmpArray = [NSMutableArray arrayWithArray: [@(psz_authors) componentsSeparatedByString:@"\n\n"]];
+        NSMutableArray *tmpArray = [NSMutableArray arrayWithArray: [[NSString stringWithUTF8String:psz_authors] componentsSeparatedByString:@"\n\n"]];
         NSUInteger count = [tmpArray count];
         for (NSUInteger i = 0; i < count; i++) {
             [tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@"\n" withString:@", "]];
@@ -129,13 +123,16 @@ static VLAboutBox *_o_sharedInstance = nil;
         [o_authors retain];
 
         /* setup join us! */
-        NSString *joinus = [NSString stringWithString:_NS("<p>VLC media player is a free and open source media player, encoder, and streamer made by the volunteers of the "
-                               "<a href=\"http://www.videolan.org/\"><span style=\" text-decoration: underline; color:#0057ae;\">VideoLAN</span>"
-                               "</a> community.</p><p>VLC uses its internal codecs, works on essentially every popular platform, and can read "
-                               "almost all files, CDs, DVDs, network streams, capture cards and other media formats!</p><p>"
-                               "<a href=\"http://www.videolan.org/contribute/\"><span style=\" text-decoration: underline; color:#0057ae;\">Help "
-                               "and join us!</span></a>")];
-        NSAttributedString *joinus_readytorender = [[NSAttributedString alloc] initWithHTML:[joinus dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES] documentAttributes:NULL];
+        NSString *joinus = [NSString stringWithUTF8String:_(""
+                                                            "<p>VLC media player is a free and open source media player, encoder, and "
+                                                            "streamer made by the volunteers of the <a href=\"http://www.videolan.org/"
+                                                            "\"><span style=\" text-decoration: underline; color:#0057ae;\">VideoLAN</"
+                                                            "span></a> community.</p><p>VLC uses its internal codecs, works on "
+                                                            "essentially every popular platform, and can read almost all files, CDs, "
+                                                            "DVDs, network streams, capture cards and other media formats!</p><p><a href="
+                                                            "\"http://www.videolan.org/contribute/\"><span style=\" text-decoration: "
+                                                            "underline; color:#0057ae;\">Help and join us!</span></a>")];
+        NSAttributedString *joinus_readytorender = [[NSAttributedString alloc] initWithHTML:[joinus dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES] options:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:NSUTF8StringEncoding] forKey:NSCharacterEncodingDocumentOption] documentAttributes:NULL];
         [o_joinus_txt setAllowsEditingTextAttributes: YES];
         [o_joinus_txt setSelectable: YES];
         [o_joinus_txt setAttributedStringValue:joinus_readytorender];
@@ -236,9 +233,9 @@ static VLAboutBox *_o_sharedInstance = nil;
     if (sender == o_authors_btn)
         [o_credits_textview setString:o_authors];
     else if (sender == o_credits_btn)
-        [o_credits_textview setString:[@(psz_thanks) stringByReplacingOccurrencesOfString:@"\n" withString:@" " options:0 range:NSRangeFromString(@"680 2")]];
+        [o_credits_textview setString:[[NSString stringWithUTF8String:psz_thanks] stringByReplacingOccurrencesOfString:@"\n" withString:@" " options:0 range:NSRangeFromString(@"680 2")]];
     else
-        [o_credits_textview setString:@(psz_license)];
+        [o_credits_textview setString:[NSString stringWithUTF8String:psz_license]];
 
     [o_credits_textview scrollPoint:NSMakePoint(0, 0)];
     b_restart = YES;
@@ -251,14 +248,7 @@ static VLAboutBox *_o_sharedInstance = nil;
 - (void)showGPL
 {
     [self showAbout];
-    [o_credits_scrollview setHidden:NO];
-    [o_credits_textview setHidden:NO];
-    [o_joinus_txt setHidden:YES];
-
-    [o_credits_textview setString:@(psz_license)];
-
-    [o_credits_textview scrollPoint:NSMakePoint(0, 0)];
-    b_restart = YES;
+    [self buttonAction:nil];
 }
 
 /*****************************************************************************