Plan document export reporting
This commit is contained in:
@@ -45,8 +45,11 @@ namespace {
|
||||
case pp::app::DocumentExportStartDecision::start_now:
|
||||
return true;
|
||||
case pp::app::DocumentExportStartDecision::show_license_disabled:
|
||||
app.message_box("License", "This function is disabled in demo mode.");
|
||||
{
|
||||
const auto plan = pp::app::plan_document_export_license_disabled_dialog();
|
||||
app.message_box(plan.title, plan.message, plan.show_cancel);
|
||||
return false;
|
||||
}
|
||||
case pp::app::DocumentExportStartDecision::unavailable_no_canvas:
|
||||
return false;
|
||||
}
|
||||
@@ -56,14 +59,12 @@ namespace {
|
||||
|
||||
void start_document_export_collection(
|
||||
App& app,
|
||||
pp::app::DocumentExportCollectionKind kind,
|
||||
const char* message_title,
|
||||
const char* collection_log_message,
|
||||
const char* stem_log_message)
|
||||
pp::app::DocumentExportCollectionKind kind)
|
||||
{
|
||||
const auto plan = pp::app::plan_document_export_collection_target(
|
||||
kind,
|
||||
app.uses_work_directory_document_export_collections());
|
||||
const auto success_kind = pp::app::document_export_collection_success_kind(kind);
|
||||
|
||||
if (plan.destination == pp::app::DocumentExportCollectionDestination::work_directory_collection) {
|
||||
const auto target = pp::app::make_document_export_collection_target(
|
||||
@@ -71,7 +72,8 @@ void start_document_export_collection(
|
||||
app.doc_name,
|
||||
plan.suffix);
|
||||
if (!target) {
|
||||
app.message_box(message_title, target.status().message);
|
||||
const auto dialog = pp::app::plan_document_export_failure_dialog(success_kind, target.status().message);
|
||||
app.message_box(dialog.title, dialog.message, dialog.show_cancel);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,19 +82,25 @@ void start_document_export_collection(
|
||||
plan.kind,
|
||||
target.value());
|
||||
if (!status.ok())
|
||||
LOG("%s: %s", collection_log_message, status.message);
|
||||
LOG(
|
||||
"%s: %s",
|
||||
pp::app::document_export_execution_log_message(
|
||||
kind == pp::app::DocumentExportCollectionKind::layers
|
||||
? pp::app::DocumentExportExecutionKind::layers_collection
|
||||
: pp::app::DocumentExportExecutionKind::animation_frames_collection),
|
||||
status.message);
|
||||
return;
|
||||
}
|
||||
|
||||
app.pick_dir([
|
||||
&app,
|
||||
kind = plan.kind,
|
||||
title = std::string(message_title),
|
||||
log_message = std::string(stem_log_message)
|
||||
success_kind
|
||||
](std::string path) {
|
||||
const auto target = pp::app::make_document_export_stem_target(path, app.doc_name);
|
||||
if (!target) {
|
||||
app.message_box(title, target.status().message);
|
||||
const auto dialog = pp::app::plan_document_export_failure_dialog(success_kind, target.status().message);
|
||||
app.message_box(dialog.title, dialog.message, dialog.show_cancel);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,7 +109,13 @@ void start_document_export_collection(
|
||||
kind,
|
||||
target.value());
|
||||
if (!status.ok())
|
||||
LOG("%s: %s", log_message.c_str(), status.message);
|
||||
LOG(
|
||||
"%s: %s",
|
||||
pp::app::document_export_execution_log_message(
|
||||
kind == pp::app::DocumentExportCollectionKind::layers
|
||||
? pp::app::DocumentExportExecutionKind::layers_stem
|
||||
: pp::app::DocumentExportExecutionKind::animation_frames_stem),
|
||||
status.message);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -409,13 +423,20 @@ void App::dialog_export(std::string ext)
|
||||
// TODO: use picker
|
||||
const auto target = pp::app::make_document_export_file_target(work_path, doc_name, ext);
|
||||
if (!target) {
|
||||
message_box("Export Equirectangular", target.status().message);
|
||||
const auto dialog = pp::app::plan_document_export_failure_dialog(
|
||||
pp::app::DocumentExportSuccessKind::equirectangular,
|
||||
target.status().message);
|
||||
message_box(dialog.title, dialog.message, dialog.show_cancel);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto status = pp::panopainter::execute_legacy_document_export_file(*this, target.value());
|
||||
if (!status.ok())
|
||||
LOG("Document export file action failed: %s", status.message);
|
||||
LOG(
|
||||
"%s: %s",
|
||||
pp::app::document_export_execution_log_message(
|
||||
pp::app::DocumentExportExecutionKind::equirectangular_file),
|
||||
status.message);
|
||||
}
|
||||
|
||||
void App::dialog_export_layers()
|
||||
@@ -425,10 +446,7 @@ void App::dialog_export_layers()
|
||||
|
||||
start_document_export_collection(
|
||||
*this,
|
||||
pp::app::DocumentExportCollectionKind::layers,
|
||||
"Export Layers",
|
||||
"Document layer collection export failed",
|
||||
"Document layer stem export failed");
|
||||
pp::app::DocumentExportCollectionKind::layers);
|
||||
}
|
||||
|
||||
void App::dialog_export_anim_frames()
|
||||
@@ -438,10 +456,7 @@ void App::dialog_export_anim_frames()
|
||||
|
||||
start_document_export_collection(
|
||||
*this,
|
||||
pp::app::DocumentExportCollectionKind::animation_frames,
|
||||
"Export Layers",
|
||||
"Document animation frame collection export failed",
|
||||
"Document animation frame stem export failed");
|
||||
pp::app::DocumentExportCollectionKind::animation_frames);
|
||||
}
|
||||
|
||||
void App::dialog_export_depth()
|
||||
@@ -451,7 +466,10 @@ void App::dialog_export_depth()
|
||||
|
||||
const auto status = pp::panopainter::execute_legacy_document_export_depth(*this, doc_name);
|
||||
if (!status.ok())
|
||||
LOG("Document depth export failed: %s", status.message);
|
||||
LOG(
|
||||
"%s: %s",
|
||||
pp::app::document_export_execution_log_message(pp::app::DocumentExportExecutionKind::depth),
|
||||
status.message);
|
||||
}
|
||||
|
||||
void App::dialog_resize()
|
||||
@@ -487,7 +505,10 @@ void App::dialog_export_cube_faces()
|
||||
|
||||
const auto status = pp::panopainter::execute_legacy_document_export_cube_faces(*this, doc_name);
|
||||
if (!status.ok())
|
||||
LOG("Document cube-face export failed: %s", status.message);
|
||||
LOG(
|
||||
"%s: %s",
|
||||
pp::app::document_export_execution_log_message(pp::app::DocumentExportExecutionKind::cube_faces),
|
||||
status.message);
|
||||
}
|
||||
|
||||
void App::dialog_layer_rename()
|
||||
@@ -575,7 +596,10 @@ void App::dialog_timelapse_export()
|
||||
{
|
||||
const auto target = pp::app::make_document_export_suggested_name(doc_name, "-timelapse");
|
||||
if (!target) {
|
||||
message_box("Export Timelapse", target.status().message);
|
||||
const auto dialog = pp::app::plan_document_export_failure_dialog(
|
||||
pp::app::DocumentExportSuccessKind::timelapse,
|
||||
target.status().message);
|
||||
message_box(dialog.title, dialog.message, dialog.show_cancel);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -587,7 +611,11 @@ void App::dialog_timelapse_export()
|
||||
path,
|
||||
false);
|
||||
if (!status.ok())
|
||||
LOG("Document timelapse export failed: %s", status.message);
|
||||
LOG(
|
||||
"%s: %s",
|
||||
pp::app::document_export_execution_log_message(
|
||||
pp::app::DocumentExportExecutionKind::timelapse),
|
||||
status.message);
|
||||
},
|
||||
[](const std::string& path, bool saved) {
|
||||
(void)path;
|
||||
@@ -604,7 +632,10 @@ void App::dialog_timelapse_export()
|
||||
path,
|
||||
true);
|
||||
if (!status.ok())
|
||||
LOG("Document timelapse export failed: %s", status.message);
|
||||
LOG(
|
||||
"%s: %s",
|
||||
pp::app::document_export_execution_log_message(pp::app::DocumentExportExecutionKind::timelapse),
|
||||
status.message);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -617,7 +648,10 @@ void App::dialog_export_mp4()
|
||||
{
|
||||
const auto target = pp::app::make_document_export_suggested_name(doc_name, "-animation");
|
||||
if (!target) {
|
||||
message_box("Export Animation", target.status().message);
|
||||
const auto dialog = pp::app::plan_document_export_failure_dialog(
|
||||
pp::app::DocumentExportSuccessKind::animation_mp4,
|
||||
target.status().message);
|
||||
message_box(dialog.title, dialog.message, dialog.show_cancel);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -629,7 +663,11 @@ void App::dialog_export_mp4()
|
||||
path,
|
||||
false);
|
||||
if (!status.ok())
|
||||
LOG("Document animation export failed: %s", status.message);
|
||||
LOG(
|
||||
"%s: %s",
|
||||
pp::app::document_export_execution_log_message(
|
||||
pp::app::DocumentExportExecutionKind::animation_mp4),
|
||||
status.message);
|
||||
},
|
||||
[](const std::string& path, bool saved) {
|
||||
(void)path;
|
||||
@@ -646,7 +684,10 @@ void App::dialog_export_mp4()
|
||||
path,
|
||||
true);
|
||||
if (!status.ok())
|
||||
LOG("Document animation export failed: %s", status.message);
|
||||
LOG(
|
||||
"%s: %s",
|
||||
pp::app::document_export_execution_log_message(pp::app::DocumentExportExecutionKind::animation_mp4),
|
||||
status.message);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user