Changeset 3476


Ignore:
Timestamp:
Oct 20, 2007, 7:25:14 PM (14 years ago)
Author:
livings124
Message:

another if-to-switch

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileNameCell.m

    r3475 r3476  
    2323 *****************************************************************************/
    2424
     25#import "FileNameCell.h"
    2526#import "FileOutlineView.h"
    26 #import "FileNameCell.h"
    2727#import "Torrent.h"
    2828#import "NSStringAdditions.h"
  • trunk/macosx/FilePriorityCell.m

    r3475 r3476  
    7474   
    7575    FileOutlineView * view = (FileOutlineView *)[self controlView];
    76     int row = [view hoverRow];
    77     if (count > 0 && row != -1 && [view itemAtRow: row] == dict)
     76    int hoverRow = [view hoverRow];
     77    if (count > 0 && hoverRow != -1 && [view itemAtRow: hoverRow] == dict)
    7878    {
    7979        [super setSelected: [priorities containsObject: [NSNumber numberWithInt: TR_PRI_LOW]] forSegment: 0];
     
    9898            image = fMixedImage;
    9999        }
    100         else if ([priorities containsObject: [NSNumber numberWithInt: TR_PRI_NORMAL]])
    101         {
    102             if (!fNormalImage)
    103                 fNormalImage = [NSImage imageNamed: @"PriorityNormal.png"];
    104             image = fNormalImage;
    105         }
    106         else if ([priorities containsObject: [NSNumber numberWithInt: TR_PRI_LOW]])
    107         {
    108             if (!fLowImage)
    109                 fLowImage = [NSImage imageNamed: @"PriorityLow.png"];
    110             image = fLowImage;
    111         }
    112100        else
    113101        {
    114             if (!fHighImage)
    115                 fHighImage = [NSImage imageNamed: @"PriorityHigh.png"];
    116             image = fHighImage;
     102            switch ([[priorities anyObject] intValue])
     103            {
     104                case TR_PRI_NORMAL:
     105                    if (!fNormalImage)
     106                        fNormalImage = [NSImage imageNamed: @"PriorityNormal.png"];
     107                    image = fNormalImage;
     108                    break;
     109                case TR_PRI_LOW:
     110                    if (!fLowImage)
     111                        fLowImage = [NSImage imageNamed: @"PriorityLow.png"];
     112                    image = fLowImage;
     113                    break;
     114                case TR_PRI_HIGH:
     115                    if (!fHighImage)
     116                        fHighImage = [NSImage imageNamed: @"PriorityHigh.png"];
     117                    image = fHighImage;
     118                    break;
     119            }
    117120        }
    118121       
Note: See TracChangeset for help on using the changeset viewer.