diff --git a/src/gui/about_imp.h b/src/gui/about_imp.h index 2625bedb4..a1bf05f69 100644 --- a/src/gui/about_imp.h +++ b/src/gui/about_imp.h @@ -55,7 +55,7 @@ public: lb_name->setText("

qBittorrent " QBT_VERSION " (32-bit)

"); #endif - logo->setPixmap(Utils::Gui::scaledPixmap(":/icons/skin/qbittorrent32.png", this)); + logo->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/skin/qbittorrent-tray.svg", this, 32)); // About QString aboutText = QString( diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 0d3f8214b..61e48b19e 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -160,11 +160,13 @@ MainWindow::MainWindow(QWidget *parent) // Setting icons #ifndef Q_OS_MAC #ifdef Q_OS_UNIX - if (Preferences::instance()->useSystemIconTheme()) - setWindowIcon(QIcon::fromTheme("qbittorrent", QIcon(":/icons/skin/qbittorrent32.png"))); - else + const QIcon appLogo = Preferences::instance()->useSystemIconTheme() + ? QIcon::fromTheme("qbittorrent", QIcon(":/icons/skin/qbittorrent-tray.svg")) + : QIcon(":/icons/skin/qbittorrent-tray.svg"); +#else + const QIcon appLogo(":/icons/skin/qbittorrent-tray.svg"); #endif // Q_OS_UNIX - setWindowIcon(QIcon(":/icons/skin/qbittorrent32.png")); + setWindowIcon(appLogo); #endif // Q_OS_MAC #if (defined(Q_OS_UNIX)) diff --git a/src/gui/utils.cpp b/src/gui/utils.cpp index 5709810b2..c01c70f73 100644 --- a/src/gui/utils.cpp +++ b/src/gui/utils.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -45,16 +46,21 @@ void Utils::Gui::resize(QWidget *widget, const QSize &newSize) qreal Utils::Gui::screenScalingFactor(const QWidget *widget) { + if (!widget) + return 1; + #ifdef Q_OS_WIN const int screen = qApp->desktop()->screenNumber(widget); return (QApplication::screens()[screen]->logicalDotsPerInch() / 96); +#elif defined(Q_OS_MAC) + return 1; #else #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) return widget->devicePixelRatioF(); #else return widget->devicePixelRatio(); #endif -#endif // Q_OS_WIN +#endif } QPixmap Utils::Gui::scaledPixmap(const QString &path, const QWidget *widget, const int height) @@ -64,6 +70,20 @@ QPixmap Utils::Gui::scaledPixmap(const QString &path, const QWidget *widget, con return pixmap.scaledToHeight(scaledHeight, Qt::SmoothTransformation); } +QPixmap Utils::Gui::scaledPixmapSvg(const QString &path, const QWidget *widget, const int baseHeight) +{ + const int scaledHeight = baseHeight * Utils::Gui::screenScalingFactor(widget); + const QString normalizedKey = path + "@" + QString::number(scaledHeight); + + QPixmap pm; + QPixmapCache cache; + if (!cache.find(normalizedKey, &pm)) { + pm = QIcon(path).pixmap(scaledHeight); + cache.insert(normalizedKey, pm); + } + return pm; +} + QSize Utils::Gui::smallIconSize(const QWidget *widget) { // Get DPI scaled icon size (device-dependent), see QT source diff --git a/src/gui/utils.h b/src/gui/utils.h index 8e44f1457..05da593be 100644 --- a/src/gui/utils.h +++ b/src/gui/utils.h @@ -49,6 +49,7 @@ namespace Utils } QPixmap scaledPixmap(const QString &path, const QWidget *widget, const int height = 0); + QPixmap scaledPixmapSvg(const QString &path, const QWidget *widget, const int baseHeight); QSize smallIconSize(const QWidget *widget = nullptr); QSize mediumIconSize(const QWidget *widget = nullptr); QSize largeIconSize(const QWidget *widget = nullptr); diff --git a/src/icons.qrc b/src/icons.qrc index 974393ce5..b0ac65c5b 100644 --- a/src/icons.qrc +++ b/src/icons.qrc @@ -361,7 +361,6 @@ icons/skin/qbittorrent-tray.svg icons/skin/qbittorrent-tray-dark.svg icons/skin/qbittorrent-tray-light.svg - icons/skin/qbittorrent16.png icons/skin/qbittorrent32.png icons/skin/queued.png icons/skin/ratio.png diff --git a/src/icons/skin/qbittorrent16.png b/src/icons/skin/qbittorrent16.png deleted file mode 100644 index 07ded05d6..000000000 Binary files a/src/icons/skin/qbittorrent16.png and /dev/null differ diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index 7363f33e6..ee31e38ba 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -5,7 +5,7 @@ qBittorrent ${VERSION} QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog] - + diff --git a/src/webui/www/public/login.html b/src/webui/www/public/login.html index 9b0bbe734..8eed097a7 100644 --- a/src/webui/www/public/login.html +++ b/src/webui/www/public/login.html @@ -4,7 +4,7 @@ qBittorrent QBT_TR(Web UI)QBT_TR[CONTEXT=OptionsDialog] - +