QmlDesigner: Cleanup code for reuse

Task-number: QDS-9479
Change-Id: If8c66444e7b85255aa2f66519ab74572d3800979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2023-03-20 18:53:18 +01:00
parent 77720c1122
commit 492c2f89c4
2 changed files with 8 additions and 22 deletions

View File

@@ -342,7 +342,6 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
package,
notUpdatedFileStatusSourceIds,
notUpdatedSourceIds,
directoryPath,
watchedQmlSourceIds,
watchedQmltypesSourceIds);
break;
@@ -408,7 +407,6 @@ void ProjectStorageUpdater::parseProjectDatas(const Storage::Synchronization::Pr
Storage::Synchronization::SynchronizationPackage &package,
SourceIds &notUpdatedFileStatusSourceIds,
SourceIds &notUpdatedSourceIds,
Utils::SmallStringView directoryPath,
SourceIds &watchedQmlSourceIds,
SourceIds &watchedQmltypesSourceIds)
{
@@ -428,13 +426,7 @@ void ProjectStorageUpdater::parseProjectDatas(const Storage::Synchronization::Pr
case Storage::Synchronization::FileType::QmlDocument: {
watchedQmlSourceIds.push_back(projectData.sourceId);
SourcePath qmlDocumentPath = m_pathCache.sourcePath(projectData.sourceId);
parseQmlComponent(qmlDocumentPath.name(),
qmlDocumentPath,
directoryPath,
projectData.sourceId,
package,
notUpdatedFileStatusSourceIds);
parseQmlComponent(projectData.sourceId, package, notUpdatedFileStatusSourceIds);
}
};
}
@@ -530,10 +522,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
package.types.push_back(std::move(type));
}
void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView fileName,
Utils::SmallStringView filePath,
Utils::SmallStringView directoryPath,
SourceId sourceId,
void ProjectStorageUpdater::parseQmlComponent(SourceId sourceId,
Storage::Synchronization::SynchronizationPackage &package,
SourceIds &notUpdatedFileStatusSourceIds)
{
@@ -546,12 +535,12 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView fileName,
package.updatedSourceIds.push_back(sourceId);
SourcePath sourcePath{filePath};
SourcePath sourcePath = m_pathCache.sourcePath(sourceId);
const auto content = m_fileSystem.contentAsQString(QString{filePath});
auto type = m_qmlDocumentParser.parse(content, package.imports, sourceId, directoryPath);
const auto content = m_fileSystem.contentAsQString(QString{sourcePath});
auto type = m_qmlDocumentParser.parse(content, package.imports, sourceId, sourcePath.directory());
type.typeName = fileName;
type.typeName = sourcePath.name();
type.traits = Storage::TypeTraits::Reference;
type.sourceId = sourceId;
type.changeLevel = Storage::Synchronization::ChangeLevel::ExcludeExportedTypes;

View File

@@ -9,6 +9,7 @@
#include "projectstoragepathwatchernotifierinterface.h"
#include "projectstoragepathwatchertypes.h"
#include "projectstoragetypes.h"
#include "sourcepath.h"
#include <qmljs/parser/qmldirparser_p.h>
@@ -124,7 +125,6 @@ private:
Storage::Synchronization::SynchronizationPackage &package,
SourceIds &notUpdatedFileStatusSourceIds,
SourceIds &notUpdatedSourceIds,
Utils::SmallStringView directoryPath,
SourceIds &watchedQmlSourceIds,
SourceIds &watchedQmltypesSourceIds);
FileState parseTypeInfo(const Storage::Synchronization::ProjectData &projectData,
@@ -149,10 +149,7 @@ private:
SourceIds &notUpdatedSourceIds,
SourceIds &watchedQmlSourceIds,
FileState qmldirState);
void parseQmlComponent(Utils::SmallStringView fileName,
Utils::SmallStringView filePath,
Utils::SmallStringView directoryPath,
SourceId sourceId,
void parseQmlComponent(SourceId sourceId,
Storage::Synchronization::SynchronizationPackage &package,
SourceIds &notUpdatedFileStatusSourceIds);