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 @@
[openPanel setCanChooseFiles: YES];
[openPanel setCanChooseDirectories: NO];
[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 );
if( i_returnValue == NSOKButton )
......@@ -592,14 +594,14 @@
NSUInteger c = 0;
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] );
if( input_AddSubtitle( p_input, [[[openPanel filenames] objectAtIndex: i] UTF8String], TRUE ) )
msg_Dbg( VLCIntf, "loading subs from %s", [[[[openPanel URLs] objectAtIndex: i] path] UTF8String] );
if( input_AddSubtitle( p_input, [[[[openPanel URLs] objectAtIndex: i] path] UTF8String], TRUE ) )
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 );
static void * ManageThread( void *user_data );
static unsigned int VLCModifiersToCocoa( unsigned int i_key );
static void updateProgressPanel (void *, const char *, float);
static bool checkProgressPanel (void *);
static void destroyProgressPanel (void *);
......@@ -1405,7 +1403,7 @@ unsigned int CocoaKeyToVLC( unichar i_key )
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;
}
......@@ -2637,7 +2635,7 @@ end:
[saveFolderPanel setCanChooseFiles: YES];
[saveFolderPanel setCanSelectHiddenExtension: NO];
[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];
}
......@@ -2646,7 +2644,7 @@ end:
BOOL b_returned;
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 )
msg_Warn( p_intf, "Error while saving the debug log" );
}
......
......@@ -508,11 +508,11 @@ static VLCOpen *_o_sharedMainInstance = nil;
o_open_panel = [NSOpenPanel openPanel];
[o_open_panel setCanChooseFiles: YES];
[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 )
[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];
}
else
......@@ -602,7 +602,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
{
if (returnCode == NSFileHandlingPanelOKButton)
{
NSString *o_filename = [[sheet filenames] objectAtIndex: 0];
NSString *o_filename = [[[sheet URLs] objectAtIndex: 0] path];
[o_file_path setStringValue: o_filename];
[self openFilePathChanged: nil];
}
......@@ -778,10 +778,9 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_open_panel setTitle: _NS("Open VIDEO_TS Directory")];
[o_open_panel setPrompt: _NS("Open")];
if( [o_open_panel runModalForDirectory: nil
file: nil types: nil] == NSOKButton )
if( [o_open_panel runModal] == 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];
[self openDiscInfoChanged: nil];
}
......@@ -953,17 +952,16 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_open_panel setTitle: _NS("Open File")];
[o_open_panel setPrompt: _NS("Open")];
if( [o_open_panel runModalForDirectory: nil
file: nil types: nil] == NSOKButton )
if( [o_open_panel runModal] == NSOKButton )
{
NSArray *o_array = [NSArray array];
NSArray *o_values = [[o_open_panel filenames]
NSArray *o_values = [[o_open_panel URLs]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
for( i = 0; i < (int)[o_values count]; i++)
{
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 )
continue;
......@@ -1196,10 +1194,9 @@ static VLCOpen *_o_sharedMainInstance = nil;
[o_open_panel setTitle: _NS("Open File")];
[o_open_panel setPrompt: _NS("Open")];
if( [o_open_panel runModalForDirectory: nil
file: nil types: nil] == NSOKButton )
if( [o_open_panel runModal] == 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];
}
}
......
......@@ -528,7 +528,7 @@
if( [o_save_panel runModalForDirectory: nil
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];
[self outputInfoChanged: nil];
}
......
......@@ -750,7 +750,7 @@
if( [o_save_panel runModalForDirectory: nil
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 )
{
......
......@@ -1255,7 +1255,7 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \
{
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];
}
}
......
......@@ -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 )
{
[o_video_snap_folder_fld setStringValue: [o_selectFolderPanel filename]];
[o_video_snap_folder_fld setStringValue: [[o_selectFolderPanel URL] path]];
b_videoSettingChanged = YES;
}
}
......
......@@ -1150,9 +1150,9 @@ static VLCWizard *_o_sharedInstance = nil;
/* check whether the extension is hidden or not.
* if not, remove it
* we need the casting to make GCC4 happy */
if( [[[NSFileManager defaultManager] fileAttributesAtPath:
if( [[[NSFileManager defaultManager] attributesOfItemAtPath:
[[o_userSelections objectForKey:@"pathToStrm"]
objectAtIndex: x] traverseLink: NO] objectForKey:
objectAtIndex: x] error:nil] objectForKey:
NSFileExtensionHidden] )
fileNameToUse = [NSString stringWithString:
[[NSFileManager defaultManager] displayNameAtPath:
......@@ -1679,8 +1679,7 @@ static VLCWizard *_o_sharedInstance = nil;
{
if (returnCode == NSOKButton)
{
[o_t2_fld_pathToNewStrm setStringValue: [@"file://"
stringByAppendingString: [sheet filename]]];
[o_t2_fld_pathToNewStrm setStringValue: [[sheet URL] absoluteString]];
}
}
......@@ -1898,9 +1897,9 @@ static VLCWizard *_o_sharedInstance = nil;
[[o_userSelections objectForKey:@"encapFormat"] intValue]]
objectAtIndex:0];
if( theEncapFormat != @"ps" )
[saveFilePanel setRequiredFileType: theEncapFormat];
[saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:theEncapFormat]];
else
[saveFilePanel setRequiredFileType: @"mpg"];
[saveFilePanel setAllowedFileTypes: [NSArray arrayWithObject:@"mpg"]];
[saveFilePanel setCanSelectHiddenExtension: YES];
[saveFilePanel setCanCreateDirectories: YES];
......@@ -1918,9 +1917,9 @@ static VLCWizard *_o_sharedInstance = nil;
* selected a folder */
if( [[o_userSelections objectForKey:@"pathToStrm"] count] > 1 )
[o_t7_fld_filePath setStringValue: [NSString stringWithFormat:
@"%@/", [sheet filename]]];
@"%@/", [[sheet URL] path]]];
else
[o_t7_fld_filePath setStringValue:[sheet filename]];
[o_t7_fld_filePath setStringValue:[[sheet URL] path]];
}
[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