mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
macOS use standard toolbar buttons (#3356)
Co-authored-by: Dmitry Serov <barbari100@gmail.com>
This commit is contained in:
parent
5407c89237
commit
b80e9bd8c2
1 changed files with 24 additions and 30 deletions
|
@ -4000,16 +4000,9 @@ static void removeKeRangerRansomware()
|
||||||
|
|
||||||
item.view = button;
|
item.view = button;
|
||||||
|
|
||||||
if (@available(macOS 11.0, *))
|
NSSize const buttonSize = NSMakeSize(36.0, 25.0);
|
||||||
{
|
item.minSize = buttonSize;
|
||||||
button.bordered = NO;
|
item.maxSize = buttonSize;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NSSize const buttonSize = NSMakeSize(36.0, 25.0);
|
|
||||||
item.minSize = 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, *))
|
NSSize const groupSize = NSMakeSize(72.0, 25.0);
|
||||||
{
|
groupItem.minSize = groupSize;
|
||||||
segmentedCell.bezeled = NO;
|
groupItem.maxSize = groupSize;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NSSize const groupSize = NSMakeSize(72.0, 25.0);
|
|
||||||
groupItem.minSize = 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, *))
|
NSSize const groupSize = NSMakeSize(72.0, 25.0);
|
||||||
{
|
groupItem.minSize = groupSize;
|
||||||
segmentedCell.bezeled = NO;
|
groupItem.maxSize = groupSize;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NSSize const groupSize = NSMakeSize(72.0, 25.0);
|
|
||||||
groupItem.minSize = 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)
|
||||||
|
|
Loading…
Reference in a new issue