Commit ced8149d authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: replaced various deprecated methods with their modern counterparts

No functional changes. Some more can't be replaced yet, as we still support 10.5
parent a7961666
...@@ -584,7 +584,9 @@ ...@@ -584,7 +584,9 @@
[openPanel setCanChooseFiles: YES]; [openPanel setCanChooseFiles: YES];
[openPanel setCanChooseDirectories: NO]; [openPanel setCanChooseDirectories: NO];
[openPanel setAllowsMultipleSelection: YES]; [openPanel setAllowsMultipleSelection: YES];
i_returnValue = [openPanel runModalForDirectory: [NSString stringWithUTF8String: path] file: nil types: [NSArray arrayWithObjects: @"cdg",@"@idx",@"srt",@"sub",@"utf",@"ass",@"ssa",@"aqt",@"jss",@"psb",@"rt",@"smi",@"txt",@"smil", nil]]; [openPanel setAllowedFileTypes: [NSArray arrayWithObjects: @"cdg",@"@idx",@"srt",@"sub",@"utf",@"ass",@"ssa",@"aqt",@"jss",@"psb",@"rt",@"smi",@"txt",@"smil", nil]];
[openPanel setDirectoryURL:[NSURL fileURLWithPath:[[NSString stringWithUTF8String:path] stringByExpandingTildeInPath]]];
i_returnValue = [openPanel runModal];
free( path ); free( path );
if( i_returnValue == NSOKButton ) if( i_returnValue == NSOKButton )
...@@ -592,14 +594,14 @@ ...@@ -592,14 +594,14 @@
NSUInteger c = 0; NSUInteger c = 0;
if( !p_input ) return; if( !p_input ) return;
c = [[openPanel filenames] count]; c = [[openPanel URLs] count];
for (int i = 0; i < [[openPanel filenames] count] ; i++) for (int i = 0; i < c ; i++)
{ {
msg_Dbg( VLCIntf, "loading subs from %s", [[[openPanel filenames] objectAtIndex: i] UTF8String] ); msg_Dbg( VLCIntf, "loading subs from %s", [[[[openPanel URLs] objectAtIndex: i] path] UTF8String] );
if( input_AddSubtitle( p_input, [[[openPanel filenames] objectAtIndex: i] UTF8String], TRUE ) ) if( input_AddSubtitle( p_input, [[[[openPanel URLs] objectAtIndex: i] path] UTF8String], TRUE ) )
msg_Warn( VLCIntf, "unable to load subtitles from '%s'", msg_Warn( VLCIntf, "unable to load subtitles from '%s'",
[[[openPanel filenames] objectAtIndex: i] UTF8String] ); [[[[openPanel URLs] objectAtIndex: i] path] UTF8String] );
} }
} }
} }
......
...@@ -66,8 +66,6 @@ static void Run ( intf_thread_t *p_intf ); ...@@ -66,8 +66,6 @@ static void Run ( intf_thread_t *p_intf );
static void * ManageThread( void *user_data ); static void * ManageThread( void *user_data );
static unsigned int VLCModifiersToCocoa( unsigned int i_key );
static void updateProgressPanel (void *, const char *, float); static void updateProgressPanel (void *, const char *, float);
static bool checkProgressPanel (void *); static bool checkProgressPanel (void *);
static void destroyProgressPanel (void *); static void destroyProgressPanel (void *);
...@@ -1405,7 +1403,7 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1405,7 +1403,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
if( [o_usedHotkeys indexOfObject: tempString] != NSNotFound || [o_usedHotkeys indexOfObject: tempStringPlus] != NSNotFound ) if( [o_usedHotkeys indexOfObject: tempString] != NSNotFound || [o_usedHotkeys indexOfObject: tempStringPlus] != NSNotFound )
{ {
var_Set( p_intf->p_libvlc, "key-pressed", val ); var_SetInteger( p_intf->p_libvlc, "key-pressed", val.i_int );
return YES; return YES;
} }
...@@ -2637,7 +2635,7 @@ end: ...@@ -2637,7 +2635,7 @@ end:
[saveFolderPanel setCanChooseFiles: YES]; [saveFolderPanel setCanChooseFiles: YES];
[saveFolderPanel setCanSelectHiddenExtension: NO]; [saveFolderPanel setCanSelectHiddenExtension: NO];
[saveFolderPanel setCanCreateDirectories: YES]; [saveFolderPanel setCanCreateDirectories: YES];
[saveFolderPanel setRequiredFileType: @"rtfd"]; [saveFolderPanel setAllowedFileTypes: [NSArray arrayWithObject:@"rtfd"]];
[saveFolderPanel beginSheetForDirectory:nil file: [NSString stringWithFormat: _NS("VLC Debug Log (%s).rtfd"), VERSION_MESSAGE] modalForWindow: o_msgs_panel modalDelegate:self didEndSelector:@selector(saveDebugLogAsRTF:returnCode:contextInfo:) contextInfo:nil]; [saveFolderPanel beginSheetForDirectory:nil file: [NSString stringWithFormat: _NS("VLC Debug Log (%s).rtfd"), VERSION_MESSAGE] modalForWindow: o_msgs_panel modalDelegate:self didEndSelector:@selector(saveDebugLogAsRTF:returnCode:contextInfo:) contextInfo:nil];
} }
...@@ -2646,7 +2644,7 @@ end: ...@@ -2646,7 +2644,7 @@ end:
BOOL b_returned; BOOL b_returned;
if( returnCode == NSOKButton ) if( returnCode == NSOKButton )
{ {
b_returned = [o_messages writeRTFDToFile: [sheet filename] atomically: YES]; b_returned = [o_messages writeRTFDToFile: [[sheet URL] path] atomically: YES];
if(! b_returned ) if(! b_returned )
msg_Warn( p_intf, "Error while saving the debug log" ); msg_Warn( p_intf, "Error while saving the debug log" );
} }
......
...@@ -508,11 +508,11 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -508,11 +508,11 @@ static VLCOpen *_o_sharedMainInstance = nil;
o_open_panel = [NSOpenPanel openPanel]; o_open_panel = [NSOpenPanel openPanel];
[o_open_panel setCanChooseFiles: YES]; [o_open_panel setCanChooseFiles: YES];
[o_open_panel setCanChooseDirectories: NO]; [o_open_panel setCanChooseDirectories: NO];
if( [o_open_panel runModalForDirectory: nil file: nil types: nil] == NSOKButton ) if( [o_open_panel runModal] == NSOKButton )
{ {
if( o_file_slave_path ) if( o_file_slave_path )
[o_file_slave_path release]; [o_file_slave_path release];
o_file_slave_path = [[o_open_panel filenames] objectAtIndex: 0]; o_file_slave_path = [[[o_open_panel URLs] objectAtIndex: 0] path];
[o_file_slave_path retain]; [o_file_slave_path retain];
} }
else else
...@@ -602,7 +602,7 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -602,7 +602,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
{ {
if (returnCode == NSFileHandlingPanelOKButton) if (returnCode == NSFileHandlingPanelOKButton)
{ {
NSString *o_filename = [[sheet filenames] objectAtIndex: 0]; NSString *o_filename = [[[sheet URLs] objectAtIndex: 0] path];
[o_file_path setStringValue: o_filename]; [o_file_path setStringValue: o_filename];
[self openFilePathChanged: nil]; [self openFilePathChanged: nil];
} }
...@@ -778,10 +778,9 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -778,10 +778,9 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_open_panel setTitle: _NS("Open VIDEO_TS Directory")]; [o_open_panel setTitle: _NS("Open VIDEO_TS Directory")];
[o_open_panel setPrompt: _NS("Open")]; [o_open_panel setPrompt: _NS("Open")];
if( [o_open_panel runModalForDirectory: nil if( [o_open_panel runModal] == NSOKButton )
file: nil types: nil] == NSOKButton )
{ {
NSString *o_dirname = [[o_open_panel filenames] objectAtIndex: 0]; NSString *o_dirname = [[[o_open_panel URLs] objectAtIndex: 0] path];
[o_disc_videots_folder setStringValue: o_dirname]; [o_disc_videots_folder setStringValue: o_dirname];
[self openDiscInfoChanged: nil]; [self openDiscInfoChanged: nil];
} }
...@@ -953,17 +952,16 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -953,17 +952,16 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_open_panel setTitle: _NS("Open File")]; [o_open_panel setTitle: _NS("Open File")];
[o_open_panel setPrompt: _NS("Open")]; [o_open_panel setPrompt: _NS("Open")];
if( [o_open_panel runModalForDirectory: nil if( [o_open_panel runModal] == NSOKButton )
file: nil types: nil] == NSOKButton )
{ {
NSArray *o_array = [NSArray array]; NSArray *o_array = [NSArray array];
NSArray *o_values = [[o_open_panel filenames] NSArray *o_values = [[o_open_panel URLs]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
for( i = 0; i < (int)[o_values count]; i++) for( i = 0; i < (int)[o_values count]; i++)
{ {
NSDictionary *o_dic; NSDictionary *o_dic;
char *psz_uri = make_URI([[o_values objectAtIndex:i] UTF8String], "file"); char *psz_uri = make_URI([[[o_values objectAtIndex:i] path] UTF8String], "file");
if( !psz_uri ) if( !psz_uri )
continue; continue;
...@@ -1196,10 +1194,9 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -1196,10 +1194,9 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_open_panel setTitle: _NS("Open File")]; [o_open_panel setTitle: _NS("Open File")];
[o_open_panel setPrompt: _NS("Open")]; [o_open_panel setPrompt: _NS("Open")];
if( [o_open_panel runModalForDirectory: nil if( [o_open_panel runModal] == NSOKButton )
file: nil types: nil] == NSOKButton )
{ {
NSString *o_filename = [[o_open_panel filenames] objectAtIndex: 0]; NSString *o_filename = [[[o_open_panel URLs] objectAtIndex: 0] path];
[o_file_sub_path setStringValue: o_filename]; [o_file_sub_path setStringValue: o_filename];
} }
} }
......
...@@ -528,7 +528,7 @@ ...@@ -528,7 +528,7 @@
if( [o_save_panel runModalForDirectory: nil if( [o_save_panel runModalForDirectory: nil
file: o_name] == NSOKButton ) file: o_name] == NSOKButton )
{ {
NSString *o_filename = [o_save_panel filename]; NSString *o_filename = [[o_save_panel URL] path];
[o_file_field setStringValue: o_filename]; [o_file_field setStringValue: o_filename];
[self outputInfoChanged: nil]; [self outputInfoChanged: nil];
} }
......
...@@ -750,7 +750,7 @@ ...@@ -750,7 +750,7 @@
if( [o_save_panel runModalForDirectory: nil if( [o_save_panel runModalForDirectory: nil
file: o_name] == NSOKButton ) file: o_name] == NSOKButton )
{ {
NSString *o_filename = [o_save_panel filename]; NSString *o_filename = [[o_save_panel URL] path];
if( [o_save_accessory_popup indexOfSelectedItem] == 0 ) if( [o_save_accessory_popup indexOfSelectedItem] == 0 )
{ {
......
...@@ -1255,7 +1255,7 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \ ...@@ -1255,7 +1255,7 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \
{ {
if( i_return_code == NSOKButton ) if( i_return_code == NSOKButton )
{ {
NSString *o_path = [[o_sheet filenames] objectAtIndex: 0]; NSString *o_path = [[[o_sheet URLs] objectAtIndex: 0] path];
[o_textfield setStringValue: o_path]; [o_textfield setStringValue: o_path];
} }
} }
......
...@@ -1145,7 +1145,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch ...@@ -1145,7 +1145,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
{ {
if( contextInfo == o_video_snap_folder_btn ) if( contextInfo == o_video_snap_folder_btn )
{ {
[o_video_snap_folder_fld setStringValue: [o_selectFolderPanel filename]]; [o_video_snap_folder_fld setStringValue: [[o_selectFolderPanel URL] path]];
b_videoSettingChanged = YES; b_videoSettingChanged = YES;
} }
} }
......
...@@ -1150,9 +1150,9 @@ static VLCWizard *_o_sharedInstance = nil; ...@@ -1150,9 +1150,9 @@ static VLCWizard *_o_sharedInstance = nil;
/* check whether the extension is hidden or not. /* check whether the extension is hidden or not.
* if not, remove it * if not, remove it
* we need the casting to make GCC4 happy */ * we need the casting to make GCC4 happy */
if( [[[NSFileManager defaultManager] fileAttributesAtPath: if( [[[NSFileManager defaultManager] attributesOfItemAtPath:
[[o_userSelections objectForKey:@"pathToStrm"] [[o_userSelections objectForKey:@"pathToStrm"]
objectAtIndex: x] traverseLink: NO] objectForKey: objectAtIndex: x] error:nil] objectForKey:
NSFileExtensionHidden] ) NSFileExtensionHidden] )
fileNameToUse = [NSString stringWithString: fileNameToUse = [NSString stringWithString:
[[NSFileManager defaultManager] displayNameAtPath: [[NSFileManager defaultManager] displayNameAtPath:
...@@ -1679,8 +1679,7 @@ static VLCWizard *_o_sharedInstance = nil; ...@@ -1679,8 +1679,7 @@ static VLCWizard *_o_sharedInstance = nil;
{ {
if (returnCode == NSOKButton) if (returnCode == NSOKButton)
{ {
[o_t2_fld_pathToNewStrm setStringValue: [@"file://" [o_t2_fld_pathToNewStrm setStringValue: [[sheet URL] absoluteString]];
stringByAppendingString: [sheet filename]]];
} }
} }
...@@ -1898,9 +1897,9 @@ static VLCWizard *_o_sharedInstance = nil; ...@@ -1898,9 +1897,9 @@ static VLCWizard *_o_sharedInstance = nil;
[[o_userSelections objectForKey:@"encapFormat"] intValue]] [[o_userSelections objectForKey:@"encapFormat"] intValue]]
objectAtIndex:0]; objectAtIndex:0];
if( theEncapFormat != @"ps" ) if( theEncapFormat != @"ps" )
[saveFilePanel setRequiredFileType: theEncapFormat]; [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:theEncapFormat]];
else else
[saveFilePanel setRequiredFileType: @"mpg"]; [saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:@"mpg"]];
[saveFilePanel setCanSelectHiddenExtension: YES]; [saveFilePanel setCanSelectHiddenExtension: YES];
[saveFilePanel setCanCreateDirectories: YES]; [saveFilePanel setCanCreateDirectories: YES];
...@@ -1918,9 +1917,9 @@ static VLCWizard *_o_sharedInstance = nil; ...@@ -1918,9 +1917,9 @@ static VLCWizard *_o_sharedInstance = nil;
* selected a folder */ * selected a folder */
if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 ) if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
[o_t7_fld_filePath setStringValue: [NSString stringWithFormat: [o_t7_fld_filePath setStringValue: [NSString stringWithFormat:
@"%@/", [sheet filename]]]; @"%@/", [[sheet URL] path]]];
else else
[o_t7_fld_filePath setStringValue:[sheet filename]]; [o_t7_fld_filePath setStringValue:[[sheet URL] path]];
} }
[sheet release]; [sheet release];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment