Commit 255ded1f authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: replace API deprecated in 10.10

parent a16a24bc
......@@ -164,8 +164,8 @@
* Note: this icon doesn't represent an endorsement of The Coca-Cola Company.
*/
NSCalendar *gregorian =
[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSUInteger dayOfYear = [gregorian ordinalityOfUnit:NSDayCalendarUnit inUnit:NSYearCalendarUnit forDate:[NSDate date]];
[[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSUInteger dayOfYear = [gregorian ordinalityOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitYear forDate:[NSDate date]];
if (dayOfYear >= 354)
[o_icon_view setImage: [NSImage imageNamed:@"VLC-Xmas"]];
......
......@@ -515,7 +515,7 @@
[_textfieldPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSString *resultingText) {
NSInteger currentProfileIndex = [_self currentProfileIndex];
if (returnCode != NSOKButton) {
if (returnCode != NSModalResponseOK) {
[_profilePopup selectItemAtIndex:currentProfileIndex];
return;
}
......@@ -573,7 +573,7 @@
[_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
NSInteger currentProfileIndex = [_self currentProfileIndex];
if (returnCode != NSOKButton) {
if (returnCode != NSModalResponseOK) {
[_profilePopup selectItemAtIndex:currentProfileIndex];
return;
}
......@@ -828,7 +828,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// EQ settings
if (returnCode != NSOKButton || [resultingText length] == 0)
if (returnCode != NSModalResponseOK || [resultingText length] == 0)
return;
NSString *decomposedStringWithCanonicalMapping = [resultingText decomposedStringWithCanonicalMapping];
......@@ -872,7 +872,7 @@ static bool GetEqualizerStatus(intf_thread_t *p_custom_intf,
__unsafe_unretained typeof(self) _self = self;
[_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
if (returnCode != NSOKButton)
if (returnCode != NSModalResponseOK)
return;
/* remove requested profile from the arrays */
......
......@@ -313,7 +313,7 @@
[openPanel setResolvesAliases:YES];
[openPanel setAllowsMultipleSelection:NO];
[openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger returnCode) {
if (returnCode == NSOKButton)
if (returnCode == NSModalResponseOK)
{
[self setMRL: toNSStr(vlc_path2uri([[[openPanel URL] path] UTF8String], NULL))];
[self updateOKButton];
......@@ -342,7 +342,7 @@
__unsafe_unretained typeof(self) _self = self;
[_popupPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSInteger selectedIndex) {
if (returnCode != NSOKButton)
if (returnCode != NSModalResponseOK)
return;
/* remove requested profile from the arrays */
......@@ -413,7 +413,7 @@
if ([[_customizeEncapMatrix selectedCell] tag] != RAW) // there is no clever guess for this
[saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:[self currentEncapsulationFormatAsFileExtension:YES]]];
[saveFilePanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger returnCode) {
if (returnCode == NSOKButton) {
if (returnCode == NSModalResponseOK) {
[self setOutputDestination:[[saveFilePanel URL] path]];
[_fileDestinationFileName setStringValue: [[NSFileManager defaultManager] displayNameAtPath:_outputDestination]];
[[_fileDestinationFileNameStub animator] setHidden: YES];
......@@ -477,7 +477,7 @@
__unsafe_unretained typeof(self) _self = self;
[_textfieldPanel runModalForWindow:_customizePanel completionHandler:^(NSInteger returnCode, NSString *resultingText) {
if (returnCode != NSOKButton || [resultingText length] == 0)
if (returnCode != NSModalResponseOK || [resultingText length] == 0)
return;
/* prepare current data */
......@@ -593,7 +593,7 @@
[saveFilePanel setCanCreateDirectories: YES];
[saveFilePanel setAllowedFileTypes:[NSArray arrayWithObject:@"sdp"]];
[saveFilePanel beginSheetModalForWindow:_streamPanel completionHandler:^(NSInteger returnCode) {
if (returnCode == NSOKButton)
if (returnCode == NSModalResponseOK)
[_streamSDPField setStringValue:[[saveFilePanel URL] path]];
}];
}
......
......@@ -197,7 +197,7 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
[saveFolderPanel setAllowedFileTypes: [NSArray arrayWithObject:@"txt"]];
[saveFolderPanel setNameFieldStringValue:[NSString stringWithFormat: _NS("VLC Debug Log (%s).txt"), VERSION_MESSAGE]];
[saveFolderPanel beginSheetModalForWindow: self.window completionHandler:^(NSInteger returnCode) {
if (returnCode != NSOKButton) {
if (returnCode != NSModalResponseOK) {
return;
}
NSMutableString *string = [[NSMutableString alloc] init];
......
......@@ -113,7 +113,7 @@ static const int kCurrentPreferencesVersion = 4;
int res = NSRunInformationalAlertPanel(_NS("Remove old preferences?"),
_NS("We just found an older version of VLC's preferences files."),
_NS("Move To Trash and Relaunch VLC"), _NS("Ignore"), nil, nil);
if (res != NSOKButton) {
if (res != NSModalResponseOK) {
[defaults setInteger:kCurrentPreferencesVersion forKey:kVLCPreferencesVersion];
return;
}
......
......@@ -255,8 +255,8 @@ static VLCMain *sharedInstance = nil;
* Note: this icon doesn't represent an endorsement of The Coca-Cola Company.
*/
NSCalendar *gregorian =
[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSUInteger dayOfYear = [gregorian ordinalityOfUnit:NSDayCalendarUnit inUnit:NSYearCalendarUnit forDate:[NSDate date]];
[[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSUInteger dayOfYear = [gregorian ordinalityOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitYear forDate:[NSDate date]];
if (dayOfYear >= 354)
[[VLCApplication sharedApplication] setApplicationIconImage: [NSImage imageNamed:@"VLC-Xmas"]];
......
......@@ -833,7 +833,7 @@
[_timeSelectionPanel runModalForWindow:[NSApp mainWindow]
completionHandler:^(NSInteger returnCode, int64_t returnTime) {
if (returnCode != NSOKButton)
if (returnCode != NSModalResponseOK)
return;
input_thread_t *p_input = pl_CurrentInput(getIntf());
......@@ -1037,7 +1037,7 @@
i_returnValue = [openPanel runModal];
if (i_returnValue == NSOKButton)
if (i_returnValue == NSModalResponseOK)
[[VLCCoreInteraction sharedInstance] addSubtitlesToCurrentInput:[openPanel URLs]];
}
......
......@@ -572,7 +572,7 @@ static NSString *kCaptureTabViewId = @"capture";
[openPanel setTitle: _NS("Open File")];
[openPanel setPrompt: _NS("Open")];
if ([openPanel runModal] == NSOKButton) {
if ([openPanel runModal] == NSModalResponseOK) {
NSArray *URLs = [openPanel URLs];
NSUInteger count = [URLs count];
NSMutableArray *values = [NSMutableArray arrayWithCapacity:count];
......@@ -679,7 +679,7 @@ static NSString *kCaptureTabViewId = @"capture";
openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles: YES];
[openPanel setCanChooseDirectories: NO];
if ([openPanel runModal] == NSOKButton) {
if ([openPanel runModal] == NSModalResponseOK) {
_fileSlavePath = [[[openPanel URLs] firstObject] path];
}
}
......@@ -895,7 +895,7 @@ static NSString *kCaptureTabViewId = @"capture";
[openPanel setCanChooseFiles: YES];
[openPanel setAllowedFileTypes:[NSArray arrayWithObject:@"public.directory"]];
if ([openPanel runModal] == NSOKButton) {
if ([openPanel runModal] == NSModalResponseOK) {
NSString *oPath = [[[openPanel URLs] firstObject] path];
if ([oPath length] > 0) {
[NSThread detachNewThreadSelector:@selector(scanSpecialPath:) toTarget:self withObject:oPath];
......@@ -1258,7 +1258,7 @@ static NSString *kCaptureTabViewId = @"capture";
[openPanel setTitle: _NS("Open File")];
[openPanel setPrompt: _NS("Open")];
if ([openPanel runModal] == NSOKButton) {
if ([openPanel runModal] == NSModalResponseOK) {
_subPath = [[[openPanel URLs] firstObject] path];
[_fileSubtitlesFilenameLabel setStringValue: [[NSFileManager defaultManager] displayNameAtPath:_subPath]];
[_fileSubPathTextField setStringValue: [_fileSubtitlesFilenameLabel stringValue]];
......
......@@ -39,7 +39,7 @@
/**
* Completion handler for popup panel
* \param returnCode Result from panel. Can be NSOKButton or NSCancelButton.
* \param returnCode Result from panel. Can be NSModalResponseOK or NSModalResponseCancel.
* \param selectedIndex Selected index of the popup in panel.
*/
typedef void(^PopupPanelCompletionBlock)(NSInteger returnCode, NSInteger selectedIndex);
......
......@@ -44,7 +44,7 @@
[NSApp endSheet: self.window];
if (_completionBlock)
_completionBlock(sender == _okButton ? NSOKButton : NSCancelButton, [_popupButton indexOfSelectedItem]);
_completionBlock(sender == _okButton ? NSModalResponseOK : NSModalResponseCancel, [_popupButton indexOfSelectedItem]);
}
- (void)runModalForWindow:(NSWindow *)window completionHandler:(PopupPanelCompletionBlock)handler;
......
......@@ -1163,7 +1163,7 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
[_selectFolderPanel setCanCreateDirectories: YES];
[_selectFolderPanel setPrompt: _NS("Choose")];
[_selectFolderPanel beginSheetModalForWindow:self.window completionHandler: ^(NSInteger returnCode) {
if (returnCode == NSOKButton) {
if (returnCode == NSModalResponseOK) {
[_video_snap_folderTextField setStringValue: [[_selectFolderPanel URL] path]];
}
}];
......@@ -1262,7 +1262,7 @@ static inline void save_string_list(intf_thread_t * p_intf, id object, const cha
[_selectFolderPanel setCanCreateDirectories: YES];
[_selectFolderPanel setPrompt: _NS("Choose")];
[_selectFolderPanel beginSheetModalForWindow:self.window completionHandler: ^(NSInteger returnCode) {
if (returnCode == NSOKButton)
if (returnCode == NSModalResponseOK)
{
[_input_recordTextField setStringValue: [[_selectFolderPanel URL] path]];
_inputSettingChanged = YES;
......
......@@ -38,7 +38,7 @@
/**
* Completion handler for textfield panel
* \param returnCode Result from panel. Can be NSOKButton or NSCancelButton.
* \param returnCode Result from panel. Can be NSModalResponseOK or NSModalResponseCancel.
* \param resultingText Resulting text string entered in panel.
*/
typedef void(^TextfieldPanelCompletionBlock)(NSInteger returnCode, NSString *resultingText);
......
......@@ -46,7 +46,7 @@
[NSApp endSheet: self.window];
if (_completionBlock)
_completionBlock(sender == _okButton ? NSOKButton : NSCancelButton, [_textField stringValue]);
_completionBlock(sender == _okButton ? NSModalResponseOK : NSModalResponseCancel, [_textField stringValue]);
}
- (void)runModalForWindow:(NSWindow *)window completionHandler:(TextfieldPanelCompletionBlock)handler;
......
......@@ -37,7 +37,7 @@
/**
* Completion handler for textfield panel
* \param returnCode Result from panel. Can be NSOKButton or NSCancelButton.
* \param returnCode Result from panel. Can be NSModalResponseOK or NSModalResponseCancel.
* \param returnTime Resulting time in seconds entered in panel.
*/
typedef void(^TimeSelectionCompletionHandler)(NSInteger returnCode, int64_t returnTime);
......
......@@ -80,7 +80,7 @@
timeInSec = [string intValue];
if (_completionHandler)
_completionHandler(sender == _okButton ? NSOKButton : NSCancelButton, timeInSec);
_completionHandler(sender == _okButton ? NSModalResponseOK : NSModalResponseCancel, timeInSec);
}
- (void)runModalForWindow:(NSWindow *)window completionHandler:(TimeSelectionCompletionHandler)handler
......
......@@ -797,7 +797,7 @@
[_textfieldPanel runModalForWindow:self.window completionHandler:^(NSInteger returnCode, NSString *resultingText) {
NSInteger currentProfileIndex = [_self currentProfileIndex];
if (returnCode != NSOKButton) {
if (returnCode != NSModalResponseOK) {
[_profilePopup selectItemAtIndex:currentProfileIndex];
return;
}
......@@ -868,7 +868,7 @@
NSInteger activeProfileIndex = [_self currentProfileIndex];
if (returnCode != NSOKButton) {
if (returnCode != NSModalResponseOK) {
[_profilePopup selectItemAtIndex:activeProfileIndex];
return;
}
......
......@@ -1152,7 +1152,7 @@ o_textfield = [[NSSecureTextField alloc] initWithFrame: s_rc]; \
[o_open_panel setCanChooseFiles: !b_directory];
[o_open_panel setCanChooseDirectories: b_directory];
[o_open_panel beginSheetModalForWindow:[sender window] completionHandler:^(NSInteger returnCode) {
if (returnCode == NSOKButton) {
if (returnCode == NSModalResponseOK) {
NSString *o_path = [[[o_open_panel URLs] firstObject] path];
[o_textfield setStringValue: o_path];
}
......
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