68 lines
2.1 KiB
C++
68 lines
2.1 KiB
C++
#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
|