1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

some cleanup from the previous commit

This commit is contained in:
Mitchell Livingston 2006-10-24 20:51:47 +00:00
parent 72d0964ffc
commit b95748b998
5 changed files with 121 additions and 78 deletions

View file

@ -201,8 +201,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
? fSpeedLimitBlueImage : fSpeedLimitGraphiteImage];
}
[fActionButton setToolTip: NSLocalizedString(@"Shortcuts for changing global settings.", "Main window -> 1st bottom left button (action) tooltip")];
[fSpeedLimitButton setToolTip: NSLocalizedString(@"Speed Limit overrides the total bandwidth limits with its own limits.", "Main window -> 2nd bottom left button (turtle) tooltip")];
[fActionButton setToolTip: NSLocalizedString(@"Shortcuts for changing global settings.",
"Main window -> 1st bottom left button (action) tooltip")];
[fSpeedLimitButton setToolTip: NSLocalizedString(@"Speed Limit overrides the total bandwidth limits with its own limits.",
"Main window -> 2nd bottom left button (turtle) tooltip")];
[fTableView setTorrents: fDisplayedTorrents];
[[fTableView tableColumnWithIdentifier: @"Torrent"] setDataCell: [[TorrentCell alloc] init]];
@ -277,24 +279,24 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[currentFilterButton setEnabled: YES];
//set upload limit action button
[fUploadLimitItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Limit (%d KB/s)", "Action context menu -> upload limit"),
[fDefaults integerForKey: @"UploadLimit"]]];
[fUploadLimitItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Limit (%d KB/s)",
"Action context menu -> upload limit"), [fDefaults integerForKey: @"UploadLimit"]]];
if ([fDefaults boolForKey: @"CheckUpload"])
[fUploadLimitItem setState: NSOnState];
else
[fUploadNoLimitItem setState: NSOnState];
//set download limit action menu
[fDownloadLimitItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Limit (%d KB/s)", "Action context menu -> download limit"),
[fDefaults integerForKey: @"DownloadLimit"]]];
[fDownloadLimitItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Limit (%d KB/s)",
"Action context menu -> download limit"), [fDefaults integerForKey: @"DownloadLimit"]]];
if ([fDefaults boolForKey: @"CheckDownload"])
[fDownloadLimitItem setState: NSOnState];
else
[fDownloadNoLimitItem setState: NSOnState];
//set ratio action menu
[fRatioSetItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)", "Action context menu -> ratio stop"),
[fDefaults floatForKey: @"RatioLimit"]]];
[fRatioSetItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)",
"Action context menu -> ratio stop"), [fDefaults floatForKey: @"RatioLimit"]]];
if ([fDefaults boolForKey: @"RatioCheck"])
[fRatioSetItem setState: NSOnState];
else
@ -394,11 +396,14 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
if ([fDefaults boolForKey: @"CheckQuitDownloading"] ? downloading > 0 : active > 0)
{
NSString * message = active == 1
? NSLocalizedString(@"There is an active transfer. Do you really want to quit?", "Confirm Quit panel -> message")
: [NSString stringWithFormat:
NSLocalizedString(@"There are %d active transfers. Do you really want to quit?", "Confirm Quit panel -> message"), active];
? NSLocalizedString(@"There is an active transfer. Do you really want to quit?",
"Confirm Quit panel -> message")
: [NSString stringWithFormat: NSLocalizedString(@"There are %d active transfers. Do you really want to quit?",
"Confirm Quit panel -> message"), active];
NSBeginAlertSheet(NSLocalizedString(@"Confirm Quit", "Confirm Quit panel -> title"), NSLocalizedString(@"Quit", "Confirm Quit panel -> button"), NSLocalizedString(@"Cancel", "Confirm Quit panel -> button"), nil, fWindow, self,
NSBeginAlertSheet(NSLocalizedString(@"Confirm Quit", "Confirm Quit panel -> title"),
NSLocalizedString(@"Quit", "Confirm Quit panel -> button"),
NSLocalizedString(@"Cancel", "Confirm Quit panel -> button"), nil, fWindow, self,
@selector(quitSheetDidEnd:returnCode:contextInfo:), nil, nil, message);
return NSTerminateLater;
}
@ -541,7 +546,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[panel setCanChooseFiles: NO];
[panel setCanChooseDirectories: YES];
[panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the download folder for \"%@\"", "Open torrent -> select destination folder"), [torrent name]]];
[panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the download folder for \"%@\"",
"Open torrent -> select destination folder"), [torrent name]]];
NSDictionary * dictionary = [[NSDictionary alloc] initWithObjectsAndKeys: torrent, @"Torrent", files, @"Files", nil];
@ -725,7 +731,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
int selected = [fTableView numberOfSelectedRows];
if (selected == 1)
{
title = [NSString stringWithFormat: NSLocalizedString(@"Confirm Removal of \"%@\"", "Removal confirm panel -> title"),
title = [NSString stringWithFormat: NSLocalizedString(@"Confirm Removal of \"%@\"",
"Removal confirm panel -> title"),
[[fDisplayedTorrents objectAtIndex: [fTableView selectedRow]] name]];
message = NSLocalizedString(@"This transfer is active."
" Once removed, continuing the transfer will require the torrent file."
@ -733,17 +740,21 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
}
else
{
title = [NSString stringWithFormat: NSLocalizedString(@"Confirm Removal of %d Transfers", "Removal confirm panel -> title"), selected];
title = [NSString stringWithFormat: NSLocalizedString(@"Confirm Removal of %d Transfers",
"Removal confirm panel -> title"), selected];
if (selected == active)
message = [NSString stringWithFormat: NSLocalizedString(@"There are %d active transfers.", "Removal confirm panel -> message part 1"), active];
message = [NSString stringWithFormat: NSLocalizedString(@"There are %d active transfers.",
"Removal confirm panel -> message part 1"), active];
else
message = [NSString stringWithFormat: NSLocalizedString(@"There are %d transfers (%d active).", "Removal confirm panel -> message part 1"), selected, active];
message = [NSString stringWithFormat: NSLocalizedString(@"There are %d transfers (%d active).",
"Removal confirm panel -> message part 1"), selected, active];
message = [message stringByAppendingString:
NSLocalizedString(@" Once removed, continuing the transfers will require the torrent files."
" Do you really want to remove them?", "Removal confirm panel -> message part 2")];
}
NSBeginAlertSheet(title, NSLocalizedString(@"Remove", "Removal confirm panel -> button"), NSLocalizedString(@"Cancel", "Removal confirm panel -> button"), nil, fWindow, self,
NSBeginAlertSheet(title, NSLocalizedString(@"Remove", "Removal confirm panel -> button"),
NSLocalizedString(@"Cancel", "Removal confirm panel -> button"), nil, fWindow, self,
nil, @selector(removeSheetDidEnd:returnCode:contextInfo:), dict, message);
return;
}
@ -865,9 +876,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
{
NSAlert * alert = [[NSAlert alloc] init];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file copy alert -> button")];
[alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Copy of \"%@\" Cannot Be Created", "Torrent file copy alert -> title"), [torrent name]]];
[alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Copy of \"%@\" Cannot Be Created",
"Torrent file copy alert -> title"), [torrent name]]];
[alert setInformativeText: [NSString stringWithFormat:
NSLocalizedString(@"The torrent file (%@) cannot be found.", "Torrent file copy alert -> message"), [torrent torrentLocation]]];
NSLocalizedString(@"The torrent file (%@) cannot be found.", "Torrent file copy alert -> message"),
[torrent torrentLocation]]];
[alert setAlertStyle: NSWarningAlertStyle];
[alert runModal];
@ -960,8 +973,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
tr_torrentRates(fLib, & downloadRate, & uploadRate);
if (![fStatusBar isHidden])
{
[fTotalDLField setStringValue: [NSLocalizedString(@"Total DL: ", "Status bar -> total download") stringByAppendingString: [NSString stringForSpeed: downloadRate]]];
[fTotalULField setStringValue: [NSLocalizedString(@"Total UL: ", "Status bar -> total upload") stringByAppendingString: [NSString stringForSpeed: uploadRate]]];
[fTotalDLField setStringValue: [NSLocalizedString(@"Total DL: ", "Status bar -> total download")
stringByAppendingString: [NSString stringForSpeed: downloadRate]]];
[fTotalULField setStringValue: [NSLocalizedString(@"Total UL: ", "Status bar -> total upload")
stringByAppendingString: [NSString stringForSpeed: uploadRate]]];
}
//update non-constant parts of info window
@ -986,7 +1001,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[sound play];
}
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Download Complete", "Growl notification title") description: [torrent name]
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Download Complete", "Growl notification title")
description: [torrent name]
notificationName: GROWL_DOWNLOAD_COMPLETE iconData: nil priority: 0 isSticky: NO clickContext: nil];
if (![fWindow isKeyWindow])
@ -1376,8 +1392,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[limitItem setState: enable ? NSOnState : NSOffState];
[noLimitItem setState: !enable ? NSOnState : NSOffState];
[limitItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Limit (%d KB/s)", "Action context menu -> upload/download limit"),
[[dict objectForKey: @"Limit"] intValue]]];
[limitItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Limit (%d KB/s)",
"Action context menu -> upload/download limit"), [[dict objectForKey: @"Limit"] intValue]]];
[dict release];
}
@ -1400,8 +1416,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[fRatioSetItem setState: enable ? NSOnState : NSOffState];
[fRatioNotSetItem setState: !enable ? NSOnState : NSOffState];
[fRatioSetItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)", "Action context menu -> ratio stop"),
[[dict objectForKey: @"Ratio"] floatValue]]];
[fRatioSetItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)",
"Action context menu -> ratio stop"), [[dict objectForKey: @"Ratio"] floatValue]]];
[dict release];
}
@ -1491,7 +1507,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[sound play];
}
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Seeding Complete", "Growl notification title") description: [[notification object] name]
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Seeding Complete", "Growl notification title")
description: [[notification object] name]
notificationName: GROWL_SEEDING_COMPLETE iconData: nil priority: 0 isSticky: NO clickContext: nil];
}
@ -1601,7 +1618,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//import only actually happened if the torrent array is larger
if (oldCount < [fTorrents count])
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added", "Growl notification title") description: file
[GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added",
"Growl notification title") description: file
notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil];
}
}
@ -2100,7 +2118,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//enable show info
if (action == @selector(showInfo:))
{
NSString * title = [[fInfoController window] isVisible] ? NSLocalizedString(@"Hide Inspector", "View menu -> Inspector") : NSLocalizedString(@"Show Inspector", "View menu -> Inspector");
NSString * title = [[fInfoController window] isVisible] ? NSLocalizedString(@"Hide Inspector",
"View menu -> Inspector") : NSLocalizedString(@"Show Inspector", "View menu -> Inspector");
if (![[menuItem title] isEqualToString: title])
[menuItem setTitle: title];
@ -2114,7 +2133,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//enable toggle status bar
if (action == @selector(toggleStatusBar:))
{
NSString * title = [fStatusBar isHidden] ? NSLocalizedString(@"Show Status Bar", "View menu -> Status Bar") : NSLocalizedString(@"Hide Status Bar", "View menu -> Status Bar");
NSString * title = [fStatusBar isHidden] ? NSLocalizedString(@"Show Status Bar", "View menu -> Status Bar")
: NSLocalizedString(@"Hide Status Bar", "View menu -> Status Bar");
if (![[menuItem title] isEqualToString: title])
[menuItem setTitle: title];
@ -2124,7 +2144,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//enable toggle filter bar
if (action == @selector(toggleFilterBar:))
{
NSString * title = [fFilterBar isHidden] ? NSLocalizedString(@"Show Filter Bar", "View menu -> Filter Bar") : NSLocalizedString(@"Hide Filter Bar", "View menu -> Filter Bar");
NSString * title = [fFilterBar isHidden] ? NSLocalizedString(@"Show Filter Bar", "View menu -> Filter Bar")
: NSLocalizedString(@"Hide Filter Bar", "View menu -> Filter Bar");
if (![[menuItem title] isEqualToString: title])
[menuItem setTitle: title];

View file

@ -174,8 +174,9 @@
[panel setRequiredFileType: @"txt"];
[panel setCanSelectHiddenExtension: YES];
[panel beginSheetForDirectory: nil file: NSLocalizedString(@"untitled", "Save log panel -> default file name") modalForWindow: [self window] modalDelegate: self
didEndSelector: @selector(writeToFileSheetClosed:returnCode:contextInfo:) contextInfo: string];
[panel beginSheetForDirectory: nil file: NSLocalizedString(@"untitled", "Save log panel -> default file name")
modalForWindow: [self window] modalDelegate: self
didEndSelector: @selector(writeToFileSheetClosed:returnCode:contextInfo:) contextInfo: string];
}
- (void) writeToFileSheetClosed: (NSSavePanel *) panel returnCode: (int) code contextInfo: (NSString *) string
@ -186,9 +187,11 @@
{
NSAlert * alert = [[NSAlert alloc] init];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Save log alert panel -> button")];
[alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Log Could Not Be Saved", "Save log alert panel -> title")]];
[alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Log Could Not Be Saved",
"Save log alert panel -> title")]];
[alert setInformativeText: [NSString stringWithFormat:
NSLocalizedString(@"There was a problem creating the file \"%@\".", "Save log alert panel -> message"), [[panel filename] lastPathComponent]]];
NSLocalizedString(@"There was a problem creating the file \"%@\".",
"Save log alert panel -> message"), [[panel filename] lastPathComponent]]];
[alert setAlertStyle: NSWarningAlertStyle];
[alert runModal];

