49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "Core/AssetItem.h"
|
|
#include <vector>
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
namespace UI {
|
|
|
|
class ProjectManager {
|
|
public:
|
|
static ProjectManager& Get();
|
|
|
|
std::vector<AssetItemPtr>& GetCurrentItems();
|
|
int GetSelectedIndex() const { return m_selectedIndex; }
|
|
void SetSelectedIndex(int index) { m_selectedIndex = index; }
|
|
|
|
void NavigateToFolder(const AssetItemPtr& folder);
|
|
void NavigateBack();
|
|
void NavigateToIndex(size_t index);
|
|
bool CanNavigateBack() const { return m_path.size() > 1; }
|
|
|
|
std::string GetCurrentPath() const;
|
|
size_t GetPathDepth() const { return m_path.size(); }
|
|
std::string GetPathName(size_t index) const;
|
|
|
|
void Initialize(const std::string& projectPath);
|
|
void RefreshCurrentFolder();
|
|
|
|
void CreateFolder(const std::string& name);
|
|
void DeleteItem(int index);
|
|
bool MoveItem(const std::string& sourceFullPath, const std::string& destFolderFullPath);
|
|
|
|
const std::string& GetProjectPath() const { return m_projectPath; }
|
|
|
|
private:
|
|
ProjectManager() = default;
|
|
|
|
AssetItemPtr ScanDirectory(const std::wstring& path);
|
|
AssetItemPtr CreateAssetItem(const std::wstring& path, const std::wstring& nameW, bool isFolder);
|
|
std::wstring GetCurrentFullPathW() const;
|
|
|
|
AssetItemPtr m_rootFolder;
|
|
std::vector<AssetItemPtr> m_path;
|
|
int m_selectedIndex = -1;
|
|
std::string m_projectPath;
|
|
};
|
|
|
|
} |