Changeset 10955


Ignore:
Timestamp:
Jul 6, 2010, 8:25:54 PM (12 years ago)
Author:
charles
Message:

(trunk T) #3045 "units" -- modify the formatter functions based on feedback from BMW

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/cli.c

    r10937 r10955  
    4141
    4242#define MEM_K 1024
    43 #define MEM_B_STR "B"
    4443#define MEM_K_STR "KiB"
    4544#define MEM_M_STR "MiB"
    4645#define MEM_G_STR "GiB"
     46#define MEM_T_STR "TiB"
    4747
    4848#define DISK_K 1000
     
    5151#define DISK_M_STR "MB"
    5252#define DISK_G_STR "GB"
     53#define DISK_T_STR "TB"
    5354
    5455#define SPEED_K 1000
     
    5758#define SPEED_M_STR "MB/s"
    5859#define SPEED_G_STR "GB/s"
     60#define SPEED_T_STR "TB/s"
    5961
    6062/***
     
    222224    size_t        fileLength;
    223225
    224     tr_formatter_mem_init( MEM_K, MEM_B_STR, MEM_K_STR, MEM_M_STR, MEM_G_STR );
    225     tr_formatter_size_init( DISK_K,DISK_B_STR, DISK_K_STR, DISK_M_STR, DISK_G_STR );
    226     tr_formatter_speed_init( SPEED_K, SPEED_B_STR, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR );
     226    tr_formatter_mem_init( MEM_K, MEM_K_STR, MEM_M_STR, MEM_G_STR, MEM_T_STR );
     227    tr_formatter_size_init( DISK_K,DISK_K_STR, DISK_M_STR, DISK_G_STR, DISK_T_STR );
     228    tr_formatter_speed_init( SPEED_K, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR, SPEED_T_STR );
    227229
    228230    printf( "Transmission %s - http://www.transmissionbt.com/\n",
  • trunk/daemon/daemon.c

    r10947 r10955  
    4242
    4343#define MEM_K 1024
    44 #define MEM_B_STR "B"
    4544#define MEM_K_STR "KiB"
    4645#define MEM_M_STR "MiB"
    4746#define MEM_G_STR "GiB"
     47#define MEM_T_STR "TiB"
    4848
    4949#define DISK_K 1000
     
    5252#define DISK_M_STR "MB"
    5353#define DISK_G_STR "GB"
     54#define DISK_T_STR "TB"
    5455
    5556#define SPEED_K 1000
     
    5859#define SPEED_M_STR "MB/s"
    5960#define SPEED_G_STR "GB/s"
     61#define SPEED_T_STR "TB/s"
    6062
    6163static tr_bool paused = FALSE;
     
    464466
    465467    /* start the session */
    466     tr_formatter_mem_init( MEM_K, MEM_B_STR, MEM_K_STR, MEM_M_STR, MEM_G_STR );
    467     tr_formatter_size_init( DISK_K,DISK_B_STR, DISK_K_STR, DISK_M_STR, DISK_G_STR );
    468     tr_formatter_speed_init( SPEED_K, SPEED_B_STR, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR );
     468    tr_formatter_mem_init( MEM_K, MEM_K_STR, MEM_M_STR, MEM_G_STR, MEM_T_STR );
     469    tr_formatter_size_init( DISK_K, DISK_K_STR, DISK_M_STR, DISK_G_STR, DISK_T_STR );
     470    tr_formatter_speed_init( SPEED_K, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR, SPEED_T_STR );
    469471    mySession = tr_sessionInit( "daemon", configDir, TRUE, &settings );
    470472    tr_ninf( NULL, "Using settings from \"%s\"", configDir );
  • trunk/daemon/remote.c

    r10937 r10955  
    4545
    4646#define MEM_K 1024
    47 #define MEM_B_STR "B"
    4847#define MEM_K_STR "KiB"
    4948#define MEM_M_STR "MiB"
    5049#define MEM_G_STR "GiB"
     50#define MEM_T_STR "TiB"
    5151
    5252#define DISK_K 1000
     
    5555#define DISK_M_STR "MB"
    5656#define DISK_G_STR "GB"
     57#define DISK_T_STR "TB"
    5758
    5859#define SPEED_K 1000
     
    6162#define SPEED_M_STR "MB/s"
    6263#define SPEED_G_STR "GB/s"
     64#define SPEED_T_STR "TB/s"
    6365
    6466/***
     
    22002202    }
    22012203
    2202     tr_formatter_mem_init( MEM_K, MEM_B_STR, MEM_K_STR, MEM_M_STR, MEM_G_STR );
    2203     tr_formatter_size_init( DISK_K,DISK_B_STR, DISK_K_STR, DISK_M_STR, DISK_G_STR );
    2204     tr_formatter_speed_init( SPEED_K, SPEED_B_STR, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR );
     2204    tr_formatter_mem_init( MEM_K, MEM_K_STR, MEM_M_STR, MEM_G_STR, MEM_T_STR );
     2205    tr_formatter_size_init( DISK_K,DISK_K_STR, DISK_M_STR, DISK_G_STR, DISK_T_STR );
     2206    tr_formatter_speed_init( SPEED_K, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR, SPEED_T_STR );
    22052207
    22062208    getHostAndPort( &argc, argv, &host, &port );
  • trunk/gtk/main.c

    r10937 r10955  
    533533    textdomain( domain );
    534534    g_set_application_name( _( "Transmission" ) );
    535     tr_formatter_mem_init( mem_K, _(mem_B_str), _(mem_K_str), _(mem_M_str), _(mem_G_str) );
    536     tr_formatter_size_init( disk_K, _(disk_B_str), _(disk_K_str), _(disk_M_str), _(disk_G_str) );
    537     tr_formatter_speed_init( speed_K, _(speed_B_str), _(speed_K_str), _(speed_M_str), _(speed_G_str) );
     535    tr_formatter_mem_init( mem_K, _(mem_K_str), _(mem_M_str), _(mem_G_str), _(mem_T_str) );
     536    tr_formatter_size_init( disk_K, _(disk_K_str), _(disk_M_str), _(disk_G_str), _(disk_T_str) );
     537    tr_formatter_speed_init( speed_K, _(speed_K_str), _(speed_M_str), _(speed_G_str), _(speed_T_str) );
    538538
    539539    /* initialize gtk */
  • trunk/gtk/util.c

    r10937 r10955  
    4848
    4949const int mem_K = 1024;
    50 /* abbreviation for bytes */
    51 const char * mem_B_str = N_("B");
    52 /* abbreviation IEC base 2 units kilobyte */
    5350const char * mem_K_str = N_("KiB");
    54 /* abbreviation IEC base 2 units megabyte */
    5551const char * mem_M_str = N_("MiB");
    56 /* abbreviation IEC base 2 units gigabyte */
    5752const char * mem_G_str = N_("GiB");
     53const char * mem_T_str = N_("TiB");
    5854
    5955const int disk_K = 1000;
    60 /* abbreviation for bytes */
    61 const char * disk_B_str = N_("B");
    62 /* abbreviation for SI base 10 kilobyte */
    6356const char * disk_K_str = N_("kB");
    64 /* abbreviation for SI base 10 megabyte */
    6557const char * disk_M_str = N_("MB");
    66 /* abbreviation for SI base 10 gigabyte */
    6758const char * disk_G_str = N_("GB");
     59const char * disk_T_str = N_("TB");
    6860
    6961const int speed_K = 1000;
    70 /* abbreviation for bytes per second */
    71 const char * speed_B_str = N_("B/s");
    72 /* abbreviation for kilobytes per second */
    7362const char * speed_K_str = N_("kB/s");
    74 /* abbreviation for megabytes per second */
    7563const char * speed_M_str = N_("MB/s");
    76 /* abbreviation for gigabytes per second */
    7764const char * speed_G_str = N_("GB/s");
     65const char * speed_T_str = N_("TB/s");
    7866
    7967/***
  • trunk/gtk/util.h

    r10937 r10955  
    2121
    2222extern const int mem_K;
    23 extern const char * mem_B_str;
    2423extern const char * mem_K_str;
    2524extern const char * mem_M_str;
    2625extern const char * mem_G_str;
     26extern const char * mem_T_str;
    2727
    2828extern const int disk_K;
    29 extern const char * disk_B_str;
    3029extern const char * disk_K_str;
    3130extern const char * disk_M_str;
    3231extern const char * disk_G_str;
     32extern const char * disk_T_str;
    3333
    3434extern const int speed_K;
    35 extern const char * speed_B_str;
    3635extern const char * speed_K_str;
    3736extern const char * speed_M_str;
    3837extern const char * speed_G_str;
     38extern const char * speed_T_str;
    3939
    4040/* portability wrapper around g_warn_if_fail() for older versions of glib */
  • trunk/libtransmission/utils.c

    r10937 r10955  
    15171517{
    15181518    char * name;
    1519     unsigned int value;
     1519    unsigned long value;
    15201520};
    15211521 
     
    15251525};
    15261526
    1527 enum { TR_FMT_B, TR_FMT_KB, TR_FMT_MB, TR_FMT_GB };
     1527enum { TR_FMT_KB, TR_FMT_MB, TR_FMT_GB, TR_FMT_TB };
    15281528
    15291529static void
    15301530formatter_init( struct formatter_units * units,
    15311531                unsigned int kilo,
    1532                 const char * b, const char * kb,
    1533                 const char * mb, const char * gb )
    1534 {
    1535     units->units[TR_FMT_B].name = tr_strdup( b );
    1536     units->units[TR_FMT_B].value = 1;
    1537 
     1532                const char * kb, const char * mb,
     1533                const char * gb, const char * tb )
     1534{
     1535    unsigned long value = kilo;
    15381536    units->units[TR_FMT_KB].name = tr_strdup( kb );
    1539     units->units[TR_FMT_KB].value = kilo;
    1540 
     1537    units->units[TR_FMT_KB].value = value;
     1538
     1539    value *= kilo;
    15411540    units->units[TR_FMT_MB].name = tr_strdup( mb );
    1542     units->units[TR_FMT_MB].value = kilo * kilo;
    1543 
     1541    units->units[TR_FMT_MB].value = value;
     1542
     1543    value *= kilo;
    15441544    units->units[TR_FMT_GB].name = tr_strdup( gb );
    1545     units->units[TR_FMT_GB].value = kilo * kilo * kilo;
     1545    units->units[TR_FMT_GB].value = value;
     1546
     1547    value *= kilo;
     1548    units->units[TR_FMT_TB].name = tr_strdup( tb );
     1549    units->units[TR_FMT_TB].value = value;
    15461550}
    15471551
  • trunk/macosx/Controller.m

    r10948 r10955  
    338338       
    339339        #warning localize and make consistent
    340         tr_formatter_size_init(1024, "bytes", "KB", "MB", "GB");
    341         tr_formatter_speed_init(1024, "B/s", "KB/s", "MB/s", "GB/s");
    342         tr_formatter_mem_init(1024, "bytes", "KB", "MB", "GB");
     340        tr_formatter_size_init(1024, "KB", "MB", "GB", "TB");
     341        tr_formatter_speed_init(1024, "B/s", "KB/s", "MB/s", "GB/s", "TB/s");
     342        tr_formatter_mem_init(1024, "KB", "MB", "GB", "TB");
    343343       
    344344        [NSApp setDelegate: self];
  • trunk/qt/app.cc

    r10933 r10955  
    102102    // initialize the units formatter
    103103    tr_formatter_mem_init( Formatter::mem_K,
    104                            qPrintable( Formatter::mem_B_str ),
    105104                           qPrintable( Formatter::mem_K_str ),
    106105                           qPrintable( Formatter::mem_M_str ),
    107                            qPrintable( Formatter::mem_G_str ) );
     106                           qPrintable( Formatter::mem_G_str ),
     107                           qPrintable( Formatter::mem_T_str ) );
    108108    tr_formatter_size_init( Formatter::size_K,
    109                             qPrintable( Formatter::size_B_str ),
    110109                            qPrintable( Formatter::size_K_str ),
    111110                            qPrintable( Formatter::size_M_str ),
    112                             qPrintable( Formatter::size_G_str ) );
     111                            qPrintable( Formatter::size_G_str ),
     112                            qPrintable( Formatter::size_T_str ) );
    113113    tr_formatter_speed_init( Formatter::speed_K,
    114                              qPrintable( Formatter::speed_B_str ),
    115114                             qPrintable( Formatter::speed_K_str ),
    116115                             qPrintable( Formatter::speed_M_str ),
    117                              qPrintable( Formatter::speed_G_str ) );
     116                             qPrintable( Formatter::speed_G_str ),
     117                             qPrintable( Formatter::speed_T_str ) );
    118118
    119119    // set the default icon
  • trunk/qt/formatter.cc

    r10937 r10955  
    2424
    2525const int     Formatter :: speed_K     = 1000;
    26 const QString Formatter :: speed_B_str = "B/s";
    2726const QString Formatter :: speed_K_str = "kB/s";
    2827const QString Formatter :: speed_M_str = "MB/s";
    2928const QString Formatter :: speed_G_str = "GB/s";
     29const QString Formatter :: speed_T_str = "TB/s";
    3030
    3131const int     Formatter :: size_K     = 1000;
    32 const QString Formatter :: size_B_str = "B";
    3332const QString Formatter :: size_K_str = "kB";
    3433const QString Formatter :: size_M_str = "MB";
    3534const QString Formatter :: size_G_str = "GB";
     35const QString Formatter :: size_T_str = "TB";
    3636
    3737const int     Formatter :: mem_K     = 1024;
    38 const QString Formatter :: mem_B_str = "B";
    3938const QString Formatter :: mem_K_str = "KiB";
    4039const QString Formatter :: mem_M_str = "MiB";
    4140const QString Formatter :: mem_G_str = "GiB";
     41const QString Formatter :: mem_T_str = "TiB";
    4242
    4343/***
  • trunk/qt/formatter.h

    r10933 r10955  
    4141
    4242        static const int speed_K;
    43         static const QString speed_B_str;
    4443        static const QString speed_K_str;
    4544        static const QString speed_M_str;
    4645        static const QString speed_G_str;
     46        static const QString speed_T_str;
    4747
    4848        static const int size_K;
    49         static const QString size_B_str;
    5049        static const QString size_K_str;
    5150        static const QString size_M_str;
    5251        static const QString size_G_str;
     52        static const QString size_T_str;
    5353
    5454        static const int mem_K;
    55         static const QString mem_B_str;
    5655        static const QString mem_K_str;
    5756        static const QString mem_M_str;
    5857        static const QString mem_G_str;
     58        static const QString mem_T_str;
    5959};
    6060
  • trunk/utils/show.c

    r10937 r10955  
    3030
    3131#define MEM_K 1024
    32 #define MEM_B_STR "B"
    3332#define MEM_K_STR "KiB"
    3433#define MEM_M_STR "MiB"
    3534#define MEM_G_STR "GiB"
     35#define MEM_T_STR "TiB"
    3636
    3737#define DISK_K 1000
     
    4040#define DISK_M_STR "MB"
    4141#define DISK_G_STR "GB"
     42#define DISK_T_STR "TB"
    4243
    4344#define SPEED_K 1000
     
    4647#define SPEED_M_STR "MB/s"
    4748#define SPEED_G_STR "GB/s"
     49#define SPEED_T_STR "TB/s"
    4850
    4951static tr_option options[] =
     
    250252
    251253    tr_setMessageLevel( TR_MSG_ERR );
    252     tr_formatter_mem_init  ( MEM_K, MEM_B_STR, MEM_K_STR, MEM_M_STR, MEM_G_STR );
    253     tr_formatter_size_init ( DISK_K, DISK_B_STR, DISK_K_STR, DISK_M_STR, DISK_G_STR );
    254     tr_formatter_size_init ( SPEED_K, SPEED_B_STR, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR );
     254    tr_formatter_mem_init  ( MEM_K, MEM_K_STR, MEM_M_STR, MEM_G_STR, MEM_T_STR );
     255    tr_formatter_size_init ( DISK_K, DISK_K_STR, DISK_M_STR, DISK_G_STR, DISK_T_STR );
     256    tr_formatter_size_init ( SPEED_K, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR, SPEED_T_STR );
    255257
    256258    if( parseCommandLine( argc, (const char**)argv ) )
Note: See TracChangeset for help on using the changeset viewer.