Re-allow to use icons from system theme

PR #18195.
This commit is contained in:
Vladimir Golovnev 2022-12-25 16:25:56 +03:00 committed by GitHub
parent ebad387c1a
commit cfd0c5433e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 204 additions and 144 deletions

View file

@ -996,6 +996,18 @@ void Preferences::resolvePeerHostNames(const bool resolve)
setValue(u"Preferences/Connection/ResolvePeerHostNames"_qs, resolve);
}
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
bool Preferences::useSystemIcons() const
{
return value(u"Preferences/Advanced/useSystemIconTheme"_qs, false);
}
void Preferences::useSystemIcons(const bool enabled)
{
setValue(u"Preferences/Advanced/useSystemIconTheme"_qs, enabled);
}
#endif
bool Preferences::isRecursiveDownloadEnabled() const
{
return !value(u"Preferences/Advanced/DisableRecursiveDownload"_qs, false);

View file

@ -281,6 +281,10 @@ public:
void resolvePeerCountries(bool resolve);
bool resolvePeerHostNames() const;
void resolvePeerHostNames(bool resolve);
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
bool useSystemIcons() const;
void useSystemIcons(bool enabled);
#endif
bool isRecursiveDownloadEnabled() const;
void setRecursiveDownloadEnabled(bool enable);
#ifdef Q_OS_WIN

View file

@ -211,7 +211,7 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const
if ((index.column() == 0) && (role == Qt::DecorationRole))
{
return UIThemeManager::instance()->getIcon(u"view-categories"_qs);
return UIThemeManager::instance()->getIcon(u"view-categories"_qs, u"inode-directory"_qs);
}
if ((index.column() == 0) && (role == Qt::DisplayRole))

View file

@ -121,18 +121,18 @@ void CategoryFilterWidget::showMenu()
, this, &CategoryFilterWidget::addSubcategory);
}
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Edit category...")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs, u"document-edit"_qs), tr("Edit category...")
, this, &CategoryFilterWidget::editCategory);
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Remove category")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Remove category")
, this, &CategoryFilterWidget::removeCategory);
}
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Remove unused categories")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Remove unused categories")
, this, &CategoryFilterWidget::removeUnusedCategories);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs), tr("Resume torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs), tr("Resume torrents")
, this, &CategoryFilterWidget::actionResumeTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs), tr("Pause torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs), tr("Pause torrents")
, this, &CategoryFilterWidget::actionPauseTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove torrents")
, this, &CategoryFilterWidget::actionDeleteTorrentsTriggered);

View file

@ -69,8 +69,8 @@ ExecutionLogWidget::ExecutionLogWidget(const Log::MsgTypes types, QWidget *paren
m_ui->tabBan->layout()->addWidget(peerView);
#ifndef Q_OS_MACOS
m_ui->tabConsole->setTabIcon(0, UIThemeManager::instance()->getIcon(u"help-contents"_qs));
m_ui->tabConsole->setTabIcon(1, UIThemeManager::instance()->getIcon(u"ip-blocked"_qs));
m_ui->tabConsole->setTabIcon(0, UIThemeManager::instance()->getIcon(u"help-contents"_qs, u"view-calendar-journal"_qs));
m_ui->tabConsole->setTabIcon(1, UIThemeManager::instance()->getIcon(u"ip-blocked"_qs, u"view-filter"_qs));
#endif
}

View file

@ -130,8 +130,7 @@ MainWindow::MainWindow(IGUIApplication *app, const State initialState)
m_displaySpeedInTitle = pref->speedInTitleBar();
// Setting icons
#ifndef Q_OS_MACOS
const QIcon appLogo(UIThemeManager::instance()->getIcon(u"qbittorrent"_qs, u"qbittorrent-tray"_qs));
setWindowIcon(appLogo);
setWindowIcon(UIThemeManager::instance()->getIcon(u"qbittorrent"_qs));
#endif // Q_OS_MACOS
#if (defined(Q_OS_UNIX))
@ -143,7 +142,7 @@ MainWindow::MainWindow(IGUIApplication *app, const State initialState)
m_ui->actionOpen->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->actionDownloadFromURL->setIcon(UIThemeManager::instance()->getIcon(u"insert-link"_qs));
m_ui->actionSetGlobalSpeedLimits->setIcon(UIThemeManager::instance()->getIcon(u"speedometer"_qs));
m_ui->actionCreateTorrent->setIcon(UIThemeManager::instance()->getIcon(u"torrent-creator"_qs));
m_ui->actionCreateTorrent->setIcon(UIThemeManager::instance()->getIcon(u"torrent-creator"_qs, u"document-edit"_qs));
m_ui->actionAbout->setIcon(UIThemeManager::instance()->getIcon(u"help-about"_qs));
m_ui->actionStatistics->setIcon(UIThemeManager::instance()->getIcon(u"view-statistics"_qs));
m_ui->actionTopQueuePos->setIcon(UIThemeManager::instance()->getIcon(u"go-top"_qs));
@ -155,13 +154,13 @@ MainWindow::MainWindow(IGUIApplication *app, const State initialState)
m_ui->actionDonateMoney->setIcon(UIThemeManager::instance()->getIcon(u"wallet-open"_qs));
m_ui->actionExit->setIcon(UIThemeManager::instance()->getIcon(u"application-exit"_qs));
m_ui->actionLock->setIcon(UIThemeManager::instance()->getIcon(u"object-locked"_qs));
m_ui->actionOptions->setIcon(UIThemeManager::instance()->getIcon(u"configure"_qs));
m_ui->actionPause->setIcon(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs));
m_ui->actionPauseAll->setIcon(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs));
m_ui->actionStart->setIcon(UIThemeManager::instance()->getIcon(u"torrent-start"_qs));
m_ui->actionStartAll->setIcon(UIThemeManager::instance()->getIcon(u"torrent-start"_qs));
m_ui->menuAutoShutdownOnDownloadsCompletion->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_qs));
m_ui->actionManageCookies->setIcon(UIThemeManager::instance()->getIcon(u"browser-cookies"_qs));
m_ui->actionOptions->setIcon(UIThemeManager::instance()->getIcon(u"configure"_qs, u"preferences-system"_qs));
m_ui->actionPause->setIcon(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs));
m_ui->actionPauseAll->setIcon(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs));
m_ui->actionStart->setIcon(UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs));
m_ui->actionStartAll->setIcon(UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs));
m_ui->menuAutoShutdownOnDownloadsCompletion->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_qs, u"application-exit"_qs));
m_ui->actionManageCookies->setIcon(UIThemeManager::instance()->getIcon(u"browser-cookies"_qs, u"preferences-web-browser-cookies"_qs));
m_ui->menuLog->setIcon(UIThemeManager::instance()->getIcon(u"help-contents"_qs));
m_ui->actionCheckForUpdates->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs));

