| 350 | } |
| 351 | |
| 352 | QList<ILanguageSupport*> LanguageController::languagesForMimetype(const QString& mimetype) |
| 353 | { |
| 354 | Q_D(LanguageController); |
| 355 | |
| 356 | QMutexLocker lock(&d->dataMutex); |
| 357 | |
| 358 | QList<ILanguageSupport*> languages; |
| 359 | LanguageCache::ConstIterator it = d->languageCache.constFind(mimetype); |
| 360 | if (it != d->languageCache.constEnd()) { |
| 361 | languages = it.value(); |
| 362 | } else { |
| 363 | QVariantMap constraints; |
| 364 | constraints.insert(KEY_SupportedMimeTypes(), mimetype); |
| 365 | const QList<IPlugin*> supports = Core::self()->pluginController()->allPluginsForExtension(KEY_ILanguageSupport(), constraints); |
| 366 | |
| 367 | if (supports.isEmpty()) { |
| 368 | qCDebug(SHELL) << "no languages for mimetype:" << mimetype; |
| 369 | d->languageCache.insert(mimetype, QList<ILanguageSupport*>()); |
| 370 | } else { |
| 371 | for (IPlugin *support : supports) { |
| 372 | auto* languageSupport = support->extension<ILanguageSupport>(); |
| 373 | qCDebug(SHELL) << "language-support:" << languageSupport; |
| 374 | if(languageSupport) { |
| 375 | d->addLanguageSupport(languageSupport); |
| 376 | languages << languageSupport; |
| 377 | } |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | return languages; |
| 382 | } |
| 383 | |
| 384 | QList<QString> LanguageController::mimetypesForLanguageName(const QString& languageName) |
| 385 | { |
nothing calls this directly
no test coverage detected