mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2024-12-16 10:38:53 +01:00
parent
5a1b4b3ff8
commit
2732536d6e
@ -56,6 +56,7 @@
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QColor>
|
||||
#include <QMetaEnum>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QSettings>
|
||||
@ -984,6 +985,10 @@ QString ReplaceVariable(const QString &variable, const Song &song, const QString
|
||||
return variable;
|
||||
}
|
||||
|
||||
bool IsColorDark(const QColor &color) {
|
||||
return ((30 * color.red() + 59 * color.green() + 11 * color.blue()) / 100) <= 130;
|
||||
}
|
||||
|
||||
} // namespace Utilities
|
||||
|
||||
ScopedWCharArray::ScopedWCharArray(const QString &str)
|
||||
|
@ -161,6 +161,8 @@ QString MacAddress();
|
||||
QString ReplaceMessage(const QString &message, const Song &song, const QString &newline);
|
||||
QString ReplaceVariable(const QString &variable, const Song &song, const QString &newline);
|
||||
|
||||
bool IsColorDark(const QColor &color);
|
||||
|
||||
} // namespace
|
||||
|
||||
class ScopedWCharArray {
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "core/mergedproxymodel.h"
|
||||
#include "core/mimedata.h"
|
||||
#include "core/musicstorage.h"
|
||||
#include "core/utilities.h"
|
||||
#include "organise/organisedialog.h"
|
||||
#include "organise/organiseerrordialog.h"
|
||||
#include "collection/collectiondirectorymodel.h"
|
||||
@ -151,10 +152,17 @@ void DeviceItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
|
||||
}
|
||||
}
|
||||
|
||||
if (option.state & QStyle::State_Selected)
|
||||
if (option.state & QStyle::State_Selected) {
|
||||
painter->setPen(option.palette.color(QPalette::HighlightedText));
|
||||
else
|
||||
painter->setPen(option.palette.color(QPalette::Dark));
|
||||
}
|
||||
else {
|
||||
if (Utilities::IsColorDark(option.palette.color(QPalette::Window))) {
|
||||
painter->setPen(option.palette.color(QPalette::Midlight).lighter().lighter());
|
||||
}
|
||||
else {
|
||||
painter->setPen(option.palette.color(QPalette::Dark));
|
||||
}
|
||||
}
|
||||
|
||||
painter->setFont(status_font);
|
||||
painter->drawText(line2, Qt::AlignLeft | Qt::AlignTop, status_text);
|
||||
|
Loading…
Reference in New Issue
Block a user