[Pkg-owncloud-commits] [owncloud-client] 110/484: Theme: cache the QIcon::fromTheme

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:23 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 407ff0a99d843e7de0725dc535b57436ef2b2ce4
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Tue Oct 20 13:24:11 2015 +0200

    Theme: cache the QIcon::fromTheme
    
    We are calling that every time we draw the folder delegate.
    Which is a lot when the sync is runing and the progress bar is moving
---
 src/libsync/theme.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp
index 6cb1275..094d6a0 100644
--- a/src/libsync/theme.cpp
+++ b/src/libsync/theme.cpp
@@ -124,14 +124,14 @@ QIcon Theme::themeIcon( const QString& name, bool sysTray ) const
         flavor = QLatin1String("colored");
     }
 
-    if( QIcon::hasThemeIcon( name )) {
-        // use from theme
-        return QIcon::fromTheme( name );
-    }
-
     QString key = name + "," + flavor;
     QIcon & cached = _iconCache[key];
     if (cached.isNull()) {
+        if(QIcon::hasThemeIcon(name)) {
+            // use from theme
+            return cached = QIcon::fromTheme(name);
+        }
+
         QList<int> sizes;
         sizes <<16 << 22 << 32 << 48 << 64 << 128 << 256;
         foreach (int size, sizes) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list