| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | static QIconLoader *iconLoaderInstance() { static QGlobalStatic<QIconLoader > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QIconLoader *x = new QIconLoader; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QIconLoader > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:6959 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:29 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:29 | yes Evaluation Count:6930 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-6959 |
| 12 | | - |
| 13 | | - |
| 14 | static QString fallbackTheme() | - |
| 15 | { | - |
| 16 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 17 | const QVariant themeHint = theme->themeHint(QPlatformTheme::SystemIconThemeName); | - |
| 18 | if (themeHint.isValid()) partially evaluated: themeHint.isValid()| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 19 | return themeHint.toString(); executed: return themeHint.toString();Execution Count:9 | 9 |
| 20 | } | 0 |
| 21 | return QString(); never executed: return QString(); | 0 |
| 22 | } | - |
| 23 | | - |
| 24 | QIconLoader::QIconLoader() : | - |
| 25 | m_themeKey(1), m_supportsSvg(false), m_initialized(false) | - |
| 26 | { | - |
| 27 | } executed: }Execution Count:29 | 29 |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | static inline QString systemThemeName() | - |
| 33 | { | - |
| 34 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 35 | const QVariant themeHint = theme->themeHint(QPlatformTheme::SystemIconThemeName); | - |
| 36 | if (themeHint.isValid()) partially evaluated: themeHint.isValid()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 37 | return themeHint.toString(); executed: return themeHint.toString();Execution Count:1 | 1 |
| 38 | } | 0 |
| 39 | return QString(); never executed: return QString(); | 0 |
| 40 | } | - |
| 41 | | - |
| 42 | static inline QStringList systemIconSearchPaths() | - |
| 43 | { | - |
| 44 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { never evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme() | 0 |
| 45 | const QVariant themeHint = theme->themeHint(QPlatformTheme::IconThemeSearchPaths); | - |
| 46 | if (themeHint.isValid()) never evaluated: themeHint.isValid() | 0 |
| 47 | return themeHint.toStringList(); never executed: return themeHint.toStringList(); | 0 |
| 48 | } | 0 |
| 49 | return QStringList(); never executed: return QStringList(); | 0 |
| 50 | } | - |
| 51 | | - |
| 52 | void QIconLoader::ensureInitialized() | - |
| 53 | { | - |
| 54 | if (!m_initialized) { evaluated: !m_initialized| yes Evaluation Count:1 | yes Evaluation Count:21 |
| 1-21 |
| 55 | m_initialized = true; | - |
| 56 | | - |
| 57 | qt_noop(); | - |
| 58 | | - |
| 59 | m_systemTheme = systemThemeName(); | - |
| 60 | | - |
| 61 | if (m_systemTheme.isEmpty()) partially evaluated: m_systemTheme.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 62 | m_systemTheme = fallbackTheme(); never executed: m_systemTheme = fallbackTheme(); | 0 |
| 63 | | - |
| 64 | QFactoryLoader iconFactoryLoader("org.qt-project.Qt.QIconEngineFactoryInterface", | - |
| 65 | QLatin1String("/iconengines"), | - |
| 66 | Qt::CaseInsensitive); | - |
| 67 | if (iconFactoryLoader.keyMap().key(QLatin1String("svg"), -1) != -1) partially evaluated: iconFactoryLoader.keyMap().key(QLatin1String("svg"), -1) != -1| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 68 | m_supportsSvg = true; never executed: m_supportsSvg = true; | 0 |
| 69 | | - |
| 70 | } executed: }Execution Count:1 | 1 |
| 71 | } executed: }Execution Count:22 | 22 |
| 72 | | - |
| 73 | QIconLoader *QIconLoader::instance() | - |
| 74 | { | - |
| 75 | return iconLoaderInstance(); executed: return iconLoaderInstance();Execution Count:6884 | 6884 |
| 76 | } | - |
| 77 | | - |
| 78 | | - |
| 79 | | - |
| 80 | void QIconLoader::updateSystemTheme() | - |
| 81 | { | - |
| 82 | | - |
| 83 | if (m_userTheme.isEmpty()) { never evaluated: m_userTheme.isEmpty() | 0 |
| 84 | QString theme = systemThemeName(); | - |
| 85 | if (theme.isEmpty()) never evaluated: theme.isEmpty() | 0 |
| 86 | theme = fallbackTheme(); never executed: theme = fallbackTheme(); | 0 |
| 87 | if (theme != m_systemTheme) { never evaluated: theme != m_systemTheme | 0 |
| 88 | m_systemTheme = theme; | - |
| 89 | invalidateKey(); | - |
| 90 | } | 0 |
| 91 | } | 0 |
| 92 | } | 0 |
| 93 | | - |
| 94 | void QIconLoader::setThemeName(const QString &themeName) | - |
| 95 | { | - |
| 96 | m_userTheme = themeName; | - |
| 97 | invalidateKey(); | - |
| 98 | } executed: }Execution Count:3 | 3 |
| 99 | | - |
| 100 | void QIconLoader::setThemeSearchPath(const QStringList &searchPaths) | - |
| 101 | { | - |
| 102 | m_iconDirs = searchPaths; | - |
| 103 | themeList.clear(); | - |
| 104 | invalidateKey(); | - |
| 105 | } executed: }Execution Count:2 | 2 |
| 106 | | - |
| 107 | QStringList QIconLoader::themeSearchPaths() const | - |
| 108 | { | - |
| 109 | if (m_iconDirs.isEmpty()) { partially evaluated: m_iconDirs.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 110 | m_iconDirs = systemIconSearchPaths(); | - |
| 111 | | - |
| 112 | m_iconDirs.append(QLatin1String(":/icons")); | - |
| 113 | } | 0 |
| 114 | return m_iconDirs; executed: return m_iconDirs;Execution Count:23 | 23 |
| 115 | } | - |
| 116 | | - |
| 117 | QIconTheme::QIconTheme(const QString &themeName) | - |
| 118 | : m_valid(false) | - |
| 119 | { | - |
| 120 | QFile themeIndex; | - |
| 121 | | - |
| 122 | QList <QIconDirInfo> keyList; | - |
| 123 | QStringList iconDirs = QIcon::themeSearchPaths(); | - |
| 124 | for ( int i = 0 ; i < iconDirs.size() ; ++i) { evaluated: i < iconDirs.size()| yes Evaluation Count:21 | yes Evaluation Count:18 |
| 18-21 |
| 125 | QDir iconDir(iconDirs[i]); | - |
| 126 | QString themeDir = iconDir.path() + QLatin1Char('/') + themeName; | - |
| 127 | themeIndex.setFileName(themeDir + QLatin1String("/index.theme")); | - |
| 128 | if (themeIndex.exists()) { evaluated: themeIndex.exists()| yes Evaluation Count:3 | yes Evaluation Count:18 |
| 3-18 |
| 129 | m_contentDir = themeDir; | - |
| 130 | m_valid = true; | - |
| 131 | break; executed: break;Execution Count:3 | 3 |
| 132 | } | - |
| 133 | } executed: }Execution Count:18 | 18 |
| 134 | | - |
| 135 | if (themeIndex.exists()) { evaluated: themeIndex.exists()| yes Evaluation Count:3 | yes Evaluation Count:18 |
| 3-18 |
| 136 | const QSettings indexReader(themeIndex.fileName(), QSettings::IniFormat); | - |
| 137 | QStringListIterator keyIterator(indexReader.allKeys()); | - |
| 138 | while (keyIterator.hasNext()) { evaluated: keyIterator.hasNext()| yes Evaluation Count:921 | yes Evaluation Count:3 |
| 3-921 |
| 139 | | - |
| 140 | const QString key = keyIterator.next(); | - |
| 141 | if (key.endsWith(QLatin1String("/Size"))) { evaluated: key.endsWith(QLatin1String("/Size"))| yes Evaluation Count:270 | yes Evaluation Count:651 |
| 270-651 |
| 142 | | - |
| 143 | | - |
| 144 | if (int size = indexReader.value(key).toInt()) { partially evaluated: int size = indexReader.value(key).toInt()| yes Evaluation Count:270 | no Evaluation Count:0 |
| 0-270 |
| 145 | QString directoryKey = key.left(key.size() - 5); | - |
| 146 | QIconDirInfo dirInfo(directoryKey); | - |
| 147 | dirInfo.size = size; | - |
| 148 | QString type = indexReader.value(directoryKey + | - |
| 149 | QLatin1String("/Type") | - |
| 150 | ).toString(); | - |
| 151 | | - |
| 152 | if (type == QLatin1String("Fixed")) evaluated: type == QLatin1String("Fixed")| yes Evaluation Count:243 | yes Evaluation Count:27 |
| 27-243 |
| 153 | dirInfo.type = QIconDirInfo::Fixed; executed: dirInfo.type = QIconDirInfo::Fixed;Execution Count:243 | 243 |
| 154 | else if (type == QLatin1String("Scalable")) partially evaluated: type == QLatin1String("Scalable")| yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
| 155 | dirInfo.type = QIconDirInfo::Scalable; executed: dirInfo.type = QIconDirInfo::Scalable;Execution Count:27 | 27 |
| 156 | else | - |
| 157 | dirInfo.type = QIconDirInfo::Threshold; never executed: dirInfo.type = QIconDirInfo::Threshold; | 0 |
| 158 | | - |
| 159 | dirInfo.threshold = indexReader.value(directoryKey + | - |
| 160 | QLatin1String("/Threshold"), | - |
| 161 | 2).toInt(); | - |
| 162 | | - |
| 163 | dirInfo.minSize = indexReader.value(directoryKey + | - |
| 164 | QLatin1String("/MinSize"), | - |
| 165 | size).toInt(); | - |
| 166 | | - |
| 167 | dirInfo.maxSize = indexReader.value(directoryKey + | - |
| 168 | QLatin1String("/MaxSize"), | - |
| 169 | size).toInt(); | - |
| 170 | m_keyList.append(dirInfo); | - |
| 171 | } executed: }Execution Count:270 | 270 |
| 172 | } executed: }Execution Count:270 | 270 |
| 173 | } executed: }Execution Count:921 | 921 |
| 174 | | - |
| 175 | | - |
| 176 | m_parents = indexReader.value( | - |
| 177 | QLatin1String("Icon Theme/Inherits")).toStringList(); | - |
| 178 | | - |
| 179 | | - |
| 180 | if (m_parents.isEmpty()) { partially evaluated: m_parents.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 181 | const QString fallback = fallbackTheme(); | - |
| 182 | if (!fallback.isEmpty()) never evaluated: !fallback.isEmpty() | 0 |
| 183 | m_parents.append(fallback); never executed: m_parents.append(fallback); | 0 |
| 184 | } | 0 |
| 185 | | - |
| 186 | | - |
| 187 | if (!m_parents.contains(QLatin1String("hicolor"))) partially evaluated: !m_parents.contains(QLatin1String("hicolor"))| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 188 | m_parents.append(QLatin1String("hicolor")); executed: m_parents.append(QLatin1String("hicolor"));Execution Count:3 | 3 |
| 189 | } executed: }Execution Count:3 | 3 |
| 190 | | - |
| 191 | } executed: }Execution Count:21 | 21 |
| 192 | | - |
| 193 | QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName, | - |
| 194 | const QString &iconName, | - |
| 195 | QStringList &visited) const | - |
| 196 | { | - |
| 197 | QThemeIconEntries entries; | - |
| 198 | qt_noop(); | - |
| 199 | | - |
| 200 | QPixmap pixmap; | - |
| 201 | | - |
| 202 | | - |
| 203 | visited << themeName; | - |
| 204 | | - |
| 205 | QIconTheme theme = themeList.value(themeName); | - |
| 206 | if (!theme.isValid()) { evaluated: !theme.isValid()| yes Evaluation Count:12 | yes Evaluation Count:7 |
| 7-12 |
| 207 | theme = QIconTheme(themeName); | - |
| 208 | if (!theme.isValid()) evaluated: !theme.isValid()| yes Evaluation Count:9 | yes Evaluation Count:3 |
| 3-9 |
| 209 | theme = QIconTheme(fallbackTheme()); executed: theme = QIconTheme(fallbackTheme());Execution Count:9 | 9 |
| 210 | | - |
| 211 | themeList.insert(themeName, theme); | - |
| 212 | } executed: }Execution Count:12 | 12 |
| 213 | | - |
| 214 | QString contentDir = theme.contentDir() + QLatin1Char('/'); | - |
| 215 | QList<QIconDirInfo> subDirs = theme.keyList(); | - |
| 216 | | - |
| 217 | const QString svgext(QLatin1String(".svg")); | - |
| 218 | const QString pngext(QLatin1String(".png")); | - |
| 219 | | - |
| 220 | | - |
| 221 | for (int i = 0; i < subDirs.size() ; ++i) { evaluated: i < subDirs.size()| yes Evaluation Count:900 | yes Evaluation Count:19 |
| 19-900 |
| 222 | const QIconDirInfo &dirInfo = subDirs.at(i); | - |
| 223 | QString subdir = dirInfo.path; | - |
| 224 | QDir currentDir(contentDir + subdir); | - |
| 225 | if (currentDir.exists(iconName + pngext)) { evaluated: currentDir.exists(iconName + pngext)| yes Evaluation Count:12 | yes Evaluation Count:888 |
| 12-888 |
| 226 | PixmapEntry *iconEntry = new PixmapEntry; | - |
| 227 | iconEntry->dir = dirInfo; | - |
| 228 | iconEntry->filename = currentDir.filePath(iconName + pngext); | - |
| 229 | | - |
| 230 | | - |
| 231 | entries.prepend(iconEntry); | - |
| 232 | } else if (m_supportsSvg && partially evaluated: m_supportsSvg| no Evaluation Count:0 | yes Evaluation Count:888 |
executed: }Execution Count:12 | 0-888 |
| 233 | currentDir.exists(iconName + svgext)) { never evaluated: currentDir.exists(iconName + svgext) | 0 |
| 234 | ScalableEntry *iconEntry = new ScalableEntry; | - |
| 235 | iconEntry->dir = dirInfo; | - |
| 236 | iconEntry->filename = currentDir.filePath(iconName + svgext); | - |
| 237 | entries.append(iconEntry); | - |
| 238 | } | 0 |
| 239 | } | - |
| 240 | | - |
| 241 | if (entries.isEmpty()) { evaluated: entries.isEmpty()| yes Evaluation Count:15 | yes Evaluation Count:4 |
| 4-15 |
| 242 | const QStringList parents = theme.parents(); | - |
| 243 | | - |
| 244 | for (int i = 0 ; i < parents.size() ; ++i) { evaluated: i < parents.size()| yes Evaluation Count:16 | yes Evaluation Count:13 |
| 13-16 |
| 245 | | - |
| 246 | const QString parentTheme = parents.at(i).trimmed(); | - |
| 247 | | - |
| 248 | if (!visited.contains(parentTheme)) evaluated: !visited.contains(parentTheme)| yes Evaluation Count:12 | yes Evaluation Count:4 |
| 4-12 |
| 249 | entries = findIconHelper(parentTheme, iconName, visited); executed: entries = findIconHelper(parentTheme, iconName, visited);Execution Count:12 | 12 |
| 250 | | - |
| 251 | if (!entries.isEmpty()) evaluated: !entries.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:14 |
| 2-14 |
| 252 | break; executed: break;Execution Count:2 | 2 |
| 253 | } executed: }Execution Count:14 | 14 |
| 254 | } executed: }Execution Count:15 | 15 |
| 255 | return entries; executed: return entries;Execution Count:19 | 19 |
| 256 | } | - |
| 257 | | - |
| 258 | QThemeIconEntries QIconLoader::loadIcon(const QString &name) const | - |
| 259 | { | - |
| 260 | if (!themeName().isEmpty()) { partially evaluated: !themeName().isEmpty()| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 261 | QStringList visited; | - |
| 262 | return findIconHelper(themeName(), name, visited); executed: return findIconHelper(themeName(), name, visited);Execution Count:7 | 7 |
| 263 | } | - |
| 264 | | - |
| 265 | return QThemeIconEntries(); never executed: return QThemeIconEntries(); | 0 |
| 266 | } | - |
| 267 | | - |
| 268 | | - |
| 269 | | - |
| 270 | | - |
| 271 | | - |
| 272 | QIconLoaderEngine::QIconLoaderEngine(const QString& iconName) | - |
| 273 | : m_iconName(iconName), m_key(0) | - |
| 274 | { | - |
| 275 | } executed: }Execution Count:6 | 6 |
| 276 | | - |
| 277 | QIconLoaderEngine::~QIconLoaderEngine() | - |
| 278 | { | - |
| 279 | while (!m_entries.isEmpty()) evaluated: !m_entries.isEmpty()| yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
| 280 | delete m_entries.takeLast(); executed: delete m_entries.takeLast();Execution Count:6 | 6 |
| 281 | qt_noop(); | - |
| 282 | } executed: }Execution Count:6 | 6 |
| 283 | | - |
| 284 | QIconLoaderEngine::QIconLoaderEngine(const QIconLoaderEngine &other) | - |
| 285 | : QIconEngine(other), | - |
| 286 | m_iconName(other.m_iconName), | - |
| 287 | m_key(0) | - |
| 288 | { | - |
| 289 | } | 0 |
| 290 | | - |
| 291 | QIconEngine *QIconLoaderEngine::clone() const | - |
| 292 | { | - |
| 293 | return new QIconLoaderEngine(*this); never executed: return new QIconLoaderEngine(*this); | 0 |
| 294 | } | - |
| 295 | | - |
| 296 | bool QIconLoaderEngine::read(QDataStream &in) { | - |
| 297 | in >> m_iconName; | - |
| 298 | return true; executed: return true;Execution Count:1 | 1 |
| 299 | } | - |
| 300 | | - |
| 301 | bool QIconLoaderEngine::write(QDataStream &out) const | - |
| 302 | { | - |
| 303 | out << m_iconName; | - |
| 304 | return true; executed: return true;Execution Count:1 | 1 |
| 305 | } | - |
| 306 | | - |
| 307 | bool QIconLoaderEngine::hasIcon() const | - |
| 308 | { | - |
| 309 | return !(m_entries.isEmpty()); never executed: return !(m_entries.isEmpty()); | 0 |
| 310 | } | - |
| 311 | | - |
| 312 | | - |
| 313 | void QIconLoaderEngine::ensureLoaded() | - |
| 314 | { | - |
| 315 | | - |
| 316 | iconLoaderInstance()->ensureInitialized(); | - |
| 317 | | - |
| 318 | if (!(iconLoaderInstance()->themeKey() == m_key)) { evaluated: !(iconLoaderInstance()->themeKey() == m_key)| yes Evaluation Count:7 | yes Evaluation Count:15 |
| 7-15 |
| 319 | | - |
| 320 | while (!m_entries.isEmpty()) evaluated: !m_entries.isEmpty()| yes Evaluation Count:6 | yes Evaluation Count:7 |
| 6-7 |
| 321 | delete m_entries.takeLast(); executed: delete m_entries.takeLast();Execution Count:6 | 6 |
| 322 | | - |
| 323 | qt_noop(); | - |
| 324 | m_entries = iconLoaderInstance()->loadIcon(m_iconName); | - |
| 325 | m_key = iconLoaderInstance()->themeKey(); | - |
| 326 | } executed: }Execution Count:7 | 7 |
| 327 | } executed: }Execution Count:22 | 22 |
| 328 | | - |
| 329 | void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect, | - |
| 330 | QIcon::Mode mode, QIcon::State state) | - |
| 331 | { | - |
| 332 | QSize pixmapSize = rect.size(); | - |
| 333 | | - |
| 334 | | - |
| 335 | | - |
| 336 | painter->drawPixmap(rect, pixmap(pixmapSize, mode, state)); | - |
| 337 | } | 0 |
| 338 | | - |
| 339 | | - |
| 340 | | - |
| 341 | | - |
| 342 | | - |
| 343 | static bool directoryMatchesSize(const QIconDirInfo &dir, int iconsize) | - |
| 344 | { | - |
| 345 | if (dir.type == QIconDirInfo::Fixed) { partially evaluated: dir.type == QIconDirInfo::Fixed| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 346 | return dir.size == iconsize; executed: return dir.size == iconsize;Execution Count:9 | 9 |
| 347 | | - |
| 348 | } else if (dir.type == QIconDirInfo::Scalable) { never evaluated: dir.type == QIconDirInfo::Scalable | 0 |
| 349 | return dir.size <= dir.maxSize && | 0 |
| 350 | iconsize >= dir.minSize; never executed: return dir.size <= dir.maxSize && iconsize >= dir.minSize; | 0 |
| 351 | | - |
| 352 | } else if (dir.type == QIconDirInfo::Threshold) { never evaluated: dir.type == QIconDirInfo::Threshold | 0 |
| 353 | return iconsize >= dir.size - dir.threshold && | 0 |
| 354 | iconsize <= dir.size + dir.threshold; never executed: return iconsize >= dir.size - dir.threshold && iconsize <= dir.size + dir.threshold; | 0 |
| 355 | } | - |
| 356 | | - |
| 357 | qt_noop(); | - |
| 358 | return false; never executed: return false; | 0 |
| 359 | } | - |
| 360 | | - |
| 361 | | - |
| 362 | | - |
| 363 | | - |
| 364 | | - |
| 365 | static int directorySizeDistance(const QIconDirInfo &dir, int iconsize) | - |
| 366 | { | - |
| 367 | if (dir.type == QIconDirInfo::Fixed) { partially evaluated: dir.type == QIconDirInfo::Fixed| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 368 | return qAbs(dir.size - iconsize); executed: return qAbs(dir.size - iconsize);Execution Count:6 | 6 |
| 369 | | - |
| 370 | } else if (dir.type == QIconDirInfo::Scalable) { never evaluated: dir.type == QIconDirInfo::Scalable | 0 |
| 371 | if (iconsize < dir.minSize) never evaluated: iconsize < dir.minSize | 0 |
| 372 | return dir.minSize - iconsize; never executed: return dir.minSize - iconsize; | 0 |
| 373 | else if (iconsize > dir.maxSize) never evaluated: iconsize > dir.maxSize | 0 |
| 374 | return iconsize - dir.maxSize; never executed: return iconsize - dir.maxSize; | 0 |
| 375 | else | - |
| 376 | return 0; never executed: return 0; | 0 |
| 377 | | - |
| 378 | } else if (dir.type == QIconDirInfo::Threshold) { never evaluated: dir.type == QIconDirInfo::Threshold | 0 |
| 379 | if (iconsize < dir.size - dir.threshold) never evaluated: iconsize < dir.size - dir.threshold | 0 |
| 380 | return dir.minSize - iconsize; never executed: return dir.minSize - iconsize; | 0 |
| 381 | else if (iconsize > dir.size + dir.threshold) never evaluated: iconsize > dir.size + dir.threshold | 0 |
| 382 | return iconsize - dir.maxSize; never executed: return iconsize - dir.maxSize; | 0 |
| 383 | else return 0; never executed: return 0; | 0 |
| 384 | } | - |
| 385 | | - |
| 386 | qt_noop(); | - |
| 387 | return 2147483647; never executed: return 2147483647; | 0 |
| 388 | } | - |
| 389 | | - |
| 390 | QIconLoaderEngineEntry *QIconLoaderEngine::entryForSize(const QSize &size) | - |
| 391 | { | - |
| 392 | int iconsize = qMin(size.width(), size.height()); | - |
| 393 | | - |
| 394 | | - |
| 395 | | - |
| 396 | | - |
| 397 | | - |
| 398 | for (int i = 0; i < m_entries.count(); ++i) { evaluated: i < m_entries.count()| yes Evaluation Count:9 | yes Evaluation Count:2 |
| 2-9 |
| 399 | QIconLoaderEngineEntry *entry = m_entries.at(i); | - |
| 400 | if (directoryMatchesSize(entry->dir, iconsize)) { evaluated: directoryMatchesSize(entry->dir, iconsize)| yes Evaluation Count:2 | yes Evaluation Count:7 |
| 2-7 |
| 401 | return entry; executed: return entry;Execution Count:2 | 2 |
| 402 | } | - |
| 403 | } executed: }Execution Count:7 | 7 |
| 404 | | - |
| 405 | | - |
| 406 | int minimalSize = 2147483647; | - |
| 407 | QIconLoaderEngineEntry *closestMatch = 0; | - |
| 408 | for (int i = 0; i < m_entries.count(); ++i) { evaluated: i < m_entries.count()| yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
| 409 | QIconLoaderEngineEntry *entry = m_entries.at(i); | - |
| 410 | int distance = directorySizeDistance(entry->dir, iconsize); | - |
| 411 | if (distance < minimalSize) { evaluated: distance < minimalSize| yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
| 412 | minimalSize = distance; | - |
| 413 | closestMatch = entry; | - |
| 414 | } executed: }Execution Count:4 | 4 |
| 415 | } executed: }Execution Count:6 | 6 |
| 416 | return closestMatch; executed: return closestMatch;Execution Count:2 | 2 |
| 417 | } | - |
| 418 | | - |
| 419 | | - |
| 420 | | - |
| 421 | | - |
| 422 | | - |
| 423 | | - |
| 424 | | - |
| 425 | QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode, | - |
| 426 | QIcon::State state) | - |
| 427 | { | - |
| 428 | ensureLoaded(); | - |
| 429 | | - |
| 430 | QIconLoaderEngineEntry *entry = entryForSize(size); | - |
| 431 | if (entry) { | 0 |
| 432 | const QIconDirInfo &dir = entry->dir; | - |
| 433 | if (dir.type == QIconDirInfo::Scalable) never evaluated: dir.type == QIconDirInfo::Scalable | 0 |
| 434 | return size; never executed: return size; | 0 |
| 435 | else { | - |
| 436 | int result = qMin<int>(dir.size, qMin(size.width(), size.height())); | - |
| 437 | return QSize(result, result); never executed: return QSize(result, result); | 0 |
| 438 | } | - |
| 439 | } | - |
| 440 | return QIconEngine::actualSize(size, mode, state); never executed: return QIconEngine::actualSize(size, mode, state); | 0 |
| 441 | } | - |
| 442 | | - |
| 443 | QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) | - |
| 444 | { | - |
| 445 | (void)state;; | - |
| 446 | | - |
| 447 | | - |
| 448 | | - |
| 449 | if (basePixmap.isNull()) evaluated: basePixmap.isNull()| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 450 | basePixmap.load(filename); executed: basePixmap.load(filename);Execution Count:3 | 3 |
| 451 | | - |
| 452 | QSize actualSize = basePixmap.size(); | - |
| 453 | if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) partially evaluated: !actualSize.isNull()| yes Evaluation Count:4 | no Evaluation Count:0 |
evaluated: actualSize.width() > size.width()| yes Evaluation Count:1 | yes Evaluation Count:3 |
partially evaluated: actualSize.height() > size.height()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-4 |
| 454 | actualSize.scale(size, Qt::KeepAspectRatio); executed: actualSize.scale(size, Qt::KeepAspectRatio);Execution Count:1 | 1 |
| 455 | | - |
| 456 | QString key = QLatin1String("$qt_theme_") | - |
| 457 | % HexString<qint64>(basePixmap.cacheKey()) | - |
| 458 | % HexString<int>(mode) | - |
| 459 | % HexString<qint64>(QGuiApplication::palette().cacheKey()) | - |
| 460 | % HexString<int>(actualSize.width()) | - |
| 461 | % HexString<int>(actualSize.height()); | - |
| 462 | | - |
| 463 | QPixmap cachedPixmap; | - |
| 464 | if (QPixmapCache::find(key, &cachedPixmap)) { evaluated: QPixmapCache::find(key, &cachedPixmap)| yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
| 465 | return cachedPixmap; executed: return cachedPixmap;Execution Count:1 | 1 |
| 466 | } else { | - |
| 467 | if (basePixmap.size() != actualSize) evaluated: basePixmap.size() != actualSize| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 468 | basePixmap = basePixmap.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); executed: basePixmap = basePixmap.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);Execution Count:1 | 1 |
| 469 | cachedPixmap = basePixmap; | - |
| 470 | if (QGuiApplication *guiApp = qobject_cast<QGuiApplication *>((static_cast<QGuiApplication *>(QCoreApplication::instance())))) partially evaluated: QGuiApplication *guiApp = qobject_cast<QGuiApplication *>((static_cast<QGuiApplication *>(QCoreApplication::instance())))| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 471 | cachedPixmap = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(mode, basePixmap); executed: cachedPixmap = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(mode, basePixmap);Execution Count:3 | 3 |
| 472 | QPixmapCache::insert(key, cachedPixmap); | - |
| 473 | } executed: }Execution Count:3 | 3 |
| 474 | return cachedPixmap; executed: return cachedPixmap;Execution Count:3 | 3 |
| 475 | } | - |
| 476 | | - |
| 477 | QPixmap ScalableEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) | - |
| 478 | { | - |
| 479 | if (svgIcon.isNull()) never evaluated: svgIcon.isNull() | 0 |
| 480 | svgIcon = QIcon(filename); never executed: svgIcon = QIcon(filename); | 0 |
| 481 | | - |
| 482 | | - |
| 483 | return svgIcon.pixmap(size, mode, state); never executed: return svgIcon.pixmap(size, mode, state); | 0 |
| 484 | } | - |
| 485 | | - |
| 486 | QPixmap QIconLoaderEngine::pixmap(const QSize &size, QIcon::Mode mode, | - |
| 487 | QIcon::State state) | - |
| 488 | { | - |
| 489 | ensureLoaded(); | - |
| 490 | | - |
| 491 | QIconLoaderEngineEntry *entry = entryForSize(size); | - |
| 492 | if (entry) partially evaluated: entry| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 493 | return entry->pixmap(size, mode, state); executed: return entry->pixmap(size, mode, state);Execution Count:4 | 4 |
| 494 | | - |
| 495 | return QPixmap(); never executed: return QPixmap(); | 0 |
| 496 | } | - |
| 497 | | - |
| 498 | QString QIconLoaderEngine::key() const | - |
| 499 | { | - |
| 500 | return QLatin1String("QIconLoaderEngine"); executed: return QLatin1String("QIconLoaderEngine");Execution Count:1 | 1 |
| 501 | } | - |
| 502 | | - |
| 503 | void QIconLoaderEngine::virtual_hook(int id, void *data) | - |
| 504 | { | - |
| 505 | ensureLoaded(); | - |
| 506 | | - |
| 507 | switch (id) { | - |
| 508 | case QIconEngine::AvailableSizesHook: | - |
| 509 | { | - |
| 510 | QIconEngine::AvailableSizesArgument &arg | - |
| 511 | = *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data); | - |
| 512 | const QList<QIconDirInfo> directoryKey = iconLoaderInstance()->theme().keyList(); | - |
| 513 | arg.sizes.clear(); | - |
| 514 | | - |
| 515 | | - |
| 516 | for (int i = 0 ; i < m_entries.size() ; ++i) { evaluated: i < m_entries.size()| yes Evaluation Count:36 | yes Evaluation Count:17 |
| 17-36 |
| 517 | int size = m_entries.at(i)->dir.size; | - |
| 518 | arg.sizes.append(QSize(size, size)); | - |
| 519 | } executed: }Execution Count:36 | 36 |
| 520 | } | - |
| 521 | break; executed: break;Execution Count:17 | 17 |
| 522 | case QIconEngine::IconNameHook: | - |
| 523 | { | - |
| 524 | QString &name = *reinterpret_cast<QString*>(data); | - |
| 525 | name = m_iconName; | - |
| 526 | } | - |
| 527 | break; executed: break;Execution Count:1 | 1 |
| 528 | default: | - |
| 529 | QIconEngine::virtual_hook(id, data); | - |
| 530 | } | 0 |
| 531 | } executed: }Execution Count:18 | 18 |
| 532 | | - |
| 533 | | - |
| 534 | | - |
| | |