QmlDesigner: Change asset import path

The only import path should be project root, so change things that
are generated under asset_imports to be generated in new folder
GeneratedComponents under project root. GeneratedComponents is prefixed
to the type names of generated items as well.

If project already contains asset_imports folder, then old location is
used.

Fixes: QDS-12430
Change-Id: I7a419fe1c5411e3d39bf3c1e659df0043c60ba33
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-04-09 15:27:42 +03:00
parent 8b877e7d4c
commit eae76dedff
28 changed files with 336 additions and 128 deletions

View File

@@ -8,12 +8,12 @@
#include "contentlibrarymaterialscategory.h"
#include "contentlibrarywidget.h"
#include <designerpaths.h>
#include "designerpaths.h"
#include "filedownloader.h"
#include "fileextractor.h"
#include "multifiledownloader.h"
#include "qmldesignerconstants.h"
#include "qmldesignerplugin.h"
#include <qmldesignerplugin.h>
#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
@@ -286,10 +286,11 @@ void ContentLibraryMaterialsModel::loadMaterialBundle(const QDir &matBundleDir)
QUrl icon = QUrl::fromLocalFile(matBundleDir.filePath(matObj.value("icon").toString()));
QString qml = matObj.value("qml").toString();
TypeName type = QLatin1String("%1.%2.%3").arg(
QLatin1String(Constants::COMPONENT_BUNDLES_FOLDER).mid(1),
bundleId,
qml.chopped(4)).toLatin1(); // chopped(4): remove .qml
TypeName type = QLatin1String("%1.%2.%3")
.arg(QmlDesignerPlugin::instance()->documentManager()
.generatedComponentUtils().componentBundlesTypePrefix(),
bundleId,
qml.chopped(4)).toLatin1(); // chopped(4): remove .qml
auto bundleMat = new ContentLibraryMaterial(category, mat, qml, type, icon, files,
m_downloadPath, m_baseUrl);