From 66ede652f848aa1d56c461b34fe75f50a036b07b Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Mon, 27 Jul 2020 17:34:42 +0200 Subject: [PATCH] Use PNGs for branded clients For branded clients try to load a png of the right size, for unbranded clients use the SVGs. If something fails at load time skip it. Signed-off-by: Kevin Ottens --- src/libsync/theme.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index b62736860..f2dcb597b 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -154,10 +154,18 @@ QIcon Theme::themeIcon(const QString &name, bool sysTray) const return QPixmap::fromImage(img); }; + const auto loadPixmap = [flavor, name] (int size) { + const auto pixmapName = QString::fromLatin1(":/client/theme/%1/%2-%3.png").arg(flavor).arg(name).arg(size); + return QPixmap(pixmapName); + }; + const auto sizes = isBranded() ? QVector{ 16, 22, 32, 48, 64, 128, 256, 512, 1024 } : QVector{ 16, 32, 64, 128, 256 }; for (int size : sizes) { - auto px = createPixmapFromSvg(size); + auto px = isBranded() ? loadPixmap(size) : createPixmapFromSvg(size); + if (px.isNull()) { + continue; + } // HACK, get rid of it by supporting FDO icon themes, this is really just emulating ubuntu-mono if (qgetenv("DESKTOP_SESSION") == "ubuntu") { QBitmap mask = px.createMaskFromColor(Qt::white, Qt::MaskOutColor); -- 2.30.2