File indexing completed on 2024-12-22 04:15:12
0001 /* 0002 * SPDX-FileCopyrightText: 2023 Srirupa Datta <srirupa.sps@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef WDG_RESOURCE_PREVIEW_H 0008 #define WDG_RESOURCE_PREVIEW_H 0009 0010 #include <QScopedPointer> 0011 #include <QSharedPointer> 0012 #include <QItemSelection> 0013 #include <QWidget> 0014 0015 #include <KisResourceThumbnailPainter.h> 0016 #include "ResourceListViewModes.h" 0017 #include <KisResourceItemDelegate.h> 0018 0019 0020 class KisActionManager; 0021 class KisResourceTypeModel; 0022 class KisStorageModel; 0023 class KisTagModel; 0024 class KisResourceModel; 0025 class KisTagFilterResourceProxyModel; 0026 class KisTag; 0027 class KisWdgTagSelectionControllerOneResource; 0028 0029 enum class WidgetType {BundleCreator, ResourceManager}; 0030 0031 namespace Ui { 0032 class WdgResourcePreview; 0033 } 0034 0035 class WdgResourcePreview : public QWidget 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 explicit WdgResourcePreview(WidgetType type, QWidget *parent = nullptr); 0041 ~WdgResourcePreview(); 0042 0043 Q_SIGNALS: 0044 void signalResourcesSelectionChanged(QModelIndex selected); 0045 void resourceTypeSelected(int); 0046 0047 private Q_SLOTS: 0048 void slotResourceTypeSelected(int); 0049 void slotTagSelected(int); 0050 void slotStorageSelected(int); 0051 0052 void slotFilterTextChanged(const QString& filterText); 0053 void slotShowDeletedChanged(int newState); 0054 void slotViewThumbnail(); 0055 void slotViewDetails(); 0056 0057 public: 0058 QString getCurrentResourceType(); 0059 QSharedPointer<KisTag> getCurrentTag(); 0060 QModelIndexList geResourceItemsSelected(); 0061 int getCurrentStorageId(); 0062 QMap<QString, KisTagFilterResourceProxyModel*> getResourceProxyModelsForResourceType(); 0063 0064 QAbstractItemModel* getModel(); 0065 0066 private: 0067 Ui::WdgResourcePreview *m_ui; 0068 WidgetType m_type; 0069 0070 QList<int> m_selectedResourcesIds; 0071 0072 KisResourceTypeModel *m_resourceTypeModel {0}; 0073 KisStorageModel *m_storageModel {0}; 0074 QMap<QString, KisTagModel*> m_tagModelsForResourceType; 0075 KisResourceModel *m_resourceModel {nullptr}; 0076 0077 QMap<QString, KisTagFilterResourceProxyModel*> m_resourceProxyModelsForResourceType; 0078 KisResourceThumbnailPainter m_thumbnailPainter; 0079 0080 KisResourceItemDelegate *m_kisResourceItemDelegate; 0081 ListViewMode m_mode; 0082 0083 }; 0084 0085 #endif // WDG_RESOURCE_PREVIEW_H