forked from qt-creator/qt-creator
A placeholder .q3d file is created under content for imported 3D components found under Generated/QtQuick3D on asset view attach and every time new import is done. .q3d file contains a project root relative path to component's import folder. .q3d files get generated preview as icon in assets view. Imported 3D items are no longer shown in Components view. Removing .q3d file will remove the corresponding module as well as all model nodes created from that asset. Removing last model node of asset will remove the import statement on next document save. Fixes: QDS-12193 Fixes: QDS-14565 Change-Id: If01546ca4c78334bac73b055ed156276f6f8f2a4 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
// Copyright (C) 2022 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
#pragma once
|
|
|
|
#include "abstractview.h"
|
|
|
|
#include <utils/filepath.h>
|
|
#include <utils/uniqueobjectptr.h>
|
|
|
|
#include <QPointer>
|
|
#include <QTimer>
|
|
|
|
#include <mutex>
|
|
|
|
namespace QmlDesigner {
|
|
|
|
class AssetsLibraryWidget;
|
|
class AsynchronousImageCache;
|
|
|
|
class AssetsLibraryView : public AbstractView
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
AssetsLibraryView(AsynchronousImageCache &imageCache,
|
|
ExternalDependenciesInterface &externalDependencies);
|
|
~AssetsLibraryView() override;
|
|
|
|
bool hasWidget() const override;
|
|
WidgetInfo widgetInfo() override;
|
|
|
|
// AbstractView
|
|
void modelAttached(Model *model) override;
|
|
void modelAboutToBeDetached(Model *model) override;
|
|
void setResourcePath(const QString &resourcePath);
|
|
|
|
private:
|
|
class ImageCacheData;
|
|
ImageCacheData *imageCacheData();
|
|
|
|
void customNotification(const AbstractView *view, const QString &identifier,
|
|
const QList<ModelNode> &nodeList, const QList<QVariant> &data) override;
|
|
QHash<QString, Utils::FilePath> collectFiles(const Utils::FilePath &dirPath,
|
|
const QString &suffix);
|
|
void sync3dImports();
|
|
|
|
std::once_flag imageCacheFlag;
|
|
std::unique_ptr<ImageCacheData> m_imageCacheData;
|
|
Utils::UniqueObjectPtr<AssetsLibraryWidget> m_widget;
|
|
QString m_lastResourcePath;
|
|
QTimer m_3dImportsSyncTimer;
|
|
};
|
|
|
|
}
|