OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / macosx / Controller.mm
index 25fe20c..faeb0cc 100644 (file)
@@ -37,6 +37,15 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
     {
         return nil;
     }
+
+    /* replace bundled app icon with one which is 32/64-bit savvy */
+#if defined( __LP64__ )
+    fApplicationIcon = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:@"HandBrake-64.icns"]];
+#else
+    fApplicationIcon = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:@"HandBrake.icns"]];
+#endif
+    if( fApplicationIcon != nil )
+        [NSApp setApplicationIconImage:fApplicationIcon];
     
     [HBPreferencesController registerUserDefaults];
     fHandle = NULL;
@@ -310,7 +319,8 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
        [fQueueController release];
     [fPreviewController release];
     [fPictureController release];
-    
+    [fApplicationIcon release];
+
        hb_close(&fHandle);
     hb_close(&fQueueEncodeLibhb);
 }
@@ -549,7 +559,6 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
  **********************************************************************/
 - (void) UpdateDockIcon: (float) progress
 {
-    NSImage * icon;
     NSData * tiff;
     NSBitmapImageRep * bmp;
     uint32_t * pen;
@@ -559,17 +568,14 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
     int row_start, row_end;
     int i, j;
 
-    /* Get application original icon */
-    icon = [NSImage imageNamed: @"NSApplicationIcon"];
-
     if( progress < 0.0 || progress > 1.0 )
     {
-        [NSApp setApplicationIconImage: icon];
+        [NSApp setApplicationIconImage: fApplicationIcon];
         return;
     }
 
     /* Get it in a raw bitmap form */
-    tiff = [icon TIFFRepresentationUsingCompression:
+    tiff = [fApplicationIcon TIFFRepresentationUsingCompression:
             NSTIFFCompressionNone factor: 1.0];
     bmp = [NSBitmapImageRep imageRepWithData: tiff];
     
@@ -618,7 +624,7 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
     /* Now update the dock icon */
     tiff = [bmp TIFFRepresentationUsingCompression:
             NSTIFFCompressionNone factor: 1.0];
-    icon = [[NSImage alloc] initWithData: tiff];
+    NSImage* icon = [[NSImage alloc] initWithData: tiff];
     [NSApp setApplicationIconImage: icon];
     [icon release];
 }
@@ -1431,6 +1437,15 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
     }
 }
 
+- (IBAction)showAboutPanel:(id)sender
+{
+    NSMutableDictionary* d = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
+        fApplicationIcon, @"ApplicationIcon",
+        nil ];
+    [NSApp orderFrontStandardAboutPanelWithOptions:d];
+    [d release];
+}
+
 /* Here we open the title selection sheet where we can specify an exact title to be scanned */
 - (IBAction) showSourceTitleScanPanel: (id) sender
 {
@@ -1489,7 +1504,7 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
         path = [detector devicePath];
         [self writeToActivityLog: "trying to open a physical dvd at: %s", [scanPath UTF8String]];
         
-#ifdef __LP64__
+#if defined( __LP64__ )
         /* If we are 64 bit, we cannot read encrypted dvd's as vlc is 32 bit only */
         cancelScanDecrypt = 1;
         [self writeToActivityLog: "64 bit mode cannot read dvd's, scan cancelled"];
@@ -2847,7 +2862,7 @@ bool one_burned = FALSE;
                 /* NOTE: Currently foreign language search is borked for preview.
                  * Commented out but left in for initial commit. */
                 
-                /*
+                
                 [self writeToActivityLog: "Foreign Language Search: %d", 1];
                 
                 job->indepth_scan = 1;
@@ -2857,12 +2872,16 @@ bool one_burned = FALSE;
                     {
                         job->select_subtitle_config.dest = hb_subtitle_config_s::PASSTHRUSUB;
                     }
+                    else
+                    {
+                        job->select_subtitle_config.dest = hb_subtitle_config_s::RENDERSUB;
+                    }
                     
                     job->select_subtitle_config.force = force;
                     job->select_subtitle_config.default_track = def;
                     
                 }
-               */ 
+                
                 
             }
             else
@@ -6102,7 +6121,16 @@ return YES;
         }
         else
         {
-            [fVidQualitySlider setFloatValue:([fVidQualitySlider maxValue] - [fVidQualitySlider minValue]) - [[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]];
+            /* Since theora's qp value goes up from left to right, we can just set the slider float value */
+            if ([[fVidEncoderPopUp selectedItem] tag] == HB_VCODEC_THEORA)
+            {
+                [fVidQualitySlider setFloatValue:[[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]];
+            }
+            else
+            {
+                /* since ffmpeg and x264 use an "inverted" slider (lower qp/rf values indicate a higher quality) we invert the value on the slider */
+                [fVidQualitySlider setFloatValue:([fVidQualitySlider maxValue] + [fVidQualitySlider minValue]) - [[chosenPreset objectForKey:@"VideoQualitySlider"] floatValue]];
+            }
         }
         
         [self videoMatrixChanged:nil];
@@ -6875,11 +6903,12 @@ return YES;
         [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"];
 
         
-        
+        /* Temporarily remove subtitles from creating a new preset as it has to be converted over to use the new
+         * subititle array code. */
         /* Subtitles*/
-        [preset setObject:[fSubPopUp titleOfSelectedItem] forKey:@"Subtitles"];
+        //[preset setObject:[fSubPopUp titleOfSelectedItem] forKey:@"Subtitles"];
         /* Forced Subtitles */
-        [preset setObject:[NSNumber numberWithInt:[fSubForcedCheck state]] forKey:@"SubtitlesForced"];
+        //[preset setObject:[NSNumber numberWithInt:[fSubForcedCheck state]] forKey:@"SubtitlesForced"];
     }
     [preset autorelease];
     return preset;