Show ratio instead of the download rate once the download is complete.
Fixed windowWillUseStandardFrame. Cleaning
This commit is contained in:
parent
f1b113ec5b
commit
3ba5313752
|
@ -49,6 +49,7 @@
|
|||
IBOutlet NSMenuItem * fShowHideToolbar;
|
||||
|
||||
IBOutlet NSWindow * fWindow;
|
||||
IBOutlet NSScrollView * fScrollView;
|
||||
IBOutlet TorrentTableView * fTableView;
|
||||
IBOutlet NSTextField * fTotalDLField;
|
||||
IBOutlet NSTextField * fTotalULField;
|
||||
|
|
|
@ -965,9 +965,10 @@ static void sleepCallBack( void * controller, io_service_t y,
|
|||
float foo;
|
||||
|
||||
rectWin = [fWindow frame];
|
||||
rectView = [[fWindow contentView] frame];
|
||||
foo = 47.0 + MAX( 1, tr_torrentCount( fHandle ) ) * 62.0 -
|
||||
rectView.size.height;
|
||||
rectView = [fScrollView frame];
|
||||
foo = 25.0 + MAX( 1, fCount ) * ( [fTableView rowHeight] +
|
||||
[fTableView intercellSpacing].height ) -
|
||||
rectView.size.height;
|
||||
|
||||
rectWin.size.height += foo;
|
||||
rectWin.origin.y -= foo;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
fRemoveItem = NSMenuItem;
|
||||
fRemoveTorrentItem = NSMenuItem;
|
||||
fRevealItem = NSMenuItem;
|
||||
fScrollView = NSScrollView;
|
||||
fShowHideToolbar = NSMenuItem;
|
||||
fTableView = TorrentTableView;
|
||||
fTotalDLField = NSTextField;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<key>589</key>
|
||||
<string>54 521 112 118 0 0 1152 842 </string>
|
||||
<key>783</key>
|
||||
<string>387 422 470 265 0 0 1280 832 </string>
|
||||
<string>456 452 470 265 0 0 1440 878 </string>
|
||||
<key>796</key>
|
||||
<string>412 490 470 129 0 0 1280 832 </string>
|
||||
<key>825</key>
|
||||
|
@ -25,11 +25,7 @@
|
|||
<string>443.0</string>
|
||||
<key>IBOldestOS</key>
|
||||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>783</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8G32</string>
|
||||
<string>8F1111g</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Binary file not shown.
|
@ -34,15 +34,12 @@
|
|||
fSizeString = [NSString stringWithFormat: @" (%@)",
|
||||
[NSString stringForFileSize: stat->info.totalSize]];
|
||||
|
||||
if( stat->folder )
|
||||
fIcon = [[NSWorkspace sharedWorkspace] iconForFile:
|
||||
[[NSString stringWithUTF8String: stat->folder]
|
||||
stringByAppendingPathComponent: fNameString]];
|
||||
if( stat->info.fileCount > 1 )
|
||||
fIcon = [[NSWorkspace sharedWorkspace] iconForFileType:
|
||||
NSFileTypeForHFSTypeCode('fldr')];
|
||||
else
|
||||
/* XXX The torrent is still being opened, the destination hasn't
|
||||
been chosen yet. It shouldn't be added to the table view so
|
||||
soon */
|
||||
fIcon = [[NSWorkspace sharedWorkspace] iconForFile: @"/System"];
|
||||
fIcon = [[NSWorkspace sharedWorkspace] iconForFileType:
|
||||
[fNameString pathExtension]];
|
||||
[fIcon setFlipped: YES];
|
||||
|
||||
fTimeString = @"";
|
||||
|
|
|
@ -122,8 +122,13 @@ static uint32_t kGreen[] =
|
|||
fWhiteText = w;
|
||||
|
||||
/* Update the strings to be displayed */
|
||||
fDlString = [@"DL: " stringByAppendingString:
|
||||
[NSString stringForSpeed: fStat->rateDownload]];
|
||||
if( fStat->progress == 1.0 )
|
||||
fDlString = [@"Ratio: " stringByAppendingString:
|
||||
[NSString stringForRatio: fStat->downloaded
|
||||
upload: fStat->uploaded]];
|
||||
else
|
||||
fDlString = [@"DL: " stringByAppendingString:
|
||||
[NSString stringForSpeed: fStat->rateDownload]];
|
||||
fUlString = [@"UL: " stringByAppendingString:
|
||||
[NSString stringForSpeed: fStat->rateUpload]];
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
+ (NSString *) stringForFileSize: (uint64_t) size;
|
||||
+ (NSString *) stringForSpeed: (float) speed;
|
||||
+ (NSString *) stringForRatio: (uint64_t) down upload: (uint64_t) up;
|
||||
- (NSString *) stringFittingInWidth: (float) width
|
||||
withAttributes: (NSDictionary *) attributes;
|
||||
|
||||
|
|
|
@ -36,6 +36,22 @@
|
|||
return [NSString stringWithFormat: @"%.2f GB/s", speed / 1048576];
|
||||
}
|
||||
|
||||
+ (NSString *) stringForRatio: (uint64_t) down upload: (uint64_t) up;
|
||||
{
|
||||
if( !down && !up )
|
||||
return @"N/A";
|
||||
if( !down )
|
||||
return @"Inf.";
|
||||
|
||||
float ratio = (float) up / (float) down;
|
||||
if( ratio < 10.0 )
|
||||
return [NSString stringWithFormat: @"%.2f", ratio];
|
||||
else if( ratio < 100.0 )
|
||||
return [NSString stringWithFormat: @"%.1f", ratio];
|
||||
else
|
||||
return [NSString stringWithFormat: @"%.0f", ratio];
|
||||
}
|
||||
|
||||
- (NSString *) stringFittingInWidth: (float) width
|
||||
withAttributes: (NSDictionary *) attributes
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue