Browse Source

Always use UIThemeManager for obtaining icons in GUI

adaptive-webui-19844
jagannatharjun 5 years ago
parent
commit
43319f2213
  1. 3
      src/gui/aboutdialog.cpp
  2. 24
      src/gui/mainwindow.cpp
  3. 12
      src/gui/optionsdialog.cpp
  4. 7
      src/gui/rss/articlelistwidget.cpp
  5. 4
      src/gui/rss/feedlistwidget.cpp
  6. 17
      src/gui/statusbar.cpp
  7. 24
      src/gui/transferlistfilterswidget.cpp
  8. 18
      src/gui/transferlistmodel.cpp
  9. 2
      src/gui/transferlistwidget.cpp
  10. 2
      src/gui/uithememanager.h

3
src/gui/aboutdialog.cpp

@ -33,6 +33,7 @@
#include "base/unicodestrings.h" #include "base/unicodestrings.h"
#include "base/utils/misc.h" #include "base/utils/misc.h"
#include "ui_aboutdialog.h" #include "ui_aboutdialog.h"
#include "uithememanager.h"
#include "utils.h" #include "utils.h"
AboutDialog::AboutDialog(QWidget *parent) AboutDialog::AboutDialog(QWidget *parent)
@ -45,7 +46,7 @@ AboutDialog::AboutDialog(QWidget *parent)
// Title // Title
m_ui->labelName->setText(QString::fromLatin1("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8)); m_ui->labelName->setText(QString::fromLatin1("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
m_ui->logo->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/qbittorrent-tray.svg", this, 32)); m_ui->logo->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("qbittorrent-tray")), this, 32));
// About // About
const QString aboutText = QString( const QString aboutText = QString(

24
src/gui/mainwindow.cpp

@ -150,13 +150,7 @@ MainWindow::MainWindow(QWidget *parent)
m_displaySpeedInTitle = pref->speedInTitleBar(); m_displaySpeedInTitle = pref->speedInTitleBar();
// Setting icons // Setting icons
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
#ifdef Q_OS_UNIX const QIcon appLogo(UIThemeManager::instance()->getIcon(QLatin1String("qbittorrent"), QLatin1String("qbittorrent-tray")));
const QIcon appLogo = Preferences::instance()->useSystemIconTheme()
? QIcon::fromTheme("qbittorrent", QIcon(":/icons/qbittorrent-tray.svg"))
: QIcon(":/icons/qbittorrent-tray.svg");
#else
const QIcon appLogo(":/icons/qbittorrent-tray.svg");
#endif // Q_OS_UNIX
setWindowIcon(appLogo); setWindowIcon(appLogo);
#endif // Q_OS_MACOS #endif // Q_OS_MACOS
@ -1539,12 +1533,14 @@ void MainWindow::reloadSessionStats()
"qBittorrent" "qBittorrent"
"</div>" "</div>"
"<div style='vertical-align: baseline; height: 18px;'>" "<div style='vertical-align: baseline; height: 18px;'>"
"<img src=':/icons/downloading_small.svg' height='14'/>&nbsp;%1" "<img src='%1' height='14'/>&nbsp;%2"
"</div>" "</div>"
"<div style='vertical-align: baseline; height: 18px;'>" "<div style='vertical-align: baseline; height: 18px;'>"
"<img src=':/icons/seeding.svg' height='14'/>&nbsp;%2" "<img src='%3' height='14'/>&nbsp;%4"
"</div>") "</div>")
.arg(tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true)) .arg(UIThemeManager::instance()->getIconPath("downloading_small")
, tr("DL speed: %1", "e.g: Download speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadDownloadRate, true))
, UIThemeManager::instance()->getIconPath("seeding")
, tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true))); , tr("UP speed: %1", "e.g: Upload speed: 10 KiB/s").arg(Utils::Misc::friendlyUnit(status.payloadUploadRate, true)));
#else #else
// OSes such as Windows do not support html here // OSes such as Windows do not support html here
@ -1984,18 +1980,18 @@ QIcon MainWindow::getSystrayIcon() const
#else #else
switch (style) { switch (style) {
case TrayIcon::NORMAL: case TrayIcon::NORMAL:
return QIcon(QLatin1String(":/icons/qbittorrent-tray.svg")); return UIThemeManager::instance()->getIcon(QLatin1String("qbittorrent-tray"));
case TrayIcon::MONO_DARK: case TrayIcon::MONO_DARK:
return QIcon(QLatin1String(":/icons/qbittorrent-tray-dark.svg")); return UIThemeManager::instance()->getIcon(QLatin1String("qbittorrent-tray-dark"));
case TrayIcon::MONO_LIGHT: case TrayIcon::MONO_LIGHT:
return QIcon(QLatin1String(":/icons/qbittorrent-tray-light.svg")); return UIThemeManager::instance()->getIcon(QLatin1String("qbittorrent-tray-light"));
default: default:
break; break;
} }
#endif #endif
// As a failsafe in case the enum is invalid // As a failsafe in case the enum is invalid
return QIcon(QLatin1String(":/icons/qbittorrent-tray.svg")); return UIThemeManager::instance()->getIcon(QLatin1String("qbittorrent-tray"));
} }
#endif // Q_OS_MACOS #endif // Q_OS_MACOS

12
src/gui/optionsdialog.cpp

@ -202,8 +202,8 @@ OptionsDialog::OptionsDialog(QWidget *parent)
m_ui->IpFilterRefreshBtn->setIcon(UIThemeManager::instance()->getIcon("view-refresh")); m_ui->IpFilterRefreshBtn->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
m_ui->labelGlobalRate->setPixmap(Utils::Gui::scaledPixmap(":/icons/slow_off.svg", this, 16)); m_ui->labelGlobalRate->setPixmap(Utils::Gui::scaledPixmap(UIThemeManager::instance()->getIcon(QLatin1String("slow_off")), this, 16));
m_ui->labelAltRate->setPixmap(Utils::Gui::scaledPixmap(":/icons/slow.svg", this, 16)); m_ui->labelAltRate->setPixmap(Utils::Gui::scaledPixmap(UIThemeManager::instance()->getIcon(QLatin1String("slow")), this, 16));
m_ui->deleteTorrentWarningIcon->setPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(16, 16)); m_ui->deleteTorrentWarningIcon->setPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(16, 16));
m_ui->deleteTorrentWarningIcon->hide(); m_ui->deleteTorrentWarningIcon->hide();
@ -1691,7 +1691,7 @@ QString OptionsDialog::webUiPassword() const
void OptionsDialog::webUIHttpsCertChanged(const QString &path, const ShowError showError) void OptionsDialog::webUIHttpsCertChanged(const QString &path, const ShowError showError)
{ {
m_ui->textWebUIHttpsCert->setSelectedPath(path); m_ui->textWebUIHttpsCert->setSelectedPath(path);
m_ui->lblSslCertStatus->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/security-low.svg", this, 24)); m_ui->lblSslCertStatus->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("security-low")), this, 24));
if (path.isEmpty()) if (path.isEmpty())
return; return;
@ -1709,13 +1709,13 @@ void OptionsDialog::webUIHttpsCertChanged(const QString &path, const ShowError s
return; return;
} }
m_ui->lblSslCertStatus->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/security-high.svg", this, 24)); m_ui->lblSslCertStatus->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("security-high")), this, 24));
} }
void OptionsDialog::webUIHttpsKeyChanged(const QString &path, const ShowError showError) void OptionsDialog::webUIHttpsKeyChanged(const QString &path, const ShowError showError)
{ {
m_ui->textWebUIHttpsKey->setSelectedPath(path); m_ui->textWebUIHttpsKey->setSelectedPath(path);
m_ui->lblSslKeyStatus->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/security-low.svg", this, 24)); m_ui->lblSslKeyStatus->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("security-low")), this, 24));
if (path.isEmpty()) if (path.isEmpty())
return; return;
@ -1733,7 +1733,7 @@ void OptionsDialog::webUIHttpsKeyChanged(const QString &path, const ShowError sh
return; return;
} }
m_ui->lblSslKeyStatus->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/security-high.svg", this, 24)); m_ui->lblSslKeyStatus->setPixmap(Utils::Gui::scaledPixmapSvg(UIThemeManager::instance()->getIconPath(QLatin1String("security-high")), this, 24));
} }
void OptionsDialog::showConnectionTab() void OptionsDialog::showConnectionTab()

