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

@@ -2577,32 +2577,50 @@ bool Canvas::project_save_thread(std::string file_path, bool show_progress)
LOG("project saved to %s", file_path.c_str());
}
if (success)
const auto post_commit_plan = pp::app::plan_document_canvas_project_save_post_commit(
pp::app::DocumentCanvasProjectSavePostCommitInput {
.save_succeeded = success,
.timelapse_encoder_available = Canvas::I->m_encoder != nullptr,
.progress_ui_visible = show_progress,
});
if (post_commit_plan.marks_document_clean)
{
m_unsaved = false;
}
if (post_commit_plan.marks_new_document_committed)
{
m_newdoc = false;
}
// save timelapse
if (Canvas::I->m_encoder)
{
BinaryStreamWriter sw;
sw.init(BinaryStream::ByteOrder::LittleEndian);
Serializer::Descriptor info;
info.class_id = "tracks-info";
info.name = L"Timelapse Tracks";
info.props["has-track-360"] = std::make_shared<Serializer::Boolean>(true);
info.props["version"] = std::make_shared<Serializer::Integer>(1);
sw << info;
sw << *Canvas::I->m_encoder;
if (!sw.save(lapse_path))
LOG("cannot save timelase to %s", lapse_path.c_str());
}
if (post_commit_plan.saves_timelapse_sidecar)
{
BinaryStreamWriter sw;
sw.init(BinaryStream::ByteOrder::LittleEndian);
Serializer::Descriptor info;
info.class_id = "tracks-info";
info.name = L"Timelapse Tracks";
info.props["has-track-360"] = std::make_shared<Serializer::Boolean>(true);
info.props["version"] = std::make_shared<Serializer::Integer>(1);
sw << info;
sw << *Canvas::I->m_encoder;
if (!sw.save(lapse_path))
LOG("cannot save timelase to %s", lapse_path.c_str());
}
if (post_commit_plan.flushes_platform_storage)
{
App::I->flush_platform_storage();
}
if (show_progress)
if (post_commit_plan.dismisses_progress_ui)
{
pb->destroy();
App::I->title_update();
}
if (post_commit_plan.updates_title)
{
App::I->title_update();
}
return success;
}