| 113 | } |
| 114 | |
| 115 | QString themedFilePath(ThemeEntryType type, UIResources::Theme theme, const QString &filePath, QWidget *widget) |
| 116 | { |
| 117 | const PairThemeFileName pair = { devicePixelRatio(widget), theme, filePath }; |
| 118 | HashedThemeFilePaths &hash(s_cachedFilePaths[type]); |
| 119 | auto it = hash.find(pair); |
| 120 | |
| 121 | if (it == hash.end()) { |
| 122 | const QString iconFilePath = QString::fromLatin1("%1/%2") |
| 123 | .arg(type == Pixmap ? QStringLiteral("pixmaps") : QStringLiteral("icons"), filePath); |
| 124 | QString candidate(UIResources::themedPath(theme, iconFilePath, widget)); |
| 125 | |
| 126 | // Fallback to default theme file |
| 127 | if (theme != UIResources::Default && !QFile::exists(candidate)) { |
| 128 | const QString fallback = UIResources::themedFilePath(type, UIResources::Default, filePath, widget); |
| 129 | if (QFile::exists(fallback)) |
| 130 | candidate = fallback; |
| 131 | } |
| 132 | |
| 133 | it = hash.insert(pair, candidate); |
| 134 | // Q_ASSERT_X(QFile::exists(*it), "themedFilePath", qPrintable(*it)); |
| 135 | } |
| 136 | |
| 137 | return *it; |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 |
no test coverage detected