Move project save post-commit planning to app core

This commit is contained in:
2026-06-06 12:16:19 +02:00
parent f3834827b1
commit c8b55b36f7
8 changed files with 176 additions and 28 deletions

View File

@@ -135,6 +135,21 @@ struct DocumentCanvasProjectSaveCommitPlan {
std::string_view log_message;
};
struct DocumentCanvasProjectSavePostCommitInput {
bool save_succeeded = false;
bool timelapse_encoder_available = false;
bool progress_ui_visible = false;
};
struct DocumentCanvasProjectSavePostCommitPlan {
bool marks_document_clean = false;
bool marks_new_document_committed = false;
bool saves_timelapse_sidecar = false;
bool flushes_platform_storage = false;
bool dismisses_progress_ui = false;
bool updates_title = true;
};
class DocumentCanvasClearServices {
public:
virtual ~DocumentCanvasClearServices() = default;
@@ -444,6 +459,23 @@ plan_document_canvas_project_save_write(
return plan;
}
[[nodiscard]] constexpr DocumentCanvasProjectSavePostCommitPlan plan_document_canvas_project_save_post_commit(
DocumentCanvasProjectSavePostCommitInput input) noexcept
{
DocumentCanvasProjectSavePostCommitPlan plan;
plan.dismisses_progress_ui = input.progress_ui_visible;
if (!input.save_succeeded) {
return plan;
}
plan.marks_document_clean = true;
plan.marks_new_document_committed = true;
plan.saves_timelapse_sidecar = input.timelapse_encoder_available;
plan.flushes_platform_storage = true;
return plan;
}
[[nodiscard]] inline pp::foundation::Result<DocumentCanvasClearPlan> plan_document_canvas_clear(
bool has_canvas,
float r = 0.0F,