7
src/gui/rss/articlelistwidget.cpp

@ -33,6 +33,7 @@
#include "base/global.h" #include "base/global.h"
#include "base/rss/rss_article.h" #include "base/rss/rss_article.h"
#include "base/rss/rss_item.h" #include "base/rss/rss_item.h"
#include "uithememanager.h"
ArticleListWidget::ArticleListWidget(QWidget *parent) ArticleListWidget::ArticleListWidget(QWidget *parent)
: QListWidget(parent) : QListWidget(parent)
@ -98,7 +99,7 @@ void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
if (!item) return; if (!item) return;
item->setData(Qt::ForegroundRole, QPalette().color(QPalette::Inactive, QPalette::WindowText)); item->setData(Qt::ForegroundRole, QPalette().color(QPalette::Inactive, QPalette::WindowText));
item->setData(Qt::DecorationRole, QIcon(":/icons/sphere.png")); item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("sphere")));
checkInvariant(); checkInvariant();
} }
@ -123,11 +124,11 @@ QListWidgetItem *ArticleListWidget::createItem(RSS::Article *article) const
item->setData(Qt::UserRole, reinterpret_cast<quintptr>(article)); item->setData(Qt::UserRole, reinterpret_cast<quintptr>(article));
if (article->isRead()) { if (article->isRead()) {
item->setData(Qt::ForegroundRole, QPalette().color(QPalette::Inactive, QPalette::WindowText)); item->setData(Qt::ForegroundRole, QPalette().color(QPalette::Inactive, QPalette::WindowText));
item->setData(Qt::DecorationRole, QIcon(":/icons/sphere.png")); item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("sphere")));
} }
else { else {
item->setData(Qt::ForegroundRole, QPalette().color(QPalette::Active, QPalette::Link)); item->setData(Qt::ForegroundRole, QPalette().color(QPalette::Active, QPalette::Link));
item->setData(Qt::DecorationRole, QIcon(":/icons/sphere2.png")); item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("sphere")));
} }
return item; return item;

4
src/gui/rss/feedlistwidget.cpp

