Changeset 7686


Ignore:
Timestamp:
Jan 12, 2009, 7:30:34 PM (12 years ago)
Author:
charles
Message:

(trunk gtk) #1341: show the number of verified pieces in the Inspector

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r7658 r7686  
    1212
    1313#include <errno.h>
     14#include <math.h> /* ceil() */
    1415#include <stddef.h>
    1516#include <stdio.h>
     
    10111012    char            buf[128];
    10121013    const tr_stat * stat = tr_torrent_stat( a->gtor );
     1014    const tr_info * info = tr_torrent_info( a->gtor );
    10131015    const double    complete = stat->percentComplete * 100.0;
    10141016    const double    done = stat->percentDone * 100.0;
     1017    const double    verifiedPieceCount = (double)stat->haveValid / info->pieceSize;
    10151018
    10161019    pch = tr_torrent_status_str( a->gtor );
     
    10351038                sizeof( sizeStr2 ) );
    10361039    /* %1$s is total size of what we've saved to disk
    1037        %2$s is how much of it's passed the checksum test */
    1038     g_snprintf( buf, sizeof( buf ), _(
    1039                     "%1$s (%2$s verified)" ), sizeStr, sizeStr2 );
     1040       %2$s is how much of it's passed the checksum test
     1041       %3$s is how many pieces are verified */
     1042    g_snprintf( buf, sizeof( buf ), _( "%1$s (%2$s verified in %3$d pieces)" ),
     1043                sizeStr, sizeStr2, (int)ceil(verifiedPieceCount) );
    10401044    gtk_label_set_text( GTK_LABEL( a->have_lb ), buf );
    10411045
Note: See TracChangeset for help on using the changeset viewer.