clicking the progress line in the transfer window will toggle between stats for the whole torrent and for just the selected files

This commit is contained in:
Mitchell Livingston 2007-09-23 05:39:41 +00:00
parent 968868debe
commit cc09e542b0
4 changed files with 47 additions and 13 deletions

View File

@ -34,6 +34,10 @@
<string>~/Desktop</string>
<key>DeleteOriginalTorrent</key>
<false/>
<key>DisplaySmallStatusRegular</key>
<true/>
<key>DisplayStatusProgressSelected</key>
<false/>
<key>DownloadChoice</key>
<string>Constant</string>
<key>DownloadFolder</key>
@ -88,8 +92,6 @@
<false/>
<key>SleepPrevent</key>
<true/>
<key>SmallStatusRegular</key>
<true/>
<key>SmallView</key>
<false/>
<key>Sort</key>

View File

@ -278,14 +278,28 @@ static int static_lastid = 0;
* shortStatusString = [[NSMutableString alloc] init];
if (![self allDownloaded])
[progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"),
{
if ([fDefaults boolForKey: @"DisplayStatusProgressSelected"])
[progressString appendFormat: NSLocalizedString(@"%@ of %@ selected (%.2f%%)", "Torrent -> progress string"),
[NSString stringForFileSize: [self downloadedValid]],
[NSString stringForFileSize: [self downloadedValid] + fStat->left], 100.0 * [self progressDone]];
else
[progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"),
[NSString stringForFileSize: [self downloadedValid]],
[NSString stringForFileSize: [self size]], 100.0 * [self progress]];
}
else if (![self isComplete])
[progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%), uploaded %@ (Ratio: %@)",
{
if ([fDefaults boolForKey: @"DisplayStatusProgressSelected"])
[progressString appendFormat: NSLocalizedString(@"%@ selected, uploaded %@ (Ratio: %@)",
"Torrent -> progress string"), [NSString stringForFileSize: [self downloadedValid]],
[NSString stringForFileSize: [self uploadedTotal]], [NSString stringForRatio: [self ratio]]];
else
[progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%), uploaded %@ (Ratio: %@)",
"Torrent -> progress string"), [NSString stringForFileSize: [self downloadedValid]],
[NSString stringForFileSize: [self size]], 100.0 * [self progress],
[NSString stringForFileSize: [self uploadedTotal]], [NSString stringForRatio: [self ratio]]];
}
else
[progressString appendFormat: NSLocalizedString(@"%@, uploaded %@ (Ratio: %@)", "Torrent -> progress string"),
[NSString stringForFileSize: [self size]], [NSString stringForFileSize: [self uploadedTotal]],

View File

@ -156,7 +156,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (NSRect) minimalStatusRectForBounds: (NSRect) bounds
{
Torrent * torrent = [self representedObject];
NSString * string = [torrent isActive] && ![fDefaults boolForKey: @"SmallStatusRegular"]
NSString * string = [torrent isActive] && ![fDefaults boolForKey: @"DisplaySmallStatusRegular"]
? [torrent remainingTimeString] : [torrent shortStatusString];
return [self rectForMinimalStatusWithString: [self attributedStatusString: string withColor: nil] inBounds: bounds];
}
@ -241,7 +241,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
NSRect minimalStatusRect;
if (minimal)
{
NSString * string = ![fDefaults boolForKey: @"SmallStatusRegular"] && [torrent isActive]
NSString * string = [torrent isActive] && ![fDefaults boolForKey: @"DisplaySmallStatusRegular"]
? [torrent remainingTimeString] : [torrent shortStatusString];
NSAttributedString * minimalString = [self attributedStatusString: string withColor: statusColor];
minimalStatusRect = [self rectForMinimalStatusWithString: minimalString inBounds: cellFrame];

View File

@ -46,6 +46,7 @@
- (NSRect) actionRectForRow: (int) row;
- (BOOL) pointInIconRect: (NSPoint) point;
- (BOOL) pointInProgressRect: (NSPoint) point;
- (BOOL) pointInMinimalStatusRect: (NSPoint) point;
- (BOOL) pointInPauseRect: (NSPoint) point;
@ -78,8 +79,6 @@
fClickPoint = NSZeroPoint;
fClickIn = NO;
fKeyStrokes = [[NSMutableArray alloc] init];
fDefaults = [NSUserDefaults standardUserDefaults];
[self setDelegate: self];
@ -142,9 +141,16 @@
}
else
{
if ([self pointInMinimalStatusRect: fClickPoint])
if ([self pointInProgressRect: fClickPoint])
{
[fDefaults setBool: ![fDefaults boolForKey: @"SmallStatusRegular"] forKey: @"SmallStatusRegular"];
[fDefaults setBool: ![fDefaults boolForKey: @"DisplayStatusProgressSelected"]
forKey: @"DisplayStatusProgressSelected"];
fClickPoint = NSZeroPoint;
[self reloadData];
}
else if ([self pointInMinimalStatusRect: fClickPoint])
{
[fDefaults setBool: ![fDefaults boolForKey: @"DisplaySmallStatusRegular"] forKey: @"DisplaySmallStatusRegular"];
fClickPoint = NSZeroPoint;
[self reloadData];
}
@ -245,6 +251,9 @@
- (void) keyDown: (NSEvent *) event
{
if (!fKeyStrokes)
fKeyStrokes = [[NSMutableArray alloc] init];
unichar newChar = [[event characters] characterAtIndex: 0];
if (newChar == ' ' || [[NSCharacterSet alphanumericCharacterSet] characterIsMember: newChar]
|| [[NSCharacterSet symbolCharacterSet] characterIsMember: newChar]
@ -258,9 +267,7 @@
}
else
{
if ([fKeyStrokes count] > 0)
[fKeyStrokes removeAllObjects];
[fKeyStrokes removeAllObjects];
[super keyDown: event];
}
}
@ -535,6 +542,17 @@
return NSPointInRect(point, [cell iconRectForBounds: [self frameOfCellAtColumn: 0 row: row]]);
}
- (BOOL) pointInProgressRect: (NSPoint) point
{
int row = [self rowAtPoint: point];
if (row < 0 || [fDefaults boolForKey: @"SmallView"])
return NO;
TorrentCell * cell = [[self tableColumnWithIdentifier: @"Torrent"] dataCell];
[cell setRepresentedObject: [fTorrents objectAtIndex: row]];
return NSPointInRect(point, [cell progressRectForBounds: [self frameOfCellAtColumn: 0 row: row]]);
}
- (BOOL) pointInMinimalStatusRect: (NSPoint) point
{
int row = [self rowAtPoint: point];