From 1550251be9216760aece1506cfdc3ceb78241db8 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Tue, 25 Jul 2006 01:23:40 +0000 Subject: [PATCH] Save minimal status text preference (speed or time) --- macosx/Defaults.plist | 4 ++++ macosx/TorrentCell.h | 2 +- macosx/TorrentCell.m | 11 ++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/macosx/Defaults.plist b/macosx/Defaults.plist index eb911f322..0158b74fc 100644 --- a/macosx/Defaults.plist +++ b/macosx/Defaults.plist @@ -2,6 +2,8 @@ + + AutoImport AutoImportDirectory @@ -58,6 +60,8 @@ ShowInspector + SmallStatusRegular + SmallView Sort diff --git a/macosx/TorrentCell.h b/macosx/TorrentCell.h index 8c2d11545..f270d7540 100644 --- a/macosx/TorrentCell.h +++ b/macosx/TorrentCell.h @@ -31,7 +31,7 @@ @interface TorrentCell : NSCell { Torrent * fTorrent; - BOOL fNormalStatus; + BOOL fStatusRegular; NSUserDefaults * fDefaults; } diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index 611cd445e..a4e1c5570 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -63,9 +63,9 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 { if ((self = [super init])) { - fNormalStatus = YES; - fDefaults = [NSUserDefaults standardUserDefaults]; + + fStatusRegular = [fDefaults boolForKey: @"SmallStatusRegular"]; NSSize startSize = NSMakeSize(100.0, BAR_HEIGHT); if (!fProgressWhite) @@ -284,7 +284,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 - (void) toggleMinimalStatus { - fNormalStatus = !fNormalStatus; + fStatusRegular = !fStatusRegular; + [fDefaults setBool: fStatusRegular forKey: @"SmallStatusRegular"]; } - (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) view @@ -362,8 +363,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 //name and status string float mainWidth = cellFrame.size.width - iconSize.width - 3.0 * PADDING - EXTRA_NAME_SHIFT; - NSString * realStatusString = !fNormalStatus && [fTorrent isActive] && [fTorrent progress] < 1.0 - ? [fTorrent remainingTimeString] : [fTorrent shortStatusString]; + NSString * realStatusString = !fStatusRegular && [fTorrent isActive] && [fTorrent progress] < 1.0 + ? [fTorrent remainingTimeString] : [fTorrent shortStatusString]; NSAttributedString * statusString = [[[NSAttributedString alloc] initWithString: realStatusString attributes: statusAttributes] autorelease];