View file

@ -135,8 +135,8 @@
[fBluePiece unlockFocus];
[fImageView setToolTip: [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"]
? NSLocalizedString(@"Piece Availability", "Inspector -> Activity -> detailed pieces view tooltip")
: NSLocalizedString(@"Piece Progress", "Inspector -> Activity -> detailed pieces view tooltip")];
? NSLocalizedString(@"Piece Availability", "Inspector -> Activity -> detailed pieces view tooltip")
: NSLocalizedString(@"Piece Progress", "Inspector -> Activity -> detailed pieces view tooltip")];
//actually draw the box
[self setTorrent: nil];
@ -383,8 +383,9 @@
[defaults setBool: showAvailability forKey: @"PiecesViewShowAvailability"];
[fImageView setToolTip: showAvailability ? NSLocalizedString(@"Piece Availability", "Inspector -> Activity -> detailed pieces view tooltip")
: NSLocalizedString(@"Piece Progress", "Inspector -> Activity -> detailed pieces view tooltip")];
[fImageView setToolTip: showAvailability
? NSLocalizedString(@"Piece Availability", "Inspector -> Activity -> detailed pieces view tooltip")
: NSLocalizedString(@"Piece Progress", "Inspector -> Activity -> detailed pieces view tooltip")];
[self updateView: YES];
}