@ -85,7 +85,7 @@ void FeedListWidget::handleFeedStateChanged(RSS::Feed *feed)
QIcon icon; QIcon icon;
if (feed->isLoading()) if (feed->isLoading())
icon = QIcon(QStringLiteral(":/icons/loading.png")); icon = UIThemeManager::instance()->getIcon(QStringLiteral("loading"));
else if (feed->hasError()) else if (feed->hasError())
icon = UIThemeManager::instance()->getIcon(QStringLiteral("unavailable")); icon = UIThemeManager::instance()->getIcon(QStringLiteral("unavailable"));
else if (!feed->iconPath().isEmpty()) else if (!feed->iconPath().isEmpty())
@ -235,7 +235,7 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
QIcon icon; QIcon icon;
if (auto feed = qobject_cast<RSS::Feed *>(rssItem)) { if (auto feed = qobject_cast<RSS::Feed *>(rssItem)) {
if (feed->isLoading()) if (feed->isLoading())
icon = QIcon(QStringLiteral(":/icons/loading.png")); icon = UIThemeManager::instance()->getIcon(QLatin1String("loading"));
else if (feed->hasError()) else if (feed->hasError())
icon = UIThemeManager::instance()->getIcon(QStringLiteral("unavailable")); icon = UIThemeManager::instance()->getIcon(QStringLiteral("unavailable"));
else if (!feed->iconPath().isEmpty()) else if (!feed->iconPath().isEmpty())

17
src/gui/statusbar.cpp

@ -40,6 +40,7 @@
#include "base/bittorrent/sessionstatus.h" #include "base/bittorrent/sessionstatus.h"
#include "base/utils/misc.h" #include "base/utils/misc.h"
#include "speedlimitdialog.h" #include "speedlimitdialog.h"
#include "uithememanager.h"
#include "utils.h" #include "utils.h"
StatusBar::StatusBar(QWidget *parent) StatusBar::StatusBar(QWidget *parent)
@ -62,14 +63,14 @@ StatusBar::StatusBar(QWidget *parent)
m_connecStatusLblIcon->setFlat(true); m_connecStatusLblIcon->setFlat(true);
m_connecStatusLblIcon->setFocusPolicy(Qt::NoFocus); m_connecStatusLblIcon->setFocusPolicy(Qt::NoFocus);
m_connecStatusLblIcon->setCursor(Qt::PointingHandCursor); m_connecStatusLblIcon->setCursor(Qt::PointingHandCursor);
m_connecStatusLblIcon->setIcon(QIcon(":/icons/firewalled.svg")); m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("firewalled")));
m_connecStatusLblIcon->setToolTip( m_connecStatusLblIcon->setToolTip(
QString::fromLatin1("<b>%1</b><br><i>%2</i>").arg(tr("Connection status:") QString::fromLatin1("<b>%1</b><br><i>%2</i>").arg(tr("Connection status:")
, tr("No direct connections. This may indicate network configuration problems."))); , tr("No direct connections. This may indicate network configuration problems.")));
connect(m_connecStatusLblIcon, &QAbstractButton::clicked, this, &StatusBar::connectionButtonClicked); connect(m_connecStatusLblIcon, &QAbstractButton::clicked, this, &StatusBar::connectionButtonClicked);
m_dlSpeedLbl = new QPushButton(this); m_dlSpeedLbl = new QPushButton(this);
m_dlSpeedLbl->setIcon(QIcon(":/icons/downloading_small.svg")); m_dlSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("downloading_small")));
connect(m_dlSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capDownloadSpeed); connect(m_dlSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capDownloadSpeed);
m_dlSpeedLbl->setFlat(true); m_dlSpeedLbl->setFlat(true);
m_dlSpeedLbl->setFocusPolicy(Qt::NoFocus); m_dlSpeedLbl->setFocusPolicy(Qt::NoFocus);
@ -78,7 +79,7 @@ StatusBar::StatusBar(QWidget *parent)
m_dlSpeedLbl->setMinimumWidth(200); m_dlSpeedLbl->setMinimumWidth(200);
m_upSpeedLbl = new QPushButton(this); m_upSpeedLbl = new QPushButton(this);
m_upSpeedLbl->setIcon(QIcon(":/icons/seeding.svg")); m_upSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("seeding")));
connect(m_upSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capUploadSpeed); connect(m_upSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capUploadSpeed);
m_upSpeedLbl->setFlat(true); m_upSpeedLbl->setFlat(true);
m_upSpeedLbl->setFocusPolicy(Qt::NoFocus); m_upSpeedLbl->setFocusPolicy(Qt::NoFocus);
@ -173,17 +174,17 @@ void StatusBar::updateConnectionStatus()
const BitTorrent::SessionStatus &sessionStatus = BitTorrent::Session::instance()->status(); const BitTorrent::SessionStatus &sessionStatus = BitTorrent::Session::instance()->status();
if (!BitTorrent::Session::instance()->isListening()) { if (!BitTorrent::Session::instance()->isListening()) {
m_connecStatusLblIcon->setIcon(QIcon(QLatin1String(":/icons/disconnected.svg"))); m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("disconnected")));
m_connecStatusLblIcon->setToolTip(QLatin1String("<b>") + tr("Connection Status:") + QLatin1String("</b><br>") + tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections.")); m_connecStatusLblIcon->setToolTip(QLatin1String("<b>") + tr("Connection Status:") + QLatin1String("</b><br>") + tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));
} }
else { else {
if (sessionStatus.hasIncomingConnections) { if (sessionStatus.hasIncomingConnections) {
// Connection OK // Connection OK
m_connecStatusLblIcon->setIcon(QIcon(QLatin1String(":/icons/connected.svg"))); m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("connected")));
m_connecStatusLblIcon->setToolTip(QLatin1String("<b>") + tr("Connection Status:") + QLatin1String("</b><br>") + tr("Online")); m_connecStatusLblIcon->setToolTip(QLatin1String("<b>") + tr("Connection Status:") + QLatin1String("</b><br>") + tr("Online"));
} }
else { else {
m_connecStatusLblIcon->setIcon(QIcon(QLatin1String(":/icons/firewalled.svg"))); m_connecStatusLblIcon->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("firewalled")));
m_connecStatusLblIcon->setToolTip(QLatin1String("<b>") + tr("Connection status:") + QLatin1String("</b><br>") + QLatin1String("<i>") + tr("No direct connections. This may indicate network configuration problems.") + QLatin1String("</i>")); m_connecStatusLblIcon->setToolTip(QLatin1String("<b>") + tr("Connection status:") + QLatin1String("</b><br>") + QLatin1String("<i>") + tr("No direct connections. This may indicate network configuration problems.") + QLatin1String("</i>"));
} }
} }
@ -230,12 +231,12 @@ void StatusBar::refresh()
void StatusBar::updateAltSpeedsBtn(bool alternative) void StatusBar::updateAltSpeedsBtn(bool alternative)
{ {
if (alternative) { if (alternative) {
m_altSpeedsBtn->setIcon(QIcon(":/icons/slow.svg")); m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("slow")));
m_altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits")); m_altSpeedsBtn->setToolTip(tr("Click to switch to regular speed limits"));
m_altSpeedsBtn->setDown(true); m_altSpeedsBtn->setDown(true);
} }
else { else {
m_altSpeedsBtn->setIcon(QIcon(":/icons/slow_off.svg")); m_altSpeedsBtn->setIcon(UIThemeManager::instance()->getIcon(QLatin1String("slow_off")));
m_altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits")); m_altSpeedsBtn->setToolTip(tr("Click to switch to alternative speed limits"));
m_altSpeedsBtn->setDown(false); m_altSpeedsBtn->setDown(false);
} }

