Verified Commit d046d4e5 authored by Fushan Wen's avatar Fushan Wen
Browse files

wallpapers/image: open dark image in dark mode

(cherry picked from commit e6f5bb30)
parent 6e8d1343
......@@ -8,6 +8,8 @@
#include "packagelistmodel.h"
#include <QDir>
#include <QGuiApplication>
#include <QPalette>
#include <QPixmap>
#include <QStandardPaths>
#include <QThreadPool>
......@@ -86,8 +88,16 @@ QVariant PackageListModel::data(const QModelIndex &index, int role) const
return QString();
}
case PathRole:
case PathRole: {
if (qGray(qGuiApp->palette().window().color().rgb()) < 192) {
const QString darkPath = b.filePath(QByteArrayLiteral("preferredDark"));
if (!darkPath.isEmpty()) {
return QUrl::fromLocalFile(darkPath);
}
}
return QUrl::fromLocalFile(b.filePath("preferred"));
}
case PackageNameRole:
return b.path();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment