]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/open.m
Revert "macosx: clean code of objectAtIndex"
[vlc] / modules / gui / macosx / open.m
index a4dff3403b4b8187ca8710b903dd9235a042d9e0..5d965a4c5b4da4ab50e706e783a10d7347311a2b 100644 (file)
@@ -47,6 +47,7 @@
 #import "open.h"
 #import "output.h"
 #import "eyetv.h"
+#import "misc.h"
 
 #import <vlc_url.h>
 
@@ -223,6 +224,10 @@ static VLCOpen *_o_sharedMainInstance = nil;
     [o_capture_width_lbl setStringValue: [NSString stringWithFormat:@"%@:",_NS("Image width")]];
     [o_capture_height_lbl setStringValue: [NSString stringWithFormat:@"%@:",_NS("Image height")]];
 
+    // setup start / stop time fields
+    [o_file_starttime_fld setFormatter:[[[PositionFormatter alloc] init] autorelease]];
+    [o_file_stoptime_fld setFormatter:[[[PositionFormatter alloc] init] autorelease]];
+
     [self qtkvideoDevices];
     [o_qtk_video_device_pop removeAllItems];
     msg_Dbg(VLCIntf, "Found %lu video capture devices", [qtkvideoDevices count]);
@@ -453,32 +458,34 @@ static VLCOpen *_o_sharedMainInstance = nil;
                     p_item->list.i[[o_file_sub_size_pop indexOfSelectedItem]]]];
             }
         }
