Changeset 11056


Ignore:
Timestamp:
Jul 25, 2010, 10:14:13 PM (12 years ago)
Author:
charles
Message:

(trunk qt) sync the compact view's progressbar with the GTK+ client's

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/torrent-delegate-min.cc

    r11043 r11056  
    2323#include <QPixmapCache>
    2424#include <QStyleOptionProgressBarV2>
     25
     26#include <libtransmission/transmission.h>
     27#include <libtransmission/utils.h>
    2528
    2629#include "torrent.h"
     
    134137                         BAR_HEIGHT );
    135138    const QRect statusArea( barArea.x( ) - GUI_PAD - statusSize.width( ),
    136                             fillArea.y( ),
     139                            fillArea.y( ) + ( fillArea.height( ) - statusSize.height( ) ) / 2,
    137140                            fillArea.width( ),
    138141                            fillArea.height( ) );
     
    157160    myProgressBarStyle->palette.setCurrentColorGroup( cg );
    158161    myProgressBarStyle->state = progressBarState;
     162    char buf[32];
     163    tr_snprintf( buf, sizeof( buf ), "%d%%", (int)tr_truncd( 100.0 * tor.percentDone( ), 0 ) );
     164    myProgressBarStyle->text = buf;
     165    myProgressBarStyle->textVisible = true;
    159166    myProgressBarStyle->progress = int(myProgressBarStyle->minimum + (((isMagnet ? tor.metadataPercentDone() : tor.percentDone()) * (myProgressBarStyle->maximum - myProgressBarStyle->minimum))));
    160167    style->drawControl( QStyle::CE_ProgressBar, myProgressBarStyle, painter );
Note: See TracChangeset for help on using the changeset viewer.