summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSergio Martins <sergio.martins@kdab.com>2013-03-27 18:17:34 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-28 16:06:45 (GMT)
commitac69080efd0f0efea50e08b8f2f9550befd3b7ae (patch)
tree0e0de75118186b75a5329cee80b3e99271210cb9 /src/gui
parent8233a15a7480ed0a5fe9a7500ac3cf54f0e63887 (diff)
downloadQt-ac69080efd0f0efea50e08b8f2f9550befd3b7ae.zip
Qt-ac69080efd0f0efea50e08b8f2f9550befd3b7ae.tar.gz
Qt-ac69080efd0f0efea50e08b8f2f9550befd3b7ae.tar.bz2
Windows: Fix one of the two file dialog bottlenecks.
This patch reduces the number of calls to GetFileAttributesEx() when icon lookup is being done. The second bottleneck is a couple of isSymLink() calls. Will fix that next. Task-number: QTBUG-13182 (cherry picked from commit a7f6f32fadd5024697c16dfcbc07d6d11beb45fa) Change-Id: If42b791d22fe0429a3b43992bad037afad09c448 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp
index c95e01f..e958eb3 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -228,13 +228,26 @@ QIcon QFileIconProvider::icon(IconType type) const
}
#ifdef Q_WS_WIN
+
+static bool isCacheable(const QFileInfo &fi)
+{
+ if (!fi.isFile())
+ return false;
+
+ // On windows it's faster to just look at the file extensions. QTBUG-13182
+ const QString fileExtension = fi.suffix();
+ return fileExtension.compare(QLatin1String("exe"), Qt::CaseInsensitive) &&
+ fileExtension.compare(QLatin1String("lnk"), Qt::CaseInsensitive) &&
+ fileExtension.compare(QLatin1String("ico"), Qt::CaseInsensitive);
+}
+
QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const
{
QIcon retIcon;
const QString fileExtension = QLatin1Char('.') + fileInfo.suffix().toUpper();
QString key;
- if (fileInfo.isFile() && !fileInfo.isExecutable() && !fileInfo.isSymLink() && fileExtension != QLatin1String(".ICO"))
+ if (isCacheable(fileInfo))
key = QLatin1String("qt_") + fileExtension;
QPixmap pixmap;