20 moveToThread(service->thread());
24 m_blacklist.blacklist(
":/qt-project.org");
25 m_blacklist.blacklist(
":/QtQuick/Controls/Styles");
26 m_blacklist.blacklist(
":/ExtrasImports/QtQuick/Controls/Styles");
29 m_blacklist.blacklist(
"/etc");
31 for (
int loc = QLibraryInfo::PrefixPath; loc < QLibraryInfo::TestsPath; ++loc) {
32 m_blacklist.blacklist(QLibraryInfo::path(
33 static_cast<QLibraryInfo::LibraryPath>(loc)));
35 m_blacklist.blacklist(QLibraryInfo::path(QLibraryInfo::SettingsPath));
37 static const QStandardPaths::StandardLocation blackListLocations[] = {
38 QStandardPaths::CacheLocation,
39 QStandardPaths::GenericDataLocation,
40 QStandardPaths::ConfigLocation,
41 QStandardPaths::GenericCacheLocation,
42 QStandardPaths::GenericConfigLocation,
43 QStandardPaths::AppDataLocation,
44 QStandardPaths::AppConfigLocation
47 for (
auto locationType : blackListLocations) {
48 const QStringList locations = QStandardPaths::standardLocations(locationType);
49 for (
const QString &location : locations)
50 m_blacklist.blacklist(location);
53 m_blacklist.whitelist(QLibraryInfo::path(QLibraryInfo::TestsPath));
58 const QStringList tempLocations
59 = QStandardPaths::standardLocations(QStandardPaths::TempLocation);
60 for (
const QString &tempLocation : tempLocations)
61 m_blacklist.whitelist(tempLocation);
67 connect(
this, &QQmlPreviewFileLoader::request, service, &QQmlPreviewServiceImpl::forwardRequest,
68 Qt::DirectConnection);
69 connect(service, &QQmlPreviewServiceImpl::directory,
this, &QQmlPreviewFileLoader::directory,
70 Qt::DirectConnection);
71 connect(service, &QQmlPreviewServiceImpl::file,
this, &QQmlPreviewFileLoader::file,
72 Qt::DirectConnection);
73 connect(service, &QQmlPreviewServiceImpl::error,
this, &QQmlPreviewFileLoader::error,
74 Qt::DirectConnection);
75 connect(service, &QQmlPreviewServiceImpl::clearCache,
this, &QQmlPreviewFileLoader::clearCache,
76 Qt::DirectConnection);
81 QMutexLocker locker(&m_contentMutex);
84 auto fileIterator = m_fileCache.constFind(path);
85 if (fileIterator != m_fileCache.constEnd()) {
87 m_contents = *fileIterator;
92 auto dirIterator = m_directoryCache.constFind(path);
93 if (dirIterator != m_directoryCache.constEnd()) {
96 m_entries = *dirIterator;
104 m_waitCondition.wait(&m_contentMutex);