Modules/Taskboard/public/SessionPresets.hpp
agent 0aee9f107f
Some checks failed
Windows / build (pull_request) Has been cancelled
CMake on a single platform / build (pull_request) Has been cancelled
CMake / build (pull_request) Has been cancelled
Taskboard: port onto the refactored Widgets
Paint on tp::Canvas, use the shared Key enum and KeyModifiers, the TextStyle
drawing API and ImageHandle, and open the context menu through Menu::openAt.
The refactor moved storage and CPU placement into each application, so Taskboard
carries the same small AppStorage Sketch2D does.
2026-11-01 13:14:54 +03:00

43 lines
1.1 KiB
C++

#pragma once
#include "FileBrowser.hpp"
#include "Task.hpp"
#include <optional>
#include <string>
#include <vector>
namespace tp::taskboard {
struct SessionPreset {
std::string name;
LaunchSettings settings;
bool operator==(const SessionPreset&) const = default;
};
class SessionPresets {
public:
SessionPresets(ui::FileSystem& files, std::string storageDirectory);
[[nodiscard]] const std::vector<SessionPreset>& all() const { return mPresets; }
[[nodiscard]] std::optional<size_t> indexOf(const std::string& name) const;
[[nodiscard]] std::optional<size_t> matching(const LaunchSettings& settings) const;
[[nodiscard]] const std::string& storagePath() const { return mPath; }
[[nodiscard]] bool lastSaveFailed() const { return mSaveFailed; }
size_t save(const std::string& name, const LaunchSettings& settings);
void remove(size_t index);
void reload();
[[nodiscard]] static std::string pathIn(const std::string& storageDirectory);
private:
void store();
ui::FileSystem& mFiles;
std::string mPath;
std::vector<SessionPreset> mPresets;
bool mSaveFailed = false;
};
}