mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
First commit on my own 8-)
Sorting by progress, sorting no longer causes crashes. New look for the table. Info is now inspector: can set individual and multiple ratio limits, shows listing of files, more info in general, resizes when changing tabs, can change tabs with cmd-left and cmd-right. Menu items moved to "Transfers" menu. Sliding status bar in its own view. Prefs moved into their own nib. Toolbar items for pause and resume selected (many wanted this, but it needs better icons) New icons for Transfers and General. A lot of tweaking of main window to fix alignment etc. Sparkle used for updated (still needs to be added to website to work). And a lot more tweaking and changes that I'm too lazy to list. ...now let's hope I commit this right
This commit is contained in:
+14
-13
@@ -90,12 +90,10 @@
|
||||
return [NSString stringWithFormat: @"%.2f G", speed / 1048576];
|
||||
}
|
||||
|
||||
+ (NSString *) stringForRatio: (uint64_t) down upload: (uint64_t) up
|
||||
+ (NSString *) stringForRatioWithDownload: (uint64_t) down upload: (uint64_t) up
|
||||
{
|
||||
if( !down && !up )
|
||||
return @"N/A";
|
||||
if( !down )
|
||||
return [NSString stringWithUTF8String: "\xE2\x88\x9E"];
|
||||
if (down == 0)
|
||||
return up == 0 ? @"N/A" : [NSString stringWithUTF8String: "\xE2\x88\x9E"];
|
||||
|
||||
float ratio = (float) up / (float) down;
|
||||
if( ratio < 10.0 )
|
||||
@@ -106,22 +104,24 @@
|
||||
return [NSString stringWithFormat: @"%.0f", ratio];
|
||||
}
|
||||
|
||||
- (NSString *) stringFittingInWidth: (float) width
|
||||
withAttributes: (NSDictionary *) attributes
|
||||
- (NSAttributedString *) attributedStringFittingInWidth: (float) width
|
||||
attributes: (NSDictionary *) attributes
|
||||
{
|
||||
int i;
|
||||
float realWidth = [self sizeWithAttributes: attributes].width;
|
||||
|
||||
/* The whole string fits */
|
||||
if( realWidth <= width )
|
||||
return self;
|
||||
|
||||
return [[[NSAttributedString alloc] initWithString: self attributes: attributes] autorelease];
|
||||
|
||||
float ellipsisWidth = [NS_ELLIPSIS sizeWithAttributes: attributes].width;
|
||||
|
||||
/* Width is too small */
|
||||
if ( [NS_ELLIPSIS sizeWithAttributes: attributes].width > width )
|
||||
return @"";
|
||||
if ( ellipsisWidth > width )
|
||||
return [[[NSAttributedString alloc] initWithString: @"" attributes: attributes] autorelease];
|
||||
|
||||
/* Don't worry about ellipsis until the end */
|
||||
width -= [NS_ELLIPSIS sizeWithAttributes: attributes].width;
|
||||
width -= ellipsisWidth;
|
||||
|
||||
/* Approximate how many characters we'll need to drop... */
|
||||
i = [self length] * (width / realWidth);
|
||||
@@ -150,7 +150,8 @@
|
||||
}
|
||||
else;
|
||||
|
||||
return [newString stringByAppendingString: NS_ELLIPSIS];
|
||||
return [[[NSAttributedString alloc] initWithString: [newString stringByAppendingString: NS_ELLIPSIS]
|
||||
attributes: attributes] autorelease];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user