mirror of
https://github.com/transmission/transmission
synced 2025-02-21 21:57:01 +00:00
(qt) #5278 'Something strange with the color of progress bars' -- patch by rb07
This commit is contained in:
parent
d1571bda02
commit
303353e55a
3 changed files with 26 additions and 11 deletions
|
@ -21,7 +21,7 @@
|
|||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QPixmapCache>
|
||||
#include <QStyleOptionProgressBarV2>
|
||||
#include <QStyleOptionProgressBar>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
@ -157,12 +157,17 @@ TorrentDelegateMin :: drawTorrent( QPainter * painter, const QStyleOptionViewIte
|
|||
if ( tor.isDownloading() ) {
|
||||
myProgressBarStyle->palette.setBrush( QPalette::Highlight, blueBrush );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Base, blueBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Background, blueBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Window, blueBack );
|
||||
}
|
||||
else if ( tor.isSeeding() ) {
|
||||
myProgressBarStyle->palette.setBrush( QPalette::Highlight, greenBrush );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Base, greenBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Background, greenBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Window, greenBack );
|
||||
}
|
||||
else {
|
||||
myProgressBarStyle->palette.setBrush( QPalette::Highlight, silverBrush );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Base, silverBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Window, silverBack );
|
||||
}
|
||||
myProgressBarStyle->state = progressBarState;
|
||||
char buf[32];
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QPixmapCache>
|
||||
#include <QStyleOptionProgressBarV2>
|
||||
#include <QStyleOptionProgressBar>
|
||||
|
||||
#include "formatter.h"
|
||||
#include "torrent.h"
|
||||
|
@ -35,12 +35,14 @@ enum
|
|||
|
||||
QColor TorrentDelegate :: greenBrush;
|
||||
QColor TorrentDelegate :: blueBrush;
|
||||
QColor TorrentDelegate :: silverBrush;
|
||||
QColor TorrentDelegate :: greenBack;
|
||||
QColor TorrentDelegate :: blueBack;
|
||||
QColor TorrentDelegate :: silverBack;
|
||||
|
||||
TorrentDelegate :: TorrentDelegate( QObject * parent ):
|
||||
QStyledItemDelegate( parent ),
|
||||
myProgressBarStyle( new QStyleOptionProgressBarV2 )
|
||||
myProgressBarStyle( new QStyleOptionProgressBar )
|
||||
{
|
||||
myProgressBarStyle->minimum = 0;
|
||||
myProgressBarStyle->maximum = 1000;
|
||||
|
@ -50,6 +52,9 @@ TorrentDelegate :: TorrentDelegate( QObject * parent ):
|
|||
|
||||
blueBrush = QColor("steelblue");
|
||||
blueBack = QColor("lightgrey");
|
||||
|
||||
silverBrush = QColor("silver");
|
||||
silverBack = QColor("grey");
|
||||
}
|
||||
|
||||
TorrentDelegate :: ~TorrentDelegate( )
|
||||
|
@ -423,12 +428,17 @@ TorrentDelegate :: drawTorrent( QPainter * painter, const QStyleOptionViewItem&
|
|||
if ( tor.isDownloading() ) {
|
||||
myProgressBarStyle->palette.setBrush( QPalette::Highlight, blueBrush );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Base, blueBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Background, blueBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Window, blueBack );
|
||||
}
|
||||
else if ( tor.isSeeding() ) {
|
||||
myProgressBarStyle->palette.setBrush( QPalette::Highlight, greenBrush );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Base, greenBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Background, greenBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Window, greenBack );
|
||||
}
|
||||
else {
|
||||
myProgressBarStyle->palette.setBrush( QPalette::Highlight, silverBrush );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Base, silverBack );
|
||||
myProgressBarStyle->palette.setColor( QPalette::Window, silverBack );
|
||||
}
|
||||
myProgressBarStyle->state = progressBarState;
|
||||
setProgressBarPercentDone( option, tor );
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <QStyledItemDelegate>
|
||||
#include <QSize>
|
||||
|
||||
class QStyleOptionProgressBarV2;
|
||||
class QStyleOptionProgressBar;
|
||||
class QStyleOptionViewItem;
|
||||
class QStyle;
|
||||
class Session;
|
||||
|
@ -27,11 +27,11 @@ class TorrentDelegate: public QStyledItemDelegate
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static QColor blueBrush, greenBrush;
|
||||
static QColor blueBack, greenBack;
|
||||
static QColor blueBrush, greenBrush, silverBrush;
|
||||
static QColor blueBack, greenBack, silverBack;
|
||||
|
||||
protected:
|
||||
QStyleOptionProgressBarV2 * myProgressBarStyle;
|
||||
QStyleOptionProgressBar * myProgressBarStyle;
|
||||
|
||||
protected:
|
||||
QString statusString( const Torrent& tor ) const;
|
||||
|
|
Loading…
Reference in a new issue