Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-01-21 17:36:08 +0300
committerHannah von Reth <hannah.vonreth@owncloud.com>2021-01-21 17:36:08 +0300
commite809ed964657a552b6b42dd1718065b10964820c (patch)
treeb1b17ff4fa99765bc74b973ffedefa0744bf8693 /src
parent8c3146423002f46bca420b8118318be65d0cd055 (diff)
parent2664d1936525133448870fc2b783f520f6cc0b4d (diff)
Merge branch 'work/v2.7.5' into 2.7
Diffstat (limited to 'src')
-rw-r--r--src/libsync/owncloudtheme.cpp2
-rw-r--r--src/libsync/theme.cpp14
-rw-r--r--src/libsync/theme.h19
3 files changed, 19 insertions, 16 deletions
diff --git a/src/libsync/owncloudtheme.cpp b/src/libsync/owncloudtheme.cpp
index 4fc5f557e..571d625b1 100644
--- a/src/libsync/owncloudtheme.cpp
+++ b/src/libsync/owncloudtheme.cpp
@@ -58,7 +58,7 @@ QColor ownCloudTheme::wizardHeaderSubTitleColor() const
QIcon ownCloudTheme::wizardHeaderLogo() const
{
- return themeIcon(QStringLiteral("wizard_logo"), false, false, Theme::IconFallback::NoFallbackToCoreIcon);
+ return themeIcon(QStringLiteral("wizard_logo"), false, false, Theme::IconType::BrandedIcon);
}
QIcon ownCloudTheme::aboutIcon() const
diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp
index 715faae14..0c1a1bb9f 100644
--- a/src/libsync/theme.cpp
+++ b/src/libsync/theme.cpp
@@ -137,9 +137,9 @@ QIcon Theme::aboutIcon() const
return applicationIcon();
}
-bool Theme::isUsingDarkTheme() const
+bool Theme::isUsingDarkTheme(IconType type) const
{
- if (!_hasDarkColoredTheme) {
+ if (!_hasDarkColoredTheme && type != IconType::VanillaIcon) {
return false;
}
return QPalette().base().color().lightnessF() <= 0.5;
@@ -148,14 +148,14 @@ bool Theme::isUsingDarkTheme() const
* helper to load a icon from either the icon theme the desktop provides or from
* the apps Qt resources.
*/
-QIcon Theme::themeIcon(const QString &name, bool sysTray, bool sysTrayMenuVisible, IconFallback fallbackType) const
+QIcon Theme::themeIcon(const QString &name, bool sysTray, bool sysTrayMenuVisible, IconType iconType) const
{
- const bool useCoreIcon = (fallbackType == IconFallback::CoreIcon) || isVanilla();
+ const bool useCoreIcon = (iconType == IconType::VanillaIcon) || isVanilla();
QString flavor;
if (sysTray) {
flavor = systrayIconFlavor(_mono, sysTrayMenuVisible);
} else {
- if (isUsingDarkTheme()) {
+ if (isUsingDarkTheme(iconType)) {
flavor = QStringLiteral("dark");
} else {
flavor = QStringLiteral("colored");
@@ -195,8 +195,8 @@ QIcon Theme::themeIcon(const QString &name, bool sysTray, bool sysTrayMenuVisibl
}
}
if (cached.isNull()) {
- if (!useCoreIcon && fallbackType == IconFallback::FallbackToCoreIcon) {
- return themeIcon(name, sysTray, sysTrayMenuVisible, IconFallback::CoreIcon);
+ if (!useCoreIcon && iconType == IconType::BrandedIconWithFallbackToVanillaIcon) {
+ return themeIcon(name, sysTray, sysTrayMenuVisible, IconType::VanillaIcon);
}
qWarning() << "Failed to locate the icon" << name;
}
diff --git a/src/libsync/theme.h b/src/libsync/theme.h
index e3efa5ba3..843f7a4bb 100644
--- a/src/libsync/theme.h
+++ b/src/libsync/theme.h
@@ -97,6 +97,14 @@ public:
#ifndef TOKEN_AUTH_ONLY
/**
+ * Wehther we allow a fallback to a vanilla icon
+ */
+ enum class IconType {
+ BrandedIcon,
+ BrandedIconWithFallbackToVanillaIcon,
+ VanillaIcon
+ };
+ /**
* get an sync state icon
*/
virtual QIcon syncStateIcon(SyncResult::Status, bool sysTray = false, bool sysTrayMenuVisible = false) const;
@@ -108,8 +116,9 @@ public:
/**
* Whether use the dark icon theme
+ * The function also ensures the theme supports the dark theme
*/
- bool isUsingDarkTheme() const;
+ bool isUsingDarkTheme(IconType fallbackType = IconType::BrandedIcon) const;
#endif
virtual QString statusHeaderText(SyncResult::Status) const;
@@ -399,13 +408,7 @@ public:
protected:
#ifndef TOKEN_AUTH_ONLY
- enum class IconFallback {
- NoFallbackToCoreIcon,
- FallbackToCoreIcon,
- CoreIcon
- };
-
- QIcon themeIcon(const QString &name, bool sysTray = false, bool sysTrayMenuVisible = false, IconFallback fallbackType = IconFallback::FallbackToCoreIcon) const;
+ QIcon themeIcon(const QString &name, bool sysTray = false, bool sysTrayMenuVisible = false, IconType iconType = IconType::BrandedIconWithFallbackToVanillaIcon) const;
static bool hasTheme(const QString &theme);
#endif
Theme();