aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-fm/Browser.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-01-17 11:15:40 -0500
committerKen Moore <ken@ixsystems.com>2017-01-17 11:15:40 -0500
commita3f14039845273c799ca7d2a8888cf7c36b5cac6 (patch)
treecac04604e86b03aa5e968356c630d62c2bc1c2de /src-qt5/desktop-utils/lumina-fm/Browser.cpp
parentGet rid of a random context menu when right-clicking on the menu bar (diff)
downloadlumina-a3f14039845273c799ca7d2a8888cf7c36b5cac6.tar.gz
lumina-a3f14039845273c799ca7d2a8888cf7c36b5cac6.tar.bz2
lumina-a3f14039845273c799ca7d2a8888cf7c36b5cac6.zip
Add an internal icon cache for the standardized mimetype icons. This seems to speed up the loading of individual items quite a bit (something in Qt is not re-using previously loaded QIcons any more?)
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/Browser.cpp')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/Browser.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/Browser.cpp b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
index 9aeb70ac..d3e1b453 100644
--- a/src-qt5/desktop-utils/lumina-fm/Browser.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/Browser.cpp
@@ -56,14 +56,20 @@ void Browser::loadItem(QString info){
if(pix.height()>128){ pix = pix.scaled(128, 128, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); }
item.icon.addPixmap(pix);
}*/
- }/*else if(item.info.isDir()){
- item.icon = LXDG::findIcon("folder","inode/directory");
}
- if(item.icon.isNull()){ item.icon = LXDG::findIcon(item.info.mimetype(), "unknown"); }*/
//qDebug() << " - done with item:" << info;
this->emit threadDone(info, bytes);
}
+QIcon Browser::loadIcon(QString icon){
+ if(!mimeIcons.contains(icon)){
+ mimeIcons.insert(icon, LXDG::findIcon(icon, "unknown"));
+ }
+
+ return mimeIcons[icon];
+}
+
+
// PRIVATE SLOTS
void Browser::fileChanged(QString file){
if(file.startsWith(currentDir+"/") ){
@@ -85,11 +91,13 @@ void Browser::futureFinished(QString name, QByteArray icon){
QPixmap pix;
if(pix.loadFromData(icon) ){ ico.addPixmap(pix); }
}else if(info.isDir()){
- ico = LXDG::findIcon("folder","inode/directory");
+ ico = loadIcon("folder");
+ //LXDG::findIcon("folder","inode/directory");
}
if(ico.isNull()){
//qDebug() << "MimeType:" << info.fileName() << info.mimetype();
- ico = LXDG::findIcon( info.iconfile(), "unknown" );
+ ico = loadIcon(info.iconfile());
+ //ico = LXDG::findIcon( info.iconfile(), "unknown" );
}
this->emit itemDataAvailable( ico, info );
}
bgstack15