Browse Source

Add an option to disable icons in menus

adaptive-webui-19844
Michał Kopeć 4 years ago
parent
commit
614376ed64
  1. 3
      src/app/main.cpp
  2. 10
      src/base/preferences.cpp
  3. 2
      src/base/preferences.h
  4. 11
      src/gui/advancedsettings.cpp
  5. 4
      src/gui/advancedsettings.h

3
src/app/main.cpp

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

10
src/base/preferences.cpp

@ -234,6 +234,16 @@ void Preferences::setCloseToTrayNotified(const bool b) @@ -234,6 +234,16 @@ void Preferences::setCloseToTrayNotified(const bool 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
bool Preferences::isToolbarDisplayed() const

2
src/base/preferences.h

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

11
src/gui/advancedsettings.cpp

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

4
src/gui/advancedsettings.h

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

Loading…
Cancel
Save