From 19f0e5e3b3c9e14082f0e4414410ebac8709f4cb Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 26 Nov 2024 13:47:00 +0800 Subject: [PATCH] Generate icon paths for activities as just svg custom color image provider based urls with no colouring Signed-off-by: Claudio Cambra --- src/gui/tray/activitylistmodel.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index 47cc441f6..a2d80c2c0 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -226,7 +226,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const }; const auto generateIconPath = [&]() { - auto colorIconPath = role == DarkIconRole ? QStringLiteral("image://svgimage-custom-color/%1/white") : QStringLiteral("image://svgimage-custom-color/%1/black"); + auto colorIconPath = QStringLiteral("image://svgimage-custom-color/%1"); if (a._type == Activity::NotificationType && !a._talkNotificationData.userAvatar.isEmpty()) { return QStringLiteral("image://svgimage-custom-color/talk-bordered.svg"); } else if (a._type == Activity::SyncResultType) { @@ -250,24 +250,16 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const } else { // File sync successful if (a._fileAction == "file_created") { - return a._previews.empty() ? QStringLiteral("image://svgimage-custom-color/add.svg/") - : QStringLiteral("image://svgimage-custom-color/add-bordered.svg/"); + return a._previews.empty() ? colorIconPath.arg("add.svg") : colorIconPath.arg("add-bordered.svg"); } else if (a._fileAction == "file_deleted") { - return a._previews.empty() ? QStringLiteral("image://svgimage-custom-color/delete.svg/") - : QStringLiteral("image://svgimage-custom-color/delete-bordered.svg/"); + return a._previews.empty() ? colorIconPath.arg("delete.svg") : colorIconPath.arg("delete-bordered.svg"); } else { - return a._previews.empty() ? colorIconPath.arg(QStringLiteral("change.svg")) - : QStringLiteral("image://svgimage-custom-color/change-bordered.svg/"); + return a._previews.empty() ? colorIconPath.arg("change.svg") : colorIconPath.arg("change-bordered.svg"); } } } else { // We have an activity - if (a._icon.isEmpty()) { - return colorIconPath.arg("activity.svg"); - } - - const QString basePath = QStringLiteral("image://tray-image-provider/") % a._icon % QStringLiteral("/"); - return role == DarkIconRole ? QString(basePath + QStringLiteral("white")) : QString(basePath + QStringLiteral("black")); + return a._icon.isEmpty() ? colorIconPath.arg("activity.svg") : colorIconPath.arg(a._icon); } }; -- 2.30.2