Changeset 5273


Ignore:
Timestamp:
Mar 17, 2008, 9:44:14 PM (14 years ago)
Author:
livings124
Message:

fix display issue on launch when group row is set to show ratio

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r5272 r5273  
    538538    NSFileManager * fileManager = [NSFileManager defaultManager];
    539539    NSString * downloadFolder = [self downloadFolder];
    540     BOOL onLeopard = [NSApp isOnLeopardOrBetter];
    541540   
    542541    NSString * volumeName;
    543542    if ((volumeName = [[fileManager componentsToDisplayForPath: downloadFolder] objectAtIndex: 0]))
    544543    {
     544        BOOL onLeopard = [NSApp isOnLeopardOrBetter];
     545       
    545546        NSDictionary * systemAttributes = onLeopard ? [fileManager attributesOfFileSystemForPath: downloadFolder error: NULL]
    546547                                            : [fileManager fileSystemAttributesAtPath: downloadFolder];
     
    579580            [alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")];
    580581           
    581             BOOL onLeopard = [NSApp isOnLeopardOrBetter];
    582582            if (onLeopard)
    583583                [alert setShowsSuppressionButton: YES];
  • trunk/macosx/TorrentTableView.m

    r5260 r5273  
    3737#define PIECE_TIME 0.005
    3838
     39#define GROUP_SPEED_IMAGE_COLUMN_WIDTH 8.0
     40#define GROUP_RATIO_IMAGE_COLUMN_WIDTH 10.0
     41
    3942@interface TorrentTableView (Private)
    4043
     
    9194            fCollapsedGroups = [[NSMutableIndexSet alloc] init];
    9295       
    93         //set group columns to show ratio (nib is set to speeds)
    94         if ([fDefaults boolForKey: @"DisplayGroupRowRatio"])
    95             [self setGroupStatusColumns];
    96        
    9796        fMouseControlRow = -1;
    9897        fMouseRevealRow = -1;
     
    120119   
    121120    [super dealloc];
     121}
     122
     123- (void) awakeFromNib
     124{
     125    //set group columns to show ratio, needs to be in awakeFromNib to size columns correctly
     126    [self setGroupStatusColumns];
    122127}
    123128
     
    818823   
    819824    NSTableColumn * dlTableColumn = [self tableColumnWithIdentifier: @"DL"];
    820     if ([dlTableColumn isHidden] == ratio)
    821         return;
    822825   
    823826    [dlTableColumn setHidden: ratio];
    824827    [[self tableColumnWithIdentifier: @"DL Image"] setHidden: ratio];
    825828   
    826     [[self tableColumnWithIdentifier: @"UL Image"] setWidth: ratio ? 10.0 : 8.0];
    827    
    828     NSTableColumn * groupTableColumn = [self tableColumnWithIdentifier: @"Group"];
    829     [groupTableColumn setWidth: [groupTableColumn width] + (ratio ? -2.0 : 2.0)];
     829    //change size of image column
     830    NSTableColumn * ulImageTableColumn = [self tableColumnWithIdentifier: @"UL Image"];
     831    float oldWidth = [ulImageTableColumn width], newWidth = ratio ? GROUP_RATIO_IMAGE_COLUMN_WIDTH : GROUP_SPEED_IMAGE_COLUMN_WIDTH;
     832    if (oldWidth != newWidth)
     833    {
     834        [ulImageTableColumn setWidth: newWidth];
     835       
     836        NSTableColumn * groupTableColumn = [self tableColumnWithIdentifier: @"Group"];
     837        [groupTableColumn setWidth: [groupTableColumn width] - (newWidth - oldWidth)];
     838    }
    830839}
    831840
Note: See TracChangeset for help on using the changeset viewer.