Skip to content

Commit

Permalink
chore: add flag to disable noncache flag
Browse files Browse the repository at this point in the history
- if flag is set always try create iconengine
- avoid too much logs
  • Loading branch information
kegechen committed Apr 23, 2024
1 parent 1776cd2 commit fd4f343
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion include/util/dicontheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ namespace DIconTheme
enum Option {
DontFallbackToQIconFromTheme = 1 << 0,
IgnoreBuiltinIcons = 1 << 1,
IgnoreDciIcons = 1 << 2
IgnoreDciIcons = 1 << 2,
IgnoreIconCache = 1 << 3
};
Q_DECLARE_FLAGS(Options, Option)

Expand Down
11 changes: 7 additions & 4 deletions src/util/private/diconproxyengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,12 @@ void DIconProxyEngine::ensureEngine()
return;

static QMap<QString, QSet<QString>> nonCache;
const auto it = nonCache.find(theme);
if (it != nonCache.end() && it->contains(m_iconName))
return;
if (Q_UNLIKELY(!m_option.testFlag(DIconTheme::IgnoreIconCache)))
{
const auto it = nonCache.find(theme);
if (it != nonCache.end() && it->contains(m_iconName))
return;
}

if (m_iconEngine) {
// dci => dci
Expand Down Expand Up @@ -271,7 +274,7 @@ void DIconProxyEngine::ensureEngine()
m_iconEngine = createXdgProxyIconEngine(m_iconName);
}
#endif
if (!m_iconEngine ) {
if (!m_iconEngine && !nonCache[theme].contains(m_iconName)) {
qErrnoWarning("create icon [%s] engine failed.[theme:%s] nonCache[theme].size[%d]",
m_iconName.toUtf8().data(),
theme.toUtf8().data(), nonCache[theme].size());
Expand Down

0 comments on commit fd4f343

Please sign in to comment.