mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:56:22 +00:00
UI: IconCache: Microoptimize file()
This commit is contained in:
parent
d824118bbc
commit
7ea1d5247b
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user