UI: IconCache: Microoptimize file()

This commit is contained in:
Nodir Temirkhodjaev 2023-08-17 12:37:32 +05:00
parent d824118bbc
commit 7ea1d5247b

View File

@ -51,21 +51,22 @@ QPixmap IconCache::file(const QString &filePath)
{ {
checkThread(); checkThread();
QString adjustedFilePath = filePath;
// Try to use "./icons/" folder from current working dir.
if (filePath.startsWith(':')) {
adjustedFilePath[0] = '.';
if (!FileUtil::fileExists(adjustedFilePath)) {
adjustedFilePath = filePath;
}
}
QPixmap pixmap; QPixmap pixmap;
if (!find(adjustedFilePath, &pixmap)) { if (!find(filePath, &pixmap)) {
QString adjustedFilePath = filePath;
// Try to use "./icons/" folder from current working dir.
if (filePath.startsWith(':')) {
adjustedFilePath[0] = '.';
if (!FileUtil::fileExists(adjustedFilePath)) {
adjustedFilePath = filePath;
}
}
pixmap.load(adjustedFilePath); pixmap.load(adjustedFilePath);
insert(adjustedFilePath, pixmap);
insert(filePath, pixmap);
} }
return pixmap; return pixmap;
} }