[calligra/calligra/2.9] /: [NEED TESTING!] Make Krita loading even more faster
Dmitry Kazakov
dimula73 at gmail.com
Wed Apr 29 17:55:20 UTC 2015
Git commit 2a3e773b06e6b558e56961aa89835ff72cc50891 by Dmitry Kazakov.
Committed on 29/04/2015 at 17:55.
Pushed by dkazakov into branch 'calligra/2.9'.
[NEED TESTING!] Make Krita loading even more faster
This patch makes Krita loading about 30% faster. Please test whether
all the icons are still loaded correctly and whether there no crashes on
loading.
Testing on Windows is needed as well!
CCMAIL:kimageshop at kde.org
M +17 -10 KoIcon.h
http://commits.kde.org/calligra/2a3e773b06e6b558e56961aa89835ff72cc50891
diff --git a/KoIcon.h b/KoIcon.h
index 6e4e21c..0350251 100644
--- a/KoIcon.h
+++ b/KoIcon.h
@@ -65,20 +65,27 @@
/// Use this function to load an icon that fits the current color theme
inline KIcon themedIcon(const QString &name, bool fast = false) {
+ Q_UNUSED(fast);
+
KIcon icon;
- bool useAdjustedIcons = true;
- if(!fast) {
- useAdjustedIcons = KIconLoader::global()->iconPath(name, KIconLoader::NoGroup, true).isEmpty();
+
+ static bool firstUse = true;
+ if (firstUse) {
+ // workaround for some kde-related crash
+ bool _unused = KIconLoader::global()->iconPath(name, KIconLoader::NoGroup, true).isEmpty();
+ firstUse = false;
}
- if (useAdjustedIcons) {
- QColor background = qApp->palette().background().color();
- bool useDarkIcons = background.value() > 100;
- QString prefix = useDarkIcons ? QString("dark_") : QString("light_");
+ // try load themed icon
+ QColor background = qApp->palette().background().color();
+ bool useDarkIcons = background.value() > 100;
+ QString prefix = useDarkIcons ? QString("dark_") : QString("light_");
+
+ QString realName = prefix + name;
+ icon = koIcon(realName.toLatin1());
- QString realName = prefix + name;
- icon = koIcon(realName.toLatin1());
- } else {
+ // fallback
+ if (icon.isNull()) {
icon = koIcon(name.toLatin1());
}
More information about the kimageshop
mailing list