mirror of
https://github.com/transmission/transmission
synced 2025-03-13 07:33:02 +00:00
use bindings for speed limit
This commit is contained in:
parent
835a616494
commit
8ebdd6070a
9 changed files with 62 additions and 41 deletions
|
@ -149,6 +149,7 @@
|
|||
A2AA579D0ADFCAB400CA59F6 /* PiecesImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AA579B0ADFCAB400CA59F6 /* PiecesImageView.m */; };
|
||||
A2AF1C390A3D0F6200F1575D /* FileTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AF1C370A3D0F6200F1575D /* FileTableView.m */; };
|
||||
A2BD40070A09BBEA008CCE96 /* bencode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1838B709DEC0430047D688 /* bencode.h */; };
|
||||
A2BF07910B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A2BF078F0B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.m */; };
|
||||
A2C655650A04FEDC00E9FD82 /* BottomBorder.png in Resources */ = {isa = PBXBuildFile; fileRef = A2C655640A04FEDC00E9FD82 /* BottomBorder.png */; };
|
||||
A2D0E0490A54A97C003C72CF /* Bandwidth.png in Resources */ = {isa = PBXBuildFile; fileRef = A2D0E0480A54A97C003C72CF /* Bandwidth.png */; };
|
||||
A2D4F0830A915F6600890C32 /* RedDot.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A2D4F0820A915F6600890C32 /* RedDot.tiff */; };
|
||||
|
@ -363,6 +364,8 @@
|
|||
A2AA579B0ADFCAB400CA59F6 /* PiecesImageView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PiecesImageView.m; path = macosx/PiecesImageView.m; sourceTree = "<group>"; };
|
||||
A2AF1C360A3D0F6200F1575D /* FileTableView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FileTableView.h; path = macosx/FileTableView.h; sourceTree = "<group>"; };
|
||||
A2AF1C370A3D0F6200F1575D /* FileTableView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = FileTableView.m; path = macosx/FileTableView.m; sourceTree = "<group>"; };
|
||||
A2BF078E0B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SpeedLimitToTurtleIconTransformer.h; path = macosx/SpeedLimitToTurtleIconTransformer.h; sourceTree = "<group>"; };
|
||||
A2BF078F0B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = SpeedLimitToTurtleIconTransformer.m; path = macosx/SpeedLimitToTurtleIconTransformer.m; sourceTree = "<group>"; };
|
||||
A2C655640A04FEDC00E9FD82 /* BottomBorder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = BottomBorder.png; path = macosx/Images/BottomBorder.png; sourceTree = "<group>"; };
|
||||
A2D0E0480A54A97C003C72CF /* Bandwidth.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Bandwidth.png; path = macosx/Images/Bandwidth.png; sourceTree = "<group>"; };
|
||||
A2D4F0820A915F6600890C32 /* RedDot.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = RedDot.tiff; path = macosx/Images/RedDot.tiff; sourceTree = "<group>"; };
|
||||
|
@ -407,6 +410,8 @@
|
|||
080E96DDFE201D6D7F000001 /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A2BF078F0B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.m */,
|
||||
A2BF078E0B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.h */,
|
||||
A25E74440AF5089E006F11AE /* ExpandedPathToPathTransformer.m */,
|
||||
A25E74450AF5089E006F11AE /* ExpandedPathToPathTransformer.h */,
|
||||
A25E74460AF5089E006F11AE /* ExpandedPathToIconTransformer.m */,
|
||||
|
@ -923,6 +928,7 @@
|
|||
A21F5C040AF26DD5008CE5CE /* ActionMenuSpeedToDisplayLimitTransformer.m in Sources */,
|
||||
A25E74650AF5097C006F11AE /* ExpandedPathToPathTransformer.m in Sources */,
|
||||
A25E74660AF5097D006F11AE /* ExpandedPathToIconTransformer.m in Sources */,
|
||||
A2BF07910B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -57,9 +57,7 @@
|
|||
|
||||
IBOutlet NSMenuItem * fOpenIgnoreDownloadFolder;
|
||||
|
||||
IBOutlet NSMenuItem * fSpeedLimitItem, * fSpeedLimitDockItem;
|
||||
IBOutlet NSButton * fActionButton, * fSpeedLimitButton;
|
||||
NSImage * fSpeedLimitNormalImage, * fSpeedLimitBlueImage, * fSpeedLimitGraphiteImage;
|
||||
NSTimer * fSpeedLimitTimer;
|
||||
|
||||
IBOutlet ImageBackgroundView * fStatusBar;
|
||||
|
@ -152,6 +150,7 @@
|
|||
- (void) setFilter: (id) sender;
|
||||
- (void) switchFilter: (id) sender;
|
||||
|
||||
- (void) applySpeedLimit: (id) sender;
|
||||
- (void) toggleSpeedLimit: (id) sender;
|
||||
- (void) autoSpeedLimitChange: (NSNotification *) notification;
|
||||
- (void) autoSpeedLimit: (NSTimer *) timer;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#import "ActionMenuRatioToDisplayRatioTransformer.h"
|
||||
#import "ExpandedPathToPathTransformer.h"
|
||||
#import "ExpandedPathToIconTransformer.h"
|
||||
#import "SpeedLimitToTurtleIconTransformer.h"
|
||||
|
||||
#import <Sparkle/Sparkle.h>
|
||||
|
||||
|
@ -92,6 +93,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
ExpandedPathToIconTransformer * iconTransformer =
|
||||
[[[ExpandedPathToIconTransformer alloc] init] autorelease];
|
||||
[NSValueTransformer setValueTransformer: iconTransformer forName: @"ExpandedPathToIconTransformer"];
|
||||
|
||||
SpeedLimitToTurtleIconTransformer * speedLimitIconTransformer =
|
||||
[[[SpeedLimitToTurtleIconTransformer alloc] init] autorelease];
|
||||
[NSValueTransformer setValueTransformer: speedLimitIconTransformer forName: @"SpeedLimitToTurtleIconTransformer"];
|
||||
}
|
||||
|
||||
- (id) init
|
||||
|
@ -200,23 +205,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
[contentView addSubview: fStatusBar];
|
||||
[fStatusBar setFrameOrigin: NSMakePoint(0, NSMaxY([contentView frame]))];
|
||||
[self showStatusBar: [fDefaults boolForKey: @"StatusBar"] animate: NO];
|
||||
|
||||
//set speed limit
|
||||
fSpeedLimitNormalImage = [fSpeedLimitButton image];
|
||||
fSpeedLimitBlueImage = [NSImage imageNamed: @"SpeedLimitButtonBlue.png"];
|
||||
fSpeedLimitGraphiteImage = [NSImage imageNamed: @"SpeedLimitButtonGraphite.png"];
|
||||
|
||||
[self updateControlTint: nil];
|
||||
|
||||
if ([fDefaults boolForKey: @"SpeedLimit"])
|
||||
{
|
||||
#warning get rid of
|
||||
[fSpeedLimitItem setState: NSOnState];
|
||||
[fSpeedLimitDockItem setState: NSOnState];
|
||||
|
||||
[fSpeedLimitButton setImage: [NSColor currentControlTint] == NSBlueControlTint
|
||||
? fSpeedLimitBlueImage : fSpeedLimitGraphiteImage];
|
||||
}
|
||||
|
||||
[fActionButton setToolTip: NSLocalizedString(@"Shortcuts for changing global settings.",
|
||||
"Main window -> 1st bottom left button (action) tooltip")];
|
||||
|
@ -927,13 +915,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
[fMessageController showWindow: nil];
|
||||
}
|
||||
|
||||
- (void) updateControlTint: (NSNotification *) notification
|
||||
{
|
||||
if ([fDefaults boolForKey: @"SpeedLimit"])
|
||||
[fSpeedLimitButton setImage: [NSColor currentControlTint] == NSBlueControlTint
|
||||
? fSpeedLimitBlueImage : fSpeedLimitGraphiteImage];
|
||||
}
|
||||
|
||||
- (void) updateUI: (NSTimer *) timer
|
||||
{
|
||||
[fTorrents makeObjectsPerformSelector: @selector(update)];
|
||||
|
@ -1283,21 +1264,22 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
[self setFilter: button];
|
||||
}
|
||||
|
||||
- (void) updateControlTint: (NSNotification *) notification
|
||||
{
|
||||
if ([fDefaults boolForKey: @"SpeedLimit"])
|
||||
[fSpeedLimitButton setImage: [NSColor currentControlTint] == NSBlueControlTint
|
||||
? [NSImage imageNamed: @"SpeedLimitButtonBlue.png"] : [NSImage imageNamed: @"SpeedLimitButtonGraphite.png"]];
|
||||
}
|
||||
|
||||
- (void) applySpeedLimit: (id) sender
|
||||
{
|
||||
[fPrefsController applySpeedSettings: nil];
|
||||
}
|
||||
|
||||
- (void) toggleSpeedLimit: (id) sender
|
||||
{
|
||||
BOOL setEnabled = ![fDefaults boolForKey: @"SpeedLimit"];
|
||||
int state = setEnabled ? NSOnState : NSOffState;
|
||||
|
||||
[fDefaults setBool: setEnabled forKey: @"SpeedLimit"];
|
||||
|
||||
#warning get rid of
|
||||
[fSpeedLimitItem setState: state];
|
||||
[fSpeedLimitDockItem setState: state];
|
||||
|
||||
[fSpeedLimitButton setImage: !setEnabled ? fSpeedLimitNormalImage
|
||||
: ([NSColor currentControlTint] == NSBlueControlTint ? fSpeedLimitBlueImage : fSpeedLimitGraphiteImage)];
|
||||
|
||||
[fPrefsController applySpeedSettings: nil];
|
||||
[fDefaults setBool: ![fDefaults boolForKey: @"SpeedLimit"] forKey: @"SpeedLimit"];
|
||||
[self applySpeedLimit: nil];
|
||||
}
|
||||
|
||||
- (void) autoSpeedLimitChange: (NSNotification *) notification
|
||||
|
|
BIN
macosx/English.lproj/InfoWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/InfoWindow.nib/keyedobjects.nib
generated
Binary file not shown.
3
macosx/English.lproj/MainMenu.nib/classes.nib
generated
3
macosx/English.lproj/MainMenu.nib/classes.nib
generated
|
@ -4,6 +4,7 @@
|
|||
{
|
||||
ACTIONS = {
|
||||
applyFilter = id;
|
||||
applySpeedLimit = id;
|
||||
copyTorrentFile = id;
|
||||
doNothing = id;
|
||||
linkForums = id;
|
||||
|
@ -65,8 +66,6 @@
|
|||
fSearchFilterField = NSSearchField;
|
||||
fSeedFilterButton = BarButton;
|
||||
fSpeedLimitButton = NSButton;
|
||||
fSpeedLimitDockItem = NSMenuItem;
|
||||
fSpeedLimitItem = NSMenuItem;
|
||||
fStateSortActionItem = NSMenuItem;
|
||||
fStateSortItem = NSMenuItem;
|
||||
fStatusBar = ImageBackgroundView;
|
||||
|
|
1
macosx/English.lproj/MainMenu.nib/info.nib
generated
1
macosx/English.lproj/MainMenu.nib/info.nib
generated
|
@ -31,6 +31,7 @@
|
|||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>581</integer>
|
||||
<integer>21</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
|
|
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
8
macosx/SpeedLimitToTurtleIconTransformer.h
Normal file
8
macosx/SpeedLimitToTurtleIconTransformer.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SpeedLimitToTurtleIconTransformer : NSValueTransformer
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
26
macosx/SpeedLimitToTurtleIconTransformer.m
Normal file
26
macosx/SpeedLimitToTurtleIconTransformer.m
Normal file
|
@ -0,0 +1,26 @@
|
|||
|
||||
#import "SpeedLimitToTurtleIconTransformer.h"
|
||||
|
||||
@implementation SpeedLimitToTurtleIconTransformer
|
||||
|
||||
+ (Class) transformedValueClass
|
||||
{
|
||||
return [NSImage class];
|
||||
}
|
||||
|
||||
+ (BOOL) allowsReverseTransformation
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (id) transformedValue: (id) value
|
||||
{
|
||||
if (!value)
|
||||
return nil;
|
||||
|
||||
return [value boolValue] ? ([NSColor currentControlTint] == NSBlueControlTint
|
||||
? [NSImage imageNamed: @"SpeedLimitButtonBlue.png"] : [NSImage imageNamed: @"SpeedLimitButtonGraphite.png"])
|
||||
: [NSImage imageNamed: @"SpeedLimitButton.png"];
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Reference in a new issue