Changeset 10711


Ignore:
Timestamp:
May 31, 2010, 2:06:54 PM (10 years ago)
Author:
livings124
Message:

#3216 Progress Percentage Should Round Down

Location:
trunk/macosx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileNameCell.m

    r10432 r10711  
    3030#import "NSStringAdditions.h"
    3131
     32#import "transmission.h" // required by utils.h
     33#import "utils.h"
     34
    3235#define PADDING_HORIZONAL 2.0
    3336#define IMAGE_FOLDER_SIZE 16.0
     
    204207   
    205208    const CGFloat progress = [torrent fileProgress: node];
    206     NSString * percentString = progress == 1.0 ? @"100%" : [NSString localizedStringWithFormat: @"%.2f%%", progress * 100.0];
     209    NSString * percentString = progress == 1.0 ? @"100%"
     210                                : [NSString localizedStringWithFormat: @"%.2f%%", tr_truncd(progress * 100.0, 2)];
    207211   
    208212    NSString * status = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@",
  • trunk/macosx/InfoActivityViewController.m

    r10522 r10711  
    125125        [fStateField setStringValue: [torrent stateString]];
    126126       
     127        #warning simplify
    127128        if ([torrent isFolder])
    128129            [fProgressField setStringValue: [NSString localizedStringWithFormat: NSLocalizedString(@"%.2f%% (%.2f%% selected)",
    129                 "Inspector -> Activity tab -> progress"), 100.0 * [torrent progress], 100.0 * [torrent progressDone]]];
     130                "Inspector -> Activity tab -> progress"), tr_truncd(100.0 * [torrent progress], 2),
     131                tr_truncd(100.0 * [torrent progressDone], 2)]];
    130132        else
    131             [fProgressField setStringValue: [NSString localizedStringWithFormat: @"%.2f%%", 100.0 * [torrent progress]]];
     133            [fProgressField setStringValue: [NSString localizedStringWithFormat: @"%.2f%%", tr_truncd(100.0 * [torrent progress], 2)]];
    132134           
    133135        [fRatioField setStringValue: [NSString stringForRatio: [torrent ratio]]];
  • trunk/macosx/InfoPeersViewController.m

    r10666 r10711  
    2929#import "Torrent.h"
    3030
     31#import "transmission.h" // required by utils.h
     32#import "utils.h"
     33
    3134@interface InfoPeersViewController (Private)
    3235
     
    357360        const CGFloat progress = [[peer objectForKey: @"Progress"] floatValue];
    358361        NSString * progressString = [NSString localizedStringWithFormat: NSLocalizedString(@"Progress: %.1f%%",
    359                                         "Inspector -> Peers tab -> table row tooltip"), progress * 100.0];
     362                                        "Inspector -> Peers tab -> table row tooltip"), tr_truncd(progress * 100.0, 1)];
    360363        if (progress < 1.0 && [[peer objectForKey: @"Seed"] boolValue])
    361364            progressString = [progressString stringByAppendingFormat: @" (%@)", NSLocalizedString(@"Partial Seed",
  • trunk/macosx/PeerProgressIndicatorCell.m

    r9844 r10711  
    2525#import "PeerProgressIndicatorCell.h"
    2626#import "NSApplicationAdditions.h"
     27
     28#import "transmission.h" // required by utils.h
     29#import "utils.h"
    2730
    2831@implementation PeerProgressIndicatorCell
     
    6164        }
    6265       
    63         [[NSString localizedStringWithFormat: @"%.1f%%", [self floatValue] * 100.0] drawInRect: cellFrame withAttributes: fAttributes];
     66        [[NSString localizedStringWithFormat: @"%.1f%%", tr_truncd([self floatValue] * 100.0, 1)] drawInRect: cellFrame
     67            withAttributes: fAttributes];
    6468    }
    6569    else
  • trunk/macosx/Torrent.m

    r10637 r10711  
    768768- (CGFloat) progress
    769769{
    770     return fStat->percentComplete;
     770    return .9999999;//fStat->percentComplete;
    771771}
    772772
     
    930930        NSString * progressString = fStat->metadataPercentComplete > 0.0
    931931                    ? [NSString localizedStringWithFormat: NSLocalizedString(@"%.2f%% of torrent metadata retrieved",
    932                         "Torrent -> progress string"), 100.0 * fStat->metadataPercentComplete]
     932                        "Torrent -> progress string"), tr_truncd(100.0 * fStat->metadataPercentComplete, 2)]
    933933                    : NSLocalizedString(@"torrent metadata needed", "Torrent -> progress string");
    934934       
     
    955955        }
    956956       
    957         string = [NSString localizedStringWithFormat: @"%@ (%.2f%%)", string, progress];
     957        string = [NSString localizedStringWithFormat: @"%@ (%.2f%%)", string, tr_truncd(progress, 2)];
    958958    }
    959959    else
     
    970970                                    [NSString stringForFileSize: [self haveTotal]], [NSString stringForFileSize: [self size]]];
    971971               
    972                 downloadString = [NSString localizedStringWithFormat: @"%@ (%.2f%%)", downloadString, 100.0 * [self progress]];
     972                downloadString = [NSString localizedStringWithFormat: @"%@ (%.2f%%)",
     973                                    downloadString, tr_truncd(100.0 * [self progress], 2)];
    973974            }
    974975        }
     
    10311032            case TR_STATUS_CHECK:
    10321033                string = [NSString localizedStringWithFormat: @"%@ (%.2f%%)",
    1033                             NSLocalizedString(@"Checking existing data", "Torrent -> status string"), 100.0 * [self checkingProgress]];
     1034                            NSLocalizedString(@"Checking existing data", "Torrent -> status string"),
     1035                                tr_truncd(100.0 * [self checkingProgress], 2)];
    10341036                break;
    10351037
     
    11101112        case TR_STATUS_CHECK:
    11111113            string = [NSString localizedStringWithFormat: @"%@ (%.2f%%)",
    1112                         NSLocalizedString(@"Checking existing data", "Torrent -> status string"), 100.0 * [self checkingProgress]];
     1114                        NSLocalizedString(@"Checking existing data", "Torrent -> status string"),
     1115                            tr_truncd(100.0 * [self checkingProgress], 2)];
    11131116            break;
    11141117       
     
    11631166        case TR_STATUS_CHECK:
    11641167            return [NSString localizedStringWithFormat: @"%@ (%.2f%%)",
    1165                     NSLocalizedString(@"Checking existing data", "Torrent -> status string"), 100.0 * [self checkingProgress]];
     1168                    NSLocalizedString(@"Checking existing data", "Torrent -> status string"),
     1169                        tr_truncd(100.0 * [self checkingProgress], 2)];
    11661170
    11671171        case TR_STATUS_DOWNLOAD:
Note: See TracChangeset for help on using the changeset viewer.