2023-12-11 15:54:22 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <wolv/io/fs.hpp>
|
2024-01-30 11:21:34 +01:00
|
|
|
#include <hex/helpers/auto_reset.hpp>
|
2023-12-11 15:54:22 +01:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace hex {
|
|
|
|
|
|
|
|
class WorkspaceManager {
|
|
|
|
public:
|
|
|
|
struct Workspace {
|
|
|
|
std::string layout;
|
|
|
|
std::fs::path path;
|
2024-02-28 22:10:48 +01:00
|
|
|
bool builtin;
|
2023-12-11 15:54:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static void createWorkspace(const std::string &name, const std::string &layout = "");
|
|
|
|
static void switchWorkspace(const std::string &name);
|
|
|
|
|
|
|
|
static void importFromFile(const std::fs::path &path);
|
2024-02-28 22:10:48 +01:00
|
|
|
static bool exportToFile(std::fs::path path = {}, std::string workspaceName = {}, bool builtin = false);
|
|
|
|
|
|
|
|
static void removeWorkspace(const std::string &name);
|
2023-12-11 15:54:22 +01:00
|
|
|
|
2024-01-30 11:21:34 +01:00
|
|
|
static const auto& getWorkspaces() { return *s_workspaces; }
|
2023-12-11 15:54:22 +01:00
|
|
|
static const auto& getCurrentWorkspace() { return s_currentWorkspace; }
|
|
|
|
|
|
|
|
static void reset();
|
2024-02-28 22:10:48 +01:00
|
|
|
static void reload();
|
2023-12-11 15:54:22 +01:00
|
|
|
|
2023-12-12 00:16:21 +01:00
|
|
|
static void process();
|
|
|
|
|
2023-12-11 15:54:22 +01:00
|
|
|
private:
|
|
|
|
WorkspaceManager() = default;
|
|
|
|
|
2024-01-30 11:21:34 +01:00
|
|
|
static AutoReset<std::map<std::string, Workspace>> s_workspaces;
|
2024-02-28 22:10:48 +01:00
|
|
|
static decltype(s_workspaces)::Type::iterator s_currentWorkspace, s_previousWorkspace, s_workspaceToRemove;
|
2023-12-11 15:54:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|