[macos] Replace Deprecated constants. (#2038)

* Replace Deprecated constants pt.1

- `NSOnState` -> `NSControlStateValueOn`
- `NSOffState` -> `NSControlStateValueOff`
- `MSMixedState` -> `NSControlStateValueMixed`

* Replace Deprecated constants pt.2

- `NS(\w+)AlertStyle` -> `NSAlertStyle$1`

* Replace Deprecated constants pt.3

- `NSFileHandlingPanel(\w+)Button` -> `NSModalResponse$1`

* Replace Deprecated constants pt.4

- `NSMouse(Entered|Exited)Mask` -> `NSEventMaskMouse$1`
- `NS(Left|Right)Mouse(Down|Up|Dragged)Mask` -> `NSEventMask$1Mouse$2`
- `NSMouse(Entered|Exited)` -> `NSEventTypeMouse$1`
- `NS(Left|Right)Mouse(Up|Down)` -> `NSEventType$1Mouse$2`

* Replace Deprecated constants pt.5

- `NSComposite(\w+)` -> `NSCompositingOperation$1`

* Replace Deprecated constants pt.6

- `NSAlternateKeyMask` -> `NSEventModifierFlagOption`
- `NSCommandKeyMask` -> `NSEventModifierFlagCommand`

* Replace Deprecated constants pt.7

- `NS(\w+)TextAlignment` -> `NSTextAlignment$1`
- `NSBackgroundStyleDark` -> `NSBackgroundStyleEmphasized`

* Replace Deprecated constants pt.8

- `NSTexturedRoundedBezelStyle` -> `NSBezelStyleTexturedRounded`
- `NSBorderlessWindowMask` -> `NSWindowStyleMaskBorderless`
- `NS(OK|Cancel)Button` -> `NSModalResponse$1`
This commit is contained in:
Dzmitry Neviadomski
2021-10-31 18:18:27 +03:00
committed by GitHub
parent 8cac7d6f94
commit b8c01a581e
30 changed files with 207 additions and 182 deletions

View File

@@ -89,7 +89,8 @@
}
[fPriorityPopUp selectItemAtIndex:priorityIndex];
fStartCheck.state = [NSUserDefaults.standardUserDefaults boolForKey:@"AutoStartDownload"] ? NSOnState : NSOffState;
fStartCheck.state = [NSUserDefaults.standardUserDefaults boolForKey:@"AutoStartDownload"] ? NSControlStateValueOn
: NSControlStateValueOff;
if (fDestination)
{
@@ -193,7 +194,7 @@
fTorrent.name];
[panel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton)
if (result == NSModalResponseOK)
{
[self setDestinationPath:panel.URLs[0].path determinationType:TorrentDeterminationUserSpecified];
}
@@ -218,13 +219,13 @@
@"If you are attempting to use already existing data,"
" the root data directory should be inside the destination directory.",
"Add torrent -> same name -> message");
alert.alertStyle = NSWarningAlertStyle;
alert.alertStyle = NSAlertStyleWarning;
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", "Add torrent -> same name -> button")];
[alert addButtonWithTitle:NSLocalizedString(@"Add", "Add torrent -> same name -> button")];
alert.showsSuppressionButton = YES;
[alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) {
if (alert.suppressionButton.state == NSOnState)
if (alert.suppressionButton.state == NSControlStateValueOn)
{
[NSUserDefaults.standardUserDefaults setBool:NO forKey:@"WarningFolderDataSameName"];
}
@@ -293,7 +294,7 @@
{
[fTorrent setGroupValue:fGroupValue determinationType:fGroupDeterminationType];
if (fStartCheck.state == NSOnState)
if (fStartCheck.state == NSControlStateValueOn)
{
[fTorrent startTransfer];
}