Ignore:
Timestamp:
Jul 13, 2007, 4:20:11 AM (15 years ago)
Author:
livings124
Message:

hopefully function for getting priorities is a bit faster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r2336 r2337  
    933933    else if ([ident isEqualToString: @"Priority"])
    934934    {
    935         Torrent * torrent = [fTorrents objectAtIndex: 0];
    936         NSIndexSet * indexSet = [item objectForKey: @"Indexes"];
    937        
    938         if (![torrent canChangeDownloadCheckForFiles: indexSet])
     935        NSArray * priorities = [[fTorrents objectAtIndex: 0] filePrioritiesForIndexes: [item objectForKey: @"Indexes"]];
     936       
     937        int count = [priorities count];
     938        if (count == 0)
    939939            return NSLocalizedString(@"Priority Not Available", "Inspector -> files tab -> tooltip");
    940        
    941         BOOL low = [torrent hasFilePriority: TR_PRI_LOW forIndexes: indexSet],
    942             normal = [torrent hasFilePriority: TR_PRI_NORMAL forIndexes: indexSet],
    943             high = [torrent hasFilePriority: TR_PRI_HIGH forIndexes: indexSet];
    944        
    945         if (low && !normal && !high)
    946             return NSLocalizedString(@"Low Priority", "Inspector -> files tab -> tooltip");
    947         else if (!low && normal && !high)
    948             return NSLocalizedString(@"Normal Priority", "Inspector -> files tab -> tooltip");
    949         else if (!low && !normal && high)
    950             return NSLocalizedString(@"High Priority", "Inspector -> files tab -> tooltip");
    951         else
     940        else if (count > 1)
    952941            return NSLocalizedString(@"Multiple Priorities", "Inspector -> files tab -> tooltip");
     942        else
     943        {
     944            int priority = [[priorities objectAtIndex: 0] intValue];
     945            if (priority == TR_PRI_LOW)
     946                return NSLocalizedString(@"Low Priority", "Inspector -> files tab -> tooltip");
     947            else if (priority == TR_PRI_HIGH)
     948                return NSLocalizedString(@"High Priority", "Inspector -> files tab -> tooltip");
     949            else
     950                return NSLocalizedString(@"Normal Priority", "Inspector -> files tab -> tooltip");
     951        }
    953952    }
    954953    else
Note: See TracChangeset for help on using the changeset viewer.