Centralize legacy brush package export
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "app_core/document_export.h"
|
||||
#include "app_core/document_session.h"
|
||||
#include "legacy_document_canvas_services.h"
|
||||
#include "legacy_brush_package_export_services.h"
|
||||
#include "legacy_document_export_services.h"
|
||||
#include "legacy_document_layer_services.h"
|
||||
#include "legacy_document_session_services.h"
|
||||
@@ -520,33 +521,34 @@ void App::dialog_ppbr_export()
|
||||
auto root = layout[main_id];
|
||||
auto dialog = root->add_child_ref<NodeDialogExportPPBR>();
|
||||
dialog->btn_ok->on_click = [this, dialog] (Node*) {
|
||||
NodePanelBrushPreset::PPBRInfo info;
|
||||
info.author = dialog->txt_author->m_text;
|
||||
info.url = dialog->txt_url->m_text;
|
||||
info.email = dialog->txt_email->m_text;
|
||||
info.descr = dialog->txt_descr->m_text;
|
||||
info.header_image = dialog->m_header_image;
|
||||
info.dest_path = dialog->m_dest_path;
|
||||
if (dialog->export_check)
|
||||
info.export_data = dialog->export_check->checked;
|
||||
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, info] (std::string path) {
|
||||
presets->export_ppbr(path, info);
|
||||
[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) {
|
||||
if (saved)
|
||||
dialog->destroy();
|
||||
(void)path;
|
||||
pp::panopainter::complete_legacy_brush_package_export(*dialog, saved);
|
||||
}
|
||||
);
|
||||
#else
|
||||
App::I->pick_file_save({ "ppbr" }, [this, dialog, info] (std::string path) {
|
||||
std::thread([this, path, dialog, info] {
|
||||
BT_SetTerminate();
|
||||
presets->export_ppbr(path, info);
|
||||
dialog->destroy();
|
||||
App::I->message_box("Export PPBR", "Brushes exported to:\n" + path);
|
||||
}).detach();
|
||||
App::I->pick_file_save({ "ppbr" }, [this, dialog, request] (std::string path) {
|
||||
const auto status = pp::panopainter::execute_legacy_brush_package_export(
|
||||
*this,
|
||||
*dialog,
|
||||
request,
|
||||
path,
|
||||
pp::panopainter::LegacyBrushPackageExportMode::desktop_async_close_and_message);
|
||||
if (!status.ok())
|
||||
LOG("PPBR export failed: %s", status.message);
|
||||
});
|
||||
#endif
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user