1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 18:18:10 +00:00

move the individual speeds array into the corresponding methods

This commit is contained in:
Mitchell Livingston 2008-01-10 07:00:56 +00:00
parent fe50c35474
commit af96ba0d41
2 changed files with 14 additions and 12 deletions

View file

@ -109,9 +109,6 @@ typedef enum
STATUS_TRANSFER_SESSION_TAG = 3 STATUS_TRANSFER_SESSION_TAG = 3
} statusTag; } statusTag;
int speedLimitGlobalActionValue[] = { 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
float ratioLimitGlobalActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1 };
#define GROWL_DOWNLOAD_COMPLETE @"Download Complete" #define GROWL_DOWNLOAD_COMPLETE @"Download Complete"
#define GROWL_SEEDING_COMPLETE @"Seeding Complete" #define GROWL_SEEDING_COMPLETE @"Seeding Complete"
#define GROWL_AUTO_ADD @"Torrent Auto Added" #define GROWL_AUTO_ADD @"Torrent Auto Added"
@ -2087,15 +2084,17 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
if ([menu numberOfItems] > 3) if ([menu numberOfItems] > 3)
return; return;
const int speedLimitActionValue[] = { 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
NSMenuItem * item; NSMenuItem * item;
int i; int i;
for (i = 0; speedLimitGlobalActionValue[i] != -1; i++) for (i = 0; speedLimitActionValue[i] != -1; i++)
{ {
item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%d KB/s", item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%d KB/s",
"Action menu -> upload/download limit"), speedLimitGlobalActionValue[i]] action: @selector(setQuickLimitGlobal:) "Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimitGlobal:)
keyEquivalent: @""]; keyEquivalent: @""];
[item setTarget: self]; [item setTarget: self];
[item setRepresentedObject: [NSNumber numberWithInt: speedLimitGlobalActionValue[i]]]; [item setRepresentedObject: [NSNumber numberWithInt: speedLimitActionValue[i]]];
[menu addItem: item]; [menu addItem: item];
[item release]; [item release];
} }
@ -2105,15 +2104,17 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
if ([menu numberOfItems] > 3) if ([menu numberOfItems] > 3)
return; return;
const float ratioLimitActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1 };
NSMenuItem * item; NSMenuItem * item;
int i; int i;
for (i = 0; ratioLimitGlobalActionValue[i] != -1; i++) for (i = 0; ratioLimitActionValue[i] != -1; i++)
{ {
item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%.2f", item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%.2f",
"Action menu -> ratio stop"), ratioLimitGlobalActionValue[i]] action: @selector(setQuickRatioGlobal:) "Action menu -> ratio stop"), ratioLimitActionValue[i]] action: @selector(setQuickRatioGlobal:)
keyEquivalent: @""]; keyEquivalent: @""];
[item setTarget: self]; [item setTarget: self];
[item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitGlobalActionValue[i]]]; [item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitActionValue[i]]];
[menu addItem: item]; [menu addItem: item];
[item release]; [item release];
} }

View file

@ -40,9 +40,6 @@
#define ACTION_MENU_UNLIMITED_TAG 102 #define ACTION_MENU_UNLIMITED_TAG 102
#define ACTION_MENU_LIMIT_TAG 103 #define ACTION_MENU_LIMIT_TAG 103
int speedLimitActionValue[] = { 0, 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
float ratioLimitActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1.0 };
@interface TorrentTableView (Private) @interface TorrentTableView (Private)
- (NSRect) pauseRectForRow: (int) row; - (NSRect) pauseRectForRow: (int) row;
@ -377,6 +374,8 @@ float ratioLimitActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1.0 };
NSMenuItem * item; NSMenuItem * item;
if ([menu numberOfItems] == 4) if ([menu numberOfItems] == 4)
{ {
const int speedLimitActionValue[] = { 0, 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
int i; int i;
for (i = 0; speedLimitActionValue[i] != -1; i++) for (i = 0; speedLimitActionValue[i] != -1; i++)
{ {
@ -409,6 +408,8 @@ float ratioLimitActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1.0 };
NSMenuItem * item; NSMenuItem * item;
if ([menu numberOfItems] == 4) if ([menu numberOfItems] == 4)
{ {
const float ratioLimitActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1.0 };
int i; int i;
for (i = 0; ratioLimitActionValue[i] != -1.0; i++) for (i = 0; ratioLimitActionValue[i] != -1.0; i++)
{ {