View file

@ -203,17 +203,17 @@ OptionsDialog::OptionsDialog(IGUIApplication *app, QWidget *parent)
// Main icons
m_ui->tabSelection->item(TAB_UI)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-desktop"_qs));
m_ui->tabSelection->item(TAB_BITTORRENT)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-bittorrent"_qs));
m_ui->tabSelection->item(TAB_CONNECTION)->setIcon(UIThemeManager::instance()->getIcon(u"network-connect"_qs));
m_ui->tabSelection->item(TAB_DOWNLOADS)->setIcon(UIThemeManager::instance()->getIcon(u"download"_qs));
m_ui->tabSelection->item(TAB_SPEED)->setIcon(UIThemeManager::instance()->getIcon(u"speedometer"_qs));
m_ui->tabSelection->item(TAB_RSS)->setIcon(UIThemeManager::instance()->getIcon(u"application-rss"_qs));
m_ui->tabSelection->item(TAB_BITTORRENT)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-bittorrent"_qs, u"preferences-system-network"_qs));
m_ui->tabSelection->item(TAB_CONNECTION)->setIcon(UIThemeManager::instance()->getIcon(u"network-connect"_qs, u"network-wired"_qs));
m_ui->tabSelection->item(TAB_DOWNLOADS)->setIcon(UIThemeManager::instance()->getIcon(u"download"_qs, u"folder-download"_qs));
m_ui->tabSelection->item(TAB_SPEED)->setIcon(UIThemeManager::instance()->getIcon(u"speedometer"_qs, u"chronometer"_qs));
m_ui->tabSelection->item(TAB_RSS)->setIcon(UIThemeManager::instance()->getIcon(u"application-rss"_qs, u"application-rss+xml"_qs));
#ifdef DISABLE_WEBUI
m_ui->tabSelection->item(TAB_WEBUI)->setHidden(true);
#else
m_ui->tabSelection->item(TAB_WEBUI)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-webui"_qs));
m_ui->tabSelection->item(TAB_WEBUI)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-webui"_qs, u"network-server"_qs));
#endif
m_ui->tabSelection->item(TAB_ADVANCED)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-advanced"_qs));
m_ui->tabSelection->item(TAB_ADVANCED)->setIcon(UIThemeManager::instance()->getIcon(u"preferences-advanced"_qs, u"preferences-other"_qs));
// set uniform size for all icons
int maxHeight = -1;
@ -288,6 +288,11 @@ void OptionsDialog::loadBehaviorTabOptions()
m_ui->customThemeFilePath->setMode(FileSystemPathEdit::Mode::FileOpen);
m_ui->customThemeFilePath->setDialogCaption(tr("Select qBittorrent UI Theme file"));
m_ui->customThemeFilePath->setFileNameFilter(tr("qBittorrent UI Theme file (*.qbtheme config.json)"));
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
m_ui->checkUseSystemIcon->setChecked(pref->useSystemIcons());
#else
m_ui->checkUseSystemIcon->setVisible(false);
#endif
m_ui->confirmDeletion->setChecked(pref->confirmTorrentDeletion());
m_ui->checkAltRowColors->setChecked(pref->useAlternatingRowColors());
@ -382,6 +387,9 @@ void OptionsDialog::loadBehaviorTabOptions()
connect(m_ui->comboI18n, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton);
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
connect(m_ui->checkUseSystemIcon, &QAbstractButton::toggled, this, &ThisType::enableApplyButton);
#endif
connect(m_ui->checkUseCustomTheme, &QGroupBox::toggled, this, &ThisType::enableApplyButton);
connect(m_ui->customThemeFilePath, &FileSystemPathEdit::selectedPathChanged, this, &ThisType::enableApplyButton);
@ -451,6 +459,9 @@ void OptionsDialog::saveBehaviorTabOptions() const
}
pref->setLocale(locale);
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
pref->useSystemIcons(m_ui->checkUseSystemIcon->isChecked());
#endif
pref->setUseCustomUITheme(m_ui->checkUseCustomTheme->isChecked());
pref->setCustomUIThemePath(m_ui->customThemeFilePath->selectedPath());

