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
} 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_SEEDING_COMPLETE @"Seeding Complete"
#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)
return;
const int speedLimitActionValue[] = { 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
NSMenuItem * item;
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",
"Action menu -> upload/download limit"), speedLimitGlobalActionValue[i]] action: @selector(setQuickLimitGlobal:)
"Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimitGlobal:)
keyEquivalent: @""];
[item setTarget: self];
[item setRepresentedObject: [NSNumber numberWithInt: speedLimitGlobalActionValue[i]]];
[item setRepresentedObject: [NSNumber numberWithInt: speedLimitActionValue[i]]];
[menu addItem: item];
[item release];
}
@ -2105,15 +2104,17 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
if ([menu numberOfItems] > 3)
return;
const float ratioLimitActionValue[] = { 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, -1 };
NSMenuItem * item;
int i;
for (i = 0; ratioLimitGlobalActionValue[i] != -1; i++)
for (i = 0; ratioLimitActionValue[i] != -1; i++)
{
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: @""];
[item setTarget: self];
[item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitGlobalActionValue[i]]];
[item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitActionValue[i]]];
[menu addItem: item];
[item release];
}

View File

@ -40,9 +40,6 @@
#define ACTION_MENU_UNLIMITED_TAG 102
#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)
- (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;
if ([menu numberOfItems] == 4)
{
const int speedLimitActionValue[] = { 0, 5, 10, 20, 30, 40, 50, 75, 100, 150, 200, 250, 500, 750, -1 };
int 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;
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;
for (i = 0; ratioLimitActionValue[i] != -1.0; i++)
{