Plan document export snapshot routing
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "app_core/app_dialog.h"
|
||||
#include "app_core/document_canvas.h"
|
||||
#include "document/document.h"
|
||||
#include "foundation/result.h"
|
||||
|
||||
@@ -137,6 +138,11 @@ enum class DocumentExportExecutionKind {
|
||||
timelapse,
|
||||
};
|
||||
|
||||
enum class DocumentExportSnapshotRouteAction {
|
||||
use_document_snapshot_writer,
|
||||
use_legacy_export,
|
||||
};
|
||||
|
||||
struct DocumentExportMenuPlan {
|
||||
DocumentExportMenuKind kind = DocumentExportMenuKind::jpeg;
|
||||
DocumentExportMenuAction action = DocumentExportMenuAction::show_jpeg_dialog;
|
||||
@@ -156,6 +162,16 @@ struct DocumentExportSuccessDialogPlan {
|
||||
bool show_dialog = false;
|
||||
};
|
||||
|
||||
struct DocumentExportSnapshotRoutePlan {
|
||||
DocumentExportExecutionKind kind = DocumentExportExecutionKind::equirectangular_file;
|
||||
DocumentExportSnapshotRouteAction action = DocumentExportSnapshotRouteAction::use_legacy_export;
|
||||
bool payload_complete = false;
|
||||
bool target_supported = false;
|
||||
bool platform_supported = false;
|
||||
bool uses_document_snapshot_writer = false;
|
||||
std::string_view fallback_reason;
|
||||
};
|
||||
|
||||
class DocumentExportMenuServices {
|
||||
public:
|
||||
virtual ~DocumentExportMenuServices() = default;
|
||||
@@ -408,6 +424,38 @@ public:
|
||||
return "Document export failed";
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr DocumentExportSnapshotRoutePlan plan_document_export_snapshot_route(
|
||||
DocumentExportExecutionKind kind,
|
||||
DocumentCanvasSaveSnapshotReport report,
|
||||
bool target_supported,
|
||||
bool platform_supported) noexcept
|
||||
{
|
||||
DocumentExportSnapshotRoutePlan plan;
|
||||
plan.kind = kind;
|
||||
plan.payload_complete = report.payload_complete;
|
||||
plan.target_supported = target_supported;
|
||||
plan.platform_supported = platform_supported;
|
||||
|
||||
if (!platform_supported) {
|
||||
plan.fallback_reason = "document snapshot export is disabled on this platform";
|
||||
return plan;
|
||||
}
|
||||
|
||||
if (!target_supported) {
|
||||
plan.fallback_reason = "document snapshot export does not support this target";
|
||||
return plan;
|
||||
}
|
||||
|
||||
if (!report.payload_complete) {
|
||||
plan.fallback_reason = "document snapshot still requires renderer payload readback";
|
||||
return plan;
|
||||
}
|
||||
|
||||
plan.action = DocumentExportSnapshotRouteAction::use_document_snapshot_writer;
|
||||
plan.uses_document_snapshot_writer = true;
|
||||
return plan;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr DocumentExportCollectionTargetPlan plan_document_export_collection_target(
|
||||
DocumentExportCollectionKind kind,
|
||||
bool use_work_directory_collection) noexcept
|
||||
|
||||
Reference in New Issue
Block a user