Advance new editor hosted panels and state flow
This commit is contained in:
67
new_editor/app/Project/ProductProjectBrowserModel.h
Normal file
67
new_editor/app/Project/ProductProjectBrowserModel.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Collections/UIEditorTreeView.h>
|
||||
|
||||
#include <XCEngine/UI/Types.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor::App::Project {
|
||||
|
||||
class ProductProjectBrowserModel {
|
||||
public:
|
||||
struct BreadcrumbSegment {
|
||||
std::string label = {};
|
||||
std::string targetFolderId = {};
|
||||
bool current = false;
|
||||
};
|
||||
|
||||
struct FolderEntry {
|
||||
std::string itemId = {};
|
||||
std::filesystem::path absolutePath = {};
|
||||
std::string label = {};
|
||||
};
|
||||
|
||||
struct AssetEntry {
|
||||
std::string itemId = {};
|
||||
std::filesystem::path absolutePath = {};
|
||||
std::string displayName = {};
|
||||
bool directory = false;
|
||||
};
|
||||
|
||||
void Initialize(const std::filesystem::path& repoRoot);
|
||||
void SetFolderIcon(const ::XCEngine::UI::UITextureHandle& icon);
|
||||
void Refresh();
|
||||
|
||||
bool Empty() const;
|
||||
const std::filesystem::path& GetAssetsRootPath() const;
|
||||
const std::vector<FolderEntry>& GetFolderEntries() const;
|
||||
const std::vector<Widgets::UIEditorTreeViewItem>& GetTreeItems() const;
|
||||
const std::vector<AssetEntry>& GetAssetEntries() const;
|
||||
const std::string& GetCurrentFolderId() const;
|
||||
|
||||
const FolderEntry* FindFolderEntry(std::string_view itemId) const;
|
||||
const AssetEntry* FindAssetEntry(std::string_view itemId) const;
|
||||
bool NavigateToFolder(std::string_view itemId);
|
||||
std::vector<BreadcrumbSegment> BuildBreadcrumbSegments() const;
|
||||
std::vector<std::string> CollectCurrentFolderAncestorIds() const;
|
||||
std::vector<std::string> BuildAncestorFolderIds(std::string_view itemId) const;
|
||||
|
||||
private:
|
||||
void RefreshFolderTree();
|
||||
void RefreshAssetList();
|
||||
void EnsureValidCurrentFolder();
|
||||
|
||||
std::filesystem::path m_assetsRootPath = {};
|
||||
std::vector<FolderEntry> m_folderEntries = {};
|
||||
std::vector<Widgets::UIEditorTreeViewItem> m_treeItems = {};
|
||||
std::vector<AssetEntry> m_assetEntries = {};
|
||||
::XCEngine::UI::UITextureHandle m_folderIcon = {};
|
||||
std::string m_currentFolderId = {};
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App::Project
|
||||
Reference in New Issue
Block a user