From 78bf8aad9b15977948ebb8944cbf742aac21557b Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Fri, 13 Dec 2019 15:29:53 +0100 Subject: [PATCH] quickopen: remove caching of project file icons, done by QIcon itself now GIT_SILENT --- plugins/quickopen/CMakeLists.txt | 8 +++++++- plugins/quickopen/projectfilequickopen.cpp | 20 +------------------- plugins/quickopen/tests/CMakeLists.txt | 6 +++++- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/plugins/quickopen/CMakeLists.txt b/plugins/quickopen/CMakeLists.txt index 99af7fdf9f..277f2b8350 100644 --- a/plugins/quickopen/CMakeLists.txt +++ b/plugins/quickopen/CMakeLists.txt @@ -27,4 +27,10 @@ ki18n_wrap_ui(kdevquickopen_PART_SRCS ) qt5_add_resources(kdevquickopen_PART_SRCS kdevquickopen.qrc) kdevplatform_add_plugin(kdevquickopen JSON kdevquickopen.json SOURCES ${kdevquickopen_PART_SRCS}) -target_link_libraries(kdevquickopen KF5::IconThemes KF5::GuiAddons KF5::TextEditor KDev::Language KDev::Interfaces KDev::Project KDev::Util) +target_link_libraries(kdevquickopen + KDev::Language + KDev::Interfaces + KDev::Project + KDev::Util + KF5::GuiAddons +) diff --git a/plugins/quickopen/projectfilequickopen.cpp b/plugins/quickopen/projectfilequickopen.cpp index 43192bc8cf..6b0ac0ff5c 100644 --- a/plugins/quickopen/projectfilequickopen.cpp +++ b/plugins/quickopen/projectfilequickopen.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -164,24 +163,7 @@ QWidget* ProjectFileData::expandingWidget() const QIcon ProjectFileData::icon() const { - const QString& iconName = iconNameForUrl(m_file.indexedPath); - - /** - * FIXME: Move this cache into a more central place and reuse it elsewhere. - * The project model e.g. could reuse this as well. - * - * Note: We cache here since otherwise displaying and esp. scrolling - * in a large list of quickopen items becomes very slow. - */ - static QHash iconCache; - QHash::const_iterator it = iconCache.constFind(iconName); - if (it != iconCache.constEnd()) { - return it.value(); - } - - const QPixmap& pixmap = KIconLoader::global()->loadIcon(iconName, KIconLoader::Small); - iconCache.insert(iconName, pixmap); - return pixmap; + return QIcon::fromTheme(iconNameForUrl(m_file.indexedPath)); } QString ProjectFileData::project() const diff --git a/plugins/quickopen/tests/CMakeLists.txt b/plugins/quickopen/tests/CMakeLists.txt index 86c0458c53..16a7ec6e13 100644 --- a/plugins/quickopen/tests/CMakeLists.txt +++ b/plugins/quickopen/tests/CMakeLists.txt @@ -9,7 +9,11 @@ add_library(quickopentestbase STATIC ../projectfilequickopen.cpp) target_link_libraries(quickopentestbase PUBLIC - Qt5::Test KF5::IconThemes KDev::Tests KDev::Project KDev::Language) + KDev::Tests + KDev::Project + KDev::Language + Qt5::Test +) ecm_add_test(test_quickopen.cpp LINK_LIBRARIES quickopentestbase) -- GitLab