24
src/gui/transferlistfilterswidget.cpp

@ -165,40 +165,40 @@ StatusFilterWidget::StatusFilterWidget(QWidget *parent, TransferListWidget *tran
// Add status filters // Add status filters
auto *all = new QListWidgetItem(this); auto *all = new QListWidgetItem(this);
all->setData(Qt::DisplayRole, tr("All (0)", "this is for the status filter")); all->setData(Qt::DisplayRole, tr("All (0)", "this is for the status filter"));
all->setData(Qt::DecorationRole, QIcon(":/icons/filterall.svg")); all->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("filterall")));
auto *downloading = new QListWidgetItem(this); auto *downloading = new QListWidgetItem(this);
downloading->setData(Qt::DisplayRole, tr("Downloading (0)")); downloading->setData(Qt::DisplayRole, tr("Downloading (0)"));
downloading->setData(Qt::DecorationRole, QIcon(":/icons/downloading.svg")); downloading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("downloading")));
auto *seeding = new QListWidgetItem(this); auto *seeding = new QListWidgetItem(this);
seeding->setData(Qt::DisplayRole, tr("Seeding (0)")); seeding->setData(Qt::DisplayRole, tr("Seeding (0)"));
seeding->setData(Qt::DecorationRole, QIcon(":/icons/uploading.svg")); seeding->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("uploading")));
auto *completed = new QListWidgetItem(this); auto *completed = new QListWidgetItem(this);
completed->setData(Qt::DisplayRole, tr("Completed (0)")); completed->setData(Qt::DisplayRole, tr("Completed (0)"));
completed->setData(Qt::DecorationRole, QIcon(":/icons/completed.svg")); completed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("completed")));
auto *resumed = new QListWidgetItem(this); auto *resumed = new QListWidgetItem(this);
resumed->setData(Qt::DisplayRole, tr("Resumed (0)")); resumed->setData(Qt::DisplayRole, tr("Resumed (0)"));
resumed->setData(Qt::DecorationRole, QIcon(":/icons/resumed.svg")); resumed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("resumed")));
auto *paused = new QListWidgetItem(this); auto *paused = new QListWidgetItem(this);
paused->setData(Qt::DisplayRole, tr("Paused (0)")); paused->setData(Qt::DisplayRole, tr("Paused (0)"));
paused->setData(Qt::DecorationRole, QIcon(":/icons/paused.svg")); paused->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("paused")));
auto *active = new QListWidgetItem(this); auto *active = new QListWidgetItem(this);
active->setData(Qt::DisplayRole, tr("Active (0)")); active->setData(Qt::DisplayRole, tr("Active (0)"));
active->setData(Qt::DecorationRole, QIcon(":/icons/filteractive.svg")); active->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("filteractive")));
auto *inactive = new QListWidgetItem(this); auto *inactive = new QListWidgetItem(this);
inactive->setData(Qt::DisplayRole, tr("Inactive (0)")); inactive->setData(Qt::DisplayRole, tr("Inactive (0)"));
inactive->setData(Qt::DecorationRole, QIcon(":/icons/filterinactive.svg")); inactive->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("filterinactive")));
auto *stalled = new QListWidgetItem(this); auto *stalled = new QListWidgetItem(this);
stalled->setData(Qt::DisplayRole, tr("Stalled (0)")); stalled->setData(Qt::DisplayRole, tr("Stalled (0)"));
stalled->setData(Qt::DecorationRole, QIcon(":/icons/filterstalled.svg")); stalled->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("filterstalled")));
auto *stalledUploading = new QListWidgetItem(this); auto *stalledUploading = new QListWidgetItem(this);
stalledUploading->setData(Qt::DisplayRole, tr("Stalled Uploading (0)")); stalledUploading->setData(Qt::DisplayRole, tr("Stalled Uploading (0)"));
stalledUploading->setData(Qt::DecorationRole, QIcon(":/icons/stalledUP.svg")); stalledUploading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("stalledUP")));
auto *stalledDownloading = new QListWidgetItem(this); auto *stalledDownloading = new QListWidgetItem(this);
stalledDownloading->setData(Qt::DisplayRole, tr("Stalled Downloading (0)")); stalledDownloading->setData(Qt::DisplayRole, tr("Stalled Downloading (0)"));
stalledDownloading->setData(Qt::DecorationRole, QIcon(":/icons/stalledDL.svg")); stalledDownloading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("stalledDL")));
auto *errored = new QListWidgetItem(this); auto *errored = new QListWidgetItem(this);
errored->setData(Qt::DisplayRole, tr("Errored (0)")); errored->setData(Qt::DisplayRole, tr("Errored (0)"));
errored->setData(Qt::DecorationRole, QIcon(":/icons/error.svg")); errored->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("error")));
const Preferences *const pref = Preferences::instance(); const Preferences *const pref = Preferences::instance();
setCurrentRow(pref->getTransSelFilter(), QItemSelectionModel::SelectCurrent); setCurrentRow(pref->getTransSelFilter(), QItemSelectionModel::SelectCurrent);