View file

@ -133,41 +133,18 @@
<string>Interface</string>
</property>
<layout class="QGridLayout" name="gridLayout_81">
<item row="3" column="0" colspan="3">
<widget class="QGroupBox" name="checkUseCustomTheme">
<property name="title">
<string>Use custom UI Theme</string>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="checkable">
<bool>true</bool>
<property name="text">
<string>Changing Interface settings requires application restart</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>UI Theme file:</string>
</property>
</widget>
</item>
<item>
<widget class="FileSystemPathLineEdit" name="customThemeFilePath" native="true"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_111">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
@ -191,15 +168,45 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<italic>true</italic>
</font>
<item row="1" column="2">
<spacer name="horizontalSpacer_111">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="checkUseCustomTheme">
<property name="title">
<string>Use custom UI Theme</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>UI Theme file:</string>
</property>
</widget>
</item>
<item>
<widget class="FileSystemPathLineEdit" name="customThemeFilePath" native="true"/>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="checkUseSystemIcon">
<property name="text">
<string>Changing Interface settings requires application restart</string>
<string>Use icons from system theme</string>
</property>
</widget>
</item>

View file

@ -777,7 +777,7 @@ void PropertiesWidget::displayWebSeedListMenu()
if (!rows.isEmpty())
{
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Remove Web seed")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Remove Web seed")
, this, &PropertiesWidget::deleteSelectedUrlSeeds);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy Web seed URL")

View file

@ -45,7 +45,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// General tab
QPushButton *mainInfosButton = new QPushButton(
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"help-about"_qs),
UIThemeManager::instance()->getIcon(u"help-about"_qs, u"document-properties"_qs),
#endif
tr("General"), parent);
mainInfosButton->setShortcut(Qt::ALT + Qt::Key_G);
@ -54,7 +54,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Trackers tab
QPushButton *trackersButton = new QPushButton(
#ifndef Q_OS_MACOS
UIThemeManager::instance()->getIcon(u"trackers"_qs),
UIThemeManager::instance()->getIcon(u"trackers"_qs, u"network-server"_qs),
#endif
tr("Trackers"), parent);
trackersButton->setShortcut(Qt::ALT + Qt::Key_C);

View file

@ -581,7 +581,7 @@ void TrackerListWidget::showTrackerListMenu()
{
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs),tr("Edit tracker URL...")
, this, &TrackerListWidget::editSelectedTracker);
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Remove tracker")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Remove tracker")
, this, &TrackerListWidget::deleteSelectedTrackers);
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy tracker URL")
, this, &TrackerListWidget::copyTrackerUrl);
@ -589,10 +589,10 @@ void TrackerListWidget::showTrackerListMenu()
if (!torrent->isPaused())
{
menu->addAction(UIThemeManager::instance()->getIcon(u"reannounce"_qs), tr("Force reannounce to selected trackers")
menu->addAction(UIThemeManager::instance()->getIcon(u"reannounce"_qs, u"view-refresh"_qs), tr("Force reannounce to selected trackers")
, this, &TrackerListWidget::reannounceSelected);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"reannounce"_qs), tr("Force reannounce to all trackers")
menu->addAction(UIThemeManager::instance()->getIcon(u"reannounce"_qs, u"view-refresh"_qs), tr("Force reannounce to all trackers")
, this, [this]()
{
BitTorrent::Torrent *h = m_properties->getCurrentTorrent();

View file

@ -52,7 +52,7 @@ TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::Torr
{
m_ui->setupUi(this);
m_ui->downloadButton->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs));
m_ui->downloadButton->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"download"_qs));
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Add"));
connect(m_ui->downloadButton, &QAbstractButton::clicked, this, &TrackersAdditionDialog::onDownloadButtonClicked);

View file

@ -105,7 +105,7 @@ void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
const QColor defaultColor {palette().color(QPalette::Inactive, QPalette::WindowText)};
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs, defaultColor)};
item->setData(Qt::ForegroundRole, foregroundBrush);
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_qs));
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_qs, u"sphere"_qs));
checkInvariant();
}
@ -133,14 +133,14 @@ QListWidgetItem *ArticleListWidget::createItem(RSS::Article *article) const
const QColor defaultColor {palette().color(QPalette::Inactive, QPalette::WindowText)};
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.ReadArticle"_qs, defaultColor)};
item->setData(Qt::ForegroundRole, foregroundBrush);
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_qs));
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_qs, u"sphere"_qs));
}
else
{
const QColor defaultColor {palette().color(QPalette::Active, QPalette::Link)};
const QBrush foregroundBrush {UIThemeManager::instance()->getColor(u"RSS.UnreadArticle"_qs, defaultColor)};
item->setData(Qt::ForegroundRole, foregroundBrush);
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_qs));
item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"loading"_qs, u"sphere"_qs));
}
return item;

