Skip to content

Commit

Permalink
Torrent state text always neutral (black or grey).
Browse files Browse the repository at this point in the history
--HG--
branch : magao-dev
  • Loading branch information
magao committed Feb 8, 2017
1 parent beb94e9 commit 4a571de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/guiiconprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ QIcon GuiIconProvider::getStatusIcon(const QString &iconId, const BitTorrent::To

if (!ignoreState) {
QPixmap colored(pixmap.size());
colored.fill(TorrentModel::getColorByState(state));
colored.fill(TorrentModel::getIconColorByState(state));
colored.setMask(pixmap.createMaskFromColor(Qt::transparent));
pixmap = colored;
}
Expand Down
12 changes: 12 additions & 0 deletions src/gui/torrentmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,18 @@ static const QColor steelBlue3(79, 148, 205);
static const QColor teal(0, 128, 128);

QColor TorrentModel::getColorByState(const BitTorrent::TorrentState &state)
{
Q_UNUSED(state);

This comment has been minimized.

Copy link
@zeule

zeule Feb 9, 2017

Contributor

You may return QPalette::color(QPalette::Active, QPalette::WindowText) (or use QPalette::Inactive for stalled torrents, although inactive colours are the same as active on Windows, AFAIK).

bool dark = GuiIconProvider::instance()->getThemeFlags() & GuiIconProvider::DarkTheme;

if (!dark)
return black;
else
return gray80;
}

QColor TorrentModel::getIconColorByState(const BitTorrent::TorrentState &state)
{
bool dark = GuiIconProvider::instance()->getThemeFlags() & GuiIconProvider::DarkTheme;

Expand Down
1 change: 1 addition & 0 deletions src/gui/torrentmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class TorrentModel: public QAbstractListModel
BitTorrent::TorrentHandle *torrentHandle(const QModelIndex &index) const;

static QIcon getIconByState(const BitTorrent::TorrentState &state);
static QColor getIconColorByState(const BitTorrent::TorrentState &state);
static QColor getColorByState(const BitTorrent::TorrentState &state);

private slots:
Expand Down

0 comments on commit 4a571de

Please sign in to comment.