2026-04-05 20:46:24 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#ifndef NOMINMAX
|
|
|
|
|
#define NOMINMAX
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <string_view>
|
|
|
|
|
|
2026-04-22 02:47:28 +08:00
|
|
|
namespace XCEngine::UI::Editor::App {
|
2026-04-05 20:46:24 +08:00
|
|
|
|
2026-04-22 02:47:28 +08:00
|
|
|
class EditorWindowScreenshotController {
|
2026-04-05 20:46:24 +08:00
|
|
|
public:
|
|
|
|
|
void Initialize(const std::filesystem::path& captureRoot);
|
|
|
|
|
void Shutdown();
|
|
|
|
|
|
|
|
|
|
void RequestCapture(std::string reason);
|
2026-04-22 02:14:26 +08:00
|
|
|
bool TryBeginCapture(std::filesystem::path& outHistoryPath);
|
|
|
|
|
void CompleteCaptureSuccess(const std::filesystem::path& historyPath);
|
|
|
|
|
void CompleteCaptureFailure(std::string error);
|
2026-04-05 20:46:24 +08:00
|
|
|
|
|
|
|
|
bool HasPendingCapture() const;
|
|
|
|
|
const std::filesystem::path& GetLatestCapturePath() const;
|
|
|
|
|
const std::string& GetLastCaptureSummary() const;
|
|
|
|
|
const std::string& GetLastCaptureError() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::filesystem::path BuildHistoryCapturePath(std::string_view reason) const;
|
2026-04-22 02:14:26 +08:00
|
|
|
void ResetPendingRequest();
|
2026-04-05 20:46:24 +08:00
|
|
|
|
|
|
|
|
static std::string BuildTimestampString();
|
|
|
|
|
static std::string SanitizeReason(std::string_view reason);
|
|
|
|
|
|
|
|
|
|
std::filesystem::path m_captureRoot = {};
|
|
|
|
|
std::filesystem::path m_historyRoot = {};
|
|
|
|
|
std::filesystem::path m_latestCapturePath = {};
|
2026-04-22 02:14:26 +08:00
|
|
|
std::filesystem::path m_activeHistoryCapturePath = {};
|
2026-04-05 20:46:24 +08:00
|
|
|
std::string m_pendingReason = {};
|
|
|
|
|
std::string m_lastCaptureSummary = {};
|
|
|
|
|
std::string m_lastCaptureError = {};
|
|
|
|
|
std::uint64_t m_captureCount = 0;
|
|
|
|
|
bool m_capturePending = false;
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-22 02:47:28 +08:00
|
|
|
} // namespace XCEngine::UI::Editor::App
|