View file

@ -76,7 +76,7 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
m_ui->setupUi(this);
// Icons
m_ui->renameRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-rename"_qs));
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_qs));
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs));
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->addCategoryBtn->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
@ -534,7 +534,7 @@ void AutomatedRssDownloader::displayRulesListMenu()
{
if (selection.count() == 1)
{
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Delete rule")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Delete rule")
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-rename"_qs), tr("Rename rule...")
@ -542,7 +542,7 @@ void AutomatedRssDownloader::displayRulesListMenu()
}
else
{
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Delete selected rules")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Delete selected rules")
, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
}
@ -772,7 +772,7 @@ void AutomatedRssDownloader::updateMustLineValidity()
else
{
m_ui->lineContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs);
m_ui->labelMustStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs).pixmap(16, 16));
m_ui->labelMustStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs, u"task-attention"_qs).pixmap(16, 16));
m_ui->labelMustStat->setToolTip(error);
}
}
@ -819,7 +819,7 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
else
{
m_ui->lineNotContains->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs);
m_ui->labelMustNotStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs).pixmap(16, 16));
m_ui->labelMustNotStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs, u"task-attention"_qs).pixmap(16, 16));
m_ui->labelMustNotStat->setToolTip(error);
}
}
@ -837,7 +837,7 @@ void AutomatedRssDownloader::updateEpisodeFilterValidity()
else
{
m_ui->lineEFilter->setStyleSheet(u"QLineEdit { color: #ff0000; }"_qs);
m_ui->labelEpFilterStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs).pixmap(16, 16));
m_ui->labelEpFilterStat->setPixmap(UIThemeManager::instance()->getIcon(u"dialog-warning"_qs, u"task-attention"_qs).pixmap(16, 16));
}
}

View file

@ -81,7 +81,7 @@ namespace
if (feed->isLoading())
return UIThemeManager::instance()->getIcon(u"loading"_qs);
if (feed->hasError())
return UIThemeManager::instance()->getIcon(u"task-reject"_qs);
return UIThemeManager::instance()->getIcon(u"task-reject"_qs, u"unavailable"_qs);
return loadIcon(feed->iconPath(), u"application-rss"_qs);
}

View file

@ -64,8 +64,8 @@ RSSWidget::RSSWidget(QWidget *parent)
// Icons
m_ui->actionCopyFeedURL->setIcon(UIThemeManager::instance()->getIcon(u"edit-copy"_qs));
m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon(u"edit-clear"_qs));
m_ui->actionDownloadTorrent->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs));
m_ui->actionMarkItemsRead->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_qs));
m_ui->actionDownloadTorrent->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"download"_qs));
m_ui->actionMarkItemsRead->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_qs, u"mail-mark-read"_qs));
m_ui->actionNewFolder->setIcon(UIThemeManager::instance()->getIcon(u"folder-new"_qs));
m_ui->actionNewSubscription->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->actionOpenNewsURL->setIcon(UIThemeManager::instance()->getIcon(u"application-url"_qs));
@ -74,9 +74,9 @@ RSSWidget::RSSWidget(QWidget *parent)
m_ui->actionUpdateAllFeeds->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs));
#ifndef Q_OS_MACOS
m_ui->newFeedButton->setIcon(UIThemeManager::instance()->getIcon(u"list-add"_qs));
m_ui->markReadButton->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_qs));
m_ui->markReadButton->setIcon(UIThemeManager::instance()->getIcon(u"task-complete"_qs, u"mail-mark-read"_qs));
m_ui->updateAllButton->setIcon(UIThemeManager::instance()->getIcon(u"view-refresh"_qs));
m_ui->rssDownloaderBtn->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs));
m_ui->rssDownloaderBtn->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"download"_qs));
#endif
m_articleListWidget = new ArticleListWidget(m_ui->splitterMain);

View file

@ -392,7 +392,7 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event)
menu->addAction(UIThemeManager::instance()->getIcon(u"download"_qs)
, tr("Open download window"), this, [this]() { downloadTorrents(AddTorrentOption::ShowDialog); });
menu->addAction(UIThemeManager::instance()->getIcon(u"downloading"_qs)
menu->addAction(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"download"_qs)
, tr("Download"), this, [this]() { downloadTorrents(AddTorrentOption::SkipDialog); });
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"application-url"_qs), tr("Open description page")
@ -401,11 +401,11 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event)
QMenu *copySubMenu = menu->addMenu(
UIThemeManager::instance()->getIcon(u"edit-copy"_qs), tr("Copy"));
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"name"_qs), tr("Name")
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"name"_qs, u"edit-copy"_qs), tr("Name")
, this, &SearchJobWidget::copyTorrentNames);
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"insert-link"_qs), tr("Download link")
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"insert-link"_qs, u"edit-copy"_qs), tr("Download link")
, this, &SearchJobWidget::copyTorrentDownloadLinks);
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"application-url"_qs), tr("Description page URL")
copySubMenu->addAction(UIThemeManager::instance()->getIcon(u"application-url"_qs, u"edit-copy"_qs), tr("Description page URL")
, this, &SearchJobWidget::copyTorrentURLs);
menu->popup(event->globalPos());

