1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 The Qt Company Ltd. 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of Qt Creator. 7 ** 8 ** Commercial License Usage 9 ** Licensees holding valid commercial Qt licenses may use this file in 10 ** accordance with the commercial license agreement provided with the 11 ** Software or, alternatively, in accordance with the terms contained in 12 ** a written agreement between you and The Qt Company. For licensing terms 13 ** and conditions see https://www.qt.io/terms-conditions. For further 14 ** information use the contact form at https://www.qt.io/contact-us. 15 ** 16 ** GNU General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU 18 ** General Public License version 3 as published by the Free Software 19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 20 ** included in the packaging of this file. Please review the following 21 ** information to ensure the GNU General Public License requirements will 22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 23 ** 24 ****************************************************************************/ 25 26 #pragma once 27 28 #include <abstractview.h> 29 30 #include <QPointer> 31 32 #include <mutex> 33 34 namespace QmlDesigner { 35 36 class ItemLibraryWidget; 37 class ImageCacheData; 38 class AsynchronousImageCache; 39 40 class ItemLibraryView : public AbstractView 41 { 42 Q_OBJECT 43 44 public: 45 ItemLibraryView(QObject* parent = nullptr); 46 ~ItemLibraryView() override; 47 48 bool hasWidget() const override; 49 WidgetInfo widgetInfo() override; 50 51 // AbstractView 52 void modelAttached(Model *model) override; 53 void modelAboutToBeDetached(Model *model) override; 54 void importsChanged(const QList<Import> &addedImports, const QList<Import> &removedImports) override; 55 void possibleImportsChanged(const QList<Import> &possibleImports) override; 56 void usedImportsChanged(const QList<Import> &usedImports) override; 57 void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override; 58 void updateImport3DSupport(const QVariantMap &supportMap) override; 59 void customNotification(const AbstractView *view, const QString &identifier, 60 const QList<ModelNode> &nodeList, const QList<QVariant> &data) override; 61 62 void setResourcePath(const QString &resourcePath); 63 64 AsynchronousImageCache &imageCache(); 65 66 protected: 67 void updateImports(); 68 69 private: 70 ImageCacheData *imageCacheData(); 71 72 std::once_flag imageCacheFlag; 73 std::unique_ptr<ImageCacheData> m_imageCacheData; 74 QPointer<ItemLibraryWidget> m_widget; 75 bool m_hasErrors = false; 76 QVariantMap m_importableExtensions3DMap; 77 QVariantMap m_importOptions3DMap; 78 }; 79 80 } 81