Changeset 2367


Ignore:
Timestamp:
Jul 15, 2007, 11:42:35 PM (15 years ago)
Author:
livings124
Message:

adjust priority colors, and show a priority color for folders

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileOutlineView.h

    r2189 r2367  
    2727@interface FileOutlineView : NSOutlineView
    2828{
    29     NSColor * fNormalColor, * fHighPriorityColor, * fLowPriorityColor;
     29    NSColor * fNormalColor, * fHighPriorityColor, * fLowPriorityColor, * fMixedPriorityColor;
    3030   
    3131    int fHoverRow;
  • trunk/macosx/FileOutlineView.m

    r2338 r2367  
    3939   
    4040    fNormalColor = [self backgroundColor];
    41     fHighPriorityColor = [[NSColor colorWithCalibratedRed: 0.678 green: 0.937 blue: 0.451 alpha: 1.0] retain];
    42     fLowPriorityColor = [[NSColor colorWithCalibratedRed: 0.984 green: 0.878 blue: 0.431 alpha: 1.0] retain];
     41    fHighPriorityColor = [[NSColor colorWithCalibratedRed: 0.8588 green: 0.9961 blue: 0.8311 alpha: 1.0] retain];
     42    fLowPriorityColor = [[NSColor colorWithCalibratedRed: 1.0 green: 0.9529 blue: 0.8078 alpha: 1.0] retain];
     43    fMixedPriorityColor = [[NSColor colorWithCalibratedRed: 0.9216 green: 0.9059 blue: 1.0 alpha: 1.0] retain];
    4344   
    4445    fHoverRow = -1;
     
    4950    [fHighPriorityColor release];
    5051    [fLowPriorityColor release];
     52    [fMixedPriorityColor release];
    5153   
    5254    [super dealloc];
     
    106108        Torrent * torrent = [(InfoWindowController *)[[self window] windowController] selectedTorrent];
    107109       
    108         if ([[item objectForKey: @"IsFolder"] boolValue])
     110
     111        NSSet * priorities = [torrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]];
     112        int count = [priorities count];
     113        if (count == 0)
    109114            [fNormalColor set];
     115        else if (count > 1)
     116            [fMixedPriorityColor set];
    110117        else
    111118        {
    112             NSSet * priorities = [torrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]];
    113             if ([priorities count] == 0)
     119            int priority = [[priorities anyObject] intValue];
     120            if (priority == TR_PRI_LOW)
     121                [fLowPriorityColor set];
     122            else if (priority == TR_PRI_HIGH)
     123                [fHighPriorityColor set];
     124            else
    114125                [fNormalColor set];
    115             else
    116             {
    117                 int priority = [[priorities anyObject] intValue];
    118                 if (priority == TR_PRI_LOW)
    119                     [fLowPriorityColor set];
    120                 else if (priority == TR_PRI_HIGH)
    121                     [fHighPriorityColor set];
    122                 else
    123                     [fNormalColor set];
    124             }
    125126        }
    126127       
     
    137138{
    138139    [super drawRect: r];
    139 
     140   
    140141    NSDictionary * item;
    141142    NSIndexSet * indexSet;
    142     int i, priority;
     143    int i, count, priority;
    143144    Torrent * torrent = [(InfoWindowController *)[[self window] windowController] selectedTorrent];
    144145    for (i = 0; i < [self numberOfRows]; i++)
     
    147148        {
    148149            item = [self itemAtRow: i];
    149             if (![[item objectForKey: @"IsFolder"] boolValue])
    150             {
    151                 NSSet * priorities = [torrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]];
    152                 if ([priorities count] == 1)
    153                 {
    154                     int priority = [[priorities anyObject] intValue];
    155                     if (priority == TR_PRI_LOW)
    156                         [fLowPriorityColor set];
    157                     else if (priority == TR_PRI_HIGH)
    158                         [fHighPriorityColor set];
    159                     else
    160                         continue;
    161                
    162                     NSRect rect = [self rectOfRow: i];
    163                     float width = 14.0;
    164                     rect.origin.y += (rect.size.height - width) * 0.5;
    165                     rect.origin.x += 3.0;
    166                     rect.size.width = width;
    167                     rect.size.height = width;
    168                    
    169                     [[NSBezierPath bezierPathWithOvalInRect: rect] fill];
    170                 }
    171             }
     150            if ([[item objectForKey: @"IsFolder"] boolValue])
     151                continue;
     152           
     153            NSSet * priorities = [torrent filePrioritiesForIndexes: [item objectForKey: @"Indexes"]];
     154            if ([priorities count] != 1)
     155                continue;
     156           
     157            priority = [[priorities anyObject] intValue];
     158            if (priority == TR_PRI_LOW)
     159                [fLowPriorityColor set];
     160            else if (priority == TR_PRI_HIGH)
     161                [fHighPriorityColor set];
     162            else
     163                continue;
     164       
     165            NSRect rect = [self rectOfRow: i];
     166            float width = 14.0;
     167            rect.origin.y += (rect.size.height - width) * 0.5;
     168            rect.origin.x += 3.0;
     169            rect.size.width = width;
     170            rect.size.height = width;
     171           
     172            [[NSBezierPath bezierPathWithOvalInRect: rect] fill];
    172173        }
    173174    }
  • trunk/macosx/FilePriorityCell.m

    r2345 r2367  
    3535    Torrent * torrent = [[[[self controlView] window] windowController] selectedTorrent];
    3636    NSIndexSet * indexes = [fItem objectForKey: @"Indexes"];
    37     if (![torrent canChangeDownloadCheckForFiles: indexes])
    38         return;
    3937   
    4038    int priority;
  • trunk/macosx/Torrent.m

    r2366 r2367  
    13041304- (BOOL) canChangeDownloadCheckForFile: (int) index
    13051305{
     1306    if (!fileStat)
     1307        [self updateFileStat];
     1308   
    13061309    return [self fileCount] > 1 && fileStat[index].completionStatus != TR_CP_COMPLETE;
    13071310}
Note: See TracChangeset for help on using the changeset viewer.