View file

@ -112,7 +112,7 @@ SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow)
#ifndef Q_OS_MACOS
// Icons
m_ui->searchButton->setIcon(UIThemeManager::instance()->getIcon(u"edit-find"_qs));
m_ui->pluginsButton->setIcon(UIThemeManager::instance()->getIcon(u"plugins"_qs));
m_ui->pluginsButton->setIcon(UIThemeManager::instance()->getIcon(u"plugins"_qs, u"preferences-system-network"_qs));
#else
// On macOS the icons overlap the text otherwise
QSize iconSize = m_ui->tabWidget->iconSize();

View file

@ -69,7 +69,7 @@ StatusBar::StatusBar(QWidget *parent)
connect(m_connecStatusLblIcon, &QAbstractButton::clicked, this, &StatusBar::connectionButtonClicked);
m_dlSpeedLbl = new QPushButton(this);
m_dlSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs));
m_dlSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"downloading"_qs, u"downloading_small"_qs));
connect(m_dlSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capSpeed);
m_dlSpeedLbl->setFlat(true);
m_dlSpeedLbl->setFocusPolicy(Qt::NoFocus);
@ -78,7 +78,7 @@ StatusBar::StatusBar(QWidget *parent)
m_dlSpeedLbl->setMinimumWidth(200);
m_upSpeedLbl = new QPushButton(this);
m_upSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"upload"_qs));
m_upSpeedLbl->setIcon(UIThemeManager::instance()->getIcon(u"upload"_qs, u"seeding"_qs));
connect(m_upSpeedLbl, &QAbstractButton::clicked, this, &StatusBar::capSpeed);
m_upSpeedLbl->setFlat(true);
m_upSpeedLbl->setFocusPolicy(Qt::NoFocus);

View file

@ -123,7 +123,7 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const
switch (role)
{
case Qt::DecorationRole:
return UIThemeManager::instance()->getIcon(u"tags"_qs);
return UIThemeManager::instance()->getIcon(u"tags"_qs, u"inode-directory"_qs);
case Qt::DisplayRole:
return u"%1 (%2)"_qs.arg(tagDisplayName(item.tag())).arg(item.torrentsCount());
case Qt::UserRole:

View file

@ -113,16 +113,16 @@ void TagFilterWidget::showMenu()
const auto selectedRows = selectionModel()->selectedRows();
if (!selectedRows.empty() && !TagFilterModel::isSpecialItem(selectedRows.first()))
{
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Remove tag")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Remove tag")
, this, &TagFilterWidget::removeTag);
}
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs), tr("Remove unused tags")
menu->addAction(UIThemeManager::instance()->getIcon(u"edit-clear"_qs, u"list-remove"_qs), tr("Remove unused tags")
, this, &TagFilterWidget::removeUnusedTags);
menu->addSeparator();
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs), tr("Resume torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs), tr("Resume torrents")
, this, &TagFilterWidget::actionResumeTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs), tr("Pause torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs), tr("Pause torrents")
, this, &TagFilterWidget::actionPauseTorrentsTriggered);
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove torrents")
, this, &TagFilterWidget::actionDeleteTorrentsTriggered);

View file

