Browse Source

Merge pull request #10914 from jagannatharjun/icon-provider

Incorporate GuiIconProvider inside UIThemeManager
adaptive-webui-19844
Vladimir Golovnev 5 years ago committed by GitHub
parent
commit
620e1be5a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/app/application.cpp
  2. 2
      src/gui/CMakeLists.txt
  3. 4
      src/gui/addnewtorrentdialog.cpp
  4. 4
      src/gui/categoryfiltermodel.cpp
  5. 18
      src/gui/categoryfilterwidget.cpp
  6. 8
      src/gui/cookiesdialog.cpp
  7. 6
      src/gui/deletionconfirmationdialog.h
  8. 6
      src/gui/executionlogwidget.cpp
  9. 2
      src/gui/gui.pri
  10. 119
      src/gui/guiiconprovider.cpp
  11. 63
      src/gui/guiiconprovider.h
  12. 4
      src/gui/lineedit.cpp
  13. 6
      src/gui/loglistwidget.cpp
  14. 62
      src/gui/mainwindow.cpp
  15. 20
      src/gui/optionsdialog.cpp
  16. 12
      src/gui/properties/peerlistwidget.cpp
  17. 20
      src/gui/properties/propertieswidget.cpp
  18. 14
      src/gui/properties/proptabbar.cpp
  19. 14
      src/gui/properties/trackerlistwidget.cpp
  20. 4
      src/gui/properties/trackersadditiondialog.cpp
  21. 24
      src/gui/rss/automatedrssdownloader.cpp
  22. 14
      src/gui/rss/feedlistwidget.cpp
  23. 30
      src/gui/rss/rsswidget.cpp
  24. 4
      src/gui/search/pluginselectdialog.cpp
  25. 14
      src/gui/search/searchjobwidget.cpp
  26. 10
      src/gui/search/searchwidget.cpp
  27. 4
      src/gui/tagfiltermodel.cpp
  28. 14
      src/gui/tagfilterwidget.cpp
  29. 4
      src/gui/torrentcontentmodel.cpp
  30. 14
      src/gui/transferlistfilterswidget.cpp
  31. 59
      src/gui/transferlistwidget.cpp
  32. 60
      src/gui/uithememanager.cpp
  33. 8
      src/gui/uithememanager.h

5
src/app/application.cpp

