1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-21 23:32:35 +00:00

Remove dead pre-Lion code from the torrent table view (#6501)

With our current minimum version, all clients will be using the popover
This commit is contained in:
Mitch Livingston 2024-01-07 13:27:48 -05:00 committed by GitHub
parent 632b7048fe
commit d0beae2f14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 321 deletions

View file

@ -421,15 +421,9 @@
</tableColumns>
<connections>
<outlet property="dataSource" destination="206" id="3097"/>
<outlet property="fActionMenu" destination="1936" id="3098"/>
<outlet property="fContextNoRow" destination="589" id="3101"/>
<outlet property="fContextRow" destination="456" id="3100"/>
<outlet property="fController" destination="206" id="3102"/>
<outlet property="fDownloadMenu" destination="1945" id="3103"/>
<outlet property="fGlobalLimitItem" destination="3190" id="3193"/>
<outlet property="fPriorityMenu" destination="3197" id="3201"/>
<outlet property="fRatioMenu" destination="2018" id="3105"/>
<outlet property="fUploadMenu" destination="1951" id="3104"/>
</connections>
</outlineView>
</subviews>
@ -1216,123 +1210,6 @@ CA
</menu>
<customObject id="1812" userLabel="SUUpdater" customClass="SUUpdater"/>
<userDefaultsController representsSharedInstance="YES" id="1815" userLabel="Shared Defaults"/>
<menu title="Menu" autoenablesItems="NO" id="1936" userLabel="TorrentActionMenu">
<items>
<menuItem title="Priority" id="3196">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Priority" id="3197">
<items>
<menuItem title="High" image="PriorityHighTemplate" tag="101" id="3198">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="setPriority:" target="3091" id="3202"/>
</connections>
</menuItem>
<menuItem title="Normal" image="PriorityNormalTemplate" tag="102" id="3199">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="setPriority:" target="3091" id="3203"/>
</connections>
</menuItem>
<menuItem title="Low" image="PriorityLowTemplate" tag="103" id="3200">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="setPriority:" target="3091" id="3204"/>
</connections>
</menuItem>
</items>
<connections>
<outlet property="delegate" destination="3091" id="3205"/>
</connections>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="3195">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Download Bandwidth Limit" id="1944">
<menu key="submenu" title="Download Bandwidth Limit" id="1945">
<items>
<menuItem title="Unlimited" tag="102" id="1946">
<connections>
<action selector="setQuickLimitMode:" target="3091" id="3110"/>
</connections>
</menuItem>
<menuItem title="limit" tag="103" id="1960">
<connections>
<action selector="setQuickLimitMode:" target="3091" id="3111"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="1971">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
</items>
<connections>
<outlet property="delegate" destination="3091" id="3121"/>
</connections>
</menu>
</menuItem>
<menuItem title="Upload Bandwidth Limit" id="1950">
<menu key="submenu" title="Upload Bandwidth Limit" id="1951">
<items>
<menuItem title="Unlimited" tag="102" id="1963">
<connections>
<action selector="setQuickLimitMode:" target="3091" id="3113"/>
</connections>
</menuItem>
<menuItem title="limit" tag="103" id="1964">
<connections>
<action selector="setQuickLimitMode:" target="3091" id="3114"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="2005">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
</items>
<connections>
<outlet property="delegate" destination="3091" id="3122"/>
</connections>
</menu>
</menuItem>
<menuItem title="Stay Within Global Bandwidth Limits" id="3190">
<connections>
<action selector="setGlobalLimit:" target="3091" id="3191"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="2029">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Stop Seeding at Ratio" id="2017">
<menu key="submenu" title="Stop Seeding at Ratio" id="2018">
<items>
<menuItem title="Global" tag="101" id="2031">
<connections>
<action selector="setQuickRatioMode:" target="3091" id="3115"/>
</connections>
</menuItem>
<menuItem title="Seed Forever" tag="102" id="2024">
<connections>
<action selector="setQuickRatioMode:" target="3091" id="3116"/>
</connections>
</menuItem>
<menuItem title="stop ratio" tag="103" id="2025">
<connections>
<action selector="setQuickRatioMode:" target="3091" id="3117"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="2026">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
</items>
<connections>
<outlet property="delegate" destination="3091" id="3123"/>
</connections>
</menu>
</menuItem>
</items>
<connections>
<outlet property="delegate" destination="3091" id="3120"/>
</connections>
</menu>
</objects>
<resources>
<image name="ActionHover" width="16" height="16"/>
@ -1342,8 +1219,6 @@ CA
<image name="NSFolder" width="32" height="32"/>
<image name="NSStatusAvailable" width="16" height="16"/>
<image name="PriorityHighTemplate" width="12" height="12"/>
<image name="PriorityLowTemplate" width="12" height="12"/>
<image name="PriorityNormalTemplate" width="12" height="12"/>
<image name="ResumeOff" width="14" height="14"/>
<image name="RevealOff" width="14" height="14"/>
<image name="TortoiseTemplate" width="18" height="18"/>

View file

@ -33,15 +33,6 @@ extern CGFloat const kGroupSeparatorHeight;
- (IBAction)displayTorrentActionPopover:(id)sender;
- (IBAction)setQuickLimitMode:(id)sender;
- (void)setQuickLimit:(id)sender;
- (IBAction)setGlobalLimit:(id)sender;
- (IBAction)setQuickRatioMode:(id)sender;
- (void)setQuickRatio:(id)sender;
- (IBAction)setPriority:(id)sender;
- (void)togglePiecesBar;
@property(nonatomic, readonly) CGFloat piecesBarPercent;

View file

@ -26,19 +26,6 @@ CGFloat const kGroupSeparatorHeight = 18.0;
static NSInteger const kMaxGroup = 999999;
static CGFloat const kErrorImageSize = 20.0;
//eliminate when Lion-only
typedef NS_ENUM(NSUInteger, ActionMenuTag) {
ActionMenuTagGlobal = 101,
ActionMenuTagUnlimited = 102,
ActionMenuTagLimit = 103,
};
typedef NS_ENUM(NSUInteger, ActionMenuPriorityTag) {
ActionMenuPriorityTagHigh = 101,
ActionMenuPriorityTagNormal = 102,
ActionMenuPriorityTagLow = 103,
};
static NSTimeInterval const kToggleProgressSeconds = 0.175;
@interface TorrentTableView ()
@ -54,14 +41,6 @@ static NSTimeInterval const kToggleProgressSeconds = 0.175;
@property(nonatomic) NSIndexSet* fSelectedRowIndexes;
@property(nonatomic) IBOutlet NSMenu* fActionMenu;
@property(nonatomic) IBOutlet NSMenu* fUploadMenu;
@property(nonatomic) IBOutlet NSMenu* fDownloadMenu;
@property(nonatomic) IBOutlet NSMenu* fRatioMenu;
@property(nonatomic) IBOutlet NSMenu* fPriorityMenu;
@property(nonatomic) IBOutlet NSMenuItem* fGlobalLimitItem;
@property(nonatomic, readonly) Torrent* fMenuTorrent;
@property(nonatomic) CGFloat piecesBarPercent;
@property(nonatomic) NSAnimation* fPiecesBarAnimation;
@ -873,172 +852,6 @@ static NSTimeInterval const kToggleProgressSeconds = 0.175;
self.fActionPopoverShown = NO;
}
//eliminate when Lion-only, along with all the menu item instance variables
- (void)menuNeedsUpdate:(NSMenu*)menu
{
//this method seems to be called when it shouldn't be
if (!self.fMenuTorrent || !menu.supermenu)
{
return;
}
if (menu == self.fUploadMenu || menu == self.fDownloadMenu)
{
NSMenuItem* item;
if (menu.numberOfItems == 3)
{
static NSArray<NSNumber*>* const speedLimitActionValues = @[ @50, @100, @250, @500, @1000, @2500, @5000, @10000 ];
for (NSNumber* i in speedLimitActionValues)
{
item = [[NSMenuItem alloc]
initWithTitle:[NSString localizedStringWithFormat:NSLocalizedString(@"%ld KB/s", "Action menu -> upload/download limit"),
i.integerValue]
action:@selector(setQuickLimit:)
keyEquivalent:@""];
item.target = self;
item.representedObject = i;
[menu addItem:item];
}
}
BOOL const upload = menu == self.fUploadMenu;
BOOL const limit = [self.fMenuTorrent usesSpeedLimit:upload];
item = [menu itemWithTag:ActionMenuTagLimit];
item.state = limit ? NSControlStateValueOn : NSControlStateValueOff;
item.title = [NSString localizedStringWithFormat:NSLocalizedString(@"Limit (%ld KB/s)", "torrent action menu -> upload/download limit"),
[self.fMenuTorrent speedLimit:upload]];
item = [menu itemWithTag:ActionMenuTagUnlimited];
item.state = !limit ? NSControlStateValueOn : NSControlStateValueOff;
}
else if (menu == self.fRatioMenu)
{
NSMenuItem* item;
if (menu.numberOfItems == 4)
{
static NSArray<NSNumber*>* const ratioLimitActionValue = @[ @0.25, @0.5, @0.75, @1.0, @1.5, @2.0, @3.0 ];
for (NSNumber* i in ratioLimitActionValue)
{
item = [[NSMenuItem alloc] initWithTitle:[NSString localizedStringWithFormat:@"%.2f", i.floatValue]
action:@selector(setQuickRatio:)
keyEquivalent:@""];
item.target = self;
item.representedObject = i;
[menu addItem:item];
}
}
tr_ratiolimit const mode = self.fMenuTorrent.ratioSetting;
item = [menu itemWithTag:ActionMenuTagLimit];
item.state = mode == TR_RATIOLIMIT_SINGLE ? NSControlStateValueOn : NSControlStateValueOff;
item.title = [NSString localizedStringWithFormat:NSLocalizedString(@"Stop at Ratio (%.2f)", "torrent action menu -> ratio stop"),
self.fMenuTorrent.ratioLimit];
item = [menu itemWithTag:ActionMenuTagUnlimited];
item.state = mode == TR_RATIOLIMIT_UNLIMITED ? NSControlStateValueOn : NSControlStateValueOff;
item = [menu itemWithTag:ActionMenuTagGlobal];
item.state = mode == TR_RATIOLIMIT_GLOBAL ? NSControlStateValueOn : NSControlStateValueOff;
}
else if (menu == self.fPriorityMenu)
{
tr_priority_t const priority = self.fMenuTorrent.priority;
NSMenuItem* item = [menu itemWithTag:ActionMenuPriorityTagHigh];
item.state = priority == TR_PRI_HIGH ? NSControlStateValueOn : NSControlStateValueOff;
item = [menu itemWithTag:ActionMenuPriorityTagNormal];
item.state = priority == TR_PRI_NORMAL ? NSControlStateValueOn : NSControlStateValueOff;
item = [menu itemWithTag:ActionMenuPriorityTagLow];
item.state = priority == TR_PRI_LOW ? NSControlStateValueOn : NSControlStateValueOff;
}
}
//the following methods might not be needed when Lion-only
- (void)setQuickLimitMode:(id)sender
{
BOOL const limit = [sender tag] == ActionMenuTagLimit;
[self.fMenuTorrent setUseSpeedLimit:limit upload:[sender menu] == self.fUploadMenu];
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateOptions" object:nil];
}
- (void)setQuickLimit:(id)sender
{
BOOL const upload = [sender menu] == self.fUploadMenu;
[self.fMenuTorrent setUseSpeedLimit:YES upload:upload];
[self.fMenuTorrent setSpeedLimit:[[sender representedObject] intValue] upload:upload];
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateOptions" object:nil];
}
- (void)setGlobalLimit:(id)sender
{
self.fMenuTorrent.usesGlobalSpeedLimit = ((NSButton*)sender).state != NSControlStateValueOn;
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateOptions" object:nil];
}
- (void)setQuickRatioMode:(id)sender
{
tr_ratiolimit mode;
switch ([sender tag])
{
case ActionMenuTagUnlimited:
mode = TR_RATIOLIMIT_UNLIMITED;
break;
case ActionMenuTagLimit:
mode = TR_RATIOLIMIT_SINGLE;
break;
case ActionMenuTagGlobal:
mode = TR_RATIOLIMIT_GLOBAL;
break;
default:
return;
}
self.fMenuTorrent.ratioSetting = mode;
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateOptions" object:nil];
}
- (void)setQuickRatio:(id)sender
{
self.fMenuTorrent.ratioSetting = TR_RATIOLIMIT_SINGLE;
self.fMenuTorrent.ratioLimit = [[sender representedObject] floatValue];
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateOptions" object:nil];
}
- (void)setPriority:(id)sender
{
tr_priority_t priority;
switch ([sender tag])
{
case ActionMenuPriorityTagHigh:
priority = TR_PRI_HIGH;
break;
case ActionMenuPriorityTagNormal:
priority = TR_PRI_NORMAL;
break;
case ActionMenuPriorityTagLow:
priority = TR_PRI_LOW;
break;
default:
NSAssert1(NO, @"Unknown priority: %ld", [sender tag]);
priority = TR_PRI_NORMAL;
}
self.fMenuTorrent.priority = priority;
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateUI" object:nil];
}
- (void)togglePiecesBar
{
NSMutableArray* progressMarks = [NSMutableArray arrayWithCapacity:16];