View file

@ -37,10 +37,10 @@
#define UPDATE_WEEKLY 1
#define UPDATE_NEVER 2
#define TOOLBAR_GENERAL NSLocalizedString(@"General", "Preferences -> General toolbar item title")
#define TOOLBAR_TRANSFERS NSLocalizedString(@"Transfers", "Preferences -> Transfers toolbar item title")
#define TOOLBAR_BANDWIDTH NSLocalizedString(@"Bandwidth", "Preferences -> Bandwidth toolbar item title")
#define TOOLBAR_NETWORK NSLocalizedString(@"Network", "Preferences -> Network toolbar item title")
#define TOOLBAR_GENERAL @"TOOLBAR_GENERAL"
#define TOOLBAR_TRANSFERS @"TOOLBAR_TRANSFERS"
#define TOOLBAR_BANDWIDTH @"TOOLBAR_BANDWIDTH"
#define TOOLBAR_NETWORK @"TOOLBAR_NETWORK"
@interface PrefsController (Private)
@ -293,28 +293,28 @@
if ([ident isEqualToString: TOOLBAR_GENERAL])
{
[item setLabel: TOOLBAR_GENERAL];
[item setLabel: NSLocalizedString(@"General", "Preferences -> General toolbar item title")];
[item setImage: [NSImage imageNamed: @"Preferences.png"]];
[item setTarget: self];
[item setAction: @selector(showGeneralPref:)];
}
else if ([ident isEqualToString: TOOLBAR_TRANSFERS])
{
[item setLabel: TOOLBAR_TRANSFERS];
[item setLabel: NSLocalizedString(@"Transfers", "Preferences -> Transfers toolbar item title")];
[item setImage: [NSImage imageNamed: @"Transfers.png"]];
[item setTarget: self];
[item setAction: @selector(showTransfersPref:)];
}
else if ([ident isEqualToString: TOOLBAR_BANDWIDTH])
{
[item setLabel: TOOLBAR_BANDWIDTH];
[item setLabel: NSLocalizedString(@"Bandwidth", "Preferences -> Bandwidth toolbar item title")];
[item setImage: [NSImage imageNamed: @"Bandwidth.png"]];
[item setTarget: self];
[item setAction: @selector(showBandwidthPref:)];
}
else if ([ident isEqualToString: TOOLBAR_NETWORK])
{
[item setLabel: TOOLBAR_NETWORK];
[item setLabel: NSLocalizedString(@"Network", "Preferences -> Network toolbar item title")];
[item setImage: [NSImage imageNamed: @"Network.png"]];
[item setTarget: self];
[item setAction: @selector(showNetworkPref:)];
@ -340,9 +340,8 @@
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar
{
return [NSArray arrayWithObjects:
TOOLBAR_GENERAL, TOOLBAR_TRANSFERS,
TOOLBAR_BANDWIDTH, TOOLBAR_NETWORK, nil];
return [NSArray arrayWithObjects: TOOLBAR_GENERAL, TOOLBAR_TRANSFERS,
TOOLBAR_BANDWIDTH, TOOLBAR_NETWORK, nil];
}
- (void) setPort: (id) sender
@ -377,7 +376,8 @@
//NSXML features are unfortunately only available since Mac OS X v10.4
PortChecker * checker = [[PortChecker alloc] initWithDelegate: self];
[fPortStatusField setStringValue: [NSLocalizedString(@"Checking port status", "Preferences -> Network -> port status") stringByAppendingEllipsis]];
[fPortStatusField setStringValue: [NSLocalizedString(@"Checking port status",
"Preferences -> Network -> port status") stringByAppendingEllipsis]];
[fPortStatusProgress startAnimation: self];
[checker probePort: [fDefaults integerForKey: @"BindPort"]];
@ -402,7 +402,8 @@
[fPortStatusImage setImage: [NSImage imageNamed: @"RedDot.tiff"]];
break;
case PORT_STATUS_ERROR:
[fPortStatusField setStringValue: NSLocalizedString(@"Unable to check port status", "Preferences -> Network -> port status")];
[fPortStatusField setStringValue: NSLocalizedString(@"Unable to check port status",
"Preferences -> Network -> port status")];
[fPortStatusImage setImage: [NSImage imageNamed: @"YellowDot.tiff"]];
break;
}
@ -427,12 +428,14 @@
if (status == 2)
{
[fNatStatusField setStringValue: NSLocalizedString(@"Port successfully mapped", "Preferences -> Network -> port map status")];
[fNatStatusField setStringValue: NSLocalizedString(@"Port successfully mapped",
"Preferences -> Network -> port map status")];
[fNatStatusImage setImage: [NSImage imageNamed: @"GreenDot.tiff"]];
}
else if (status == 3 || status == 4)
{
[fNatStatusField setStringValue: NSLocalizedString(@"Error mapping port", "Preferences -> Network -> port map status")];
[fNatStatusField setStringValue: NSLocalizedString(@"Error mapping port",
"Preferences -> Network -> port map status")];
[fNatStatusImage setImage: [NSImage imageNamed: @"RedDot.tiff"]];
}
else