18
src/gui/transferlistmodel.cpp

@ -727,55 +727,55 @@ QColor getDefaultColorByState(const BitTorrent::TorrentState state)
QIcon getPausedIcon() QIcon getPausedIcon()
{ {
static QIcon cached = QIcon(":/icons/paused.svg"); static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("paused"));
return cached; return cached;
} }
QIcon getQueuedIcon() QIcon getQueuedIcon()
{ {
static QIcon cached = QIcon(":/icons/queued.svg"); static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("queued"));
return cached; return cached;
} }
QIcon getDownloadingIcon() QIcon getDownloadingIcon()
{ {
static QIcon cached = QIcon(":/icons/downloading.svg"); static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("downloading"));
return cached; return cached;
} }
QIcon getStalledDownloadingIcon() QIcon getStalledDownloadingIcon()
{ {
static QIcon cached = QIcon(":/icons/stalledDL.svg"); static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("stalledDL"));
return cached; return cached;
} }
QIcon getUploadingIcon() QIcon getUploadingIcon()
{ {
static QIcon cached = QIcon(":/icons/uploading.svg"); static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("uploading"));
return cached; return cached;
} }
QIcon getStalledUploadingIcon() QIcon getStalledUploadingIcon()
{ {
static QIcon cached = QIcon(":/icons/stalledUP.svg"); static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("stalledUP"));
return cached; return cached;
} }
QIcon getCompletedIcon() QIcon getCompletedIcon()
{ {
static QIcon cached = QIcon(":/icons/completed.svg"); static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("completed"));
return cached; return cached;
} }
QIcon getCheckingIcon() QIcon getCheckingIcon()
{ {
static QIcon cached = QIcon(":/icons/checking.svg"); static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("checking"));
return cached; return cached;
} }
QIcon getErrorIcon() QIcon getErrorIcon()
{ {
static QIcon cached = QIcon(":/icons/error.svg"); static QIcon cached = UIThemeManager::instance()->getIcon(QLatin1String("error"));
return cached; return cached;
} }

