Route prepared export policy through platform services

This commit is contained in:
2026-06-04 17:05:49 +02:00
parent cabfa44729
commit 104358bc62
10 changed files with 111 additions and 65 deletions

View File

@@ -515,25 +515,29 @@ void App::dialog_ppbr_export()
auto dialog = root->add_child_ref<NodeDialogExportPPBR>();
dialog->btn_ok->on_click = [this, dialog] (Node*) {
const auto request = pp::panopainter::make_legacy_brush_package_export_request(*dialog);
#if __IOS__ || __WEB__
App::I->pick_file_save("ppbr", "exported-brushes",
[this, dialog, request] (std::string path) {
const auto status = pp::panopainter::execute_legacy_brush_package_export(
*this,
*dialog,
request,
path,
pp::panopainter::LegacyBrushPackageExportMode::inline_export_only);
if (!status.ok())
LOG("PPBR export failed: %s", status.message);
},
[dialog] (const std::string& path, bool saved) {
(void)path;
pp::panopainter::complete_legacy_brush_package_export(*dialog, saved);
}
);
#else
App::I->pick_file_save({ "ppbr" }, [this, dialog, request] (std::string path) {
if (uses_prepared_file_writes())
{
pick_file_save("ppbr", "exported-brushes",
[this, dialog, request] (std::string path) {
const auto status = pp::panopainter::execute_legacy_brush_package_export(
*this,
*dialog,
request,
path,
pp::panopainter::LegacyBrushPackageExportMode::inline_export_only);
if (!status.ok())
LOG("PPBR export failed: %s", status.message);
},
[dialog] (const std::string& path, bool saved) {
(void)path;
pp::panopainter::complete_legacy_brush_package_export(*dialog, saved);
}
);
return;
}
pick_file_save({ "ppbr" }, [this, dialog, request] (std::string path) {
const auto status = pp::panopainter::execute_legacy_brush_package_export(
*this,
*dialog,
@@ -543,7 +547,6 @@ void App::dialog_ppbr_export()
if (!status.ok())
LOG("PPBR export failed: %s", status.message);
});
#endif
};
}
@@ -552,29 +555,32 @@ void App::dialog_timelapse_export()
if (!can_start_document_export(*this, false))
return;
#if __IOS__ || __WEB__
const auto target = pp::app::make_document_export_suggested_name(doc_name, "-timelapse");
if (!target) {
message_box("Export Timelapse", target.status().message);
if (uses_prepared_file_writes())
{
const auto target = pp::app::make_document_export_suggested_name(doc_name, "-timelapse");
if (!target) {
message_box("Export Timelapse", target.status().message);
return;
}
pick_file_save("mp4", target.value().name,
[this](std::string path) {
const auto status = pp::panopainter::execute_legacy_document_video_export(
*this,
pp::app::DocumentVideoExportKind::timelapse,
path,
false);
if (!status.ok())
LOG("Document timelapse export failed: %s", status.message);
},
[](const std::string& path, bool saved) {
(void)path;
(void)saved;
}
);
return;
}
pick_file_save("mp4", target.value().name,
[this](std::string path) {
const auto status = pp::panopainter::execute_legacy_document_video_export(
*this,
pp::app::DocumentVideoExportKind::timelapse,
path,
false);
if (!status.ok())
LOG("Document timelapse export failed: %s", status.message);
},
[](const std::string& path, bool saved) {
(void)path;
(void)saved;
}
);
#else
pick_file_save({ "mp4" }, [this](std::string path) {
const auto status = pp::panopainter::execute_legacy_document_video_export(
*this,
@@ -584,7 +590,6 @@ void App::dialog_timelapse_export()
if (!status.ok())
LOG("Document timelapse export failed: %s", status.message);
});
#endif
}
void App::dialog_export_mp4()
@@ -592,29 +597,32 @@ void App::dialog_export_mp4()
if (!can_start_document_export(*this, false))
return;
#if __IOS__ || __WEB__
const auto target = pp::app::make_document_export_suggested_name(doc_name, "-animation");
if (!target) {
message_box("Export Animation", target.status().message);
if (uses_prepared_file_writes())
{
const auto target = pp::app::make_document_export_suggested_name(doc_name, "-animation");
if (!target) {
message_box("Export Animation", target.status().message);
return;
}
pick_file_save("mp4", target.value().name,
[this](std::string path) {
const auto status = pp::panopainter::execute_legacy_document_video_export(
*this,
pp::app::DocumentVideoExportKind::animation_mp4,
path,
false);
if (!status.ok())
LOG("Document animation export failed: %s", status.message);
},
[](const std::string& path, bool saved) {
(void)path;
(void)saved;
}
);
return;
}
pick_file_save("mp4", target.value().name,
[this](std::string path) {
const auto status = pp::panopainter::execute_legacy_document_video_export(
*this,
pp::app::DocumentVideoExportKind::animation_mp4,
path,
false);
if (!status.ok())
LOG("Document animation export failed: %s", status.message);
},
[](const std::string& path, bool saved) {
(void)path;
(void)saved;
}
);
#else
pick_file_save({ "mp4" }, [this](std::string path) {
const auto status = pp::panopainter::execute_legacy_document_video_export(
*this,
@@ -624,7 +632,6 @@ void App::dialog_export_mp4()
if (!status.ok())
LOG("Document animation export failed: %s", status.message);
});
#endif
}
void App::dialog_whatsnew(bool force_show)