@ -70,7 +70,7 @@ namespace
{
public:
UnifiedFileIconProvider()
: m_textPlainIcon {UIThemeManager::instance()->getIcon(u"help-about"_qs)}
: m_textPlainIcon {UIThemeManager::instance()->getIcon(u"help-about"_qs, u"text-plain"_qs)}
{
}

View file

@ -173,31 +173,31 @@ StatusFilterWidget::StatusFilterWidget(QWidget *parent, TransferListWidget *tran
// Add status filters
auto *all = new QListWidgetItem(this);
all->setData(Qt::DisplayRole, tr("All (0)", "this is for the status filter"));
all->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filter-all"_qs));
all->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filter-all"_qs, u"filterall"_qs));
auto *downloading = new QListWidgetItem(this);
downloading->setData(Qt::DisplayRole, tr("Downloading (0)"));
downloading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"downloading"_qs));
auto *seeding = new QListWidgetItem(this);
seeding->setData(Qt::DisplayRole, tr("Seeding (0)"));
seeding->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"upload"_qs));
seeding->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"upload"_qs, u"uploading"_qs));
auto *completed = new QListWidgetItem(this);
completed->setData(Qt::DisplayRole, tr("Completed (0)"));
completed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"checked-completed"_qs));
completed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"checked-completed"_qs, u"completed"_qs));
auto *resumed = new QListWidgetItem(this);
resumed->setData(Qt::DisplayRole, tr("Resumed (0)"));
resumed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"torrent-start"_qs));
resumed->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs));
auto *paused = new QListWidgetItem(this);
paused->setData(Qt::DisplayRole, tr("Paused (0)"));
paused->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"torrent-stop"_qs));
paused->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs));
auto *active = new QListWidgetItem(this);
active->setData(Qt::DisplayRole, tr("Active (0)"));
active->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filter-active"_qs));
active->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filter-active"_qs, u"filteractive"_qs));
auto *inactive = new QListWidgetItem(this);
inactive->setData(Qt::DisplayRole, tr("Inactive (0)"));
inactive->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filter-inactive"_qs));
inactive->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filter-inactive"_qs, u"filterinactive"_qs));
auto *stalled = new QListWidgetItem(this);
stalled->setData(Qt::DisplayRole, tr("Stalled (0)"));
stalled->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filter-stalled"_qs));
stalled->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"filter-stalled"_qs, u"filterstalled"_qs));
auto *stalledUploading = new QListWidgetItem(this);
stalledUploading->setData(Qt::DisplayRole, tr("Stalled Uploading (0)"));
stalledUploading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"stalledUP"_qs));
@ -206,7 +206,7 @@ StatusFilterWidget::StatusFilterWidget(QWidget *parent, TransferListWidget *tran
stalledDownloading->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"stalledDL"_qs));
auto *checking = new QListWidgetItem(this);
checking->setData(Qt::DisplayRole, tr("Checking (0)"));
checking->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"force-recheck"_qs));
checking->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"force-recheck"_qs, u"checking"_qs));
auto *moving = new QListWidgetItem(this);
moving->setData(Qt::DisplayRole, tr("Moving (0)"));
moving->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"set-location"_qs));
@ -308,9 +308,9 @@ void StatusFilterWidget::showMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs), tr("Resume torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs), tr("Resume torrents")
, transferList, &TransferListWidget::startVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs), tr("Pause torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs), tr("Pause torrents")
, transferList, &TransferListWidget::pauseVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove torrents")
, transferList, &TransferListWidget::deleteVisibleTorrents);
@ -371,16 +371,16 @@ TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *tran
{
auto *allTrackers = new QListWidgetItem(this);
allTrackers->setData(Qt::DisplayRole, tr("All (0)", "this is for the tracker filter"));
allTrackers->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"trackers"_qs));
allTrackers->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"trackers"_qs, u"network-server"_qs));
auto *noTracker = new QListWidgetItem(this);
noTracker->setData(Qt::DisplayRole, tr("Trackerless (0)"));
noTracker->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"trackerless"_qs));
noTracker->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"trackerless"_qs, u"network-server"_qs));
auto *errorTracker = new QListWidgetItem(this);
errorTracker->setData(Qt::DisplayRole, tr("Error (0)"));
errorTracker->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"tracker-error"_qs));
errorTracker->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"tracker-error"_qs, u"dialog-error"_qs));
auto *warningTracker = new QListWidgetItem(this);
warningTracker->setData(Qt::DisplayRole, tr("Warning (0)"));
warningTracker->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"tracker-warning"_qs));
warningTracker->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"tracker-warning"_qs, u"dialog-warning"_qs));
m_trackers[NULL_HOST] = {{}, noTracker};
@ -474,7 +474,7 @@ void TrackerFiltersList::addItems(const QString &trackerURL, const QVector<BitTo
else
{
trackerItem = new QListWidgetItem();
trackerItem->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"trackers"_qs));
trackerItem->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"trackers"_qs, u"network-server"_qs));
const TrackerData trackerData {{}, trackerItem};
trackersIt = m_trackers.insert(host, trackerData);
@ -704,9 +704,9 @@ void TrackerFiltersList::showMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs), tr("Resume torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs), tr("Resume torrents")
, transferList, &TransferListWidget::startVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs), tr("Pause torrents")
menu->addAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs), tr("Pause torrents")
, transferList, &TransferListWidget::pauseVisibleTorrents);
menu->addAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("Remove torrents")
, transferList, &TransferListWidget::deleteVisibleTorrents);

View file