View file

@ -193,11 +193,12 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[fProgressString setString: @""];
if ([self progress] < 1.0)
[fProgressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"), [NSString stringForFileSize:
[self downloadedValid]], [NSString stringForFileSize: [self size]], 100.0 * [self progress]];
[fProgressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"),
[NSString stringForFileSize: [self downloadedValid]],
[NSString stringForFileSize: [self size]], 100.0 * [self progress]];
else
[fProgressString appendFormat: NSLocalizedString(@"%@, uploaded %@ (Ratio: %@)", "Torrent -> progress string"), [NSString stringForFileSize:
[self size]], [NSString stringForFileSize: [self uploadedTotal]],
[fProgressString appendFormat: NSLocalizedString(@"%@, uploaded %@ (Ratio: %@)", "Torrent -> progress string"),
[NSString stringForFileSize: [self size]], [NSString stringForFileSize: [self uploadedTotal]],
[NSString stringForRatioWithDownload: [self downloadedTotal] upload: [self uploadedTotal]]];
switch (fStat->status)
@ -229,9 +230,11 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
case TR_STATUS_DOWNLOAD:
[fStatusString setString: @""];
if ([self totalPeers] > 1)
[fStatusString appendFormat: NSLocalizedString(@"Downloading from %d of %d peers", "Torrent -> status string"), [self peersUploading], [self totalPeers]];
[fStatusString appendFormat: NSLocalizedString(@"Downloading from %d of %d peers",
"Torrent -> status string"), [self peersUploading], [self totalPeers]];
else
[fStatusString appendFormat: NSLocalizedString(@"Downloading from %d of %d peer", "Torrent -> status string"), [self peersUploading], [self totalPeers]];
[fStatusString appendFormat: NSLocalizedString(@"Downloading from %d of %d peer",
"Torrent -> status string"), [self peersUploading], [self totalPeers]];
[fRemainingTimeString setString: @""];
int eta = [self eta];
@ -245,20 +248,23 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
if (eta < 60)
[fRemainingTimeString appendFormat: NSLocalizedString(@"%d sec", "Torrent -> remaining time"), eta];
else if (eta < 3600) //60 * 60
[fRemainingTimeString appendFormat: NSLocalizedString(@"%d min %02d sec", "Torrent -> remaining time"), eta / 60, eta % 60];
[fRemainingTimeString appendFormat: NSLocalizedString(@"%d min %02d sec", "Torrent -> remaining time"),
eta / 60, eta % 60];
else if (eta < 86400) //24 * 60 * 60
[fRemainingTimeString appendFormat: NSLocalizedString(@"%d hr %02d min", "Torrent -> remaining time"), eta / 3600, (eta / 60) % 60];
[fRemainingTimeString appendFormat: NSLocalizedString(@"%d hr %02d min", "Torrent -> remaining time"),
eta / 3600, (eta / 60) % 60];
else
{
if (eta / 86400 > 1)
[fRemainingTimeString appendFormat: NSLocalizedString(@"%d days %d hr", "Torrent -> remaining time"),
eta / 86400, (eta / 3600) % 24];
eta / 86400, (eta / 3600) % 24];
else
[fRemainingTimeString appendFormat: NSLocalizedString(@"%d day %d hr", "Torrent -> remaining time"),
eta / 86400, (eta / 3600) % 24];
eta / 86400, (eta / 3600) % 24];
}
[fProgressString appendFormat: NSLocalizedString(@" - %@ remaining", "Torrent -> progress string"), fRemainingTimeString];
[fProgressString appendFormat: NSLocalizedString(@" - %@ remaining", "Torrent -> progress string"),
fRemainingTimeString];
}
break;
@ -266,9 +272,11 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
case TR_STATUS_SEED:
[fStatusString setString: @""];
if ([self totalPeers] > 1)
[fStatusString appendFormat: NSLocalizedString(@"Seeding to %d of %d peers", "Torrent -> status string"), [self peersDownloading], [self totalPeers]];
[fStatusString appendFormat: NSLocalizedString(@"Seeding to %d of %d peers", "Torrent -> status string"),
[self peersDownloading], [self totalPeers]];
else
[fStatusString appendFormat: NSLocalizedString(@"Seeding to %d of %d peer", "Torrent -> status string"), [self peersDownloading], [self totalPeers]];
[fStatusString appendFormat: NSLocalizedString(@"Seeding to %d of %d peer", "Torrent -> status string"),
[self peersDownloading], [self totalPeers]];
break;
@ -283,7 +291,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
if (fStat->error & TR_ETRACKER)
{
[fStatusString setString: [NSLocalizedString(@"Error: ", "Torrent -> status string") stringByAppendingString: [NSString stringWithUTF8String: fStat->trackerError]]];
[fStatusString setString: [NSLocalizedString(@"Error: ", "Torrent -> status string") stringByAppendingString:
[NSString stringWithUTF8String: fStat->trackerError]]];
if (!fError && [self isActive])
{
fError = YES;
@ -302,7 +311,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
NSString * stringToAppend = @"";
if ([self progress] < 1.0)
{
stringToAppend = [NSString stringWithFormat: NSLocalizedString(@"DL: %@, ", "Torrent -> status string"), [NSString stringForSpeed: [self downloadRate]]];
stringToAppend = [NSString stringWithFormat: NSLocalizedString(@"DL: %@, ", "Torrent -> status string"),
[NSString stringForSpeed: [self downloadRate]]];
[fShortStatusString setString: @""];
}
else
@ -310,12 +320,14 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
NSString * ratioString = [NSString stringForRatioWithDownload: [self downloadedTotal]
upload: [self uploadedTotal]];
[fShortStatusString setString: [NSString stringWithFormat: NSLocalizedString(@"Ratio: %@, ", "Torrent -> status string"), ratioString]];
[fRemainingTimeString setString: [NSLocalizedString(@"Ratio: ", "Torrent -> status string") stringByAppendingString: ratioString]];
[fShortStatusString setString: [NSString stringWithFormat: NSLocalizedString(@"Ratio: %@, ",
"Torrent -> status string"), ratioString]];
[fRemainingTimeString setString: [NSLocalizedString(@"Ratio: ", "Torrent -> status string")
stringByAppendingString: ratioString]];
}
stringToAppend = [stringToAppend stringByAppendingString: [NSLocalizedString(@"UL: ", "Torrent -> status string") stringByAppendingString:
[NSString stringForSpeed: [self uploadRate]]]];
stringToAppend = [stringToAppend stringByAppendingString: [NSLocalizedString(@"UL: ", "Torrent -> status string")
stringByAppendingString: [NSString stringForSpeed: [self uploadRate]]]];
[fStatusString appendFormat: @" - %@", stringToAppend];
[fShortStatusString appendString: stringToAppend];
@ -475,10 +487,12 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
if (volume && remainingSpace <= torrentRemaining)
{
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Not enough remaining disk space to download \"%@\" completely.", "Torrent file disk space alert -> title"),
[self name]]];
[alert setMessageText: [NSString stringWithFormat:
NSLocalizedString(@"Not enough remaining disk space to download \"%@\" completely.",
"Torrent file disk space alert -> title"), [self name]]];
[alert setInformativeText: [NSString stringWithFormat:
NSLocalizedString(@"The transfer will be paused. Clear up space on %@ to continue.", "Torrent file disk space alert -> message"), volume]];
NSLocalizedString(@"The transfer will be paused. Clear up space on %@ to continue.",
"Torrent file disk space alert -> message"), volume]];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file disk space alert -> button")];
[alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")];
@ -555,7 +569,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (NSString *) torrentLocationString
{
return fPrivateTorrent ? NSLocalizedString(@"Transmission Support Folder", "Torrent -> location") : [fPublicTorrentLocation stringByAbbreviatingWithTildeInPath];
return fPrivateTorrent ? NSLocalizedString(@"Transmission Support Folder", "Torrent -> location")
: [fPublicTorrentLocation stringByAbbreviatingWithTildeInPath];
}
- (NSString *) dataLocation