]> granicus.if.org Git - transmission/commitdiff
(trunk qt) progressbar patch from kjg
authorCharles Kerr <charles@transmissionbt.com>
Mon, 4 May 2009 16:38:07 +0000 (16:38 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Mon, 4 May 2009 16:38:07 +0000 (16:38 +0000)
qt/torrent-delegate-min.cc
qt/torrent-delegate.cc

index 4c973f6f539c47ef3e3f56bb1a606e639145382f..f50e2466d5b9f9ffb817aa5407d6e7b42def10c3 100644 (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 );
 
index d8b9fadf83e4a515fbf8e5e1a3a24f7319fd6f69..d7b36beb6c85ee780c0ddba605a2f673a843fc0c 100644 (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 );