qmljs: (QString -> Utils::FilePath)++

convert more QString containing paths to Utils::FilePath

Change-Id: I1219d7d147993e48cfa641dc9bea72ab38c90f51
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Fawzi Mohamed
2022-06-20 12:35:13 +02:00
committed by Tim Jenssen
parent 0bb272d411
commit fd89043de2
79 changed files with 844 additions and 680 deletions

View File

@@ -68,12 +68,12 @@ public:
struct ProjectInfo
{
QPointer<ProjectExplorer::Project> project;
QStringList sourceFiles;
QList<Utils::FilePath> sourceFiles;
PathsAndLanguages importPaths;
QStringList activeResourceFiles;
QStringList allResourceFiles;
QHash<QString, QString> resourceFileContents;
QStringList applicationDirectories;
QList<Utils::FilePath> activeResourceFiles;
QList<Utils::FilePath> allResourceFiles;
QHash<Utils::FilePath, QString> resourceFileContents;
QList<Utils::FilePath> applicationDirectories;
QHash<QString, QString> moduleMappings; // E.g.: QtQuick.Controls -> MyProject.MyControls
// whether trying to run qmldump makes sense
@@ -91,18 +91,18 @@ public:
class WorkingCopy
{
public:
using Table = QHash<QString, QPair<QString, int>>;
using Table = QHash<Utils::FilePath, QPair<QString, int>>;
void insert(const QString &fileName, const QString &source, int revision = 0)
void insert(const Utils::FilePath &fileName, const QString &source, int revision = 0)
{ m_elements.insert(fileName, {source, revision}); }
bool contains(const QString &fileName) const
bool contains(const Utils::FilePath &fileName) const
{ return m_elements.contains(fileName); }
QString source(const QString &fileName) const
QString source(const Utils::FilePath &fileName) const
{ return m_elements.value(fileName).first; }
QPair<QString, int> get(const QString &fileName) const
QPair<QString, int> get(const Utils::FilePath &fileName) const
{ return m_elements.value(fileName); }
Table all() const
@@ -124,7 +124,7 @@ public:
ModelManagerInterface(QObject *parent = nullptr);
~ModelManagerInterface() override;
static Dialect guessLanguageOfFile(const QString &fileName);
static Dialect guessLanguageOfFile(const Utils::FilePath &fileName);
static QStringList globPatternsForLanguages(const QList<Dialect> &languages);
static ModelManagerInterface *instance();
static ModelManagerInterface *instanceForFuture(const QFuture<void> &future);
@@ -135,11 +135,11 @@ public:
QmlJS::Snapshot newestSnapshot() const;
void activateScan();
void updateSourceFiles(const QStringList &files,
bool emitDocumentOnDiskChanged);
void fileChangedOnDisk(const QString &path);
void removeFiles(const QStringList &files);
QStringList qrcPathsForFile(const QString &file, const QLocale *locale = nullptr,
void updateSourceFiles(const QList<Utils::FilePath> &files, bool emitDocumentOnDiskChanged);
void fileChangedOnDisk(const Utils::FilePath &path);
void removeFiles(const QList<Utils::FilePath> &files);
QStringList qrcPathsForFile(const Utils::FilePath &file,
const QLocale *locale = nullptr,
ProjectExplorer::Project *project = nullptr,
QrcResourceSelector resources = AllQrcResources);
QStringList filesAtQrcPath(const QString &path, const QLocale *locale = nullptr,
@@ -160,16 +160,18 @@ public:
void updateDocument(const QmlJS::Document::Ptr& doc);
void updateLibraryInfo(const Utils::FilePath &path, const QmlJS::LibraryInfo &info);
void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc);
void updateQrcFile(const QString &path);
ProjectInfo projectInfoForPath(const QString &path) const;
QList<ProjectInfo> allProjectInfosForPath(const QString &path) const;
void updateQrcFile(const Utils::FilePath &path);
ProjectInfo projectInfoForPath(const Utils::FilePath &path) const;
QList<ProjectInfo> allProjectInfosForPath(const Utils::FilePath &path) const;
QStringList importPathsNames() const;
QList<Utils::FilePath> importPathsNames() const;
QmlJS::QmlLanguageBundles activeBundles() const;
QmlJS::QmlLanguageBundles extendedBundles() const;
void loadPluginTypes(const QString &libraryPath, const QString &importPath,
const QString &importUri, const QString &importVersion);
void loadPluginTypes(const Utils::FilePath &libraryPath,
const Utils::FilePath &importPath,
const QString &importUri,
const QString &importVersion);
CppDataHash cppData() const;
LibraryInfo builtins(const Document::Ptr &doc) const;
@@ -192,7 +194,7 @@ public:
void addFuture(const QFuture<T> &future) { addFuture(QFuture<void>(future)); }
void addFuture(const QFuture<void> &future);
QmlJS::Document::Ptr ensuredGetDocumentForPath(const QString &filePath);
QmlJS::Document::Ptr ensuredGetDocumentForPath(const Utils::FilePath &filePath);
static void importScan(QFutureInterface<void> &future, const WorkingCopy& workingCopyInternal,
const PathsAndLanguages& paths, ModelManagerInterface *modelManager,
bool emitDocChangedOnDisk, bool libOnly = true,
@@ -205,10 +207,10 @@ public:
signals:
void documentUpdated(QmlJS::Document::Ptr doc);
void documentChangedOnDisk(QmlJS::Document::Ptr doc);
void aboutToRemoveFiles(const QStringList &files);
void libraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info);
void aboutToRemoveFiles(const QList<Utils::FilePath> &files);
void libraryInfoUpdated(const Utils::FilePath &path, const QmlJS::LibraryInfo &info);
void projectInfoUpdated(const ProjectInfo &pinfo);
void projectPathChanged(const QString &projectPath);
void projectPathChanged(const Utils::FilePath &projectPath);
protected:
Q_INVOKABLE void queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc, bool scan);
@@ -221,17 +223,20 @@ protected:
virtual void addTaskInternal(const QFuture<void> &result, const QString &msg,
const char *taskId) const;
QFuture<void> refreshSourceFiles(const QStringList &sourceFiles,
QFuture<void> refreshSourceFiles(const QList<Utils::FilePath> &sourceFiles,
bool emitDocumentOnDiskChanged);
static void parseLoop(QSet<QString> &scannedPaths, QSet<QString> &newLibraries,
const WorkingCopy &workingCopyInternal, QStringList files,
static void parseLoop(QSet<Utils::FilePath> &scannedPaths,
QSet<Utils::FilePath> &newLibraries,
const WorkingCopy &workingCopyInternal,
QList<Utils::FilePath> files,
ModelManagerInterface *modelManager,
QmlJS::Dialect mainLanguage, bool emitDocChangedOnDisk,
QmlJS::Dialect mainLanguage,
bool emitDocChangedOnDisk,
const std::function<bool(qreal)> &reportProgress);
static void parse(QFutureInterface<void> &future,
const WorkingCopy &workingCopyInternal,
QStringList files,
QList<Utils::FilePath> files,
ModelManagerInterface *modelManager,
QmlJS::Dialect mainLanguage,
bool emitDocChangedOnDisk);
@@ -257,19 +262,19 @@ private:
QmlJS::Snapshot m_newestSnapshot;
PathsAndLanguages m_allImportPaths;
QList<Utils::FilePath> m_applicationPaths;
QStringList m_defaultImportPaths;
QList<Utils::FilePath> m_defaultImportPaths;
QmlJS::QmlLanguageBundles m_activeBundles;
QmlJS::QmlLanguageBundles m_extendedBundles;
QHash<Dialect, QmlJS::ViewerContext> m_defaultVContexts;
bool m_shouldScanImports = false;
QSet<QString> m_scannedPaths;
QSet<Utils::FilePath> m_scannedPaths;
QTimer *m_updateCppQmlTypesTimer = nullptr;
QTimer *m_asyncResetTimer = nullptr;
QHash<QString, QPair<CPlusPlus::Document::Ptr, bool>> m_queuedCppDocuments;
QFuture<void> m_cppQmlTypesUpdater;
Utils::QrcCache m_qrcCache;
QHash<QString, QString> m_qrcContents;
QHash<Utils::FilePath, QString> m_qrcContents;
CppDataHash m_cppDataHash;
QHash<QString, QList<CPlusPlus::Document::Ptr>> m_cppDeclarationFiles;
@@ -279,7 +284,7 @@ private:
QMap<ProjectExplorer::Project *, ProjectInfo> m_projects;
ProjectInfo m_defaultProjectInfo;
ProjectExplorer::Project *m_defaultProject = nullptr;
QMultiHash<QString, ProjectExplorer::Project *> m_fileToProject;
QMultiHash<Utils::FilePath, ProjectExplorer::Project *> m_fileToProject;
PluginDumper *m_pluginDumper = nullptr;