1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 03:12:44 +00:00

clean up more of the dock badging code

This commit is contained in:
Mitchell Livingston 2007-12-05 18:44:11 +00:00
parent 8a15058d80
commit 254f98a77b
2 changed files with 7 additions and 15 deletions

View file

@ -32,7 +32,6 @@
NSDictionary * fAttributes;
BOOL fQuitting;
NSProgressIndicator * fQuitIndicator;
}
- (id) initWithFrame: (NSRect) frame lib: (tr_handle *) lib;

View file

@ -63,6 +63,7 @@
if (fQuitting)
{
[self badge: [NSImage imageNamed: @"UploadBadge"] string: @"Quitting" atHeight: 0.0];
return;
}
@ -76,22 +77,14 @@
float downloadRate, uploadRate;
tr_torrentRates(fLib, &downloadRate, &uploadRate);
BOOL upload;
if ((upload = checkUpload && uploadRate >= 0.1))
[self badge: [NSImage imageNamed: @"UploadBadge"] string: [NSString stringForSpeedAbbrev: uploadRate] atHeight: 0.0];
if (checkDownload && downloadRate >= 0.1)
downloadRateString = [NSString stringForSpeedAbbrev: downloadRate];
if (checkUpload && uploadRate >= 0.1)
uploadRateString = [NSString stringForSpeedAbbrev: uploadRate];
if (uploadRateString || downloadRateString)
{
if (uploadRateString)
[self badge: [NSImage imageNamed: @"UploadBadge"] string: uploadRateString atHeight: 0.0];
if (downloadRateString)
{
//download rate above upload rate
float bottom = uploadRateString ? [[NSImage imageNamed: @"UploadBadge"] size].height + BETWEEN_PADDING : 0.0;
[self badge: [NSImage imageNamed: @"DownloadBadge"] string: downloadRateString atHeight: bottom];
}
float bottom = upload ? [[NSImage imageNamed: @"UploadBadge"] size].height + BETWEEN_PADDING : 0.0;
[self badge: [NSImage imageNamed: @"DownloadBadge"] string: [NSString stringForSpeedAbbrev: downloadRate] atHeight: bottom];
}
}
}