@ -158,15 +158,15 @@ TransferListModel::TransferListModel(QObject *parent)
{BitTorrent::TorrentState::Error, tr("Errored", "Torrent status, the torrent has an error")}
}
, m_stateThemeColors {torrentStateColorsFromUITheme()}
, m_checkingIcon {UIThemeManager::instance()->getIcon(u"force-recheck"_qs)}
, m_completedIcon {UIThemeManager::instance()->getIcon(u"checked-completed"_qs)}
, m_checkingIcon {UIThemeManager::instance()->getIcon(u"force-recheck"_qs, u"checking"_qs)}
, m_completedIcon {UIThemeManager::instance()->getIcon(u"checked-completed"_qs, u"completed"_qs)}
, m_downloadingIcon {UIThemeManager::instance()->getIcon(u"downloading"_qs)}
, m_errorIcon {UIThemeManager::instance()->getIcon(u"error"_qs)}
, m_pausedIcon {UIThemeManager::instance()->getIcon(u"torrent-stop"_qs)}
, m_pausedIcon {UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs)}
, m_queuedIcon {UIThemeManager::instance()->getIcon(u"queued"_qs)}
, m_stalledDLIcon {UIThemeManager::instance()->getIcon(u"stalledDL"_qs)}
, m_stalledUPIcon {UIThemeManager::instance()->getIcon(u"stalledUP"_qs)}
, m_uploadingIcon {UIThemeManager::instance()->getIcon(u"upload"_qs)}
, m_uploadingIcon {UIThemeManager::instance()->getIcon(u"upload"_qs, u"uploading"_qs)}
{
configure();
connect(Preferences::instance(), &Preferences::changed, this, &TransferListModel::configure);

View file

@ -930,11 +930,11 @@ void TransferListWidget::displayListMenu()
// Create actions
auto *actionStart = new QAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs), tr("&Resume", "Resume/start the torrent"), listMenu);
auto *actionStart = new QAction(UIThemeManager::instance()->getIcon(u"torrent-start"_qs, u"media-playback-start"_qs), tr("&Resume", "Resume/start the torrent"), listMenu);
connect(actionStart, &QAction::triggered, this, &TransferListWidget::startSelectedTorrents);
auto *actionPause = new QAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs), tr("&Pause", "Pause the torrent"), listMenu);
auto *actionPause = new QAction(UIThemeManager::instance()->getIcon(u"torrent-stop"_qs, u"media-playback-pause"_qs), tr("&Pause", "Pause the torrent"), listMenu);
connect(actionPause, &QAction::triggered, this, &TransferListWidget::pauseSelectedTorrents);
auto *actionForceStart = new QAction(UIThemeManager::instance()->getIcon(u"torrent-start-forced"_qs), tr("Force Resu&me", "Force Resume/start the torrent"), listMenu);
auto *actionForceStart = new QAction(UIThemeManager::instance()->getIcon(u"torrent-start-forced"_qs, u"media-playback-start"_qs), tr("Force Resu&me", "Force Resume/start the torrent"), listMenu);
connect(actionForceStart, &QAction::triggered, this, &TransferListWidget::forceStartSelectedTorrents);
auto *actionDelete = new QAction(UIThemeManager::instance()->getIcon(u"list-remove"_qs), tr("&Remove", "Remove the torrent"), listMenu);
connect(actionDelete, &QAction::triggered, this, &TransferListWidget::softDeleteSelectedTorrents);
@ -952,21 +952,21 @@ void TransferListWidget::displayListMenu()
connect(actionTopQueuePos, &QAction::triggered, this, &TransferListWidget::topQueuePosSelectedTorrents);
auto *actionBottomQueuePos = new QAction(UIThemeManager::instance()->getIcon(u"go-bottom"_qs), tr("Move to &bottom", "i.e. Move to bottom of the queue"), listMenu);
connect(actionBottomQueuePos, &QAction::triggered, this, &TransferListWidget::bottomQueuePosSelectedTorrents);
auto *actionSetTorrentPath = new QAction(UIThemeManager::instance()->getIcon(u"set-location"_qs), tr("Set loc&ation..."), listMenu);
auto *actionSetTorrentPath = new QAction(UIThemeManager::instance()->getIcon(u"set-location"_qs, u"inode-directory"_qs), tr("Set loc&ation..."), listMenu);
connect(actionSetTorrentPath, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsLocation);
auto *actionForceRecheck = new QAction(UIThemeManager::instance()->getIcon(u"force-recheck"_qs), tr("Force rec&heck"), listMenu);
auto *actionForceRecheck = new QAction(UIThemeManager::instance()->getIcon(u"force-recheck"_qs, u"document-edit-verify"_qs), tr("Force rec&heck"), listMenu);
connect(actionForceRecheck, &QAction::triggered, this, &TransferListWidget::recheckSelectedTorrents);
auto *actionForceReannounce = new QAction(UIThemeManager::instance()->getIcon(u"reannounce"_qs), tr("Force r&eannounce"), listMenu);
auto *actionForceReannounce = new QAction(UIThemeManager::instance()->getIcon(u"reannounce"_qs, u"document-edit-verify"_qs), tr("Force r&eannounce"), listMenu);
connect(actionForceReannounce, &QAction::triggered, this, &TransferListWidget::reannounceSelectedTorrents);
auto *actionCopyMagnetLink = new QAction(UIThemeManager::instance()->getIcon(u"torrent-magnet"_qs), tr("&Magnet link"), listMenu);
auto *actionCopyMagnetLink = new QAction(UIThemeManager::instance()->getIcon(u"torrent-magnet"_qs, u"kt-magnet"_qs), tr("&Magnet link"), listMenu);
connect(actionCopyMagnetLink, &QAction::triggered, this, &TransferListWidget::copySelectedMagnetURIs);
auto *actionCopyID = new QAction(UIThemeManager::instance()->getIcon(u"help-about"_qs), tr("Torrent &ID"), listMenu);
auto *actionCopyID = new QAction(UIThemeManager::instance()->getIcon(u"help-about"_qs, u"edit-copy"_qs), tr("Torrent &ID"), listMenu);
connect(actionCopyID, &QAction::triggered, this, &TransferListWidget::copySelectedIDs);
auto *actionCopyName = new QAction(UIThemeManager::instance()->getIcon(u"name"_qs), tr("&Name"), listMenu);
auto *actionCopyName = new QAction(UIThemeManager::instance()->getIcon(u"name"_qs, u"edit-copy"_qs), tr("&Name"), listMenu);
connect(actionCopyName, &QAction::triggered, this, &TransferListWidget::copySelectedNames);
auto *actionCopyHash1 = new QAction(UIThemeManager::instance()->getIcon(u"hash"_qs), tr("Info &hash v1"), listMenu);
auto *actionCopyHash1 = new QAction(UIThemeManager::instance()->getIcon(u"hash"_qs, u"edit-copy"_qs), tr("Info &hash v1"), listMenu);
connect(actionCopyHash1, &QAction::triggered, this, [this]() { copySelectedInfohashes(CopyInfohashPolicy::Version1); });
auto *actionCopyHash2 = new QAction(UIThemeManager::instance()->getIcon(u"hash"_qs), tr("Info h&ash v2"), listMenu);
auto *actionCopyHash2 = new QAction(UIThemeManager::instance()->getIcon(u"hash"_qs, u"edit-copy"_qs), tr("Info h&ash v2"), listMenu);
connect(actionCopyHash2, &QAction::triggered, this, [this]() { copySelectedInfohashes(CopyInfohashPolicy::Version2); });
auto *actionSuperSeedingMode = new TriStateAction(tr("Super seeding mode"), listMenu);
connect(actionSuperSeedingMode, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsSuperSeeding);
@ -1152,7 +1152,7 @@ void TransferListWidget::displayListMenu()
QStringList tags(BitTorrent::Session::instance()->tags().values());
std::sort(tags.begin(), tags.end(), Utils::Compare::NaturalLessThan<Qt::CaseInsensitive>());
QMenu *tagsMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"tags"_qs), tr("Ta&gs"));
QMenu *tagsMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon(u"tags"_qs, u"view-categories"_qs), tr("Ta&gs"));
tagsMenu->addAction(UIThemeManager::instance()->getIcon(u"list-add"_qs), tr("&Add...", "Add / assign multiple tags...")
, this, &TransferListWidget::askAddTagsForSelection);

