From 92afbd45e8daf7c29efcd5c0fb30bccb9dc8d339 Mon Sep 17 00:00:00 2001 From: "Nowshed H. Imran" Date: Tue, 5 Jul 2022 10:32:35 +0600 Subject: [PATCH] Remove option of using icons from system theme PR #17292. Closes #17150. --- src/base/preferences.cpp | 12 ------------ src/base/preferences.h | 4 ---- src/gui/optionsdialog.cpp | 13 ------------- src/gui/optionsdialog.ui | 8 -------- src/gui/uithememanager.cpp | 30 ------------------------------ src/gui/uithememanager.h | 3 --- 6 files changed, 70 deletions(-) diff --git a/src/base/preferences.cpp b/src/base/preferences.cpp index b97590e9d..9ad689b6b 100644 --- a/src/base/preferences.cpp +++ b/src/base/preferences.cpp @@ -979,18 +979,6 @@ void Preferences::resolvePeerHostNames(const bool resolve) setValue(u"Preferences/Connection/ResolvePeerHostNames"_qs, resolve); } -#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) -bool Preferences::useSystemIconTheme() const -{ - return value(u"Preferences/Advanced/useSystemIconTheme"_qs, false); -} - -void Preferences::useSystemIconTheme(const bool enabled) -{ - setValue(u"Preferences/Advanced/useSystemIconTheme"_qs, enabled); -} -#endif - bool Preferences::recursiveDownloadDisabled() const { return value(u"Preferences/Advanced/DisableRecursiveDownload"_qs, false); diff --git a/src/base/preferences.h b/src/base/preferences.h index 0d976b75f..c9b9ffed3 100644 --- a/src/base/preferences.h +++ b/src/base/preferences.h @@ -275,10 +275,6 @@ public: void resolvePeerCountries(bool resolve); bool resolvePeerHostNames() const; void resolvePeerHostNames(bool resolve); -#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) - bool useSystemIconTheme() const; - void useSystemIconTheme(bool enabled); -#endif bool recursiveDownloadDisabled() const; void disableRecursiveDownload(bool disable = true); #ifdef Q_OS_WIN diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index 90d24962e..618d880af 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -257,12 +257,6 @@ OptionsDialog::OptionsDialog(IGUIApplication *app, QWidget *parent) 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(Preferences::instance()->useSystemIconTheme()); -#else - m_ui->checkUseSystemIcon->setVisible(false); -#endif - // Load week days (scheduler) m_ui->comboBoxScheduleDays->addItems(translatedWeekdayNames()); @@ -306,9 +300,6 @@ OptionsDialog::OptionsDialog(IGUIApplication *app, QWidget *parent) connect(m_ui->comboI18n, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton); connect(m_ui->checkUseCustomTheme, &QGroupBox::toggled, this, &ThisType::enableApplyButton); connect(m_ui->customThemeFilePath, &FileSystemPathEdit::selectedPathChanged, 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->confirmDeletion, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkAltRowColors, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkHideZero, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); @@ -679,10 +670,6 @@ void OptionsDialog::saveOptions() pref->setUseCustomUITheme(m_ui->checkUseCustomTheme->isChecked()); pref->setCustomUIThemePath(m_ui->customThemeFilePath->selectedPath()); -#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) - pref->useSystemIconTheme(m_ui->checkUseSystemIcon->isChecked()); -#endif - pref->setConfirmTorrentDeletion(m_ui->confirmDeletion->isChecked()); pref->setAlternatingRowColors(m_ui->checkAltRowColors->isChecked()); pref->setHideZeroValues(m_ui->checkHideZero->isChecked()); diff --git a/src/gui/optionsdialog.ui b/src/gui/optionsdialog.ui index cf62259dd..4136ad5e6 100644 --- a/src/gui/optionsdialog.ui +++ b/src/gui/optionsdialog.ui @@ -175,13 +175,6 @@ - - - - Use system icon theme - - - @@ -3532,7 +3525,6 @@ Use ';' to split multiple entries. Can use wildcard '*'. tabOption comboI18n - checkUseSystemIcon checkUseCustomTheme customThemeFilePath checkStartPaused diff --git a/src/gui/uithememanager.cpp b/src/gui/uithememanager.cpp index 3fadcd826..54d9f6623 100644 --- a/src/gui/uithememanager.cpp +++ b/src/gui/uithememanager.cpp @@ -168,9 +168,6 @@ void UIThemeManager::initInstance() UIThemeManager::UIThemeManager() : m_useCustomTheme(Preferences::instance()->useCustomUITheme()) -#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) - , m_useSystemTheme(Preferences::instance()->useSystemIconTheme()) -#endif { if (m_useCustomTheme) { @@ -206,17 +203,6 @@ QIcon UIThemeManager::getIcon(const QString &iconId, const QString &fallback) co if (iter != m_iconCache.end()) return *iter; -#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) - // Don't cache system icons because users might change them at run time - if (m_useSystemTheme) - { - QIcon icon = QIcon::fromTheme(iconId); - if (icon.name() != iconId) - icon = QIcon::fromTheme(fallback, QIcon(getIconPathFromResources(iconId, fallback).toString())); - return icon; - } -#endif - const QIcon icon {getIconPathFromResources(iconId, fallback).data()}; m_iconCache[iconId] = icon; return icon; @@ -273,22 +259,6 @@ QIcon UIThemeManager::getSystrayIcon() const Path UIThemeManager::getIconPath(const QString &iconId) const { -#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) - if (m_useSystemTheme) - { - 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, {}); } diff --git a/src/gui/uithememanager.h b/src/gui/uithememanager.h index 41989783d..3b3c18cde 100644 --- a/src/gui/uithememanager.h +++ b/src/gui/uithememanager.h @@ -81,7 +81,4 @@ private: QHash m_colors; mutable QHash m_iconCache; mutable QHash m_flagCache; -#if (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)) - const bool m_useSystemTheme; -#endif };