mirror of
https://github.com/transmission/transmission.git
synced 2025-12-27 13:41:17 +00:00
[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:
committed by
GitHub
parent
8cac7d6f94
commit
b8c01a581e
@@ -298,7 +298,7 @@ static void removeKeRangerRansomware()
|
||||
@"There is already a copy of Transmission running. "
|
||||
"This copy cannot be opened until that instance is quit.",
|
||||
"Transmission already running alert -> message");
|
||||
alert.alertStyle = NSCriticalAlertStyle;
|
||||
alert.alertStyle = NSAlertStyleCritical;
|
||||
|
||||
[alert runModal];
|
||||
|
||||
@@ -328,7 +328,7 @@ static void removeKeRangerRansomware()
|
||||
" When you run a torrent, its data will be made available to others by means of upload."
|
||||
" You and you alone are fully responsible for exercising proper judgement and abiding by your local laws.",
|
||||
"Legal alert -> message");
|
||||
alert.alertStyle = NSInformationalAlertStyle;
|
||||
alert.alertStyle = NSAlertStyleInformational;
|
||||
|
||||
if ([alert runModal] == NSAlertSecondButtonReturn)
|
||||
{
|
||||
@@ -785,7 +785,7 @@ static void removeKeRangerRansomware()
|
||||
NSLocalizedString(@"Donate or not, there will be no difference to your torrenting experience.", "Donation beg -> message")];
|
||||
|
||||
alert.informativeText = donateMessage;
|
||||
alert.alertStyle = NSInformationalAlertStyle;
|
||||
alert.alertStyle = NSAlertStyleInformational;
|
||||
|
||||
[alert addButtonWithTitle:[NSLocalizedString(@"Donate", "Donation beg -> button") stringByAppendingEllipsis]];
|
||||
NSButton* noDonateButton = [alert addButtonWithTitle:NSLocalizedString(@"Nope", "Donation beg -> button")];
|
||||
@@ -807,7 +807,7 @@ static void removeKeRangerRansomware()
|
||||
|
||||
if (allowNeverAgain)
|
||||
{
|
||||
[fDefaults setBool:(alert.suppressionButton.state != NSOnState) forKey:@"WarningDonate"];
|
||||
[fDefaults setBool:(alert.suppressionButton.state != NSControlStateValueOn) forKey:@"WarningDonate"];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1331,7 +1331,7 @@ static void removeKeRangerRansomware()
|
||||
panel.allowedFileTypes = @[ @"org.bittorrent.torrent", @"torrent" ];
|
||||
|
||||
[panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) {
|
||||
if (result == NSFileHandlingPanelOKButton)
|
||||
if (result == NSModalResponseOK)
|
||||
{
|
||||
NSMutableArray* filenames = [NSMutableArray arrayWithCapacity:panel.URLs.count];
|
||||
for (NSURL* url in panel.URLs)
|
||||
@@ -1359,11 +1359,11 @@ static void removeKeRangerRansomware()
|
||||
stringWithFormat:NSLocalizedString(@"\"%@\" is not a valid torrent file.", "Open invalid alert -> title"), filename];
|
||||
alert.informativeText = NSLocalizedString(@"The torrent file cannot be opened because it contains invalid data.", "Open invalid alert -> message");
|
||||
|
||||
alert.alertStyle = NSWarningAlertStyle;
|
||||
alert.alertStyle = NSAlertStyleWarning;
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"OK", "Open invalid alert -> button")];
|
||||
|
||||
[alert runModal];
|
||||
if (alert.suppressionButton.state == NSOnState)
|
||||
if (alert.suppressionButton.state == NSControlStateValueOn)
|
||||
{
|
||||
[fDefaults setBool:NO forKey:@"WarningInvalidOpen"];
|
||||
}
|
||||
@@ -1383,11 +1383,11 @@ static void removeKeRangerRansomware()
|
||||
" The transfer will not occur.",
|
||||
"Magnet link failed -> message"),
|
||||
address];
|
||||
alert.alertStyle = NSWarningAlertStyle;
|
||||
alert.alertStyle = NSAlertStyleWarning;
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"OK", "Magnet link failed -> button")];
|
||||
|
||||
[alert runModal];
|
||||
if (alert.suppressionButton.state == NSOnState)
|
||||
if (alert.suppressionButton.state == NSControlStateValueOn)
|
||||
{
|
||||
[fDefaults setBool:NO forKey:@"WarningInvalidOpen"];
|
||||
}
|
||||
@@ -1407,7 +1407,7 @@ static void removeKeRangerRansomware()
|
||||
@"The transfer cannot be added because it is a duplicate of an already existing transfer.",
|
||||
"Open duplicate alert -> message");
|
||||
|
||||
alert.alertStyle = NSWarningAlertStyle;
|
||||
alert.alertStyle = NSAlertStyleWarning;
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"OK", "Open duplicate alert -> button")];
|
||||
alert.showsSuppressionButton = YES;
|
||||
|
||||
@@ -1440,7 +1440,7 @@ static void removeKeRangerRansomware()
|
||||
@"The magnet link \"%@\" cannot be added because it is a duplicate of an already existing transfer.",
|
||||
"Open duplicate magnet alert -> message"),
|
||||
address];
|
||||
alert.alertStyle = NSWarningAlertStyle;
|
||||
alert.alertStyle = NSAlertStyleWarning;
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"OK", "Open duplicate magnet alert -> button")];
|
||||
alert.showsSuppressionButton = YES;
|
||||
|
||||
@@ -1881,7 +1881,7 @@ static void removeKeRangerRansomware()
|
||||
NSAlert* alert = [[NSAlert alloc] init];
|
||||
alert.messageText = message;
|
||||
alert.informativeText = info;
|
||||
alert.alertStyle = NSWarningAlertStyle;
|
||||
alert.alertStyle = NSAlertStyleWarning;
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"Remove", "Remove completed confirm panel -> button")];
|
||||
[alert addButtonWithTitle:NSLocalizedString(@"Cancel", "Remove completed confirm panel -> button")];
|
||||
alert.showsSuppressionButton = YES;
|
||||
@@ -1929,7 +1929,7 @@ static void removeKeRangerRansomware()
|
||||
}
|
||||
|
||||
[panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) {
|
||||
if (result == NSFileHandlingPanelOKButton)
|
||||
if (result == NSModalResponseOK)
|
||||
{
|
||||
for (Torrent* torrent in torrents)
|
||||
{
|
||||
@@ -1963,7 +1963,7 @@ static void removeKeRangerRansomware()
|
||||
|
||||
[panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) {
|
||||
//copy torrent to new location with name of data file
|
||||
if (result == NSFileHandlingPanelOKButton)
|
||||
if (result == NSModalResponseOK)
|
||||
{
|
||||
[torrent copyTorrentFileTo:panel.URL.path];
|
||||
}
|
||||
@@ -1984,7 +1984,7 @@ static void removeKeRangerRansomware()
|
||||
alert.informativeText = [NSString
|
||||
stringWithFormat:NSLocalizedString(@"The torrent file (%@) cannot be found.", "Torrent file copy alert -> message"),
|
||||
torrent.torrentLocation];
|
||||
alert.alertStyle = NSWarningAlertStyle;
|
||||
alert.alertStyle = NSAlertStyleWarning;
|
||||
|
||||
[alert runModal];
|
||||
}
|
||||
@@ -4210,7 +4210,7 @@ static void removeKeRangerRansomware()
|
||||
ButtonToolbarItem* item = [[klass alloc] initWithItemIdentifier:ident];
|
||||
|
||||
NSButton* button = [[NSButton alloc] init];
|
||||
button.bezelStyle = NSTexturedRoundedBezelStyle;
|
||||
button.bezelStyle = NSBezelStyleTexturedRounded;
|
||||
button.stringValue = @"";
|
||||
|
||||
item.view = button;
|
||||
@@ -4521,7 +4521,7 @@ static void removeKeRangerRansomware()
|
||||
NSButton* itemButton = (NSButton*)item.view;
|
||||
itemButton.target = self;
|
||||
itemButton.action = @selector(showToolbarShare:);
|
||||
[itemButton sendActionOn:NSLeftMouseDownMask];
|
||||
[itemButton sendActionOn:NSEventMaskLeftMouseDown];
|
||||
|
||||
return item;
|
||||
}
|
||||
@@ -4695,7 +4695,7 @@ static void removeKeRangerRansomware()
|
||||
|
||||
if (action == @selector(toggleSpeedLimit:))
|
||||
{
|
||||
menuItem.state = [fDefaults boolForKey:@"SpeedLimit"] ? NSOnState : NSOffState;
|
||||
menuItem.state = [fDefaults boolForKey:@"SpeedLimit"] ? NSControlStateValueOn : NSControlStateValueOff;
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -4743,7 +4743,7 @@ static void removeKeRangerRansomware()
|
||||
sortType = SORT_ORDER;
|
||||
}
|
||||
|
||||
menuItem.state = [sortType isEqualToString:[fDefaults stringForKey:@"Sort"]] ? NSOnState : NSOffState;
|
||||
menuItem.state = [sortType isEqualToString:[fDefaults stringForKey:@"Sort"]] ? NSControlStateValueOn : NSControlStateValueOff;
|
||||
return fWindow.visible;
|
||||
}
|
||||
|
||||
@@ -4761,25 +4761,26 @@ static void removeKeRangerRansomware()
|
||||
}
|
||||
}
|
||||
|
||||
menuItem.state = checked ? NSOnState : NSOffState;
|
||||
menuItem.state = checked ? NSControlStateValueOn : NSControlStateValueOff;
|
||||
return canUseTable && fTableView.numberOfSelectedRows > 0;
|
||||
}
|
||||
|
||||
if (action == @selector(toggleSmallView:))
|
||||
{
|
||||
menuItem.state = [fDefaults boolForKey:@"SmallView"] ? NSOnState : NSOffState;
|
||||
menuItem.state = [fDefaults boolForKey:@"SmallView"] ? NSControlStateValueOn : NSControlStateValueOff;
|
||||
return fWindow.visible;
|
||||
}
|
||||
|
||||
if (action == @selector(togglePiecesBar:))
|
||||
{
|
||||
menuItem.state = [fDefaults boolForKey:@"PiecesBar"] ? NSOnState : NSOffState;
|
||||
menuItem.state = [fDefaults boolForKey:@"PiecesBar"] ? NSControlStateValueOn : NSControlStateValueOff;
|
||||
return fWindow.visible;
|
||||
}
|
||||
|
||||
if (action == @selector(toggleAvailabilityBar:))
|
||||
{
|
||||
menuItem.state = [fDefaults boolForKey:@"DisplayProgressBarAvailable"] ? NSOnState : NSOffState;
|
||||
menuItem.state = [fDefaults boolForKey:@"DisplayProgressBarAvailable"] ? NSControlStateValueOn
|
||||
: NSControlStateValueOff;
|
||||
return fWindow.visible;
|
||||
}
|
||||
|
||||
@@ -5072,14 +5073,15 @@ static void removeKeRangerRansomware()
|
||||
if (action == @selector(setSortReverse:))
|
||||
{
|
||||
BOOL const isReverse = menuItem.tag == SORT_DESC_TAG;
|
||||
menuItem.state = (isReverse == [fDefaults boolForKey:@"SortReverse"]) ? NSOnState : NSOffState;
|
||||
menuItem.state = (isReverse == [fDefaults boolForKey:@"SortReverse"]) ? NSControlStateValueOn
|
||||
: NSControlStateValueOff;
|
||||
return ![[fDefaults stringForKey:@"Sort"] isEqualToString:SORT_ORDER];
|
||||
}
|
||||
|
||||
//enable group sort item
|
||||
if (action == @selector(setSortByGroup:))
|
||||
{
|
||||
menuItem.state = [fDefaults boolForKey:@"SortByGroup"] ? NSOnState : NSOffState;
|
||||
menuItem.state = [fDefaults boolForKey:@"SortByGroup"] ? NSControlStateValueOn : NSControlStateValueOff;
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user