From: Kevin Ottens Date: Wed, 20 Jan 2021 09:44:29 +0000 (+0100) Subject: Use the SVG wizard logo when APPLICATION_ICON_SET says so X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~414^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=88986749a43fc629c65d2606e0f93badd476d5c8;p=nextcloud-desktop.git Use the SVG wizard logo when APPLICATION_ICON_SET says so Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 97f0b3697..93487134f 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -52,6 +52,11 @@ QUrl imagePathToUrl(const QString &imagePath) } } +bool shouldPreferSvg() +{ + return QByteArray(APPLICATION_ICON_SET).toUpper() == QByteArrayLiteral("SVG"); +} + } namespace OCC { @@ -533,7 +538,17 @@ QColor Theme::wizardHeaderBackgroundColor() const QPixmap Theme::wizardHeaderLogo() const { #ifdef APPLICATION_WIZARD_USE_CUSTOM_LOGO - return QPixmap(hidpiFileName(":/client/theme/colored/wizard_logo.png")); + const auto useSvg = shouldPreferSvg(); + const auto logoBasePath = QStringLiteral(":/client/theme/colored/wizard_logo"); + if (useSvg) { + const auto maxHeight = 64; + const auto maxWidth = 2 * maxHeight; + const auto icon = QIcon(logoBasePath + ".svg"); + const auto size = icon.actualSize(QSize(maxWidth, maxHeight)); + return icon.pixmap(size); + } else { + return QPixmap(hidpiFileName(logoBasePath + ".png")); + } #else return applicationIcon().pixmap(64); #endif