mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-28 05:27:15 +03:00
Adjust color scheme for dark themes. Closes #1359.
This commit is contained in:
parent
4493fd9c31
commit
6aceac152d
1 changed files with 23 additions and 3 deletions
|
@ -29,6 +29,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QPalette>
|
||||||
|
|
||||||
#include "torrentmodel.h"
|
#include "torrentmodel.h"
|
||||||
#include "torrentpersistentdata.h"
|
#include "torrentpersistentdata.h"
|
||||||
|
@ -84,6 +86,14 @@ QIcon get_error_icon() {
|
||||||
static QIcon cached = QIcon(":/icons/skin/error.png");
|
static QIcon cached = QIcon(":/icons/skin/error.png");
|
||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isDarkTheme()
|
||||||
|
{
|
||||||
|
QPalette pal = QApplication::palette();
|
||||||
|
// QPalette::Base is used for the background of the Treeview
|
||||||
|
QColor color = pal.color(QPalette::Active, QPalette::Base);
|
||||||
|
return (color.lightness() < 127);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TorrentStatusReport::TorrentStatusReport()
|
TorrentStatusReport::TorrentStatusReport()
|
||||||
|
@ -187,6 +197,7 @@ QIcon TorrentModelItem::getIconByState(State state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor TorrentModelItem::getColorByState(State state) {
|
QColor TorrentModelItem::getColorByState(State state) {
|
||||||
|
bool dark = isDarkTheme();
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case STATE_DOWNLOADING:
|
case STATE_DOWNLOADING:
|
||||||
case STATE_DOWNLOADING_META:
|
case STATE_DOWNLOADING_META:
|
||||||
|
@ -194,13 +205,22 @@ QColor TorrentModelItem::getColorByState(State state) {
|
||||||
case STATE_ALLOCATING:
|
case STATE_ALLOCATING:
|
||||||
case STATE_STALLED_DL:
|
case STATE_STALLED_DL:
|
||||||
case STATE_STALLED_UP:
|
case STATE_STALLED_UP:
|
||||||
return QColor(0, 0, 0); // Black
|
if (!dark)
|
||||||
|
return QColor(0, 0, 0); // Black
|
||||||
|
else
|
||||||
|
return QColor(255, 255, 255); // White
|
||||||
case STATE_SEEDING:
|
case STATE_SEEDING:
|
||||||
return QColor(65, 105, 225); // Royal Blue
|
if (!dark)
|
||||||
|
return QColor(65, 105, 225); // Royal Blue
|
||||||
|
else
|
||||||
|
return QColor(100, 149, 237); // Cornflower Blue
|
||||||
case STATE_PAUSED_DL:
|
case STATE_PAUSED_DL:
|
||||||
return QColor(250, 128, 114); // Salmon
|
return QColor(250, 128, 114); // Salmon
|
||||||
case STATE_PAUSED_UP:
|
case STATE_PAUSED_UP:
|
||||||
return QColor(0, 0, 139); // Dark Blue
|
if (!dark)
|
||||||
|
return QColor(0, 0, 139); // Dark Blue
|
||||||
|
else
|
||||||
|
return QColor(65, 105, 225); // Royal Blue
|
||||||
case STATE_PAUSED_MISSING:
|
case STATE_PAUSED_MISSING:
|
||||||
return QColor(255, 0, 0); // red
|
return QColor(255, 0, 0); // red
|
||||||
case STATE_QUEUED_DL:
|
case STATE_QUEUED_DL:
|
||||||
|
|
Loading…
Reference in a new issue