From 34e9789f1f9f572b3c47b6727bf7c4067ae15d05 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Mon, 15 Jun 2026 21:00:38 +0200 Subject: [PATCH] Extract cloud publish worker helper --- docs/modernization/debt.md | 6 ++++++ docs/modernization/roadmap.md | 5 +++++ docs/modernization/tasks.md | 35 +++++++++++++++++++++++++++++++ src/legacy_cloud_services.cpp | 39 ++++++++++++++++++++--------------- 4 files changed, 68 insertions(+), 17 deletions(-) diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index b92fc19a..12ccdd09 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -18,6 +18,12 @@ agent or engineer to remove them without reconstructing context from chat. ## Recent Reductions +- 2026-06-15: `DEBT-0038` was narrowed again. The retained cloud-publish + worker body in `LegacyCloudServices::prompt_publish()` now routes through a + focused helper in `src/legacy_cloud_services.cpp` instead of living inline + in the retained service method; the remaining cloud bridge debt stays + concentrated in retained prompt/progress lifetime, OpenGL context guarding, + and the still-retained transfer-thread execution model. - 2026-06-15: `DEBT-0038` was narrowed again. The retained cloud-download detached worker body in `LegacyCloudServices::start_download()` now routes through a focused helper in `src/legacy_cloud_services.cpp` instead of diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 338da86b..e0fccbf8 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -134,6 +134,11 @@ The retained cloud-download detached worker body in helper in `src/legacy_cloud_services.cpp`, so the remaining cloud bridge debt is further concentrated on prompt/progress lifetime, OpenGL context guarding, and the still-retained transfer-thread execution model. +The retained cloud-publish worker body in +`LegacyCloudServices::prompt_publish()` now also routes through a focused +helper in `src/legacy_cloud_services.cpp`, so the remaining cloud bridge debt +is further concentrated on retained prompt/progress lifetime, OpenGL context +guarding, and the still-retained transfer-thread execution model. Recent 2026-06-13 retained preview reductions continue to narrow DEBT-0036: `NodeStrokePreview::draw_stroke_immediate()` now also routes diff --git a/docs/modernization/tasks.md b/docs/modernization/tasks.md index ea8777e2..dcdbf45d 100644 --- a/docs/modernization/tasks.md +++ b/docs/modernization/tasks.md @@ -731,6 +731,41 @@ Completed Task Log: | --- | --- | ---: | --- | --- | | 2026-06-15 | ADP-018 | no score movement | `MSBuild.exe out\build\windows-msvc-default\panopainter_app.vcxproj /p:Configuration=Debug /p:Platform=x64`; `ctest --preset desktop-fast --build-config Debug -R "pp_app_core_document_cloud" --output-on-failure` | `54b6aee2` | +### ADP-019 - Extract Cloud Publish Worker Helper + +Status: Done +Score: no score movement +Debt: `DEBT-0038` +Scope: `src/legacy_cloud_services.cpp` only + +Goal: + +Reduce the inline retained cloud-publish worker surface by extracting the +upload thread body built inside `LegacyCloudServices::prompt_publish()` into a +focused helper while preserving current behavior. + +Done Checks: + +- The retained cloud-publish worker body no longer lives inline in + `LegacyCloudServices::prompt_publish()`. +- The retained upload-thread execution path now routes through a focused + helper in `src/legacy_cloud_services.cpp`. +- `DEBT-0038` and the roadmap note the reduced remaining cloud bridge + surface. + +Validation: + +```powershell +& 'C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\MSBuild.exe' out\build\windows-msvc-default\panopainter_app.vcxproj /p:Configuration=Debug /p:Platform=x64 +ctest --preset desktop-fast --build-config Debug -R "pp_app_core_document_cloud" --output-on-failure +``` + +Completed Task Log: + +| Date | Task | Score | Validation | Commit | +| --- | --- | ---: | --- | --- | +| 2026-06-15 | ADP-019 | no score movement | `MSBuild.exe out\build\windows-msvc-default\panopainter_app.vcxproj /p:Configuration=Debug /p:Platform=x64`; `ctest --preset desktop-fast --build-config Debug -R "pp_app_core_document_cloud" --output-on-failure` | `(pending)` | + Completed Task Log: | Date | Task | Score | Validation | Commit | diff --git a/src/legacy_cloud_services.cpp b/src/legacy_cloud_services.cpp index 6ccfb416..496cc1ad 100644 --- a/src/legacy_cloud_services.cpp +++ b/src/legacy_cloud_services.cpp @@ -170,6 +170,27 @@ void execute_cloud_download_thread( execute_legacy_downloaded_project_open(app, request.selected_path, request.selected_name); pp::panopainter::close_legacy_dialog_node(*m); } + +void execute_cloud_publish_worker(App& app, bool save_before_upload) +{ + BT_SetTerminate(); + + if (save_before_upload) + { + execute_legacy_document_save_before_cloud_upload(app); + } + + const auto progress_plan = pp::app::plan_cloud_upload_progress_dialog(); + auto pb = app.show_progress(progress_plan.title, progress_plan.total); + + execute_cloud_upload_transfer(app, app.doc_path, app.doc_filename, [pb](float p) { + pb->set_progress(p); + }); + + pp::panopainter::close_legacy_dialog_node(*pb); + const auto success_plan = pp::app::plan_cloud_upload_success_prompt(); + app.message_box(success_plan.title, success_plan.message, success_plan.show_cancel); +} #endif //WITH_CURL class LegacyCloudServices final : public pp::app::CloudServices { @@ -189,23 +210,7 @@ public: { auto* app = &app_; auto upload_thread = [app, save_before_upload] { - BT_SetTerminate(); - - if (save_before_upload) - { - execute_legacy_document_save_before_cloud_upload(*app); - } - - const auto progress_plan = pp::app::plan_cloud_upload_progress_dialog(); - auto pb = app->show_progress(progress_plan.title, progress_plan.total); - - execute_cloud_upload_transfer(*app, app->doc_path, app->doc_filename, [pb](float p) { - pb->set_progress(p); - }); - - pp::panopainter::close_legacy_dialog_node(*pb); - const auto success_plan = pp::app::plan_cloud_upload_success_prompt(); - app->message_box(success_plan.title, success_plan.message, success_plan.show_cancel); + execute_cloud_publish_worker(*app, save_before_upload); }; const auto prompt_plan = pp::app::plan_cloud_publish_prompt();