2
src/gui/transferlistwidget.cpp

@ -865,7 +865,7 @@ void TransferListWidget::displayListMenu(const QPoint &)
connect(actionDelete, &QAction::triggered, this, &TransferListWidget::softDeleteSelectedTorrents); connect(actionDelete, &QAction::triggered, this, &TransferListWidget::softDeleteSelectedTorrents);
auto *actionPreviewFile = new QAction(UIThemeManager::instance()->getIcon("view-preview"), tr("Preview file..."), listMenu); auto *actionPreviewFile = new QAction(UIThemeManager::instance()->getIcon("view-preview"), tr("Preview file..."), listMenu);
connect(actionPreviewFile, &QAction::triggered, this, &TransferListWidget::previewSelectedTorrents); connect(actionPreviewFile, &QAction::triggered, this, &TransferListWidget::previewSelectedTorrents);
auto *actionSetMaxRatio = new QAction(QIcon(QLatin1String(":/icons/ratio.svg")), tr("Limit share ratio..."), listMenu); auto *actionSetMaxRatio = new QAction(UIThemeManager::instance()->getIcon(QLatin1String("ratio")), tr("Limit share ratio..."), listMenu);
connect(actionSetMaxRatio, &QAction::triggered, this, &TransferListWidget::setMaxRatioSelectedTorrents); connect(actionSetMaxRatio, &QAction::triggered, this, &TransferListWidget::setMaxRatioSelectedTorrents);
auto *actionSetUploadLimit = new QAction(UIThemeManager::instance()->getIcon("kt-set-max-upload-speed"), tr("Limit upload rate..."), listMenu); auto *actionSetUploadLimit = new QAction(UIThemeManager::instance()->getIcon("kt-set-max-upload-speed"), tr("Limit upload rate..."), listMenu);
connect(actionSetUploadLimit, &QAction::triggered, this, &TransferListWidget::setUpLimitSelectedTorrents); connect(actionSetUploadLimit, &QAction::triggered, this, &TransferListWidget::setUpLimitSelectedTorrents);

2
src/gui/uithememanager.h

@ -46,6 +46,7 @@ public:
void applyStyleSheet() const; void applyStyleSheet() const;
QString getIconPath(const QString &iconId) const;
QIcon getIcon(const QString &iconId) const; QIcon getIcon(const QString &iconId) const;
QIcon getIcon(const QString &iconId, const QString &fallback) const; QIcon getIcon(const QString &iconId, const QString &fallback) const;
QIcon getFlagIcon(const QString &countryIsoCode) const; QIcon getFlagIcon(const QString &countryIsoCode) const;
@ -54,7 +55,6 @@ public:
private: private:
UIThemeManager(); // singleton class UIThemeManager(); // singleton class
QString getIconPath(const QString &iconId) const;
void loadColorsFromJSONConfig(); void loadColorsFromJSONConfig();
void applyPalette() const; void applyPalette() const;

Loading…
Cancel
Save