more string fiddling and minor badger changes
This commit is contained in:
parent
85c57c00cb
commit
9dc92d4d3b
|
@ -64,7 +64,7 @@
|
||||||
{
|
{
|
||||||
NSImage * quitBadge = [NSImage imageNamed: @"QuitBadge.png"];
|
NSImage * quitBadge = [NSImage imageNamed: @"QuitBadge.png"];
|
||||||
[self badge: quitBadge string: NSLocalizedString(@"Quitting", "Dock Badger -> quit")
|
[self badge: quitBadge string: NSLocalizedString(@"Quitting", "Dock Badger -> quit")
|
||||||
atHeight: (rect.size.height - [quitBadge size].height) * 0.5];
|
atHeight: (rect.size.height - [quitBadge size].height) * 0.5];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,16 +75,19 @@
|
||||||
float downloadRate, uploadRate;
|
float downloadRate, uploadRate;
|
||||||
tr_torrentRates(fLib, &downloadRate, &uploadRate);
|
tr_torrentRates(fLib, &downloadRate, &uploadRate);
|
||||||
|
|
||||||
BOOL upload = checkUpload && uploadRate >= 0.1;
|
BOOL upload = checkUpload && uploadRate >= 0.1,
|
||||||
|
download = checkDownload && downloadRate >= 0.1;
|
||||||
|
float bottom = 0.0;
|
||||||
if (upload)
|
if (upload)
|
||||||
[self badge: [NSImage imageNamed: @"UploadBadge.png"] string: [NSString stringForSpeedAbbrev: uploadRate] atHeight: 0.0];
|
|
||||||
if (checkDownload && downloadRate >= 0.1)
|
|
||||||
{
|
{
|
||||||
//download rate above upload rate
|
NSImage * uploadBadge = [NSImage imageNamed: @"UploadBadge.png"];
|
||||||
float bottom = upload ? [[NSImage imageNamed: @"UploadBadge.png"] size].height + BETWEEN_PADDING : 0.0;
|
[self badge: uploadBadge string: [NSString stringForSpeedAbbrev: uploadRate] atHeight: bottom];
|
||||||
|
if (download)
|
||||||
|
bottom += [uploadBadge size].height + BETWEEN_PADDING; //download rate above upload rate
|
||||||
|
}
|
||||||
|
if (download)
|
||||||
[self badge: [NSImage imageNamed: @"DownloadBadge.png"] string: [NSString stringForSpeedAbbrev: downloadRate]
|
[self badge: [NSImage imageNamed: @"DownloadBadge.png"] string: [NSString stringForSpeedAbbrev: downloadRate]
|
||||||
atHeight: bottom];
|
atHeight: bottom];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +111,7 @@
|
||||||
[stringShadow release];
|
[stringShadow release];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSRect badgeRect = NSZeroRect;
|
NSRect badgeRect;
|
||||||
badgeRect.size = [badge size];
|
badgeRect.size = [badge size];
|
||||||
badgeRect.origin.y = height;
|
badgeRect.origin.y = height;
|
||||||
|
|
||||||
|
@ -117,7 +120,7 @@
|
||||||
//string is in center of image
|
//string is in center of image
|
||||||
NSSize stringSize = [string sizeWithAttributes: fAttributes];
|
NSSize stringSize = [string sizeWithAttributes: fAttributes];
|
||||||
|
|
||||||
NSRect stringRect = badgeRect;
|
NSRect stringRect;
|
||||||
stringRect.origin.x += (badgeRect.size.width - stringSize.width) * 0.5;
|
stringRect.origin.x += (badgeRect.size.width - stringSize.width) * 0.5;
|
||||||
stringRect.origin.y += (badgeRect.size.height - stringSize.height) * 0.5 + 1.0; //adjust for shadow
|
stringRect.origin.y += (badgeRect.size.height - stringSize.height) * 0.5 + 1.0; //adjust for shadow
|
||||||
stringRect.size = stringSize;
|
stringRect.size = stringSize;
|
||||||
|
|
|
@ -48,8 +48,6 @@
|
||||||
fLib = lib;
|
fLib = lib;
|
||||||
|
|
||||||
fCompleted = 0;
|
fCompleted = 0;
|
||||||
fCompletedBadged = 0;
|
|
||||||
fSpeedBadge = NO;
|
|
||||||
|
|
||||||
if ([NSApp isOnLeopardOrBetter])
|
if ([NSApp isOnLeopardOrBetter])
|
||||||
{
|
{
|
||||||
|
@ -58,7 +56,11 @@
|
||||||
[view release];
|
[view release];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fQuittingTiger = NO;
|
fQuittingTiger = NO;
|
||||||
|
fSpeedBadge = NO;
|
||||||
|
fCompletedBadged = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//change that just impacts the dock badge
|
//change that just impacts the dock badge
|
||||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateBadge) name: @"DockBadgeChange" object: nil];
|
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(updateBadge) name: @"DockBadgeChange" object: nil];
|
||||||
|
|
Binary file not shown.
|
@ -823,12 +823,14 @@ typedef enum
|
||||||
if ([[peer objectForKey: @"Encryption"] boolValue])
|
if ([[peer objectForKey: @"Encryption"] boolValue])
|
||||||
[components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")];
|
[components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")];
|
||||||
|
|
||||||
|
NSString * portString;
|
||||||
int port;
|
int port;
|
||||||
if ((port = [[peer objectForKey: @"Port"] intValue]) > 0)
|
if ((port = [[peer objectForKey: @"Port"] intValue]) > 0)
|
||||||
[components addObject: [NSString stringWithFormat:
|
portString = [NSString stringWithFormat: @"%d", port];
|
||||||
NSLocalizedString(@"Port: %d", "Inspector -> Peers tab -> table row tooltip"), port]];
|
|
||||||
else
|
else
|
||||||
[components addObject: NSLocalizedString(@"Port: N/A", "Inspector -> Peers tab -> table row tooltip")];
|
portString = NSLocalizedString(@"N/A", "Inspector -> Peers tab -> table row tooltip");
|
||||||
|
[components addObject: [NSString stringWithFormat: @"%@: %@", NSLocalizedString(@"Port",
|
||||||
|
"Inspector -> Peers tab -> table row tooltip"), portString]];
|
||||||
|
|
||||||
switch ([[peer objectForKey: @"From"] intValue])
|
switch ([[peer objectForKey: @"From"] intValue])
|
||||||
{
|
{
|
||||||
|
|
|
@ -254,6 +254,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
||||||
fFinishedPiecesDate = tab != NULL ? [[NSDate alloc] init] : nil;
|
fFinishedPiecesDate = tab != NULL ? [[NSDate alloc] init] : nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#warning when queue and seeding options are folded into libt, no need to call this on all torrents - use tr_torrentGetStatus
|
||||||
- (void) update
|
- (void) update
|
||||||
{
|
{
|
||||||
//get previous status values before update
|
//get previous status values before update
|
||||||
|
@ -986,7 +987,6 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
||||||
NSString * downloadString;
|
NSString * downloadString;
|
||||||
if (![self isComplete]) //only multifile possible
|
if (![self isComplete]) //only multifile possible
|
||||||
{
|
{
|
||||||
|
|
||||||
if ([fDefaults boolForKey: @"DisplayStatusProgressSelected"])
|
if ([fDefaults boolForKey: @"DisplayStatusProgressSelected"])
|
||||||
downloadString = [NSString stringWithFormat: NSLocalizedString(@"%@ selected", "Torrent -> progress string"),
|
downloadString = [NSString stringWithFormat: NSLocalizedString(@"%@ selected", "Torrent -> progress string"),
|
||||||
[NSString stringForFileSize: [self haveTotal]]];
|
[NSString stringForFileSize: [self haveTotal]]];
|
||||||
|
@ -1080,7 +1080,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fStalled)
|
if (fStalled)
|
||||||
string = [NSLocalizedString(@"Stalled, ", "Torrent -> status string") stringByAppendingString: string];
|
string = [NSString stringWithFormat: @"%@, %@", NSLocalizedString(@"Stalled", "Torrent -> status string"), string];
|
||||||
}
|
}
|
||||||
|
|
||||||
//append even if error
|
//append even if error
|
||||||
|
|
Loading…
Reference in New Issue