1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-03 05:25:52 +00:00

(trunk qt) progressbar patch from kjg

This commit is contained in:
Charles Kerr 2009-05-04 16:38:07 +00:00
parent 75b83b101f
commit 75a115e2f8
2 changed files with 10 additions and 2 deletions

View file

@ -114,6 +114,10 @@ TorrentDelegateMin :: drawTorrent( QPainter * painter, const QStyleOptionViewIte
if( option.state & QStyle::State_Selected ) cr = QPalette::HighlightedText;
else cr = QPalette::Text;
QStyle::State progressBarState( option.state );
if( isPaused ) progressBarState = QStyle::State_None;
progressBarState |= QStyle::State_Small;
// layout
const QSize m( margin( *style ) );
QRect fillArea( option.rect );
@ -149,7 +153,7 @@ TorrentDelegateMin :: drawTorrent( QPainter * painter, const QStyleOptionViewIte
myProgressBarStyle->direction = option.direction;
myProgressBarStyle->palette = option.palette;
myProgressBarStyle->palette.setCurrentColorGroup( QPalette::Disabled );
myProgressBarStyle->state = option.state | QStyle::State_Small;
myProgressBarStyle->state = progressBarState;
myProgressBarStyle->progress = int(myProgressBarStyle->minimum + ((tor.percentDone() * (myProgressBarStyle->maximum - myProgressBarStyle->minimum))));
style->drawControl( QStyle::CE_ProgressBar, myProgressBarStyle, painter );

View file

@ -332,6 +332,10 @@ TorrentDelegate :: drawTorrent( QPainter * painter, const QStyleOptionViewItem&
if( option.state & QStyle::State_Selected ) cr = QPalette::HighlightedText;
else cr = QPalette::Text;
QStyle::State progressBarState( option.state );
if( isPaused ) progressBarState = QStyle::State_None;
progressBarState |= QStyle::State_Small;
// layout
const QSize m( margin( *style ) );
QRect fillArea( option.rect );
@ -364,7 +368,7 @@ TorrentDelegate :: drawTorrent( QPainter * painter, const QStyleOptionViewItem&
myProgressBarStyle->direction = option.direction;
myProgressBarStyle->palette = option.palette;
myProgressBarStyle->palette.setCurrentColorGroup( QPalette::Disabled );
myProgressBarStyle->state = option.state | QStyle::State_Small;
myProgressBarStyle->state = progressBarState;
myProgressBarStyle->progress = int(myProgressBarStyle->minimum + ((tor.percentDone() * (myProgressBarStyle->maximum - myProgressBarStyle->minimum))));
style->drawControl( QStyle::CE_ProgressBar, myProgressBarStyle, painter );