Save minimal status text preference (speed or time)

This commit is contained in:
Mitchell Livingston 2006-07-25 01:23:40 +00:00
parent d4f3ac6ae2
commit 1550251be9
3 changed files with 11 additions and 6 deletions

View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key></key>
<string></string>
<key>AutoImport</key> <key>AutoImport</key>
<false/> <false/>
<key>AutoImportDirectory</key> <key>AutoImportDirectory</key>
@ -58,6 +60,8 @@
<true/> <true/>
<key>ShowInspector</key> <key>ShowInspector</key>
<false/> <false/>
<key>SmallStatusRegular</key>
<true/>
<key>SmallView</key> <key>SmallView</key>
<false/> <false/>
<key>Sort</key> <key>Sort</key>

View File

@ -31,7 +31,7 @@
@interface TorrentCell : NSCell @interface TorrentCell : NSCell
{ {
Torrent * fTorrent; Torrent * fTorrent;
BOOL fNormalStatus; BOOL fStatusRegular;
NSUserDefaults * fDefaults; NSUserDefaults * fDefaults;
} }

View File

@ -63,10 +63,10 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
{ {
if ((self = [super init])) if ((self = [super init]))
{ {
fNormalStatus = YES;
fDefaults = [NSUserDefaults standardUserDefaults]; fDefaults = [NSUserDefaults standardUserDefaults];
fStatusRegular = [fDefaults boolForKey: @"SmallStatusRegular"];
NSSize startSize = NSMakeSize(100.0, BAR_HEIGHT); NSSize startSize = NSMakeSize(100.0, BAR_HEIGHT);
if (!fProgressWhite) if (!fProgressWhite)
{ {
@ -284,7 +284,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (void) toggleMinimalStatus - (void) toggleMinimalStatus
{ {
fNormalStatus = !fNormalStatus; fStatusRegular = !fStatusRegular;
[fDefaults setBool: fStatusRegular forKey: @"SmallStatusRegular"];
} }
- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) view - (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) view
@ -362,7 +363,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
//name and status string //name and status string
float mainWidth = cellFrame.size.width - iconSize.width - 3.0 * PADDING - EXTRA_NAME_SHIFT; float mainWidth = cellFrame.size.width - iconSize.width - 3.0 * PADDING - EXTRA_NAME_SHIFT;
NSString * realStatusString = !fNormalStatus && [fTorrent isActive] && [fTorrent progress] < 1.0 NSString * realStatusString = !fStatusRegular && [fTorrent isActive] && [fTorrent progress] < 1.0
? [fTorrent remainingTimeString] : [fTorrent shortStatusString]; ? [fTorrent remainingTimeString] : [fTorrent shortStatusString];
NSAttributedString * statusString = [[[NSAttributedString alloc] initWithString: realStatusString NSAttributedString * statusString = [[[NSAttributedString alloc] initWithString: realStatusString