quickopen: remove caching of project file icons, done by QIcon itself now

GIT_SILENT
parent 4fc86e6d
......@@ -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
)
......@@ -22,7 +22,6 @@
#include <QIcon>
#include <QTextBrowser>
#include <KIconLoader>
#include <KLocalizedString>
#include <interfaces/iprojectcontroller.h>
......@@ -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<QString, QPixmap> iconCache;
QHash<QString, QPixmap>::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
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment