Plasma Engine  2.0
Loading...
Searching...
No Matches
AssetBrowserWidget.moc.h
1#pragma once
2
3#include <EditorFramework/EditorFrameworkDLL.h>
4#include <EditorFramework/ui_AssetBrowserWidget.h>
5#include <ToolsFoundation/FileSystem/FileSystemModel.h>
6#include <ToolsFoundation/Project/ToolsProject.h>
7
8
9
15
16class plQtAssetBrowserWidget : public QWidget, public Ui_AssetBrowserWidget
17{
18 Q_OBJECT
19public:
20 plQtAssetBrowserWidget(QWidget* pParent);
22
23 enum class Mode
24 {
25 Browser,
26 AssetPicker,
27 FilePicker,
28 };
29
30 void SetMode(Mode mode);
31 void SetSelectedAsset(plUuid preselectedAsset);
32 void SetSelectedFile(plStringView sAbsPath);
33 void ShowOnlyTheseTypeFilters(plStringView sFilters);
34 void UseFileExtensionFilters(plStringView sFileExtensions);
35 void SetRequiredTag(plStringView sRequiredTag);
36
37 void SaveState(const char* szSettingsName);
38 void RestoreState(const char* szSettingsName);
39
40 void dragEnterEvent(QDragEnterEvent* event) override;
41 void dragMoveEvent(QDragMoveEvent* event) override;
42 void dragLeaveEvent(QDragLeaveEvent* event) override;
43 void dropEvent(QDropEvent* event) override;
44
45
46 plQtAssetBrowserModel* GetAssetBrowserModel() { return m_pModel; }
47 const plQtAssetBrowserModel* GetAssetBrowserModel() const { return m_pModel; }
48 plQtAssetBrowserFilter* GetAssetBrowserFilter() { return m_pFilter; }
49 const plQtAssetBrowserFilter* GetAssetBrowserFilter() const { return m_pFilter; }
50
51Q_SIGNALS:
52 void ItemChosen(plUuid guid, QString sAssetPathRelative, QString sAssetPathAbsolute, plUInt8 uiAssetBrowserItemFlags);
53 void ItemSelected(plUuid guid, QString sAssetPathRelative, QString sAssetPathAbsolute, plUInt8 uiAssetBrowserItemFlags);
54 void ItemCleared();
55
56private Q_SLOTS:
57 void OnTextFilterChanged();
58 void OnTypeFilterChanged();
59 void OnPathFilterChanged();
60 void on_ListAssets_doubleClicked(const QModelIndex& index);
61 void on_ListAssets_activated(const QModelIndex& index);
62 void on_ListAssets_clicked(const QModelIndex& index);
63 void on_ButtonListMode_clicked();
64 void on_ButtonIconMode_clicked();
65 void on_IconSizeSlider_valueChanged(int iValue);
66 void on_ListAssets_ViewZoomed(plInt32 iIconSizePercentage);
67 void OnSearchWidgetTextChanged(const QString& text);
68 void on_TreeFolderFilter_customContextMenuRequested(const QPoint& pt);
69 void on_TypeFilter_currentIndexChanged(int index);
70 void OnScrollToItem(plUuid preselectedAsset);
71 void OnScrollToFile(QString sPreselectedFile);
72 void OnShowSubFolderItemsToggled();
73 void OnShowHiddenFolderItemsToggled();
74 void on_ListAssets_customContextMenuRequested(const QPoint& pt);
75 void OnListOpenExplorer();
76 void OnListOpenAssetDocument();
77 void OnTransform();
78 void OnListToggleSortByRecentlyUsed();
79 void OnListCopyAssetGuid();
80 void OnFilterToThisPath();
81 void OnListFindAllReferences(bool transitive);
82 void OnSelectionTimer();
83 void OnAssetSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
84 void OnAssetSelectionCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
85 void OnModelReset();
86 void NewAsset();
87 void OnFileEditingFinished(const QString& sAbsPath, const QString& sNewName, bool bIsAsset);
88 void ImportSelection();
89 void OnOpenImportReferenceAsset();
90 void RenameCurrent();
91 void DeleteSelection();
92 void OnImportAsAboutToShow();
93 void OnImportAsClicked();
94
95
96private:
97 virtual void keyPressEvent(QKeyEvent* e) override;
98 virtual void mousePressEvent(QMouseEvent* e) override;
99
100private:
101 void AssetCuratorEventHandler(const plAssetCuratorEvent& e);
102 void UpdateAssetTypes();
103 void ProjectEventHandler(const plToolsProjectEvent& e);
104 void AddAssetCreatorMenu(QMenu* pMenu, bool useSelectedAsset);
105 void AddImportedViaMenu(QMenu* pMenu);
106 void GetSelectedImportableFiles(plDynamicArray<plString>& out_Files) const;
107
108
109 Mode m_Mode = Mode::Browser;
110 plQtToolBarActionMapView* m_pToolbar = nullptr;
111 plString m_sAllTypesFilter;
112 plQtAssetBrowserModel* m_pModel = nullptr;
113 plQtAssetBrowserFilter* m_pFilter = nullptr;
114
116 bool m_bOpenAfterRename = false;
117};
Definition DynamicArray.h:81
Definition AssetBrowserFilter.moc.h:8
Model of the item view in the asset browser.
Definition AssetBrowserModel.moc.h:59
Definition AssetBrowserWidget.moc.h:17
Definition ToolBarActionMapView.moc.h:16
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
This data type is the abstraction for 128-bit Uuid (also known as GUID) instances.
Definition Uuid.h:11
Definition AssetCurator.h:122
Definition ToolsProject.h:13