Ignore:
Timestamp:
Oct 1, 2007, 11:41:15 AM (15 years ago)
Author:
livings124
Message:

"switch" instead of "ifs"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r3250 r3251  
    855855        NSMutableArray * components = [NSMutableArray arrayWithCapacity: 4];
    856856       
    857         [components addObject: [NSString stringWithFormat:
    858                                 NSLocalizedString(@"Progress: %.1f%%", "Inspector -> Peers tab -> table row tooltip"),
    859                                 [[peer objectForKey: @"Progress"] floatValue] * 100.0]];
     857        [components addObject: [NSString stringWithFormat: NSLocalizedString(@"Progress: %.1f%%",
     858            "Inspector -> Peers tab -> table row tooltip"), [[peer objectForKey: @"Progress"] floatValue] * 100.0]];
    860859       
    861860        if ([[peer objectForKey: @"Encryption"] boolValue])
     
    869868            [components addObject: NSLocalizedString(@"Port: N/A", "Inspector -> Peers tab -> table row tooltip")];
    870869       
    871         int from = [[peer objectForKey: @"From"] intValue];
    872         if (from == TR_PEER_FROM_INCOMING)
    873             [components addObject: NSLocalizedString(@"From: incoming connection", "Inspector -> Peers tab -> table row tooltip")];
    874         else if (from == TR_PEER_FROM_CACHE)
    875             [components addObject: NSLocalizedString(@"From: cache", "Inspector -> Peers tab -> table row tooltip")];
    876         else if (from == TR_PEER_FROM_PEX)
    877             [components addObject: NSLocalizedString(@"From: peer exchange", "Inspector -> Peers tab -> table row tooltip")];
    878         else
    879             [components addObject: NSLocalizedString(@"From: tracker", "Inspector -> Peers tab -> table row tooltip")];
     870        switch ([[peer objectForKey: @"From"] intValue])
     871        {
     872            case TR_PEER_FROM_TRACKER:
     873                [components addObject: NSLocalizedString(@"From: tracker", "Inspector -> Peers tab -> table row tooltip")];
     874                break;
     875            case TR_PEER_FROM_INCOMING:
     876                [components addObject: NSLocalizedString(@"From: incoming connection", "Inspector -> Peers tab -> table row tooltip")];
     877                break;
     878            case TR_PEER_FROM_CACHE:
     879                [components addObject: NSLocalizedString(@"From: cache", "Inspector -> Peers tab -> table row tooltip")];
     880                break;
     881            case TR_PEER_FROM_PEX:
     882                [components addObject: NSLocalizedString(@"From: peer exchange", "Inspector -> Peers tab -> table row tooltip")];
     883                break;
     884        }
    880885       
    881886        return [components componentsJoinedByString: @"\n"];
Note: See TracChangeset for help on using the changeset viewer.