Skip to content

Commit

Permalink
Remove monochrome icons
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOneRing committed Feb 12, 2025
1 parent ceb07b6 commit e29c55a
Show file tree
Hide file tree
Showing 36 changed files with 30 additions and 437 deletions.
3 changes: 0 additions & 3 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ Application::Application(Platform *platform, const QString &displayLanguage, boo

qApp->setQuitOnLastWindowClosed(false);

Theme::instance()->setSystrayUseMonoIcons(cfg.monoIcons());
connect(Theme::instance(), &Theme::systrayUseMonoIconsChanged, this, &Application::slotUseMonoIconsChanged);

// Setting up the gui class will allow tray notifications for the
// setup that follows, like folder setup
_gui = new ownCloudGui(this);
Expand Down
10 changes: 0 additions & 10 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ GeneralSettings::GeneralSettings(QWidget *parent)
loadMiscSettings();

// misc
connect(_ui->monoIconsCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);
connect(_ui->crashreporterCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::saveMiscSettings);

connect(_ui->languageDropdown, QOverload<int>::of(&QComboBox::activated), this, [this]() {
Expand All @@ -69,10 +68,6 @@ GeneralSettings::GeneralSettings(QWidget *parent)
Q_EMIT syncOptionsChanged();
});

// OEM themes are not obliged to ship mono icons, so there
// is no point in offering an option
_ui->monoIconsCheckBox->setVisible(Resources::hasMonoTheme());

connect(_ui->ignoredFilesButton, &QAbstractButton::clicked, this, &GeneralSettings::slotIgnoreFilesEditor);
connect(_ui->logSettingsButton, &QPushButton::clicked, this, [] {
// only access occApp after things are set up
Expand All @@ -91,10 +86,8 @@ void GeneralSettings::loadMiscSettings()
{
QScopedValueRollback<bool> scope(_currentlyLoading, true);
ConfigFile cfgFile;
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
_ui->desktopNotificationsCheckBox->setChecked(cfgFile.optionalDesktopNotifications());
_ui->crashreporterCheckBox->setChecked(cfgFile.crashReporter());
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());

// the dropdown has to be populated before we can can pick an entry below based on the stored setting
loadLanguageNamesIntoDropdown();
Expand All @@ -114,9 +107,6 @@ void GeneralSettings::saveMiscSettings()
if (_currentlyLoading)
return;
ConfigFile cfgFile;
bool isChecked = _ui->monoIconsCheckBox->isChecked();
cfgFile.setMonoIcons(isChecked);
Theme::instance()->setSystrayUseMonoIcons(isChecked);
cfgFile.setCrashReporter(_ui->crashreporterCheckBox->isChecked());

// the first entry, identified by index 0, means "use default", which is a special case handled below
Expand Down
36 changes: 14 additions & 22 deletions src/gui/generalsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,6 @@
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QCheckBox" name="monoIconsCheckBox">
<property name="text">
<string>Use Monochrome Icons in the system tray</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="desktopNotificationsCheckBox">
<property name="text">
<string>Show Desktop Notifications</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="autostartCheckBox">
<property name="text">
<string>Start on Login</string>
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="languageLabel">
Expand Down Expand Up @@ -95,6 +74,20 @@
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="desktopNotificationsCheckBox">
<property name="text">
<string>Show Desktop Notifications</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="autostartCheckBox">
<property name="text">
<string>Start on Login</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -253,7 +246,6 @@
<tabstops>
<tabstop>autostartCheckBox</tabstop>
<tabstop>desktopNotificationsCheckBox</tabstop>
<tabstop>monoIconsCheckBox</tabstop>
<tabstop>languageDropdown</tabstop>
<tabstop>syncHiddenFilesCheckBox</tabstop>
<tabstop>crashreporterCheckBox</tabstop>
Expand Down
18 changes: 0 additions & 18 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const QString fullLocalDiscoveryIntervalC()
{
return QStringLiteral("fullLocalDiscoveryInterval");
}
const QString monoIconsC() { return QStringLiteral("monoIcons"); }
const QString promptDeleteC() { return QStringLiteral("promptDeleteAllFiles"); }
const QString crashReporterC() { return QStringLiteral("crashReporter"); }
const QString optionalDesktopNoficationsC()
Expand Down Expand Up @@ -693,23 +692,6 @@ void ConfigFile::setPromptDeleteFiles(bool promptDeleteFiles)
settings.setValue(promptDeleteC(), promptDeleteFiles);
}

bool ConfigFile::monoIcons() const
{
auto settings = makeQSettings();
bool monoDefault = false; // On Mac we want bw by default
#ifdef Q_OS_MAC
// OEM themes are not obliged to ship mono icons
monoDefault = Resources::isVanillaTheme();
#endif
return settings.value(monoIconsC(), monoDefault).toBool();
}

void ConfigFile::setMonoIcons(bool useMonoIcons)
{
auto settings = makeQSettings();
settings.setValue(monoIconsC(), useMonoIcons);
}

bool ConfigFile::crashReporter() const
{
auto settings = makeQSettings();
Expand Down
3 changes: 0 additions & 3 deletions src/libsync/configfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ class OPENCLOUD_SYNC_EXPORT ConfigFile
*/
std::chrono::milliseconds fullLocalDiscoveryInterval() const;

bool monoIcons() const;
void setMonoIcons(bool);

bool promptDeleteFiles() const;
void setPromptDeleteFiles(bool promptDeleteFiles);

Expand Down
38 changes: 4 additions & 34 deletions src/libsync/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@
#endif

namespace {
QString whiteTheme()
{
return QStringLiteral("white");
}

QString blackTheme()
{
return QStringLiteral("black");
}

QString darkTheme()
{
return QStringLiteral("dark");
Expand Down Expand Up @@ -136,27 +126,13 @@ QIcon Theme::aboutIcon() const

QIcon Theme::themeTrayIcon(const SyncResult &result, [[maybe_unused]] bool sysTrayMenuVisible, Resources::IconType iconType) const
{
auto systrayIconFlavor = [&]() {
QString flavor;
if (_mono) {
flavor = Utility::hasDarkSystray() ? whiteTheme() : blackTheme();

#ifdef Q_OS_MAC
if (sysTrayMenuVisible) {
flavor = whiteTheme();
}
#endif
} else {
// we have a dark sys tray and the theme has support for that
flavor = (Utility::hasDarkSystray() && Resources::hasDarkTheme()) ? darkTheme() : coloredTheme();
}
return flavor;
};
auto icon = Resources::loadIcon(systrayIconFlavor(), QStringLiteral("state-%1").arg(syncStateIconName(result)), iconType);
// we have a dark sys tray and the theme has support for that
const QString flavor = (Utility::hasDarkSystray() && Resources::hasDarkTheme()) ? darkTheme() : coloredTheme();
auto icon = Resources::loadIcon(flavor, QStringLiteral("state-%1").arg(syncStateIconName(result)), iconType);
#ifdef Q_OS_MAC
// This defines the icon as a template and enables automatic macOS color handling
// See https://bugreports.qt.io/browse/QTBUG-42109
icon.setIsMask(_mono && !sysTrayMenuVisible);
icon.setIsMask(true);
#endif
return icon;
}
Expand Down Expand Up @@ -208,12 +184,6 @@ QString Theme::overrideServerPath() const
return {};
}

void Theme::setSystrayUseMonoIcons(bool mono)
{
_mono = mono;
Q_EMIT systrayUseMonoIconsChanged(mono);
}

QUrl Theme::updateCheckUrl() const
{
#ifdef APPLICATION_UPDATE_URL
Expand Down
8 changes: 0 additions & 8 deletions src/libsync/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,6 @@ class OPENCLOUD_SYNC_EXPORT Theme : public QObject
virtual QString about() const;
virtual bool aboutShowCopyright() const;

/**
* Define if the systray icons should be using mono design
*/
void setSystrayUseMonoIcons(bool mono);


/**
* @brief Where to check for new Updates.
Expand Down Expand Up @@ -440,8 +435,6 @@ class OPENCLOUD_SYNC_EXPORT Theme : public QObject
}

Q_SIGNALS:
void systrayUseMonoIconsChanged(bool);

void themeChanged();

private:
Expand All @@ -450,7 +443,6 @@ class OPENCLOUD_SYNC_EXPORT Theme : public QObject
Theme &operator=(Theme const &);

static Theme *_instance;
bool _mono = false;
};

template <>
Expand Down
36 changes: 12 additions & 24 deletions src/resources/core_theme.qrc
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
<RCC>
<qresource prefix="/client/OpenCloud">
<file alias="theme/black/state-ok.svg">theme/black/ui-light-plain-monochrom-state-checkmark.svg</file>
<file alias="theme/black/state-error.svg">theme/black/ui-light-plain-monochrom-state-error.svg</file>
<file alias="theme/black/state-information.svg">theme/black/ui-light-plain-monochrom-state-info.svg</file>
<file alias="theme/black/state-offline.svg">theme/black/ui-light-plain-monochrom-state-offline.svg</file>
<file alias="theme/black/state-pause.svg">theme/black/ui-light-plain-monochrom-state-pause.svg</file>
<file alias="theme/black/state-sync.svg">theme/black/ui-light-plain-monochrom-state-sync.svg</file>
<file alias="theme/colored/state-ok.svg">theme/colored/ui-light-plain-color-state-checkmark.svg</file>
<file alias="theme/colored/state-error.svg">theme/colored/ui-light-plain-color-state-error.svg</file>
<file alias="theme/colored/state-information.svg">theme/colored/ui-light-plain-color-state-info.svg</file>
<file alias="theme/colored/state-offline.svg">theme/colored/ui-light-plain-color-state-offline.svg</file>
<file alias="theme/colored/state-pause.svg">theme/colored/ui-light-plain-color-state-pause.svg</file>
<file alias="theme/colored/state-sync.svg">theme/colored/ui-light-plain-color-state-sync.svg</file>
<file alias="theme/dark/state-ok.svg">theme/dark/ui-dark-plain-color-state-checkmark.svg</file>
<file alias="theme/dark/state-error.svg">theme/dark/ui-dark-plain-color-state-error.svg</file>
<file alias="theme/dark/state-information.svg">theme/dark/ui-dark-plain-color-state-info.svg</file>
<file alias="theme/dark/state-offline.svg">theme/dark/ui-dark-plain-color-state-offline.svg</file>
<file alias="theme/dark/state-pause.svg">theme/dark/ui-dark-plain-color-state-pause.svg</file>
<file alias="theme/dark/state-sync.svg">theme/dark/ui-dark-plain-color-state-sync.svg</file>
<file alias="theme/colored/state-ok.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/colored/state-error.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/colored/state-information.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/colored/state-offline.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/colored/state-pause.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/colored/state-sync.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/dark/state-ok.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/dark/state-error.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/dark/state-information.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/dark/state-offline.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/dark/state-pause.svg">theme/universal/opencloud-icon.svg</file>
<file alias="theme/dark/state-sync.svg">theme/universal/opencloud-icon.svg</file>
<file>theme/universal/opencloud-icon.svg</file>
<file>theme/universal/wizard_logo.svg</file>
<file alias="theme/white/state-ok.svg">theme/white/ui-dark-plain-monochrom-state-checkmark.svg</file>
<file alias="theme/white/state-error.svg">theme/white/ui-dark-plain-monochrom-state-error.svg</file>
<file alias="theme/white/state-information.svg">theme/white/ui-dark-plain-monochrom-state-info.svg</file>
<file alias="theme/white/state-offline.svg">theme/white/ui-dark-plain-monochrom-state-offline.svg</file>
<file alias="theme/white/state-pause.svg">theme/white/ui-dark-plain-monochrom-state-pause.svg</file>
<file alias="theme/white/state-sync.svg">theme/white/ui-dark-plain-monochrom-state-sync.svg</file>
</qresource>
</RCC>
12 changes: 0 additions & 12 deletions src/resources/resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ QString coloredTheme()
return QStringLiteral("colored");
}

QString whiteTheme()
{
return QStringLiteral("white");
}

bool hasTheme(IconType type, const QString &theme)
{
// <<is vanilla, theme name>, bool
Expand All @@ -90,13 +85,6 @@ bool OCC::Resources::hasDarkTheme()
return _hasBrandedColored == _hasBrandedDark;
}

bool Resources::hasMonoTheme()
{
// mono icons are only supported in vanilla and if a customer provides them
// no fallback to vanilla
return hasTheme(Resources::IconType::BrandedIcon, whiteTheme());
}

bool Resources::isVanillaTheme()
{
return std::string_view(APPLICATION_SHORTNAME) == "OpenCloud";
Expand Down
4 changes: 0 additions & 4 deletions src/resources/resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ bool OPENCLOUD_RESOURCES_EXPORT isUsingDarkTheme();

bool OPENCLOUD_RESOURCES_EXPORT hasDarkTheme();

/** Whether the theme provides monochrome tray icons
*/
bool OPENCLOUD_RESOURCES_EXPORT hasMonoTheme();

QIcon OPENCLOUD_RESOURCES_EXPORT getCoreIcon(const QString &icon_name);

QIcon OPENCLOUD_RESOURCES_EXPORT loadIcon(const QString &flavor, const QString &name, IconType iconType);
Expand Down

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions src/resources/theme/black/ui-light-plain-monochrom-state-error.svg

This file was deleted.

Loading

0 comments on commit e29c55a

Please sign in to comment.