-        NSArray * components = [[o_file_starttime_fld stringValue] componentsSeparatedByString:@":"];
-        NSUInteger componentCount = [components count];
-        NSInteger tempValue;
-        if (componentCount == 1)
-            tempValue = 1000000 * ([[components objectAtIndex:0] intValue]);
-        else if (componentCount == 2)
-            tempValue = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
-        else if (componentCount == 3)
-            tempValue = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
-        if (tempValue > 0)
-            [o_options addObject: [NSString stringWithFormat:@"start-time=%li", tempValue]];
-        components = [[o_file_stoptime_fld stringValue] componentsSeparatedByString:@":"];
-        componentCount = [components count];
-        if (componentCount == 1)
-            tempValue = 1000000 * ([[components objectAtIndex:0] intValue]);
-        else if (componentCount == 2)
-            tempValue = 1000000 * ([[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue]);
-        else if (componentCount == 3)
-            tempValue = 1000000 * ([[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue]);
-        if (tempValue > 0)
-            [o_options addObject: [NSString stringWithFormat:@"stop-time=%li", tempValue]];
+        if ([o_file_custom_timing_ckb state] == NSOnState) {
+            NSArray * components = [[o_file_starttime_fld stringValue] componentsSeparatedByString:@":"];
+            NSUInteger componentCount = [components count];
+            NSInteger tempValue;
+            if (componentCount == 1)
+                tempValue = [[components objectAtIndex:0] intValue];
+            else if (componentCount == 2)
+                tempValue = [[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue];
+            else if (componentCount == 3)
+                tempValue = [[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue];
+            if (tempValue > 0)
+                [o_options addObject: [NSString stringWithFormat:@"start-time=%li", tempValue]];
+            components = [[o_file_stoptime_fld stringValue] componentsSeparatedByString:@":"];
+            componentCount = [components count];
+            if (componentCount == 1)
+                tempValue = [[components objectAtIndex:0] intValue];
+            else if (componentCount == 2)
+                tempValue = [[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue];
+            else if (componentCount == 3)
+                tempValue = [[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue];
+            if (tempValue > 0)
+                [o_options addObject: [NSString stringWithFormat:@"stop-time=%li", tempValue]];
+        }
         if ([o_output_ckbox state] == NSOnState) {
             NSArray * soutMRL = [o_sout_options soutMRL];
             NSUInteger count = [soutMRL count];
             for (NSUInteger i = 0 ; i < count ; i++)
-                [o_options addObject: [NSString stringWithString: [soutMRL objectAtIndex: i]]];
+                [o_options addObject: [NSString stringWithString: [soutMRL objectAtIndex:i]]];
         }
         if ([o_file_slave_ckbox state] && o_file_slave_path)
            [o_options addObject: [NSString stringWithFormat: @"input-slave=%@", o_file_slave_path]];
@@ -540,7 +547,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
 {
     NSInteger i_selectedDevice = [o_qtk_video_device_pop indexOfSelectedItem];
     if ([qtkvideoDevices count] >= 1) {
-        NSValue *sizes = [[[[qtkvideoDevices objectAtIndex:i_selectedDevice] formatDescriptions] objectAtIndex: 0] attributeForKey: QTFormatDescriptionVideoEncodedPixelsSizeAttribute];
+        NSValue *sizes = [[[[qtkvideoDevices objectAtIndex:i_selectedDevice] formatDescriptions] objectAtIndex:0] attributeForKey: QTFormatDescriptionVideoEncodedPixelsSizeAttribute];
 
         [o_capture_width_fld setIntValue: [sizes sizeValue].width];
         [o_capture_height_fld setIntValue: [sizes sizeValue].height];
@@ -667,7 +674,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
         NSMutableArray *o_values = [NSMutableArray arrayWithCapacity:count];
         NSMutableArray *o_array = [NSMutableArray arrayWithCapacity:count];
         for (NSUInteger i = 0; i < count; i++)
-            [o_values addObject: [[o_urls objectAtIndex: i] path]];
+            [o_values addObject: [[o_urls objectAtIndex:i] path]];
         [o_values sortUsingSelector:@selector(caseInsensitiveCompare:)];
 
         for (NSUInteger i = 0; i < count; i++) {
@@ -739,7 +746,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
         if (returnCode == NSFileHandlingPanelOKButton) {
             if (o_file_path)
                 [o_file_path release];
-            o_file_path = [[[o_open_panel URLs] objectAtIndex: 0] path];
+            o_file_path = [[[o_open_panel URLs] objectAtIndex:0] path];
             [o_file_path retain];
             [self openFilePathChanged: nil];
         }
@@ -763,7 +770,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
         if ([o_open_panel runModal] == NSOKButton) {
             if (o_file_slave_path)
                 [o_file_slave_path release];
-            o_file_slave_path = [[[o_open_panel URLs] objectAtIndex: 0] path];
+            o_file_slave_path = [[[o_open_panel URLs] objectAtIndex:0] path];
             [o_file_slave_path retain];
         }
     }
@@ -1065,7 +1072,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
     NSUInteger count = [o_allMediaDevices count];
     if (count > 0) {
         for (NSUInteger i = 0; i < count ; i++) {
-            NSDictionary *o_dict = [o_allMediaDevices objectAtIndex: i];
+            NSDictionary *o_dict = [o_allMediaDevices objectAtIndex:i];
             [o_disc_selector_pop addItemWithTitle: [[NSFileManager defaultManager] displayNameAtPath:[o_dict objectForKey:@"path"]]];
         }
 
@@ -1089,7 +1096,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
 
 - (IBAction)discSelectorChanged:(id)sender
 {
-    NSDictionary *o_dict = [o_allMediaDevices objectAtIndex: [o_disc_selector_pop indexOfSelectedItem]];    
+    NSDictionary *o_dict = [o_allMediaDevices objectAtIndex:[o_disc_selector_pop indexOfSelectedItem]];    
     [self showOpticalAtPath:o_dict];
 }
 
@@ -1109,7 +1116,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
     [o_open_panel setAllowedFileTypes:@[@"public.directory"]];
 
     if ([o_open_panel runModal] == NSOKButton) {
-        NSString *o_path = [[[o_open_panel URLs] objectAtIndex: 0] path];
+        NSString *o_path = [[[o_open_panel URLs] objectAtIndex:0] path];
         if ([o_path length] > 0) {
             [NSThread detachNewThreadSelector:@selector(scanSpecialPath:) toTarget:self withObject:o_path];
         }
@@ -1118,7 +1125,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
 
 - (IBAction)dvdreadOptionChanged:(id)sender
 {
-    NSDictionary *o_dict = [o_allMediaDevices objectAtIndex: [o_disc_selector_pop indexOfSelectedItem]];
+    NSDictionary *o_dict = [o_allMediaDevices objectAtIndex:[o_disc_selector_pop indexOfSelectedItem]];
     NSString *o_device_path = [o_dict objectForKey:@"devicePath"];
 
     if (sender == o_disc_dvdwomenus_enablemenus_btn) {
@@ -1155,7 +1162,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
     if (sender == o_disc_vcd_chapter_stp)
         [o_disc_vcd_chapter setIntValue: [o_disc_vcd_chapter_stp intValue]];
 
-    NSString *o_device_path = [[o_allMediaDevices objectAtIndex: [o_disc_selector_pop indexOfSelectedItem]] objectForKey:@"devicePath"];
+    NSString *o_device_path = [[o_allMediaDevices objectAtIndex:[o_disc_selector_pop indexOfSelectedItem]] objectForKey:@"devicePath"];
     [self setMRL: [NSString stringWithFormat: @"vcd://%@@%i:%i", o_device_path, [o_disc_vcd_title intValue], [o_disc_vcd_chapter intValue]]];
 }
 
@@ -1537,7 +1544,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
     [o_open_panel setPrompt: _NS("Open")];
 
     if ([o_open_panel runModal] == NSOKButton) {
-        o_sub_path = [[[o_open_panel URLs] objectAtIndex: 0] path];
+        o_sub_path = [[[o_open_panel URLs] objectAtIndex:0] path];
         [o_sub_path retain];
         [o_file_subtitles_filename_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath:o_sub_path]];
         [o_file_sub_path_fld setStringValue: [o_file_subtitles_filename_lbl stringValue]];