2023-11-01 21:11:11 +00:00
|
|
|
// This file Copyright © Transmission authors and contributors.
|
2022-01-20 18:27:56 +00:00
|
|
|
// It may be used under the MIT (SPDX: MIT) license.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2007-11-17 15:55:23 +00:00
|
|
|
|
|
|
|
#import "FilterButton.h"
|
2010-11-14 20:26:58 +00:00
|
|
|
#import "NSStringAdditions.h"
|
2007-11-17 15:55:23 +00:00
|
|
|
|
|
|
|
@implementation FilterButton
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (instancetype)initWithCoder:(NSCoder*)coder
|
2007-11-17 15:55:23 +00:00
|
|
|
{
|
2021-08-15 09:41:48 +00:00
|
|
|
if ((self = [super initWithCoder:coder]))
|
2007-11-17 16:35:48 +00:00
|
|
|
{
|
2022-02-22 16:04:20 +00:00
|
|
|
_count = NSNotFound;
|
2007-11-17 16:52:56 +00:00
|
|
|
}
|
|
|
|
return self;
|
2007-11-17 15:55:23 +00:00
|
|
|
}
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)setCount:(NSUInteger)count
|
2007-11-17 15:55:23 +00:00
|
|
|
{
|
2022-02-22 16:04:20 +00:00
|
|
|
if (count == _count)
|
2021-08-15 09:41:48 +00:00
|
|
|
{
|
2007-11-17 15:55:23 +00:00
|
|
|
return;
|
2021-08-15 09:41:48 +00:00
|
|
|
}
|
2017-01-24 17:53:16 +00:00
|
|
|
|
2022-02-22 16:04:20 +00:00
|
|
|
_count = count;
|
2017-01-24 17:53:16 +00:00
|
|
|
|
2022-11-14 18:30:03 +00:00
|
|
|
self.toolTip = count == 1 ?
|
|
|
|
NSLocalizedString(@"1 transfer", "Filter Button -> tool tip") :
|
|
|
|
[NSString localizedStringWithFormat:NSLocalizedString(@"%lu transfers", "Filter Bar Button -> tool tip"), count];
|
2007-11-17 15:55:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|