View file

@ -167,7 +167,10 @@ void UIThemeManager::initInstance()
}
UIThemeManager::UIThemeManager()
: m_useCustomTheme(Preferences::instance()->useCustomUITheme())
: m_useCustomTheme {Preferences::instance()->useCustomUITheme()}
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
, m_useSystemIcons {Preferences::instance()->useSystemIcons()}
#endif
{
if (m_useCustomTheme)
{
@ -196,14 +199,25 @@ void UIThemeManager::applyStyleSheet() const
qApp->setStyleSheet(QString::fromUtf8(m_themeSource->readStyleSheet()));
}
QIcon UIThemeManager::getIcon(const QString &iconId, const QString &fallback) const
QIcon UIThemeManager::getIcon(const QString &iconId, [[maybe_unused]] const QString &fallback) const
{
// Cache to avoid rescaling svg icons
const auto iter = m_iconCache.find(iconId);
if (iter != m_iconCache.end())
return *iter;
const QIcon icon {getIconPathFromResources(iconId, fallback).data()};
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
// Don't cache system icons because users might change them at run time
if (m_useSystemIcons)
{
auto icon = QIcon::fromTheme(iconId);
if (icon.name() != iconId)
icon = QIcon::fromTheme(fallback, QIcon(getIconPathFromResources(iconId).data()));
return icon;
}
#endif
const QIcon icon {getIconPathFromResources(iconId).data()};
m_iconCache[iconId] = icon;
return icon;
}
@ -259,23 +273,33 @@ QIcon UIThemeManager::getSystrayIcon() const
Path UIThemeManager::getIconPath(const QString &iconId) const
{
return getIconPathFromResources(iconId, {});
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
if (m_useSystemIcons)
{
Path path = Utils::Fs::tempPath() / Path(iconId + u".png");
if (!path.exists())
{
const QIcon icon = QIcon::fromTheme(iconId);
if (!icon.isNull())
icon.pixmap(32).save(path.toString());
else
path = getIconPathFromResources(iconId);
}
return path;
}
#endif
return getIconPathFromResources(iconId);
}
Path UIThemeManager::getIconPathFromResources(const QString &iconId, const QString &fallback) const
Path UIThemeManager::getIconPathFromResources(const QString &iconId) const
{
if (m_useCustomTheme && m_themeSource)
{
const Path customIcon = m_themeSource->iconPath(iconId);
if (!customIcon.isEmpty())
return customIcon;
if (!fallback.isEmpty())
{
const Path fallbackIcon = m_themeSource->iconPath(fallback);
if (!fallbackIcon.isEmpty())
return fallbackIcon;
}
}
return findIcon(iconId, DEFAULT_ICONS_DIR);

View file

@ -70,13 +70,16 @@ public:
private:
UIThemeManager(); // singleton class
Path getIconPathFromResources(const QString &iconId, const QString &fallback = {}) const;
Path getIconPathFromResources(const QString &iconId) const;
void loadColorsFromJSONConfig();
void applyPalette() const;
void applyStyleSheet() const;
static UIThemeManager *m_instance;
const bool m_useCustomTheme;
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
const bool m_useSystemIcons;
#endif
std::unique_ptr<UIThemeSource> m_themeSource;
QHash<QString, QColor> m_colors;
mutable QHash<QString, QIcon> m_iconCache;