mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-25 17:28:18 +03:00
Replace raster qbt logo with vector version
Add helper function for svg icons.
This commit is contained in:
parent
17c0463906
commit
e5577e43f8
4 changed files with 23 additions and 5 deletions
|
@ -55,7 +55,7 @@ public:
|
||||||
lb_name->setText("<b><h2>qBittorrent " QBT_VERSION " (32-bit)</h2></b>");
|
lb_name->setText("<b><h2>qBittorrent " QBT_VERSION " (32-bit)</h2></b>");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
logo->setPixmap(Utils::Gui::scaledPixmap(":/icons/skin/qbittorrent32.png", this));
|
logo->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/skin/qbittorrent-tray.svg", this, 32));
|
||||||
|
|
||||||
// About
|
// About
|
||||||
QString aboutText = QString(
|
QString aboutText = QString(
|
||||||
|
|
|
@ -160,11 +160,13 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
// Setting icons
|
// Setting icons
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
if (Preferences::instance()->useSystemIconTheme())
|
const QIcon appLogo = Preferences::instance()->useSystemIconTheme()
|
||||||
setWindowIcon(QIcon::fromTheme("qbittorrent", QIcon(":/icons/skin/qbittorrent32.png")));
|
? QIcon::fromTheme("qbittorrent", QIcon(":/icons/skin/qbittorrent-tray.svg"))
|
||||||
else
|
: QIcon(":/icons/skin/qbittorrent-tray.svg");
|
||||||
|
#else
|
||||||
|
const QIcon appLogo(":/icons/skin/qbittorrent-tray.svg");
|
||||||
#endif // Q_OS_UNIX
|
#endif // Q_OS_UNIX
|
||||||
setWindowIcon(QIcon(":/icons/skin/qbittorrent32.png"));
|
setWindowIcon(appLogo);
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX))
|
#if (defined(Q_OS_UNIX))
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#include <QPixmapCache>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
@ -69,6 +70,20 @@ QPixmap Utils::Gui::scaledPixmap(const QString &path, const QWidget *widget, con
|
||||||
return pixmap.scaledToHeight(scaledHeight, Qt::SmoothTransformation);
|
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)
|
QSize Utils::Gui::smallIconSize(const QWidget *widget)
|
||||||
{
|
{
|
||||||
// Get DPI scaled icon size (device-dependent), see QT source
|
// Get DPI scaled icon size (device-dependent), see QT source
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace Utils
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap scaledPixmap(const QString &path, const QWidget *widget, const int height = 0);
|
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 smallIconSize(const QWidget *widget = nullptr);
|
||||||
QSize mediumIconSize(const QWidget *widget = nullptr);
|
QSize mediumIconSize(const QWidget *widget = nullptr);
|
||||||
QSize largeIconSize(const QWidget *widget = nullptr);
|
QSize largeIconSize(const QWidget *widget = nullptr);
|
||||||
|
|
Loading…
Reference in a new issue