@ -55,7 +55,6 @@ @@ -55,7 +55,6 @@
#include <QFileOpenEvent>
#endif // Q_OS_MAC
#include "addnewtorrentdialog.h"
#include "gui/guiiconprovider.h"
#include "gui/uithememanager.h"
#include "gui/utils.h"
#include "mainwindow.h"
@ -499,11 +498,7 @@ int Application::exec(const QStringList &params) @@ -499,11 +498,7 @@ int Application::exec(const QStringList &params)
{
Net::ProxyConfigurationManager::initInstance();
Net::DownloadManager::initInstance();
#ifdef DISABLE_GUI
IconProvider::initInstance();
#else
GuiIconProvider::initInstance();
#endif
try {
BitTorrent::Session::initInstance();

2
src/gui/CMakeLists.txt

@ -26,7 +26,6 @@ downloadfromurldialog.h @@ -26,7 +26,6 @@ downloadfromurldialog.h
executionlogwidget.h
fspathedit.h
fspathedit_p.h
guiiconprovider.h
hidabletabwidget.h
ipsubnetwhitelistoptionsdialog.h
lineedit.h
@ -78,7 +77,6 @@ downloadfromurldialog.cpp @@ -78,7 +77,6 @@ downloadfromurldialog.cpp
executionlogwidget.cpp
fspathedit.cpp
fspathedit_p.cpp
guiiconprovider.cpp
ipsubnetwhitelistoptionsdialog.cpp
lineedit.cpp
loglistwidget.cpp

4
src/gui/addnewtorrentdialog.cpp

@ -49,12 +49,12 @@ @@ -49,12 +49,12 @@
#include "base/utils/misc.h"
#include "base/utils/string.h"
#include "autoexpandabledialog.h"
#include "guiiconprovider.h"
#include "proplistdelegate.h"
#include "raisedmessagebox.h"
#include "torrentcontentfiltermodel.h"
#include "torrentcontentmodel.h"
#include "ui_addnewtorrentdialog.h"
#include "uithememanager.h"
#include "utils.h"
namespace
@ -472,7 +472,7 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &) @@ -472,7 +472,7 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint &)
menu->setAttribute(Qt::WA_DeleteOnClose);
if (selectedRows.size() == 1) {
QAction *actRename = menu->addAction(GuiIconProvider::instance()->getIcon("edit-rename"), tr("Rename..."));
QAction *actRename = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename..."));
connect(actRename, &QAction::triggered, this, [this]() { m_ui->contentTreeView->renameSelectedFile(m_torrentInfo); });
menu->addSeparator();

4
src/gui/categoryfiltermodel.cpp

@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
#include "base/bittorrent/session.h"
#include "base/bittorrent/torrenthandle.h"
#include "base/global.h"
#include "guiiconprovider.h"
#include "uithememanager.h"
class CategoryModelItem
{
@ -212,7 +212,7 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const @@ -212,7 +212,7 @@ QVariant CategoryFilterModel::data(const QModelIndex &index, int role) const
auto item = static_cast<const CategoryModelItem *>(index.internalPointer());
if ((index.column() == 0) && (role == Qt::DecorationRole)) {
return GuiIconProvider::instance()->getIcon("inode-directory");
return UIThemeManager::instance()->getIcon("inode-directory");
}
if ((index.column() == 0) && (role == Qt::DisplayRole)) {

18
src/gui/categoryfilterwidget.cpp

@ -35,8 +35,8 @@ @@ -35,8 +35,8 @@
#include "base/global.h"
#include "categoryfiltermodel.h"
#include "categoryfilterproxymodel.h"
#include "guiiconprovider.h"
#include "torrentcategorydialog.h"
#include "uithememanager.h"
#include "utils.h"
namespace
@ -110,7 +110,7 @@ void CategoryFilterWidget::showMenu(const QPoint &) @@ -110,7 +110,7 @@ void CategoryFilterWidget::showMenu(const QPoint &)
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *addAct = menu->addAction(
GuiIconProvider::instance()->getIcon("list-add")
UIThemeManager::instance()->getIcon("list-add")
, tr("Add category..."));
connect(addAct, &QAction::triggered, this, &CategoryFilterWidget::addCategory);
@ -118,41 +118,41 @@ void CategoryFilterWidget::showMenu(const QPoint &) @@ -118,41 +118,41 @@ void CategoryFilterWidget::showMenu(const QPoint &)
if (!selectedRows.empty() && !CategoryFilterModel::isSpecialItem(selectedRows.first())) {
if (BitTorrent::Session::instance()->isSubcategoriesEnabled()) {
const QAction *addSubAct = menu->addAction(
GuiIconProvider::instance()->getIcon("list-add")
UIThemeManager::instance()->getIcon("list-add")
, tr("Add subcategory..."));
connect(addSubAct, &QAction::triggered, this, &CategoryFilterWidget::addSubcategory);
}
const QAction *editAct = menu->addAction(
GuiIconProvider::instance()->getIcon("document-edit")
UIThemeManager::instance()->getIcon("document-edit")
, tr("Edit category..."));
connect(editAct, &QAction::triggered, this, &CategoryFilterWidget::editCategory);
const QAction *removeAct = menu->addAction(
GuiIconProvider::instance()->getIcon("list-remove")
UIThemeManager::instance()->getIcon("list-remove")
, tr("Remove category"));
connect(removeAct, &QAction::triggered, this, &CategoryFilterWidget::removeCategory);
}
const QAction *removeUnusedAct = menu->addAction(
GuiIconProvider::instance()->getIcon("list-remove")
UIThemeManager::instance()->getIcon("list-remove")
, tr("Remove unused categories"));
connect(removeUnusedAct, &QAction::triggered, this, &CategoryFilterWidget::removeUnusedCategories);
menu->addSeparator();
const QAction *startAct = menu->addAction(
GuiIconProvider::instance()->getIcon("media-playback-start")
UIThemeManager::instance()->getIcon("media-playback-start")
, tr("Resume torrents"));
connect(startAct, &QAction::triggered, this, &CategoryFilterWidget::actionResumeTorrentsTriggered);
const QAction *pauseAct = menu->addAction(
GuiIconProvider::instance()->getIcon("media-playback-pause")
UIThemeManager::instance()->getIcon("media-playback-pause")
, tr("Pause torrents"));
connect(pauseAct, &QAction::triggered, this, &CategoryFilterWidget::actionPauseTorrentsTriggered);
const QAction *deleteTorrentsAct = menu->addAction(
GuiIconProvider::instance()->getIcon("edit-delete")
UIThemeManager::instance()->getIcon("edit-delete")
, tr("Delete torrents"));
connect(deleteTorrentsAct, &QAction::triggered, this, &CategoryFilterWidget::actionDeleteTorrentsTriggered);

8
src/gui/cookiesdialog.cpp

@ -34,8 +34,8 @@ @@ -34,8 +34,8 @@
#include "base/net/downloadmanager.h"
#include "base/settingsstorage.h"
#include "cookiesmodel.h"
#include "guiiconprovider.h"
#include "ui_cookiesdialog.h"
#include "uithememanager.h"
#include "utils.h"
#define SETTINGS_KEY(name) QStringLiteral("CookiesDialog/" name)
@ -49,9 +49,9 @@ CookiesDialog::CookiesDialog(QWidget *parent) @@ -49,9 +49,9 @@ CookiesDialog::CookiesDialog(QWidget *parent)
{
m_ui->setupUi(this);
setWindowIcon(GuiIconProvider::instance()->getIcon("preferences-web-browser-cookies"));
m_ui->buttonAdd->setIcon(GuiIconProvider::instance()->getIcon("list-add"));
m_ui->buttonDelete->setIcon(GuiIconProvider::instance()->getIcon("list-remove"));
setWindowIcon(UIThemeManager::instance()->getIcon("preferences-web-browser-cookies"));
m_ui->buttonAdd->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->buttonDelete->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
m_ui->buttonAdd->setIconSize(Utils::Gui::mediumIconSize());
m_ui->buttonDelete->setIconSize(Utils::Gui::mediumIconSize());

6
src/gui/deletionconfirmationdialog.h

@ -33,8 +33,8 @@ @@ -33,8 +33,8 @@
#include <QPushButton>
#include "base/preferences.h"
#include "guiiconprovider.h"
#include "ui_deletionconfirmationdialog.h"
#include "uithememanager.h"
#include "utils.h"
class DeletionConfirmationDialog : public QDialog
@ -53,9 +53,9 @@ public: @@ -53,9 +53,9 @@ public:
m_ui->label->setText(tr("Are you sure you want to delete these %1 torrents from the transfer list?", "Are you sure you want to delete these 5 torrents from the transfer list?").arg(QString::number(size)));
// Icons
const QSize iconSize = Utils::Gui::largeIconSize();
m_ui->labelWarning->setPixmap(GuiIconProvider::instance()->getIcon("dialog-warning").pixmap(iconSize));
m_ui->labelWarning->setPixmap(UIThemeManager::instance()->getIcon("dialog-warning").pixmap(iconSize));
m_ui->labelWarning->setFixedWidth(iconSize.width());
m_ui->rememberBtn->setIcon(GuiIconProvider::instance()->getIcon("object-locked"));
m_ui->rememberBtn->setIcon(UIThemeManager::instance()->getIcon("object-locked"));
m_ui->rememberBtn->setIconSize(Utils::Gui::mediumIconSize());
m_ui->checkPermDelete->setChecked(defaultDeleteFiles || Preferences::instance()->deleteTorrentFilesAsDefault());

6
src/gui/executionlogwidget.cpp

@ -32,9 +32,9 @@ @@ -32,9 +32,9 @@
#include <QPalette>
#include "base/global.h"
#include "guiiconprovider.h"
#include "loglistwidget.h"
#include "ui_executionlogwidget.h"
#include "uithememanager.h"
ExecutionLogWidget::ExecutionLogWidget(QWidget *parent, const Log::MsgTypes &types)
: QWidget(parent)
@ -45,8 +45,8 @@ ExecutionLogWidget::ExecutionLogWidget(QWidget *parent, const Log::MsgTypes &typ @@ -45,8 +45,8 @@ ExecutionLogWidget::ExecutionLogWidget(QWidget *parent, const Log::MsgTypes &typ
m_ui->setupUi(this);
#ifndef Q_OS_MAC
m_ui->tabConsole->setTabIcon(0, GuiIconProvider::instance()->getIcon("view-calendar-journal"));
m_ui->tabConsole->setTabIcon(1, GuiIconProvider::instance()->getIcon("view-filter"));
m_ui->tabConsole->setTabIcon(0, UIThemeManager::instance()->getIcon("view-calendar-journal"));
m_ui->tabConsole->setTabIcon(1, UIThemeManager::instance()->getIcon("view-filter"));
#endif
m_ui->tabGeneral->layout()->addWidget(m_msgList);
m_ui->tabBan->layout()->addWidget(m_peerList);

2
src/gui/gui.pri

@ -20,7 +20,6 @@ HEADERS += \ @@ -20,7 +20,6 @@ HEADERS += \
$$PWD/executionlogwidget.h \
$$PWD/fspathedit.h \
$$PWD/fspathedit_p.h \
$$PWD/guiiconprovider.h \
$$PWD/hidabletabwidget.h \
$$PWD/ipsubnetwhitelistoptionsdialog.h \
$$PWD/lineedit.h \
@ -83,7 +82,6 @@ SOURCES += \ @@ -83,7 +82,6 @@ SOURCES += \
$$PWD/executionlogwidget.cpp \
$$PWD/fspathedit.cpp \
$$PWD/fspathedit_p.cpp \
$$PWD/guiiconprovider.cpp \
$$PWD/ipsubnetwhitelistoptionsdialog.cpp \
$$PWD/lineedit.cpp \
$$PWD/loglistwidget.cpp \

119
src/gui/guiiconprovider.cpp

@ -1,119 +0,0 @@ @@ -1,119 +0,0 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2011 Christophe Dumez <chris@qbittorrent.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#include "guiiconprovider.h"
#include <QHash>
#include <QIcon>
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
#include <QFile>
#endif
#include "base/preferences.h"
#include "base/utils/fs.h"
GuiIconProvider::GuiIconProvider(QObject *parent)
: IconProvider(parent)
{
configure();
connect(Preferences::instance(), &Preferences::changed, this, &GuiIconProvider::configure);
}
GuiIconProvider::~GuiIconProvider() = default;
void GuiIconProvider::initInstance()
{
if (!m_instance)
m_instance = new GuiIconProvider;
}
GuiIconProvider *GuiIconProvider::instance()
{
return static_cast<GuiIconProvider *>(m_instance);
}
QIcon GuiIconProvider::getIcon(const QString &iconId) const
{
return getIcon(iconId, iconId);
}
QIcon GuiIconProvider::getIcon(const QString &iconId, const QString &fallback) const
{
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
if (m_useSystemTheme) {
QIcon icon = QIcon::fromTheme(iconId);
if (icon.name() != iconId)
icon = QIcon::fromTheme(fallback, QIcon(IconProvider::getIconPath(iconId)));
return icon;
}
#else
Q_UNUSED(fallback)
#endif
// cache to avoid rescaling svg icons
static QHash<QString, QIcon> iconCache;
const auto iter = iconCache.find(iconId);
if (iter != iconCache.end())
return *iter;
const QIcon icon {IconProvider::getIconPath(iconId)};
iconCache[iconId] = icon;
return icon;
}
QIcon GuiIconProvider::getFlagIcon(const QString &countryIsoCode) const
{
if (countryIsoCode.isEmpty()) return {};
return QIcon(":/icons/flags/" + countryIsoCode.toLower() + ".svg");
}
QString GuiIconProvider::getIconPath(const QString &iconId) const
{
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
if (m_useSystemTheme) {
QString path = Utils::Fs::tempPath() + iconId + ".png";
if (!QFile::exists(path)) {
const QIcon icon = QIcon::fromTheme(iconId);
if (!icon.isNull())
icon.pixmap(32).save(path);
else
path = IconProvider::getIconPath(iconId);
}
return path;
}
#endif
return IconProvider::getIconPath(iconId);
}
void GuiIconProvider::configure()
{
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
m_useSystemTheme = Preferences::instance()->useSystemIconTheme();
#endif
}

63
src/gui/guiiconprovider.h

@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2011 Christophe Dumez <chris@qbittorrent.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#ifndef GUIICONPROVIDER_H
#define GUIICONPROVIDER_H
#include "base/iconprovider.h"
class QIcon;
class GuiIconProvider : public IconProvider
{
Q_DISABLE_COPY(GuiIconProvider)
Q_OBJECT
public:
static void initInstance();
static GuiIconProvider *instance();
QIcon getIcon(const QString &iconId) const;
QIcon getIcon(const QString &iconId, const QString &fallback) const;
QIcon getFlagIcon(const QString &countryIsoCode) const;
QString getIconPath(const QString &iconId) const override;
private slots:
void configure();
private:
explicit GuiIconProvider(QObject *parent = nullptr);
~GuiIconProvider() override;
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
bool m_useSystemTheme;
#endif
};
#endif // GUIICONPROVIDER_H

4
src/gui/lineedit.cpp

@ -16,13 +16,13 @@ @@ -16,13 +16,13 @@
#include <QStyle>
#include <QToolButton>
#include "guiiconprovider.h"
#include "uithememanager.h"
LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent)
{
m_searchButton = new QToolButton(this);
m_searchButton->setIcon(GuiIconProvider::instance()->getIcon("edit-find"));
m_searchButton->setIcon(UIThemeManager::instance()->getIcon("edit-find"));
m_searchButton->setCursor(Qt::ArrowCursor);
m_searchButton->setStyleSheet("QToolButton {border: none; padding: 2px;}");

6
src/gui/loglistwidget.cpp

@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
#include <QRegularExpression>
#include "base/global.h"
#include "guiiconprovider.h"
#include "uithememanager.h"
LogListWidget::LogListWidget(const int maxLines, const Log::MsgTypes &types, QWidget *parent)
: QListWidget(parent)
@ -47,8 +47,8 @@ LogListWidget::LogListWidget(const int maxLines, const Log::MsgTypes &types, QWi @@ -47,8 +47,8 @@ LogListWidget::LogListWidget(const int maxLines, const Log::MsgTypes &types, QWi
// Allow multiple selections
setSelectionMode(QAbstractItemView::ExtendedSelection);
// Context menu
auto *copyAct = new QAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy"), this);
auto *clearAct = new QAction(GuiIconProvider::instance()->getIcon("edit-clear"), tr("Clear"), this);
auto *copyAct = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy"), this);
auto *clearAct = new QAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Clear"), this);
connect(copyAct, &QAction::triggered, this, &LogListWidget::copySelection);
connect(clearAct, &QAction::triggered, this, &LogListWidget::clear);
addAction(copyAct);

62
src/gui/mainwindow.cpp

@ -73,7 +73,6 @@ @@ -73,7 +73,6 @@
#include "cookiesdialog.h"
#include "downloadfromurldialog.h"
#include "executionlogwidget.h"
#include "guiiconprovider.h"
#include "hidabletabwidget.h"
#include "lineedit.h"
#include "optionsdialog.h"
@ -86,11 +85,12 @@ @@ -86,11 +85,12 @@
#include "statsdialog.h"
#include "statusbar.h"
#include "torrentcreatordialog.h"
#include "transferlistmodel.h"
#include "trackerlistwidget.h"
#include "transferlistfilterswidget.h"
#include "transferlistmodel.h"
#include "transferlistwidget.h"
#include "ui_mainwindow.h"
#include "uithememanager.h"
#include "utils.h"
#ifdef Q_OS_MAC
@ -162,31 +162,31 @@ MainWindow::MainWindow(QWidget *parent) @@ -162,31 +162,31 @@ MainWindow::MainWindow(QWidget *parent)
addToolbarContextMenu();
m_ui->actionOpen->setIcon(GuiIconProvider::instance()->getIcon("list-add"));
m_ui->actionDownloadFromURL->setIcon(GuiIconProvider::instance()->getIcon("insert-link"));
m_ui->actionSetUploadLimit->setIcon(GuiIconProvider::instance()->getIcon("kt-set-max-upload-speed"));
m_ui->actionSetDownloadLimit->setIcon(GuiIconProvider::instance()->getIcon("kt-set-max-download-speed"));
m_ui->actionSetGlobalUploadLimit->setIcon(GuiIconProvider::instance()->getIcon("kt-set-max-upload-speed"));
m_ui->actionSetGlobalDownloadLimit->setIcon(GuiIconProvider::instance()->getIcon("kt-set-max-download-speed"));
m_ui->actionCreateTorrent->setIcon(GuiIconProvider::instance()->getIcon("document-edit"));
m_ui->actionAbout->setIcon(GuiIconProvider::instance()->getIcon("help-about"));
m_ui->actionStatistics->setIcon(GuiIconProvider::instance()->getIcon("view-statistics"));
m_ui->actionTopQueuePos->setIcon(GuiIconProvider::instance()->getIcon("go-top"));
m_ui->actionIncreaseQueuePos->setIcon(GuiIconProvider::instance()->getIcon("go-up"));
m_ui->actionDecreaseQueuePos->setIcon(GuiIconProvider::instance()->getIcon("go-down"));
m_ui->actionBottomQueuePos->setIcon(GuiIconProvider::instance()->getIcon("go-bottom"));
m_ui->actionDelete->setIcon(GuiIconProvider::instance()->getIcon("list-remove"));
m_ui->actionDocumentation->setIcon(GuiIconProvider::instance()->getIcon("help-contents"));
m_ui->actionDonateMoney->setIcon(GuiIconProvider::instance()->getIcon("wallet-open"));
m_ui->actionExit->setIcon(GuiIconProvider::instance()->getIcon("application-exit"));
m_ui->actionLock->setIcon(GuiIconProvider::instance()->getIcon("object-locked"));
m_ui->actionOptions->setIcon(GuiIconProvider::instance()->getIcon("configure", "preferences-system"));
m_ui->actionPause->setIcon(GuiIconProvider::instance()->getIcon("media-playback-pause"));
m_ui->actionPauseAll->setIcon(GuiIconProvider::instance()->getIcon("media-playback-pause"));
m_ui->actionStart->setIcon(GuiIconProvider::instance()->getIcon("media-playback-start"));
m_ui->actionStartAll->setIcon(GuiIconProvider::instance()->getIcon("media-playback-start"));
m_ui->menuAutoShutdownOnDownloadsCompletion->setIcon(GuiIconProvider::instance()->getIcon("application-exit"));
m_ui->actionManageCookies->setIcon(GuiIconProvider::instance()->getIcon("preferences-web-browser-cookies"));
m_ui->actionOpen->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->actionDownloadFromURL->setIcon(UIThemeManager::instance()->getIcon("insert-link"));
m_ui->actionSetUploadLimit->setIcon(UIThemeManager::instance()->getIcon("kt-set-max-upload-speed"));
m_ui->actionSetDownloadLimit->setIcon(UIThemeManager::instance()->getIcon("kt-set-max-download-speed"));
m_ui->actionSetGlobalUploadLimit->setIcon(UIThemeManager::instance()->getIcon("kt-set-max-upload-speed"));
m_ui->actionSetGlobalDownloadLimit->setIcon(UIThemeManager::instance()->getIcon("kt-set-max-download-speed"));
m_ui->actionCreateTorrent->setIcon(UIThemeManager::instance()->getIcon("document-edit"));
m_ui->actionAbout->setIcon(UIThemeManager::instance()->getIcon("help-about"));
m_ui->actionStatistics->setIcon(UIThemeManager::instance()->getIcon("view-statistics"));
m_ui->actionTopQueuePos->setIcon(UIThemeManager::instance()->getIcon("go-top"));
m_ui->actionIncreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon("go-up"));
m_ui->actionDecreaseQueuePos->setIcon(UIThemeManager::instance()->getIcon("go-down"));
m_ui->actionBottomQueuePos->setIcon(UIThemeManager::instance()->getIcon("go-bottom"));
m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
m_ui->actionDocumentation->setIcon(UIThemeManager::instance()->getIcon("help-contents"));
m_ui->actionDonateMoney->setIcon(UIThemeManager::instance()->getIcon("wallet-open"));
m_ui->actionExit->setIcon(UIThemeManager::instance()->getIcon("application-exit"));
m_ui->actionLock->setIcon(UIThemeManager::instance()->getIcon("object-locked"));
m_ui->actionOptions->setIcon(UIThemeManager::instance()->getIcon("configure", "preferences-system"));
m_ui->actionPause->setIcon(UIThemeManager::instance()->getIcon("media-playback-pause"));
m_ui->actionPauseAll->setIcon(UIThemeManager::instance()->getIcon("media-playback-pause"));
m_ui->actionStart->setIcon(UIThemeManager::instance()->getIcon("media-playback-start"));
m_ui->actionStartAll->setIcon(UIThemeManager::instance()->getIcon("media-playback-start"));
m_ui->menuAutoShutdownOnDownloadsCompletion->setIcon(UIThemeManager::instance()->getIcon("application-exit"));
m_ui->actionManageCookies->setIcon(UIThemeManager::instance()->getIcon("preferences-web-browser-cookies"));
auto *lockMenu = new QMenu(this);
QAction *defineUiLockPasswdAct = lockMenu->addAction(tr("&Set Password"));
@ -241,7 +241,7 @@ MainWindow::MainWindow(QWidget *parent) @@ -241,7 +241,7 @@ MainWindow::MainWindow(QWidget *parent)
m_splitter->setCollapsible(1, false);
m_tabs->addTab(m_splitter,
#ifndef Q_OS_MAC
GuiIconProvider::instance()->getIcon("folder-remote"),
UIThemeManager::instance()->getIcon("folder-remote"),
#endif
tr("Transfers"));
@ -672,7 +672,7 @@ void MainWindow::displayRSSTab(bool enable) @@ -672,7 +672,7 @@ void MainWindow::displayRSSTab(bool enable)
m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
#else
const int indexTab = m_tabs->addTab(m_rssWidget, tr("RSS (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
m_tabs->setTabIcon(indexTab, GuiIconProvider::instance()->getIcon("application-rss+xml"));
m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon("application-rss+xml"));
#endif
}
}
@ -707,7 +707,7 @@ void MainWindow::displaySearchTab(bool enable) @@ -707,7 +707,7 @@ void MainWindow::displaySearchTab(bool enable)
m_searchWidget = new SearchWidget(this);
m_tabs->insertTab(1, m_searchWidget,
#ifndef Q_OS_MAC
GuiIconProvider::instance()->getIcon("edit-find"),
UIThemeManager::instance()->getIcon("edit-find"),
#endif
tr("Search"));
}
@ -1864,7 +1864,7 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked) @@ -1864,7 +1864,7 @@ void MainWindow::on_actionExecutionLogs_triggered(bool checked)
m_tabs->addTab(m_executionLog, tr("Execution Log"));
#else
const int indexTab = m_tabs->addTab(m_executionLog, tr("Execution Log"));
m_tabs->setTabIcon(indexTab, GuiIconProvider::instance()->getIcon("view-calendar-journal"));
m_tabs->setTabIcon(indexTab, UIThemeManager::instance()->getIcon("view-calendar-journal"));
#endif
}
else if (m_executionLog) {

20
src/gui/optionsdialog.cpp

@ -61,11 +61,11 @@ @@ -61,11 +61,11 @@
#include "advancedsettings.h"
#include "app/application.h"
#include "banlistoptionsdialog.h"
#include "guiiconprovider.h"
#include "ipsubnetwhitelistoptionsdialog.h"
#include "rss/automatedrssdownloader.h"
#include "scanfoldersdelegate.h"
#include "ui_optionsdialog.h"
#include "uithememanager.h"
#include "utils.h"
namespace
@ -111,18 +111,18 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -111,18 +111,18 @@ OptionsDialog::OptionsDialog(QWidget *parent)
#endif
// Icons
m_ui->tabSelection->item(TAB_UI)->setIcon(GuiIconProvider::instance()->getIcon("preferences-desktop"));
m_ui->tabSelection->item(TAB_BITTORRENT)->setIcon(GuiIconProvider::instance()->getIcon("preferences-system-network"));
m_ui->tabSelection->item(TAB_CONNECTION)->setIcon(GuiIconProvider::instance()->getIcon("network-wired"));
m_ui->tabSelection->item(TAB_DOWNLOADS)->setIcon(GuiIconProvider::instance()->getIcon("folder-download"));
m_ui->tabSelection->item(TAB_SPEED)->setIcon(GuiIconProvider::instance()->getIcon("speedometer", "chronometer"));
m_ui->tabSelection->item(TAB_RSS)->setIcon(GuiIconProvider::instance()->getIcon("rss-config", "application-rss+xml"));
m_ui->tabSelection->item(TAB_UI)->setIcon(UIThemeManager::instance()->getIcon("preferences-desktop"));
m_ui->tabSelection->item(TAB_BITTORRENT)->setIcon(UIThemeManager::instance()->getIcon("preferences-system-network"));
m_ui->tabSelection->item(TAB_CONNECTION)->setIcon(UIThemeManager::instance()->getIcon("network-wired"));
m_ui->tabSelection->item(TAB_DOWNLOADS)->setIcon(UIThemeManager::instance()->getIcon("folder-download"));
m_ui->tabSelection->item(TAB_SPEED)->setIcon(UIThemeManager::instance()->getIcon("speedometer", "chronometer"));
m_ui->tabSelection->item(TAB_RSS)->setIcon(UIThemeManager::instance()->getIcon("rss-config", "application-rss+xml"));
#ifndef DISABLE_WEBUI
m_ui->tabSelection->item(TAB_WEBUI)->setIcon(GuiIconProvider::instance()->getIcon("network-server"));
m_ui->tabSelection->item(TAB_WEBUI)->setIcon(UIThemeManager::instance()->getIcon("network-server"));
#else
m_ui->tabSelection->item(TAB_WEBUI)->setHidden(true);
#endif
m_ui->tabSelection->item(TAB_ADVANCED)->setIcon(GuiIconProvider::instance()->getIcon("preferences-other"));
m_ui->tabSelection->item(TAB_ADVANCED)->setIcon(UIThemeManager::instance()->getIcon("preferences-other"));
// set uniform size for all icons
int maxHeight = -1;
@ -133,7 +133,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -133,7 +133,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
m_ui->tabSelection->item(i)->setSizeHint(size);
}
m_ui->IpFilterRefreshBtn->setIcon(GuiIconProvider::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->labelAltRate->setPixmap(Utils::Gui::scaledPixmap(":/icons/slow.svg", this, 16));

12
src/gui/properties/peerlistwidget.cpp

@ -47,11 +47,11 @@ @@ -47,11 +47,11 @@
#include "base/net/geoipmanager.h"
#include "base/net/reverseresolution.h"
#include "base/preferences.h"
#include "guiiconprovider.h"
#include "peerlistdelegate.h"
#include "peerlistsortmodel.h"
#include "peersadditiondialog.h"
#include "propertieswidget.h"
#include "uithememanager.h"
PeerListWidget::PeerListWidget(PropertiesWidget *parent)
: QTreeView(parent)
@ -235,7 +235,7 @@ void PeerListWidget::showPeerListMenu(const QPoint &) @@ -235,7 +235,7 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
// Add Peer Action
if (!torrent->isQueued() && !torrent->isChecking()) {
const QAction *addPeerAct = menu->addAction(GuiIconProvider::instance()->getIcon("user-group-new"), tr("Add a new peer..."));
const QAction *addPeerAct = menu->addAction(UIThemeManager::instance()->getIcon("user-group-new"), tr("Add a new peer..."));
connect(addPeerAct, &QAction::triggered, this, [this, torrent]()
{
const QList<BitTorrent::PeerAddress> peersList = PeersAdditionDialog::askForPeers(this);
@ -257,12 +257,12 @@ void PeerListWidget::showPeerListMenu(const QPoint &) @@ -257,12 +257,12 @@ void PeerListWidget::showPeerListMenu(const QPoint &)
}
if (!selectionModel()->selectedRows().isEmpty()) {
const QAction *copyPeerAct = menu->addAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy IP:port"));
const QAction *copyPeerAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy IP:port"));
connect(copyPeerAct, &QAction::triggered, this, &PeerListWidget::copySelectedPeers);
menu->addSeparator();
const QAction *banAct = menu->addAction(GuiIconProvider::instance()->getIcon("user-group-delete"), tr("Ban peer permanently"));
const QAction *banAct = menu->addAction(UIThemeManager::instance()->getIcon("user-group-delete"), tr("Ban peer permanently"));
connect(banAct, &QAction::triggered, this, &PeerListWidget::banSelectedPeers);
}
@ -378,7 +378,7 @@ QStandardItem *PeerListWidget::addPeer(const QString &ip, BitTorrent::TorrentHan @@ -378,7 +378,7 @@ QStandardItem *PeerListWidget::addPeer(const QString &ip, BitTorrent::TorrentHan
m_listModel->setData(m_listModel->index(row, PeerListDelegate::PORT), peer.address().port);
m_listModel->setData(m_listModel->index(row, PeerListDelegate::IP_HIDDEN), ip);
if (m_resolveCountries) {
const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());
const QIcon ico = UIThemeManager::instance()->getFlagIcon(peer.country());
if (!ico.isNull()) {
m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);
const QString countryName = Net::GeoIPManager::CountryName(peer.country());
@ -410,7 +410,7 @@ void PeerListWidget::updatePeer(const QString &ip, BitTorrent::TorrentHandle *co @@ -410,7 +410,7 @@ void PeerListWidget::updatePeer(const QString &ip, BitTorrent::TorrentHandle *co
QStandardItem *item = m_peerItems.value(ip);
int row = item->row();
if (m_resolveCountries) {
const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());
const QIcon ico = UIThemeManager::instance()->getFlagIcon(peer.country());
if (!ico.isNull()) {
m_listModel->setData(m_listModel->index(row, PeerListDelegate::COUNTRY), ico, Qt::DecorationRole);
const QString countryName = Net::GeoIPManager::CountryName(peer.country());

20
src/gui/properties/propertieswidget.cpp

@ -52,7 +52,6 @@ @@ -52,7 +52,6 @@
#include "base/utils/string.h"
#include "autoexpandabledialog.h"
#include "downloadedpiecesbar.h"
#include "guiiconprovider.h"
#include "lineedit.h"
#include "peerlistwidget.h"
#include "pieceavailabilitybar.h"
@ -63,6 +62,7 @@ @@ -63,6 +62,7 @@
#include "torrentcontentfiltermodel.h"
#include "torrentcontentmodel.h"
#include "trackerlistwidget.h"
#include "uithememanager.h"
#include "utils.h"
#include "ui_propertieswidget.h"
@ -131,9 +131,9 @@ PropertiesWidget::PropertiesWidget(QWidget *parent) @@ -131,9 +131,9 @@ PropertiesWidget::PropertiesWidget(QWidget *parent)
// Tracker list
m_trackerList = new TrackerListWidget(this);
m_ui->trackerUpButton->setIcon(GuiIconProvider::instance()->getIcon("go-up"));
m_ui->trackerUpButton->setIcon(UIThemeManager::instance()->getIcon("go-up"));
m_ui->trackerUpButton->setIconSize(Utils::Gui::smallIconSize());
m_ui->trackerDownButton->setIcon(GuiIconProvider::instance()->getIcon("go-down"));
m_ui->trackerDownButton->setIcon(UIThemeManager::instance()->getIcon("go-down"));
m_ui->trackerDownButton->setIconSize(Utils::Gui::smallIconSize());
connect(m_ui->trackerUpButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionUp);
connect(m_ui->trackerDownButton, &QPushButton::clicked, m_trackerList, &TrackerListWidget::moveSelectionDown);
@ -586,13 +586,13 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &) @@ -586,13 +586,13 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &)
if (selectedRows.size() == 1) {
const QModelIndex index = selectedRows[0];
const QAction *actOpen = menu->addAction(GuiIconProvider::instance()->getIcon("folder-documents"), tr("Open"));
const QAction *actOpen = menu->addAction(UIThemeManager::instance()->getIcon("folder-documents"), tr("Open"));
connect(actOpen, &QAction::triggered, this, [this, index]() { openDoubleClickedFile(index); });
const QAction *actOpenContainingFolder = menu->addAction(GuiIconProvider::instance()->getIcon("inode-directory"), tr("Open Containing Folder"));
const QAction *actOpenContainingFolder = menu->addAction(UIThemeManager::instance()->getIcon("inode-directory"), tr("Open Containing Folder"));
connect(actOpenContainingFolder, &QAction::triggered, this, [this, index]() { openFolder(index, true); });
const QAction *actRename = menu->addAction(GuiIconProvider::instance()->getIcon("edit-rename"), tr("Rename..."));
const QAction *actRename = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename..."));
connect(actRename, &QAction::triggered, this, [this]() { m_ui->filesList->renameSelectedFile(m_torrent); });
menu->addSeparator();
@ -658,19 +658,19 @@ void PropertiesWidget::displayWebSeedListMenu(const QPoint &) @@ -658,19 +658,19 @@ void PropertiesWidget::displayWebSeedListMenu(const QPoint &)
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *actAdd = menu->addAction(GuiIconProvider::instance()->getIcon("list-add"), tr("New Web seed"));
const QAction *actAdd = menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("New Web seed"));
connect(actAdd, &QAction::triggered, this, &PropertiesWidget::askWebSeed);
if (!rows.isEmpty()) {
const QAction *actDel = menu->addAction(GuiIconProvider::instance()->getIcon("list-remove"), tr("Remove Web seed"));
const QAction *actDel = menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove Web seed"));
connect(actDel, &QAction::triggered, this, &PropertiesWidget::deleteSelectedUrlSeeds);
menu->addSeparator();
const QAction *actCpy = menu->addAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy Web seed URL"));
const QAction *actCpy = menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy Web seed URL"));
connect(actCpy, &QAction::triggered, this, &PropertiesWidget::copySelectedWebSeedsToClipboard);
const QAction *actEdit = menu->addAction(GuiIconProvider::instance()->getIcon("edit-rename"), tr("Edit Web seed URL"));
const QAction *actEdit = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit Web seed URL"));
connect(actEdit, &QAction::triggered, this, &PropertiesWidget::editWebSeed);
}

14
src/gui/properties/proptabbar.cpp

@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
#include <QSpacerItem>
#include "base/global.h"
#include "guiiconprovider.h"
#include "uithememanager.h"
PropTabBar::PropTabBar(QWidget *parent)
: QHBoxLayout(parent)
@ -46,7 +46,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -46,7 +46,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// General tab
QPushButton *mainInfosButton = new QPushButton(
#ifndef Q_OS_MAC
GuiIconProvider::instance()->getIcon("document-properties"),
UIThemeManager::instance()->getIcon("document-properties"),
#endif
tr("General"), parent);
mainInfosButton->setShortcut(Qt::ALT + Qt::Key_G);
@ -55,7 +55,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -55,7 +55,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Trackers tab
QPushButton *trackersButton = new QPushButton(
#ifndef Q_OS_MAC
GuiIconProvider::instance()->getIcon("network-server"),
UIThemeManager::instance()->getIcon("network-server"),
#endif
tr("Trackers"), parent);
trackersButton->setShortcut(Qt::ALT + Qt::Key_C);
@ -64,7 +64,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -64,7 +64,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Peers tab
QPushButton *peersButton = new QPushButton(
#ifndef Q_OS_MAC
GuiIconProvider::instance()->getIcon("edit-find-user"),
UIThemeManager::instance()->getIcon("edit-find-user"),
#endif
tr("Peers"), parent);
peersButton->setShortcut(Qt::ALT + Qt::Key_R);
@ -73,7 +73,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -73,7 +73,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// URL seeds tab
QPushButton *URLSeedsButton = new QPushButton(
#ifndef Q_OS_MAC
GuiIconProvider::instance()->getIcon("network-server"),
UIThemeManager::instance()->getIcon("network-server"),
#endif
tr("HTTP Sources"), parent);
URLSeedsButton->setShortcut(Qt::ALT + Qt::Key_B);
@ -82,7 +82,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -82,7 +82,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Files tab
QPushButton *filesButton = new QPushButton(
#ifndef Q_OS_MAC
GuiIconProvider::instance()->getIcon("inode-directory"),
UIThemeManager::instance()->getIcon("inode-directory"),
#endif
tr("Content"), parent);
filesButton->setShortcut(Qt::ALT + Qt::Key_Z);
@ -93,7 +93,7 @@ PropTabBar::PropTabBar(QWidget *parent) @@ -93,7 +93,7 @@ PropTabBar::PropTabBar(QWidget *parent)
// Speed tab
QPushButton *speedButton = new QPushButton(
#ifndef Q_OS_MAC
GuiIconProvider::instance()->getIcon("office-chart-line"),
UIThemeManager::instance()->getIcon("office-chart-line"),
#endif
tr("Speed"), parent);
speedButton->setShortcut(Qt::ALT + Qt::Key_D);

14
src/gui/properties/trackerlistwidget.cpp

@ -50,9 +50,9 @@ @@ -50,9 +50,9 @@
#include "base/global.h"
#include "base/preferences.h"
#include "autoexpandabledialog.h"
#include "guiiconprovider.h"
#include "propertieswidget.h"
#include "trackersadditiondialog.h"
#include "uithememanager.h"
#define NB_STICKY_ITEM 3
@ -553,27 +553,27 @@ void TrackerListWidget::showTrackerListMenu(const QPoint &) @@ -553,27 +553,27 @@ void TrackerListWidget::showTrackerListMenu(const QPoint &)
menu->setAttribute(Qt::WA_DeleteOnClose);
// Add actions
const QAction *addAct = menu->addAction(GuiIconProvider::instance()->getIcon("list-add"), tr("Add a new tracker..."));
const QAction *addAct = menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add a new tracker..."));
connect(addAct, &QAction::triggered, this, &TrackerListWidget::askForTrackers);
if (!getSelectedTrackerItems().isEmpty()) {
const QAction *editAct = menu->addAction(GuiIconProvider::instance()->getIcon("edit-rename"),tr("Edit tracker URL..."));
const QAction *editAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"),tr("Edit tracker URL..."));
connect(editAct, &QAction::triggered, this, &TrackerListWidget::editSelectedTracker);
const QAction *delAct = menu->addAction(GuiIconProvider::instance()->getIcon("list-remove"), tr("Remove tracker"));
const QAction *delAct = menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Remove tracker"));
connect(delAct, &QAction::triggered, this, &TrackerListWidget::deleteSelectedTrackers);
const QAction *copyAct = menu->addAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy tracker URL"));
const QAction *copyAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy tracker URL"));
connect(copyAct, &QAction::triggered, this, &TrackerListWidget::copyTrackerUrl);
}
if (!torrent->isPaused()) {
const QAction *reannounceSelAct = menu->addAction(GuiIconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers"));
const QAction *reannounceSelAct = menu->addAction(UIThemeManager::instance()->getIcon("view-refresh"), tr("Force reannounce to selected trackers"));
connect(reannounceSelAct, &QAction::triggered, this, &TrackerListWidget::reannounceSelected);
menu->addSeparator();
const QAction *reannounceAllAct = menu->addAction(GuiIconProvider::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers"));
const QAction *reannounceAllAct = menu->addAction(UIThemeManager::instance()->getIcon("view-refresh"), tr("Force reannounce to all trackers"));
connect(reannounceAllAct, &QAction::triggered, this, [this]()
{
BitTorrent::TorrentHandle *h = m_properties->getCurrentTorrent();

4
src/gui/properties/trackersadditiondialog.cpp

@ -36,8 +36,8 @@ @@ -36,8 +36,8 @@
#include "base/bittorrent/trackerentry.h"
#include "base/global.h"
#include "base/net/downloadmanager.h"
#include "guiiconprovider.h"
#include "ui_trackersadditiondialog.h"
#include "uithememanager.h"
TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::TorrentHandle *const torrent)
: QDialog(parent)
@ -46,7 +46,7 @@ TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::Torr @@ -46,7 +46,7 @@ TrackersAdditionDialog::TrackersAdditionDialog(QWidget *parent, BitTorrent::Torr
{
m_ui->setupUi(this);
// Icons
m_ui->uTorrentListButton->setIcon(GuiIconProvider::instance()->getIcon("download"));
m_ui->uTorrentListButton->setIcon(UIThemeManager::instance()->getIcon("download"));
}
TrackersAdditionDialog::~TrackersAdditionDialog()

24
src/gui/rss/automatedrssdownloader.cpp

@ -50,8 +50,8 @@ @@ -50,8 +50,8 @@
#include "base/utils/fs.h"
#include "base/utils/string.h"
#include "autoexpandabledialog.h"
#include "guiiconprovider.h"
#include "ui_automatedrssdownloader.h"
#include "uithememanager.h"
#include "utils.h"
const QString EXT_JSON {QStringLiteral(".json")};
@ -66,8 +66,8 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent) @@ -66,8 +66,8 @@ AutomatedRssDownloader::AutomatedRssDownloader(QWidget *parent)
{
m_ui->setupUi(this);
// Icons
m_ui->removeRuleBtn->setIcon(GuiIconProvider::instance()->getIcon("list-remove"));
m_ui->addRuleBtn->setIcon(GuiIconProvider::instance()->getIcon("list-add"));
m_ui->removeRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
m_ui->addRuleBtn->setIcon(UIThemeManager::instance()->getIcon("list-add"));
// Ui Settings
m_ui->listRules->setSortingEnabled(true);
@ -469,29 +469,29 @@ void AutomatedRssDownloader::displayRulesListMenu() @@ -469,29 +469,29 @@ void AutomatedRssDownloader::displayRulesListMenu()
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *addAct = menu->addAction(GuiIconProvider::instance()->getIcon("list-add"), tr("Add new rule..."));
const QAction *addAct = menu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add new rule..."));
connect(addAct, &QAction::triggered, this, &AutomatedRssDownloader::on_addRuleBtn_clicked);
const QList<QListWidgetItem *> selection = m_ui->listRules->selectedItems();
if (!selection.isEmpty()) {
if (selection.count() == 1) {
const QAction *delAct = menu->addAction(GuiIconProvider::instance()->getIcon("list-remove"), tr("Delete rule"));
const QAction *delAct = menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete rule"));
connect(delAct, &QAction::triggered, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
menu->addSeparator();
const QAction *renameAct = menu->addAction(GuiIconProvider::instance()->getIcon("edit-rename"), tr("Rename rule..."));
const QAction *renameAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename rule..."));
connect(renameAct, &QAction::triggered, this, &AutomatedRssDownloader::renameSelectedRule);
}
else {
const QAction *delAct = menu->addAction(GuiIconProvider::instance()->getIcon("list-remove"), tr("Delete selected rules"));
const QAction *delAct = menu->addAction(UIThemeManager::instance()->getIcon("list-remove"), tr("Delete selected rules"));
connect(delAct, &QAction::triggered, this, &AutomatedRssDownloader::on_removeRuleBtn_clicked);
}
menu->addSeparator();
const QAction *clearAct = menu->addAction(GuiIconProvider::instance()->getIcon("edit-clear"), tr("Clear downloaded episodes..."));
const QAction *clearAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Clear downloaded episodes..."));
connect(clearAct, &QAction::triggered, this, &AutomatedRssDownloader::clearSelectedRuleDownloadedEpisodeList);
}
@ -611,7 +611,7 @@ void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStrin @@ -611,7 +611,7 @@ void AutomatedRssDownloader::addFeedArticlesToTree(RSS::Feed *feed, const QStrin
QFont f = treeFeedItem->font(0);
f.setBold(true);
treeFeedItem->setFont(0, f);
treeFeedItem->setData(0, Qt::DecorationRole, GuiIconProvider::instance()->getIcon("inode-directory"));
treeFeedItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon("inode-directory"));
treeFeedItem->setData(0, Qt::UserRole, feed->url());
m_ui->treeMatchingArticles->addTopLevelItem(treeFeedItem);
}
@ -693,7 +693,7 @@ void AutomatedRssDownloader::updateMustLineValidity() @@ -693,7 +693,7 @@ void AutomatedRssDownloader::updateMustLineValidity()
}
else {
m_ui->lineContains->setStyleSheet("QLineEdit { color: #ff0000; }");
m_ui->labelMustStat->setPixmap(GuiIconProvider::instance()->getIcon("task-attention").pixmap(16, 16));
m_ui->labelMustStat->setPixmap(UIThemeManager::instance()->getIcon("task-attention").pixmap(16, 16));
m_ui->labelMustStat->setToolTip(error);
}
}
@ -731,7 +731,7 @@ void AutomatedRssDownloader::updateMustNotLineValidity() @@ -731,7 +731,7 @@ void AutomatedRssDownloader::updateMustNotLineValidity()
}
else {
m_ui->lineNotContains->setStyleSheet("QLineEdit { color: #ff0000; }");
m_ui->labelMustNotStat->setPixmap(GuiIconProvider::instance()->getIcon("task-attention").pixmap(16, 16));
m_ui->labelMustNotStat->setPixmap(UIThemeManager::instance()->getIcon("task-attention").pixmap(16, 16));
m_ui->labelMustNotStat->setToolTip(error);
}
}
@ -747,7 +747,7 @@ void AutomatedRssDownloader::updateEpisodeFilterValidity() @@ -747,7 +747,7 @@ void AutomatedRssDownloader::updateEpisodeFilterValidity()
}
else {
m_ui->lineEFilter->setStyleSheet("QLineEdit { color: #ff0000; }");
m_ui->labelEpFilterStat->setPixmap(GuiIconProvider::instance()->getIcon("task-attention").pixmap(16, 16));
m_ui->labelEpFilterStat->setPixmap(UIThemeManager::instance()->getIcon("task-attention").pixmap(16, 16));
}
}

14
src/gui/rss/feedlistwidget.cpp

@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
#include "base/rss/rss_feed.h"
#include "base/rss/rss_folder.h"
#include "base/rss/rss_session.h"
#include "guiiconprovider.h"
#include "uithememanager.h"
FeedListWidget::FeedListWidget(QWidget *parent)
: QTreeWidget(parent)
@ -60,7 +60,7 @@ FeedListWidget::FeedListWidget(QWidget *parent) @@ -60,7 +60,7 @@ FeedListWidget::FeedListWidget(QWidget *parent)
m_unreadStickyItem = new QTreeWidgetItem(this);
m_unreadStickyItem->setData(0, Qt::UserRole, reinterpret_cast<quintptr>(RSS::Session::instance()->rootFolder()));
m_unreadStickyItem->setText(0, tr("Unread (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
m_unreadStickyItem->setData(0, Qt::DecorationRole, GuiIconProvider::instance()->getIcon("mail-folder-inbox"));
m_unreadStickyItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon("mail-folder-inbox"));
connect(RSS::Session::instance()->rootFolder(), &RSS::Item::unreadCountChanged, this, &FeedListWidget::handleItemUnreadCountChanged);
@ -92,11 +92,11 @@ void FeedListWidget::handleFeedStateChanged(RSS::Feed *feed) @@ -92,11 +92,11 @@ void FeedListWidget::handleFeedStateChanged(RSS::Feed *feed)
if (feed->isLoading())
icon = QIcon(QStringLiteral(":/icons/loading.png"));
else if (feed->hasError())
icon = GuiIconProvider::instance()->getIcon(QStringLiteral("unavailable"));
icon = UIThemeManager::instance()->getIcon(QStringLiteral("unavailable"));
else if (!feed->iconPath().isEmpty())
icon = QIcon(feed->iconPath());
else
icon = GuiIconProvider::instance()->getIcon(QStringLiteral("application-rss+xml"));
icon = UIThemeManager::instance()->getIcon(QStringLiteral("application-rss+xml"));
item->setData(0, Qt::DecorationRole, icon);
}
@ -242,14 +242,14 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem @@ -242,14 +242,14 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
if (feed->isLoading())
icon = QIcon(QStringLiteral(":/icons/loading.png"));
else if (feed->hasError())
icon = GuiIconProvider::instance()->getIcon(QStringLiteral("unavailable"));
icon = UIThemeManager::instance()->getIcon(QStringLiteral("unavailable"));
else if (!feed->iconPath().isEmpty())
icon = QIcon(feed->iconPath());
else
icon = GuiIconProvider::instance()->getIcon(QStringLiteral("application-rss+xml"));
icon = UIThemeManager::instance()->getIcon(QStringLiteral("application-rss+xml"));
}
else {
icon = GuiIconProvider::instance()->getIcon("inode-directory");
icon = UIThemeManager::instance()->getIcon("inode-directory");
}
item->setData(0, Qt::DecorationRole, icon);

30
src/gui/rss/rsswidget.cpp

@ -52,8 +52,8 @@ @@ -52,8 +52,8 @@
#include "autoexpandabledialog.h"
#include "automatedrssdownloader.h"
#include "feedlistwidget.h"
#include "guiiconprovider.h"
#include "ui_rsswidget.h"
#include "uithememanager.h"
RSSWidget::RSSWidget(QWidget *parent)
: QWidget(parent)
@ -62,21 +62,21 @@ RSSWidget::RSSWidget(QWidget *parent) @@ -62,21 +62,21 @@ RSSWidget::RSSWidget(QWidget *parent)
m_ui->setupUi(this);
// Icons
m_ui->actionCopyFeedURL->setIcon(GuiIconProvider::instance()->getIcon("edit-copy"));
m_ui->actionDelete->setIcon(GuiIconProvider::instance()->getIcon("edit-delete"));
m_ui->actionDownloadTorrent->setIcon(GuiIconProvider::instance()->getIcon("download"));
m_ui->actionMarkItemsRead->setIcon(GuiIconProvider::instance()->getIcon("mail-mark-read"));
m_ui->actionNewFolder->setIcon(GuiIconProvider::instance()->getIcon("folder-new"));
m_ui->actionNewSubscription->setIcon(GuiIconProvider::instance()->getIcon("list-add"));
m_ui->actionOpenNewsURL->setIcon(GuiIconProvider::instance()->getIcon("application-x-mswinurl"));
m_ui->actionRename->setIcon(GuiIconProvider::instance()->getIcon("edit-rename"));
m_ui->actionUpdate->setIcon(GuiIconProvider::instance()->getIcon("view-refresh"));
m_ui->actionUpdateAllFeeds->setIcon(GuiIconProvider::instance()->getIcon("view-refresh"));
m_ui->actionCopyFeedURL->setIcon(UIThemeManager::instance()->getIcon("edit-copy"));
m_ui->actionDelete->setIcon(UIThemeManager::instance()->getIcon("edit-delete"));
m_ui->actionDownloadTorrent->setIcon(UIThemeManager::instance()->getIcon("download"));
m_ui->actionMarkItemsRead->setIcon(UIThemeManager::instance()->getIcon("mail-mark-read"));
m_ui->actionNewFolder->setIcon(UIThemeManager::instance()->getIcon("folder-new"));
m_ui->actionNewSubscription->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->actionOpenNewsURL->setIcon(UIThemeManager::instance()->getIcon("application-x-mswinurl"));
m_ui->actionRename->setIcon(UIThemeManager::instance()->getIcon("edit-rename"));
m_ui->actionUpdate->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
m_ui->actionUpdateAllFeeds->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
#ifndef Q_OS_MAC
m_ui->newFeedButton->setIcon(GuiIconProvider::instance()->getIcon("list-add"));
m_ui->markReadButton->setIcon(GuiIconProvider::instance()->getIcon("mail-mark-read"));
m_ui->updateAllButton->setIcon(GuiIconProvider::instance()->getIcon("view-refresh"));
m_ui->rssDownloaderBtn->setIcon(GuiIconProvider::instance()->getIcon("download"));
m_ui->newFeedButton->setIcon(UIThemeManager::instance()->getIcon("list-add"));
m_ui->markReadButton->setIcon(UIThemeManager::instance()->getIcon("mail-mark-read"));
m_ui->updateAllButton->setIcon(UIThemeManager::instance()->getIcon("view-refresh"));
m_ui->rssDownloaderBtn->setIcon(UIThemeManager::instance()->getIcon("download"));
#endif
m_articleListWidget = new ArticleListWidget(m_ui->splitterMain);

4
src/gui/search/pluginselectdialog.cpp

@ -43,10 +43,10 @@ @@ -43,10 +43,10 @@
#include "base/net/downloadmanager.h"
#include "base/utils/fs.h"
#include "autoexpandabledialog.h"
#include "guiiconprovider.h"
#include "pluginsourcedialog.h"
#include "searchwidget.h"
#include "ui_pluginselectdialog.h"
#include "uithememanager.h"
#include "utils.h"
enum PluginColumns
@ -79,7 +79,7 @@ PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidg @@ -79,7 +79,7 @@ PluginSelectDialog::PluginSelectDialog(SearchPluginManager *pluginManager, QWidg
m_ui->pluginsTree->hideColumn(PLUGIN_ID);
m_ui->pluginsTree->header()->setSortIndicator(0, Qt::AscendingOrder);
m_ui->actionUninstall->setIcon(GuiIconProvider::instance()->getIcon("list-remove"));
m_ui->actionUninstall->setIcon(UIThemeManager::instance()->getIcon("list-remove"));
connect(m_ui->actionEnable, &QAction::toggled, this, &PluginSelectDialog::enableSelection);
connect(m_ui->pluginsTree, &QTreeWidget::customContextMenuRequested, this, &PluginSelectDialog::displayContextMenu);

14
src/gui/search/searchjobwidget.cpp

@ -48,11 +48,11 @@ @@ -48,11 +48,11 @@
#include "base/settingvalue.h"
#include "base/utils/misc.h"
#include "addnewtorrentdialog.h"
#include "guiiconprovider.h"
#include "lineedit.h"
#include "searchlistdelegate.h"
#include "searchsortmodel.h"
#include "ui_searchjobwidget.h"
#include "uithememanager.h"
#include "utils.h"
SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent)
@ -390,29 +390,29 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event) @@ -390,29 +390,29 @@ void SearchJobWidget::contextMenuEvent(QContextMenuEvent *event)
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *downloadAction = menu->addAction(
GuiIconProvider::instance()->getIcon("download"), tr("Download"));
UIThemeManager::instance()->getIcon("download"), tr("Download"));
connect(downloadAction, &QAction::triggered, this, &SearchJobWidget::downloadTorrents);
menu->addSeparator();
const QAction *openDescriptionAction = menu->addAction(
GuiIconProvider::instance()->getIcon("application-x-mswinurl"), tr("Open description page"));
UIThemeManager::instance()->getIcon("application-x-mswinurl"), tr("Open description page"));
connect(openDescriptionAction, &QAction::triggered, this, &SearchJobWidget::openTorrentPages);
QMenu *copySubMenu = menu->addMenu(
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy"));
UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy"));
const QAction *copyNamesAction = copySubMenu->addAction(
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Name"));
UIThemeManager::instance()->getIcon("edit-copy"), tr("Name"));
connect(copyNamesAction, &QAction::triggered, this, &SearchJobWidget::copyTorrentNames);
const QAction *copyDownloadLinkAction = copySubMenu->addAction(
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Download link"));
UIThemeManager::instance()->getIcon("edit-copy"), tr("Download link"));
connect(copyDownloadLinkAction, &QAction::triggered
, this, &SearchJobWidget::copyTorrentDownloadLinks);
const QAction *copyDescriptionAction = copySubMenu->addAction(
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Description page URL"));
UIThemeManager::instance()->getIcon("edit-copy"), tr("Description page URL"));
connect(copyDescriptionAction, &QAction::triggered, this, &SearchJobWidget::copyTorrentURLs);
menu->popup(event->globalPos());

10
src/gui/search/searchwidget.cpp

@ -43,14 +43,14 @@ @@ -43,14 +43,14 @@
#include <QVector>
#include "base/global.h"
#include "base/search/searchpluginmanager.h"
#include "base/search/searchhandler.h"
#include "base/search/searchpluginmanager.h"
#include "base/utils/foreignapps.h"
#include "guiiconprovider.h"
#include "mainwindow.h"
#include "pluginselectdialog.h"
#include "searchjobwidget.h"
#include "ui_searchwidget.h"
#include "uithememanager.h"
#define SEARCHHISTORY_MAXSIZE 50
#define URL_COLUMN 5
@ -104,8 +104,8 @@ SearchWidget::SearchWidget(MainWindow *mainWindow) @@ -104,8 +104,8 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
#ifndef Q_OS_MAC
// Icons
m_ui->searchButton->setIcon(GuiIconProvider::instance()->getIcon("edit-find"));
m_ui->pluginsButton->setIcon(GuiIconProvider::instance()->getIcon("preferences-system-network"));
m_ui->searchButton->setIcon(UIThemeManager::instance()->getIcon("edit-find"));
m_ui->pluginsButton->setIcon(UIThemeManager::instance()->getIcon("preferences-system-network"));
#else
// On macOS the icons overlap the text otherwise
QSize iconSize = m_ui->tabWidget->iconSize();
@ -318,7 +318,7 @@ void SearchWidget::tabStatusChanged(QWidget *tab) @@ -318,7 +318,7 @@ void SearchWidget::tabStatusChanged(QWidget *tab)
{
const int tabIndex = m_ui->tabWidget->indexOf(tab);
m_ui->tabWidget->setTabToolTip(tabIndex, tab->statusTip());
m_ui->tabWidget->setTabIcon(tabIndex, GuiIconProvider::instance()->getIcon(
m_ui->tabWidget->setTabIcon(tabIndex, UIThemeManager::instance()->getIcon(
statusIconName(static_cast<SearchJobWidget *>(tab)->status())));
if ((tab == m_activeSearchTab) && (m_activeSearchTab->status() != SearchJobWidget::Status::Ongoing)) {

4
src/gui/tagfiltermodel.cpp

@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
#include "base/bittorrent/session.h"
#include "base/bittorrent/torrenthandle.h"
#include "base/global.h"
#include "guiiconprovider.h"
#include "uithememanager.h"
namespace
{
@ -122,7 +122,7 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const @@ -122,7 +122,7 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const
switch (role) {
case Qt::DecorationRole:
return GuiIconProvider::instance()->getIcon("inode-directory");
return UIThemeManager::instance()->getIcon("inode-directory");
case Qt::DisplayRole:
return QString(QLatin1String("%1 (%2)"))
.arg(tagDisplayName(item.tag())).arg(item.torrentsCount());

14
src/gui/tagfilterwidget.cpp

@ -35,9 +35,9 @@ @@ -35,9 +35,9 @@
#include "base/bittorrent/session.h"
#include "base/global.h"
#include "autoexpandabledialog.h"
#include "guiiconprovider.h"
#include "tagfiltermodel.h"
#include "tagfilterproxymodel.h"
#include "uithememanager.h"
#include "utils.h"
namespace
@ -108,39 +108,39 @@ void TagFilterWidget::showMenu(QPoint) @@ -108,39 +108,39 @@ void TagFilterWidget::showMenu(QPoint)
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *addAct = menu->addAction(
GuiIconProvider::instance()->getIcon("list-add")
UIThemeManager::instance()->getIcon("list-add")
, tr("Add tag..."));
connect(addAct, &QAction::triggered, this, &TagFilterWidget::addTag);
const auto selectedRows = selectionModel()->selectedRows();
if (!selectedRows.empty() && !TagFilterModel::isSpecialItem(selectedRows.first())) {
const QAction *removeAct = menu->addAction(
GuiIconProvider::instance()->getIcon("list-remove")
UIThemeManager::instance()->getIcon("list-remove")
, tr("Remove tag"));
connect(removeAct, &QAction::triggered, this, &TagFilterWidget::removeTag);
}
const QAction *removeUnusedAct = menu->addAction(
GuiIconProvider::instance()->getIcon("list-remove")
UIThemeManager::instance()->getIcon("list-remove")
, tr("Remove unused tags"));
connect(removeUnusedAct, &QAction::triggered, this, &TagFilterWidget::removeUnusedTags);
menu->addSeparator();
const QAction *startAct = menu->addAction(
GuiIconProvider::instance()->getIcon("media-playback-start")
UIThemeManager::instance()->getIcon("media-playback-start")
, tr("Resume torrents"));
connect(startAct, &QAction::triggered
, this, &TagFilterWidget::actionResumeTorrentsTriggered);
const QAction *pauseAct = menu->addAction(
GuiIconProvider::instance()->getIcon("media-playback-pause")
UIThemeManager::instance()->getIcon("media-playback-pause")
, tr("Pause torrents"));
connect(pauseAct, &QAction::triggered, this
, &TagFilterWidget::actionPauseTorrentsTriggered);
const QAction *deleteTorrentsAct = menu->addAction(
GuiIconProvider::instance()->getIcon("edit-delete")
UIThemeManager::instance()->getIcon("edit-delete")
, tr("Delete torrents"));
connect(deleteTorrentsAct, &QAction::triggered, this
, &TagFilterWidget::actionDeleteTorrentsTriggered);

4
src/gui/torrentcontentmodel.cpp

@ -52,10 +52,10 @@ @@ -52,10 +52,10 @@
#include "base/bittorrent/torrentinfo.h"
#include "base/global.h"
#include "base/utils/fs.h"
#include "guiiconprovider.h"
#include "torrentcontentmodelfile.h"
#include "torrentcontentmodelfolder.h"
#include "torrentcontentmodelitem.h"
#include "uithememanager.h"
#ifdef Q_OS_MAC
#include "macutilities.h"
@ -71,7 +71,7 @@ namespace @@ -71,7 +71,7 @@ namespace
QIcon icon(const QFileInfo &info) const override
{
Q_UNUSED(info);
static QIcon cached = GuiIconProvider::instance()->getIcon("text-plain");
static QIcon cached = UIThemeManager::instance()->getIcon("text-plain");
return cached;
}
};

14
src/gui/transferlistfilterswidget.cpp

@ -49,9 +49,9 @@ @@ -49,9 +49,9 @@
#include "base/utils/fs.h"
#include "base/utils/string.h"
#include "categoryfilterwidget.h"
#include "guiiconprovider.h"
#include "tagfilterwidget.h"
#include "transferlistwidget.h"
#include "uithememanager.h"
#include "utils.h"
namespace
@ -221,10 +221,10 @@ TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *tran @@ -221,10 +221,10 @@ TrackerFiltersList::TrackerFiltersList(QWidget *parent, TransferListWidget *tran
{
auto *allTrackers = new QListWidgetItem(this);
allTrackers->setData(Qt::DisplayRole, QVariant(tr("All (0)", "this is for the tracker filter")));
allTrackers->setData(Qt::DecorationRole, GuiIconProvider::instance()->getIcon("network-server"));
allTrackers->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon("network-server"));
auto *noTracker = new QListWidgetItem(this);
noTracker->setData(Qt::DisplayRole, QVariant(tr("Trackerless (0)")));
noTracker->setData(Qt::DecorationRole, GuiIconProvider::instance()->getIcon("network-server"));
noTracker->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon("network-server"));
auto *errorTracker = new QListWidgetItem(this);
errorTracker->setData(Qt::DisplayRole, QVariant(tr("Error (0)")));
errorTracker->setData(Qt::DecorationRole, style()->standardIcon(QStyle::SP_MessageBoxCritical));
@ -264,7 +264,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash) @@ -264,7 +264,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash)
}
else {
trackerItem = new QListWidgetItem();
trackerItem->setData(Qt::DecorationRole, GuiIconProvider::instance()->getIcon("network-server"));
trackerItem->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon("network-server"));
const QString scheme = getScheme(tracker);
downloadFavicon(QString("%1://%2/favicon.ico").arg((scheme.startsWith("http") ? scheme : "http"), host));
@ -470,13 +470,13 @@ void TrackerFiltersList::showMenu(const QPoint &) @@ -470,13 +470,13 @@ void TrackerFiltersList::showMenu(const QPoint &)
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
const QAction *startAct = menu->addAction(GuiIconProvider::instance()->getIcon("media-playback-start"), tr("Resume torrents"));
const QAction *startAct = menu->addAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume torrents"));
connect(startAct, &QAction::triggered, transferList, &TransferListWidget::startVisibleTorrents);
const QAction *pauseAct = menu->addAction(GuiIconProvider::instance()->getIcon("media-playback-pause"), tr("Pause torrents"));
const QAction *pauseAct = menu->addAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause torrents"));
connect(pauseAct, &QAction::triggered, transferList, &TransferListWidget::pauseVisibleTorrents);
const QAction *deleteTorrentsAct = menu->addAction(GuiIconProvider::instance()->getIcon("edit-delete"), tr("Delete torrents"));
const QAction *deleteTorrentsAct = menu->addAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete torrents"));
connect(deleteTorrentsAct, &QAction::triggered, transferList, &TransferListWidget::deleteVisibleTorrents);
menu->popup(QCursor::pos());

59
src/gui/transferlistwidget.cpp

@ -55,7 +55,6 @@ @@ -55,7 +55,6 @@
#include "base/utils/string.h"
#include "autoexpandabledialog.h"
#include "deletionconfirmationdialog.h"
#include "guiiconprovider.h"
#include "mainwindow.h"
#include "optionsdialog.h"
#include "previewselectdialog.h"
@ -66,6 +65,7 @@ @@ -66,6 +65,7 @@
#include "transferlistmodel.h"
#include "transferlistsortmodel.h"
#include "tristateaction.h"
#include "uithememanager.h"
#include "updownratiodialog.h"
#include "utils.h"
@ -812,47 +812,48 @@ void TransferListWidget::displayListMenu(const QPoint &) @@ -812,47 +812,48 @@ void TransferListWidget::displayListMenu(const QPoint &)
listMenu->setAttribute(Qt::WA_DeleteOnClose);
// Create actions
auto *actionStart = new QAction(GuiIconProvider::instance()->getIcon("media-playback-start"), tr("Resume", "Resume/start the torrent"), listMenu);
auto *actionStart = new QAction(UIThemeManager::instance()->getIcon("media-playback-start"), tr("Resume", "Resume/start the torrent"), listMenu);
connect(actionStart, &QAction::triggered, this, &TransferListWidget::startSelectedTorrents);
auto *actionPause = new QAction(GuiIconProvider::instance()->getIcon("media-playback-pause"), tr("Pause", "Pause the torrent"), listMenu);
auto *actionPause = new QAction(UIThemeManager::instance()->getIcon("media-playback-pause"), tr("Pause", "Pause the torrent"), listMenu);
connect(actionPause, &QAction::triggered, this, &TransferListWidget::pauseSelectedTorrents);
auto *actionForceStart = new QAction(GuiIconProvider::instance()->getIcon("media-seek-forward"), tr("Force Resume", "Force Resume/start the torrent"), listMenu);
auto *actionForceStart = new QAction(UIThemeManager::instance()->getIcon("media-seek-forward"), tr("Force Resume", "Force Resume/start the torrent"), listMenu);
connect(actionForceStart, &QAction::triggered, this, &TransferListWidget::forceStartSelectedTorrents);
auto *actionDelete = new QAction(GuiIconProvider::instance()->getIcon("edit-delete"), tr("Delete", "Delete the torrent"), listMenu);
auto *actionDelete = new QAction(UIThemeManager::instance()->getIcon("edit-delete"), tr("Delete", "Delete the torrent"), listMenu);
connect(actionDelete, &QAction::triggered, this, &TransferListWidget::softDeleteSelectedTorrents);
auto *actionPreviewFile = new QAction(GuiIconProvider::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);
auto *actionSetMaxRatio = new QAction(QIcon(QLatin1String(":/icons/skin/ratio.svg")), tr("Limit share ratio..."), listMenu);
connect(actionSetMaxRatio, &QAction::triggered, this, &TransferListWidget::setMaxRatioSelectedTorrents);
auto *actionSetUploadLimit = new QAction(GuiIconProvider::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);
auto *actionSetDownloadLimit = new QAction(GuiIconProvider::instance()->getIcon("kt-set-max-download-speed"), tr("Limit download rate..."), listMenu);
auto *actionSetDownloadLimit = new QAction(UIThemeManager::instance()->getIcon("kt-set-max-download-speed"), tr("Limit download rate..."), listMenu);
connect(actionSetDownloadLimit, &QAction::triggered, this, &TransferListWidget::setDlLimitSelectedTorrents);
auto *actionOpenDestinationFolder = new QAction(GuiIconProvider::instance()->getIcon("inode-directory"), tr("Open destination folder"), listMenu);
auto *actionOpenDestinationFolder = new QAction(UIThemeManager::instance()->getIcon("inode-directory"), tr("Open destination folder"), listMenu);
connect(actionOpenDestinationFolder, &QAction::triggered, this, &TransferListWidget::openSelectedTorrentsFolder);
auto *actionIncreaseQueuePos = new QAction(GuiIconProvider::instance()->getIcon("go-up"), tr("Move up", "i.e. move up in the queue"), listMenu);
auto *actionIncreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon("go-up"), tr("Move up", "i.e. move up in the queue"), listMenu);
connect(actionIncreaseQueuePos, &QAction::triggered, this, &TransferListWidget::increaseQueuePosSelectedTorrents);
auto *actionDecreaseQueuePos = new QAction(GuiIconProvider::instance()->getIcon("go-down"), tr("Move down", "i.e. Move down in the queue"), listMenu);
auto *actionDecreaseQueuePos = new QAction(UIThemeManager::instance()->getIcon("go-down"), tr("Move down", "i.e. Move down in the queue"), listMenu);
connect(actionDecreaseQueuePos, &QAction::triggered, this, &TransferListWidget::decreaseQueuePosSelectedTorrents);
auto *actionTopQueuePos = new QAction(GuiIconProvider::instance()->getIcon("go-top"), tr("Move to top", "i.e. Move to top of the queue"), listMenu);
auto *actionTopQueuePos = new QAction(UIThemeManager::instance()->getIcon("go-top"), tr("Move to top", "i.e. Move to top of the queue"), listMenu);
connect(actionTopQueuePos, &QAction::triggered, this, &TransferListWidget::topQueuePosSelectedTorrents);
auto *actionBottomQueuePos = new QAction(GuiIconProvider::instance()->getIcon("go-bottom"), tr("Move to bottom", "i.e. Move to bottom of the queue"), listMenu);
auto *actionBottomQueuePos = new QAction(UIThemeManager::instance()->getIcon("go-bottom"), tr("Move to bottom", "i.e. Move to bottom of the queue"), listMenu);
connect(actionBottomQueuePos, &QAction::triggered, this, &TransferListWidget::bottomQueuePosSelectedTorrents);
auto *actionSetTorrentPath = new QAction(GuiIconProvider::instance()->getIcon("inode-directory"), tr("Set location..."), listMenu);
auto *actionSetTorrentPath = new QAction(UIThemeManager::instance()->getIcon("inode-directory"), tr("Set location..."), listMenu);
connect(actionSetTorrentPath, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsLocation);
auto *actionForceRecheck = new QAction(GuiIconProvider::instance()->getIcon("document-edit-verify"), tr("Force recheck"), listMenu);
auto *actionForceRecheck = new QAction(UIThemeManager::instance()->getIcon("document-edit-verify"), tr("Force recheck"), listMenu);
connect(actionForceRecheck, &QAction::triggered, this, &TransferListWidget::recheckSelectedTorrents);
auto *actionForceReannounce = new QAction(GuiIconProvider::instance()->getIcon("document-edit-verify"), tr("Force reannounce"), listMenu);
auto *actionForceReannounce = new QAction(UIThemeManager::instance()->getIcon("document-edit-verify"), tr("Force reannounce"), listMenu);
connect(actionForceReannounce, &QAction::triggered, this, &TransferListWidget::reannounceSelectedTorrents);
auto *actionCopyMagnetLink = new QAction(GuiIconProvider::instance()->getIcon("kt-magnet"), tr("Magnet link"), listMenu);
auto *actionCopyMagnetLink = new QAction(UIThemeManager::instance()->getIcon("kt-magnet"), tr("Magnet link"), listMenu);
connect(actionCopyMagnetLink, &QAction::triggered, this, &TransferListWidget::copySelectedMagnetURIs);
auto *actionCopyName = new QAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Name"), listMenu);
auto *actionCopyName = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Name"), listMenu);
connect(actionCopyName, &QAction::triggered, this, &TransferListWidget::copySelectedNames);
auto *actionCopyHash = new QAction(GuiIconProvider::instance()->getIcon("edit-copy"), tr("Hash"), listMenu);
auto *actionCopyHash = new QAction(UIThemeManager::instance()->getIcon("edit-copy"), tr("Hash"), listMenu);
connect(actionCopyHash, &QAction::triggered, this, &TransferListWidget::copySelectedHashes);
auto *actionSuperSeedingMode = new TriStateAction(tr("Super seeding mode"), listMenu);
connect(actionSuperSeedingMode, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsSuperSeeding);
auto *actionRename = new QAction(GuiIconProvider::instance()->getIcon("edit-rename"), tr("Rename..."), listMenu);
auto *actionRename = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Rename..."), listMenu);
connect(actionRename, &QAction::triggered, this, &TransferListWidget::renameSelectedTorrent);
auto *actionSequentialDownload = new TriStateAction(tr("Download in sequential order"), listMenu);
connect(actionSequentialDownload, &QAction::triggered, this, &TransferListWidget::setSelectedTorrentsSequentialDownload);
@ -861,7 +862,7 @@ void TransferListWidget::displayListMenu(const QPoint &) @@ -861,7 +862,7 @@ void TransferListWidget::displayListMenu(const QPoint &)
auto *actionAutoTMM = new TriStateAction(tr("Automatic Torrent Management"), listMenu);
actionAutoTMM->setToolTip(tr("Automatic mode means that various torrent properties(eg save path) will be decided by the associated category"));
connect(actionAutoTMM, &QAction::triggered, this, &TransferListWidget::setSelectedAutoTMMEnabled);
QAction *actionEditTracker = new QAction(GuiIconProvider::instance()->getIcon("edit-rename"), tr("Edit trackers..."), listMenu);
QAction *actionEditTracker = new QAction(UIThemeManager::instance()->getIcon("edit-rename"), tr("Edit trackers..."), listMenu);
connect(actionEditTracker, &QAction::triggered, this, &TransferListWidget::editTorrentTrackers);
// End of actions
@ -965,12 +966,12 @@ void TransferListWidget::displayListMenu(const QPoint &) @@ -965,12 +966,12 @@ void TransferListWidget::displayListMenu(const QPoint &)
QStringList categories = BitTorrent::Session::instance()->categories().keys();
std::sort(categories.begin(), categories.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
QMenu *categoryMenu = listMenu->addMenu(GuiIconProvider::instance()->getIcon("view-categories"), tr("Category"));
QMenu *categoryMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon("view-categories"), tr("Category"));
const QAction *newCategoryAction = categoryMenu->addAction(GuiIconProvider::instance()->getIcon("list-add"), tr("New...", "New category..."));
const QAction *newCategoryAction = categoryMenu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("New...", "New category..."));
connect(newCategoryAction, &QAction::triggered, this, &TransferListWidget::askNewCategoryForSelection);
const QAction *resetCategoryAction = categoryMenu->addAction(GuiIconProvider::instance()->getIcon("edit-clear"), tr("Reset", "Reset category"));
const QAction *resetCategoryAction = categoryMenu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Reset", "Reset category"));
connect(resetCategoryAction, &QAction::triggered, this, [this]() { setSelectionCategory(""); });
categoryMenu->addSeparator();
@ -978,7 +979,7 @@ void TransferListWidget::displayListMenu(const QPoint &) @@ -978,7 +979,7 @@ void TransferListWidget::displayListMenu(const QPoint &)
for (const QString &category : asConst(categories)) {
const QString escapedCategory = QString(category).replace('&', "&&"); // avoid '&' becomes accelerator key
QAction *cat = new QAction(GuiIconProvider::instance()->getIcon("inode-directory"), escapedCategory, categoryMenu);
QAction *cat = new QAction(UIThemeManager::instance()->getIcon("inode-directory"), escapedCategory, categoryMenu);
if (allSameCategory && (category == firstCategory)) {
cat->setCheckable(true);
cat->setChecked(true);
@ -992,12 +993,12 @@ void TransferListWidget::displayListMenu(const QPoint &) @@ -992,12 +993,12 @@ void TransferListWidget::displayListMenu(const QPoint &)
QStringList tags(BitTorrent::Session::instance()->tags().toList());
std::sort(tags.begin(), tags.end(), Utils::String::naturalLessThan<Qt::CaseInsensitive>);
QMenu *tagsMenu = listMenu->addMenu(GuiIconProvider::instance()->getIcon("view-categories"), tr("Tags"));
QMenu *tagsMenu = listMenu->addMenu(UIThemeManager::instance()->getIcon("view-categories"), tr("Tags"));
const QAction *addTagAction = tagsMenu->addAction(GuiIconProvider::instance()->getIcon("list-add"), tr("Add...", "Add / assign multiple tags..."));
const QAction *addTagAction = tagsMenu->addAction(UIThemeManager::instance()->getIcon("list-add"), tr("Add...", "Add / assign multiple tags..."));
connect(addTagAction, &QAction::triggered, this, &TransferListWidget::askAddTagsForSelection);
const QAction *removeTagsAction = tagsMenu->addAction(GuiIconProvider::instance()->getIcon("edit-clear"), tr("Remove All", "Remove all tags"));
const QAction *removeTagsAction = tagsMenu->addAction(UIThemeManager::instance()->getIcon("edit-clear"), tr("Remove All", "Remove all tags"));
connect(removeTagsAction, &QAction::triggered, this, [this]()
{
if (Preferences::instance()->confirmRemoveAllTags())
@ -1082,7 +1083,7 @@ void TransferListWidget::displayListMenu(const QPoint &) @@ -1082,7 +1083,7 @@ void TransferListWidget::displayListMenu(const QPoint &)
}
QMenu *copySubMenu = listMenu->addMenu(
GuiIconProvider::instance()->getIcon("edit-copy"), tr("Copy"));
UIThemeManager::instance()->getIcon("edit-copy"), tr("Copy"));
copySubMenu->addAction(actionCopyName);
copySubMenu->addAction(actionCopyHash);
copySubMenu->addAction(actionCopyMagnetLink);

60
src/gui/uithememanager.cpp

@ -31,10 +31,13 @@ @@ -31,10 +31,13 @@
#include <QApplication>
#include <QFile>
#include <QIcon>
#include <QResource>
#include "base/iconprovider.h"
#include "base/logger.h"
#include "base/preferences.h"
#include "base/utils/fs.h"
UIThemeManager *UIThemeManager::m_instance = nullptr;
@ -58,6 +61,10 @@ UIThemeManager::UIThemeManager() @@ -58,6 +61,10 @@ UIThemeManager::UIThemeManager()
if (pref->useCustomUITheme()
&& !QResource::registerResource(pref->customUIThemePath(), "/uitheme"))
LogMsg(tr("Failed to load UI theme from file: \"%1\"").arg(pref->customUIThemePath()), Log::WARNING);
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
m_useSystemTheme = pref->useSystemIconTheme();
#endif
}
UIThemeManager *UIThemeManager::instance()
@ -82,3 +89,56 @@ void UIThemeManager::applyStyleSheet() const @@ -82,3 +89,56 @@ void UIThemeManager::applyStyleSheet() const
qApp->setStyleSheet(qssFile.readAll());
}
QIcon UIThemeManager::getIcon(const QString &iconId) const
{
return getIcon(iconId, iconId);
}
QIcon UIThemeManager::getIcon(const QString &iconId, const QString &fallback) const
{
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
if (m_useSystemTheme) {
QIcon icon = QIcon::fromTheme(iconId);
if (icon.name() != iconId)
icon = QIcon::fromTheme(fallback, QIcon(IconProvider::instance()->getIconPath(iconId)));
return icon;
}
#else
Q_UNUSED(fallback)
#endif
// cache to avoid rescaling svg icons
static QHash<QString, QIcon> iconCache;
const auto iter = iconCache.find(iconId);
if (iter != iconCache.end())
return *iter;
const QIcon icon {IconProvider::instance()->getIconPath(iconId)};
iconCache[iconId] = icon;
return icon;
}
QIcon UIThemeManager::getFlagIcon(const QString &countryIsoCode) const
{
if (countryIsoCode.isEmpty()) return {};
return QIcon(":/icons/flags/" + countryIsoCode.toLower() + ".svg");
}
QString UIThemeManager::getIconPath(const QString &iconId) const
{
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
if (m_useSystemTheme) {
QString path = Utils::Fs::tempPath() + iconId + ".png";
if (!QFile::exists(path)) {
const QIcon icon = QIcon::fromTheme(iconId);
if (!icon.isNull())
icon.pixmap(32).save(path);
else
path = IconProvider::instance()->getIconPath(iconId);
}
return path;
}
#endif
return IconProvider::instance()->getIconPath(iconId);
}

8
src/gui/uithememanager.h

@ -45,8 +45,16 @@ public: @@ -45,8 +45,16 @@ public:
void applyStyleSheet() const;
QIcon getIcon(const QString &iconId) const;
QIcon getIcon(const QString &iconId, const QString &fallback) const;
QIcon getFlagIcon(const QString &countryIsoCode) const;
private:
UIThemeManager(); // singleton class
QString getIconPath(const QString &iconId) const;
static UIThemeManager *m_instance;
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
bool m_useSystemTheme;
#endif
};

Loading…
Cancel
Save