From c67b781fcbcbf8922c854336fd18554f1f6c7086 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 24 Mar 2008 02:38:00 +0000 Subject: [PATCH] more unused code removal, update NEWS --- NEWS | 4 +++ macosx/NSStringAdditions.m | 10 +++--- macosx/PeerProgressIndicatorCell.h | 1 - macosx/PeerProgressIndicatorCell.m | 54 +++++++++++------------------- macosx/PeerTableView.h | 3 +- macosx/ToolbarSegmentedCell.h | 2 -- 6 files changed, 30 insertions(+), 44 deletions(-) diff --git a/NEWS b/NEWS index 7b806b0c7..6821950ed 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ NEWS file for Transmission +1.20 (2008/xx/yy) +- Mac + + Display of decimal numbers matches system international settings + 1.10 (2008/xx/yy) - All Platforms + Stop torrents when downloading and the disk becomes full diff --git a/macosx/NSStringAdditions.m b/macosx/NSStringAdditions.m index 9dd440eb5..b5ce75083 100644 --- a/macosx/NSStringAdditions.m +++ b/macosx/NSStringAdditions.m @@ -40,29 +40,29 @@ + (NSString *) stringForFileSize: (uint64_t) size { if (size < 1024) - return [NSString stringWithFormat: NSLocalizedString(@"%lld bytes", "File size"), size]; + return [NSString stringWithFormat: @"%lld %@", size, NSLocalizedString(@"bytes", "File size - bytes")]; float convertedSize; NSString * unit; if (size < 1048576) { convertedSize = size / 1024.0; - unit = NSLocalizedString(@"KB", "File size"); + unit = NSLocalizedString(@"KB", "File size - kilobytes"); } else if (size < 1073741824) { convertedSize = size / 1048576.0; - unit = NSLocalizedString(@"MB", "File size"); + unit = NSLocalizedString(@"MB", "File size - megabytes"); } else if (size < 1099511627776.0) { convertedSize = size / 1073741824.0; - unit = NSLocalizedString(@"GB", "File size"); + unit = NSLocalizedString(@"GB", "File size - gigabytes"); } else { convertedSize = size / 1099511627776.0; - unit = NSLocalizedString(@"TB", "File size"); + unit = NSLocalizedString(@"TB", "File size - terabytes"); } //attempt to have minimum of 3 digits with at least 1 decimal diff --git a/macosx/PeerProgressIndicatorCell.h b/macosx/PeerProgressIndicatorCell.h index e2f8ab0db..3790f1773 100644 --- a/macosx/PeerProgressIndicatorCell.h +++ b/macosx/PeerProgressIndicatorCell.h @@ -26,7 +26,6 @@ @interface PeerProgressIndicatorCell : NSLevelIndicatorCell { - BOOL fIsHidden; NSDictionary * fAttributes; } diff --git a/macosx/PeerProgressIndicatorCell.m b/macosx/PeerProgressIndicatorCell.m index 86b2694e5..ddc6f9948 100644 --- a/macosx/PeerProgressIndicatorCell.m +++ b/macosx/PeerProgressIndicatorCell.m @@ -40,47 +40,33 @@ [super dealloc]; } -- (BOOL) hidden -{ - return fIsHidden; -} - -- (void) setHidden: (BOOL) isHidden -{ - fIsHidden = isHidden; -} - - (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView { - if (!fIsHidden) + if ([[NSUserDefaults standardUserDefaults] boolForKey: @"DisplayPeerProgressBarNumber"]) { - if ([[NSUserDefaults standardUserDefaults] boolForKey: @"DisplayPeerProgressBarNumber"]) + if (!fAttributes) + fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: [NSFont systemFontOfSize: 11.0], NSFontAttributeName, nil]; + [[NSString localizedStringWithFormat: @"%.1f%%", [self floatValue] * 100.0] drawInRect: cellFrame withAttributes: fAttributes]; + } + else + { + //attributes not needed anymore + if (fAttributes) { - if (!fAttributes) - fAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: [NSFont systemFontOfSize: 11.0], NSFontAttributeName, nil]; - [[NSString localizedStringWithFormat: @"%.1f%%", [self floatValue] * 100.0] drawInRect: cellFrame - withAttributes: fAttributes]; + [fAttributes release]; + fAttributes = nil; } - else + + [super drawWithFrame: cellFrame inView: controlView]; + if ([self floatValue] >= 1.0) { - //attributes not needed anymore - if (fAttributes) - { - [fAttributes release]; - fAttributes = nil; - } + NSImage * checkImage = [NSImage imageNamed: @"CompleteCheck.png"]; + [checkImage setFlipped: YES]; - [super drawWithFrame: cellFrame inView: controlView]; - if ([self floatValue] >= 1.0) - { - NSImage * checkImage = [NSImage imageNamed: @"CompleteCheck.png"]; - [checkImage setFlipped: YES]; - - NSSize imageSize = [checkImage size]; - NSRect rect = NSMakeRect(cellFrame.origin.x + (cellFrame.size.width - imageSize.width) * 0.5, - cellFrame.origin.y + (cellFrame.size.height - imageSize.height) * 0.5, imageSize.width, imageSize.height); - [checkImage drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; - } + NSSize imageSize = [checkImage size]; + NSRect rect = NSMakeRect(cellFrame.origin.x + (cellFrame.size.width - imageSize.width) * 0.5, + cellFrame.origin.y + (cellFrame.size.height - imageSize.height) * 0.5, imageSize.width, imageSize.height); + [checkImage drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; } } } diff --git a/macosx/PeerTableView.h b/macosx/PeerTableView.h index 19f304dff..17f081be7 100644 --- a/macosx/PeerTableView.h +++ b/macosx/PeerTableView.h @@ -25,6 +25,5 @@ #import @interface PeerTableView : NSTableView -{ -} + @end diff --git a/macosx/ToolbarSegmentedCell.h b/macosx/ToolbarSegmentedCell.h index d1d3fed6a..e07adc316 100644 --- a/macosx/ToolbarSegmentedCell.h +++ b/macosx/ToolbarSegmentedCell.h @@ -25,7 +25,5 @@ #import @interface ToolbarSegmentedCell : NSSegmentedCell -{ -} @end