Merge pull request #14428 from mkopec/menuicons

Add an option to disable icons in menus
This commit is contained in:
Vladimir Golovnev 2021-02-22 07:10:50 +03:00 committed by GitHub
commit da87eb7b4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 0 deletions

View file

@ -251,6 +251,9 @@ int main(int argc, char *argv[])
// On OS X the standard is to not show icons in the menus // On OS X the standard is to not show icons in the menus
app->setAttribute(Qt::AA_DontShowIconsInMenus); app->setAttribute(Qt::AA_DontShowIconsInMenus);
#else
if (!Preferences::instance()->iconsInMenusEnabled())
app->setAttribute(Qt::AA_DontShowIconsInMenus);
#endif #endif
if (!firstTimeUser) if (!firstTimeUser)

View file

@ -234,6 +234,16 @@ void Preferences::setCloseToTrayNotified(const bool b)
{ {
setValue("Preferences/General/CloseToTrayNotified", b); setValue("Preferences/General/CloseToTrayNotified", b);
} }
bool Preferences::iconsInMenusEnabled() const
{
return value("Preferences/Advanced/EnableIconsInMenus", true).toBool();
}
void Preferences::setIconsInMenusEnabled(const bool enable)
{
setValue("Preferences/Advanced/EnableIconsInMenus", enable);
}
#endif // Q_OS_MACOS #endif // Q_OS_MACOS
bool Preferences::isToolbarDisplayed() const bool Preferences::isToolbarDisplayed() const

View file

@ -313,6 +313,8 @@ public:
void setCloseToTrayNotified(bool b); void setCloseToTrayNotified(bool b);
TrayIcon::Style trayIconStyle() const; TrayIcon::Style trayIconStyle() const;
void setTrayIconStyle(TrayIcon::Style style); void setTrayIconStyle(TrayIcon::Style style);
bool iconsInMenusEnabled() const;
void setIconsInMenusEnabled(bool enable);
#endif // Q_OS_MACOS #endif // Q_OS_MACOS
// Stuff that don't appear in the Options GUI but are saved // Stuff that don't appear in the Options GUI but are saved

View file

@ -82,6 +82,9 @@ namespace
DOWNLOAD_TRACKER_FAVICON, DOWNLOAD_TRACKER_FAVICON,
SAVE_PATH_HISTORY_LENGTH, SAVE_PATH_HISTORY_LENGTH,
ENABLE_SPEED_WIDGET, ENABLE_SPEED_WIDGET,
#ifndef Q_OS_MACOS
ENABLE_ICONS_IN_MENUS,
#endif
// embedded tracker // embedded tracker
TRACKER_STATUS, TRACKER_STATUS,
TRACKER_PORT, TRACKER_PORT,
@ -279,6 +282,9 @@ void AdvancedSettings::saveAdvancedSettings()
mainWindow->setDownloadTrackerFavicon(m_checkBoxTrackerFavicon.isChecked()); mainWindow->setDownloadTrackerFavicon(m_checkBoxTrackerFavicon.isChecked());
AddNewTorrentDialog::setSavePathHistoryLength(m_spinBoxSavePathHistoryLength.value()); AddNewTorrentDialog::setSavePathHistoryLength(m_spinBoxSavePathHistoryLength.value());
pref->setSpeedWidgetEnabled(m_checkBoxSpeedWidgetEnabled.isChecked()); pref->setSpeedWidgetEnabled(m_checkBoxSpeedWidgetEnabled.isChecked());
#ifndef Q_OS_MACOS
pref->setIconsInMenusEnabled(m_checkBoxIconsInMenusEnabled.isChecked());
#endif
// Tracker // Tracker
pref->setTrackerPort(m_spinBoxTrackerPort.value()); pref->setTrackerPort(m_spinBoxTrackerPort.value());
@ -647,6 +653,11 @@ void AdvancedSettings::loadAdvancedSettings()
// Enable speed graphs // Enable speed graphs
m_checkBoxSpeedWidgetEnabled.setChecked(pref->isSpeedWidgetEnabled()); m_checkBoxSpeedWidgetEnabled.setChecked(pref->isSpeedWidgetEnabled());
addRow(ENABLE_SPEED_WIDGET, tr("Enable speed graphs"), &m_checkBoxSpeedWidgetEnabled); addRow(ENABLE_SPEED_WIDGET, tr("Enable speed graphs"), &m_checkBoxSpeedWidgetEnabled);
#ifndef Q_OS_MACOS
// Enable icons in menus
m_checkBoxIconsInMenusEnabled.setChecked(pref->iconsInMenusEnabled());
addRow(ENABLE_ICONS_IN_MENUS, tr("Enable icons in menus"), &m_checkBoxIconsInMenusEnabled);
#endif
// Tracker State // Tracker State
m_checkBoxTrackerStatus.setChecked(session->isTrackerEnabled()); m_checkBoxTrackerStatus.setChecked(session->isTrackerEnabled());
addRow(TRACKER_STATUS, tr("Enable embedded tracker"), &m_checkBoxTrackerStatus); addRow(TRACKER_STATUS, tr("Enable embedded tracker"), &m_checkBoxTrackerStatus);

View file

@ -84,4 +84,8 @@ private:
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
QComboBox m_comboBoxOSMemoryPriority; QComboBox m_comboBoxOSMemoryPriority;
#endif #endif
#ifndef Q_OS_MACOS
QCheckBox m_checkBoxIconsInMenusEnabled;
#endif
}; };