1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

macOS use standard toolbar buttons (#3356)

Co-authored-by: Dmitry Serov <barbari100@gmail.com>
This commit is contained in:
SweetPPro 2022-06-28 23:14:10 +02:00 committed by GitHub
parent 5407c89237
commit b80e9bd8c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4000,16 +4000,9 @@ static void removeKeRangerRansomware()
item.view = button; item.view = button;
if (@available(macOS 11.0, *))
{
button.bordered = NO;
}
else
{
NSSize const buttonSize = NSMakeSize(36.0, 25.0); NSSize const buttonSize = NSMakeSize(36.0, 25.0);
item.minSize = buttonSize; item.minSize = buttonSize;
item.maxSize = buttonSize; item.maxSize = buttonSize;
}
return item; return item;
} }
@ -4099,16 +4092,9 @@ static void removeKeRangerRansomware()
segmentedControl.segmentCount = 2; segmentedControl.segmentCount = 2;
segmentedCell.trackingMode = NSSegmentSwitchTrackingMomentary; segmentedCell.trackingMode = NSSegmentSwitchTrackingMomentary;
if (@available(macOS 11.0, *))
{
segmentedCell.bezeled = NO;
}
else
{
NSSize const groupSize = NSMakeSize(72.0, 25.0); NSSize const groupSize = NSMakeSize(72.0, 25.0);
groupItem.minSize = groupSize; groupItem.minSize = groupSize;
groupItem.maxSize = groupSize; groupItem.maxSize = groupSize;
}
groupItem.label = NSLocalizedString(@"Apply All", "All toolbar item -> label"); groupItem.label = NSLocalizedString(@"Apply All", "All toolbar item -> label");
groupItem.paletteLabel = NSLocalizedString(@"Pause / Resume All", "All toolbar item -> palette label"); groupItem.paletteLabel = NSLocalizedString(@"Pause / Resume All", "All toolbar item -> palette label");
@ -4150,16 +4136,9 @@ static void removeKeRangerRansomware()
segmentedControl.segmentCount = 2; segmentedControl.segmentCount = 2;
segmentedCell.trackingMode = NSSegmentSwitchTrackingMomentary; segmentedCell.trackingMode = NSSegmentSwitchTrackingMomentary;
if (@available(macOS 11.0, *))
{
segmentedCell.bezeled = NO;
}
else
{
NSSize const groupSize = NSMakeSize(72.0, 25.0); NSSize const groupSize = NSMakeSize(72.0, 25.0);
groupItem.minSize = groupSize; groupItem.minSize = groupSize;
groupItem.maxSize = groupSize; groupItem.maxSize = groupSize;
}
groupItem.label = NSLocalizedString(@"Apply Selected", "Selected toolbar item -> label"); groupItem.label = NSLocalizedString(@"Apply Selected", "Selected toolbar item -> label");
groupItem.paletteLabel = NSLocalizedString(@"Pause / Resume Selected", "Selected toolbar item -> palette label"); groupItem.paletteLabel = NSLocalizedString(@"Pause / Resume Selected", "Selected toolbar item -> palette label");
@ -5042,12 +5021,27 @@ static void removeKeRangerRansomware()
[self removeStackViewHeightConstraints]; [self removeStackViewHeightConstraints];
} }
//this fixes a macOS bug where on toggling the toolbar item bezels will show
[self hideToolBarBezels:YES];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self setWindowSizeToFit]; [self setWindowSizeToFit];
[self hideToolBarBezels:NO];
}); });
} }
} }
- (void)hideToolBarBezels:(BOOL)hide
{
if (@available(macOS 11.0, *))
{
for (NSToolbarItem* item in self.fWindow.toolbar.items)
{
item.view.hidden = hide;
}
}
}
- (void)removeStackViewHeightConstraints - (void)removeStackViewHeightConstraints
{ {
if (self.fStackViewHeightConstraints) if (self.fStackViewHeightConstraints)