Changeset 156


Ignore:
Timestamp:
Mar 15, 2006, 12:21:33 AM (16 years ago)
Author:
titer
Message:

Added [NSString stringWithInt:] for convenience.
UI cosmetic: bigger margin left from the pause/resume button

Location:
branches/new_api/macosx
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/new_api/macosx/Badger.m

    r103 r156  
    1 //
    2 //  Badger.m
    3 //  Transmission
    4 //
    5 //  Created by Mitchell Livingston on 12/21/05.
    6 //
     1/******************************************************************************
     2 * Copyright (c) 2005-2006 Transmission authors and contributors
     3 *
     4 * Permission is hereby granted, free of charge, to any person obtaining a
     5 * copy of this software and associated documentation files (the "Software"),
     6 * to deal in the Software without restriction, including without limitation
     7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     8 * and/or sell copies of the Software, and to permit persons to whom the
     9 * Software is furnished to do so, subject to the following conditions:
     10 *
     11 * The above copyright notice and this permission notice shall be included in
     12 * all copies or substantial portions of the Software.
     13 *
     14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     20 * DEALINGS IN THE SOFTWARE.
     21 *****************************************************************************/
    722
    823#import "Badger.h"
     24#import "StringAdditions.h"
    925
    1026@interface Badger (Private)
     
    88104           
    89105            //place badge text
    90             [self badgeString: [NSString stringWithFormat: @"%d", completed]
     106            [self badgeString: [NSString stringWithInt: completed]
    91107                        forRect: badgeRect];
    92108                       
  • branches/new_api/macosx/Controller.m

    r154 r156  
    463463    {
    464464        NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys:
    465             [NSString stringWithFormat: @"%d", idx], @"Index",
    466             [NSString stringWithFormat: @"%d", deleteTorrent], @"DeleteTorrent",
    467             [NSString stringWithFormat: @"%d", deleteData], @"DeleteData",
     465            [NSString stringWithInt: idx], @"Index",
     466            [NSString stringWithInt: deleteTorrent], @"DeleteTorrent",
     467            [NSString stringWithInt: deleteData], @"DeleteData",
    468468            nil];
    469469        [dict retain];
     
    705705    [fInfoSize setStringValue:
    706706        [NSString stringForFileSize: fStat[row].info.totalSize]];
    707     [fInfoPieces setStringValue: [NSString stringWithFormat: @"%d",
     707    [fInfoPieces setStringValue: [NSString stringWithInt:
    708708        fStat[row].info.pieceCount]];
    709709    [fInfoPieceSize setStringValue:
     
    715715        [fInfoSeeders setStringValue: [NSString stringWithUTF8String: "?"]];
    716716    } else {
    717         [fInfoSeeders setStringValue: [NSString stringWithFormat: @"%d",
     717        [fInfoSeeders setStringValue: [NSString stringWithInt:
    718718            fStat[row].seeders]];
    719719    }
     
    721721        [fInfoLeechers setStringValue: [NSString stringWithUTF8String: "?"]];
    722722    } else {
    723         [fInfoLeechers setStringValue: [NSString stringWithFormat: @"%d",
     723        [fInfoLeechers setStringValue: [NSString stringWithInt:
    724724            fStat[row].leechers]];
    725725    }
  • branches/new_api/macosx/PrefsController.m

    r106 r156  
    11/******************************************************************************
    2  * Copyright (c) 2005 Eric Petit
     2 * Copyright (c) 2005-2006 Transmission authors and contributors
    33 *
    44 * Permission is hereby granted, free of charge, to any person obtaining a
     
    2222
    2323#import "PrefsController.h"
     24#import "StringAdditions.h"
    2425#import "Utils.h"
    2526
     
    203204    //if value entered is not an int or is not in range do not change
    204205    if (![[fPortField stringValue] isEqualToString:
    205             [NSString stringWithFormat: @"%d", bindPort]]
     206            [NSString stringWithInt: bindPort]]
    206207            || bindPort < MIN_PORT
    207208            || bindPort > MAX_PORT)
     
    234235    //if value entered is not an int or is less than 0 do not change
    235236    if (![[fUploadField stringValue] isEqualToString:
    236             [NSString stringWithFormat: @"%d", uploadLimit]]
    237             || uploadLimit < 0)
     237            [NSString stringWithInt: uploadLimit]] || uploadLimit < 0)
    238238    {
    239239        NSBeep();
  • branches/new_api/macosx/StringAdditions.h

    r103 r156  
    1 //
    2 //  StringAdditions.h
    3 //  Transmission
    4 //
    5 //  Created by Mitchell Livingston on 1/16/06.
    6 //  Copyright 2006 __MyCompanyName__. All rights reserved.
    7 //
     1/******************************************************************************
     2 * Copyright (c) 2005-2006 Transmission authors and contributors
     3 *
     4 * Permission is hereby granted, free of charge, to any person obtaining a
     5 * copy of this software and associated documentation files (the "Software"),
     6 * to deal in the Software without restriction, including without limitation
     7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     8 * and/or sell copies of the Software, and to permit persons to whom the
     9 * Software is furnished to do so, subject to the following conditions:
     10 *
     11 * The above copyright notice and this permission notice shall be included in
     12 * all copies or substantial portions of the Software.
     13 *
     14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     20 * DEALINGS IN THE SOFTWARE.
     21 *****************************************************************************/
    822
    923#import <Cocoa/Cocoa.h>
     
    1125@interface NSString (StringAdditions)
    1226
     27+ (NSString *) stringWithInt: (int) value;
    1328+ (NSString *) stringForFileSize: (uint64_t) size;
    1429+ (NSString *) stringForSpeed: (float) speed;
  • branches/new_api/macosx/StringAdditions.m

    r118 r156  
    1 //
    2 //  StringAdditions.m
    3 //  Transmission
    4 //
    5 //  Created by Mitchell Livingston on 1/16/06.
    6 //  Copyright 2006 __MyCompanyName__. All rights reserved.
    7 //
     1/******************************************************************************
     2 * Copyright (c) 2005-2006 Transmission authors and contributors
     3 *
     4 * Permission is hereby granted, free of charge, to any person obtaining a
     5 * copy of this software and associated documentation files (the "Software"),
     6 * to deal in the Software without restriction, including without limitation
     7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     8 * and/or sell copies of the Software, and to permit persons to whom the
     9 * Software is furnished to do so, subject to the following conditions:
     10 *
     11 * The above copyright notice and this permission notice shall be included in
     12 * all copies or substantial portions of the Software.
     13 *
     14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     20 * DEALINGS IN THE SOFTWARE.
     21 *****************************************************************************/
    822
    923#import "StringAdditions.h"
     
    1125
    1226@implementation NSString (StringAdditions)
     27
     28+ (NSString *) stringWithInt: (int) value
     29{
     30    return [NSString stringWithFormat: @"%d", value];
     31}
    1332
    1433+ (NSString *) stringForFileSize: (uint64_t) size
  • branches/new_api/macosx/TorrentCell.m

    r152 r156  
    289289    NSString * sizeString = [NSString stringWithFormat: @" (%@)",
    290290        [NSString stringForFileSize: [fTorrent size]]];
    291     string = [[[fTorrent name] stringFittingInWidth: fWidth - 40 -
     291    string = [[[fTorrent name] stringFittingInWidth: fWidth - 50 -
    292292        [sizeString sizeWithAttributes: attributes].width
    293293        withAttributes: attributes] stringByAppendingString: sizeString];
Note: See TracChangeset for help on using the changeset viewer.