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