Plan document export success messages

This commit is contained in:
2026-06-05 09:31:11 +02:00
parent f46839bf5c
commit 808a084ee3
8 changed files with 575 additions and 34 deletions

View File

@@ -10,6 +10,15 @@
namespace pp::panopainter {
namespace {
void show_export_success_dialog(
App& app,
const pp::app::DocumentExportSuccessDialogPlan& plan)
{
if (plan.show_dialog) {
app.message_box(plan.dialog.title, plan.dialog.message, plan.dialog.show_cancel);
}
}
class LegacyDocumentExportServices final : public pp::app::DocumentExportServices {
public:
explicit LegacyDocumentExportServices(App& app) noexcept
@@ -26,20 +35,18 @@ public:
{
auto* app = &app_;
app_.canvas->m_canvas->export_equirectangular(target.path, [app, target] {
#if defined(__IOS__)
app->message_box("Export Equirectangular", "Image exported to Photos");
#elif defined(__OSX__)
app->message_box("Export Equirectangular", "Image exported to Pictures/PanoPainter folder");
#elif defined(_WIN32)
app->message_box("Export Equirectangular", "Image exported to " + app->work_path);
#elif defined(__QUEST__)
(void)target;
#elif __WEB__
#if __WEB__
app->ui_task([app, target] {
app->save_prepared_file(target.path, target.suggested_name, [](const std::string&, bool) { });
});
#else
(void)target;
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::equirectangular,
pp::app::document_export_equirectangular_platform_destination(),
app->work_path));
#endif
});
}
@@ -48,7 +55,12 @@ public:
{
auto* app = &app_;
app_.canvas->m_canvas->export_layers(target.stem_path, [app, target] {
app->message_box("Export Layers", "Layers exported to: " + target.stem_path);
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::layers,
pp::app::DocumentExportSuccessDestination::path,
target.stem_path));
});
}
@@ -56,7 +68,11 @@ public:
{
auto* app = &app_;
app_.canvas->m_canvas->export_layers(target.stem_path, [app] {
app->message_box("Export Layers", "Image layers exported to Files/PanoPainter");
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::layers,
pp::app::DocumentExportSuccessDestination::files_panopainter));
});
}
@@ -64,7 +80,12 @@ public:
{
auto* app = &app_;
app_.canvas->m_canvas->export_anim_frames(target.stem_path, [app, target] {
app->message_box("Export Layers", "Layers exported to: " + target.stem_path);
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::animation_frames,
pp::app::DocumentExportSuccessDestination::path,
target.stem_path));
});
}
@@ -72,7 +93,11 @@ public:
{
auto* app = &app_;
app_.canvas->m_canvas->export_anim_frames(target.stem_path, [app] {
app->message_box("Export Layers", "Image layers exported to Files/PanoPainter");
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::animation_frames,
pp::app::DocumentExportSuccessDestination::files_panopainter));
});
}
@@ -80,13 +105,12 @@ public:
{
auto* app = &app_;
app_.canvas->m_canvas->export_depth(std::string(document_name), [app] {
#if defined(__IOS__)
app->message_box("Export 3D View + Depth", "Image and depth exported to Files/PanoPainter");
#elif defined(__OSX__)
app->message_box("Export 3D View + Depth", "Image and depth exported to Pictures/PanoPainter folder");
#elif defined(_WIN32)
app->message_box("Export 3D View + Depth", "Image and depth exported to " + app->work_path);
#endif
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::depth,
pp::app::document_export_media_platform_destination(),
app->work_path));
});
}
@@ -94,13 +118,12 @@ public:
{
auto* app = &app_;
app_.canvas->m_canvas->export_cube_faces(std::string(document_name), [app] {
#if defined(__IOS__)
app->message_box("Export Cube Faces", "Image and depth exported to Files/PanoPainter");
#elif defined(__OSX__)
app->message_box("Export Cube Faces", "Image and depth exported to Pictures/PanoPainter folder");
#elif defined(_WIN32)
app->message_box("Export Cube Faces", "Image and depth exported to " + app->work_path);
#endif
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::cube_faces,
pp::app::document_export_media_platform_destination(),
app->work_path));
});
}
@@ -122,13 +145,22 @@ public:
auto path_string = std::string(path);
if (asynchronous_) {
Canvas::I->export_anim_mp4(path_string, [app, path_string] {
app->message_box("Export Animation", "Animation exported to: " + path_string);
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::animation_mp4,
pp::app::DocumentExportSuccessDestination::path,
path_string));
});
return;
}
Canvas::I->export_anim_mp4(path_string, [app] {
app->message_box("Export Animation", "Animation exported successfully.");
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::animation_mp4,
pp::app::DocumentExportSuccessDestination::generic_success));
});
}
@@ -140,7 +172,12 @@ public:
std::thread([app, path_string] {
BT_SetTerminate();
app->rec_export(path_string);
app->message_box("Export Timelapse", "Timelapse exported to: " + path_string);
show_export_success_dialog(
*app,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::timelapse,
pp::app::DocumentExportSuccessDestination::path,
path_string));
}).detach();
return;
}
@@ -158,7 +195,12 @@ public:
if (asynchronous_) {
(void)path;
} else {
app_.message_box("Export Timelapse", "Timelapse exported successfully.");
(void)path;
show_export_success_dialog(
app_,
pp::app::plan_document_export_success_dialog(
pp::app::DocumentExportSuccessKind::timelapse,
pp::app::DocumentExportSuccessDestination::generic_success));
}
}