Extract open legacy project result helper

This commit is contained in:
2026-06-15 22:35:39 +02:00
parent a401ab356b
commit 7b8da2f0e2

View File

@@ -38,16 +38,8 @@ pp::foundation::Status apply_document_history(const pp::app::HistoryUiPlan& plan
return pp::app::execute_history_ui_plan(plan, services); return pp::app::execute_history_ui_plan(plan, services);
} }
void open_legacy_project(App& app, const pp::app::DocumentOpenRoute& route) void handle_open_legacy_project_result(App& app, bool success)
{ {
app.doc_name = route.name;
app.doc_dir = route.directory;
app.doc_path = route.path;
const auto reset_status = execute_legacy_canvas_camera_reset(app);
if (!reset_status.ok())
LOG("Project open camera reset failed: %s", reset_status.message);
app.layers->clear();
app.canvas->m_canvas->project_open(route.path, [&app](bool success) {
if (success) if (success)
{ {
app.title_update(); app.title_update();
@@ -64,6 +56,19 @@ void open_legacy_project(App& app, const pp::app::DocumentOpenRoute& route)
"There was an error opening the document.\n" "There was an error opening the document.\n"
"It may be inaccessible or corrupted."); "It may be inaccessible or corrupted.");
} }
}
void open_legacy_project(App& app, const pp::app::DocumentOpenRoute& route)
{
app.doc_name = route.name;
app.doc_dir = route.directory;
app.doc_path = route.path;
const auto reset_status = execute_legacy_canvas_camera_reset(app);
if (!reset_status.ok())
LOG("Project open camera reset failed: %s", reset_status.message);
app.layers->clear();
app.canvas->m_canvas->project_open(route.path, [&app](bool success) {
handle_open_legacy_project_result(app, success);
}); });
const auto history_status = apply_document_history(pp::app::plan_document_open_history(route)); const auto history_status = apply_document_history(pp::app::plan_document_open_history(route));
if (!history_status.ok()) { if (!history_status.ok()) {