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

@@ -1,5 +1,6 @@
#pragma once
#include "app_core/app_dialog.h"
#include "foundation/result.h"
#include <string>
@@ -71,6 +72,26 @@ enum class DocumentVideoExportKind {
timelapse,
};
enum class DocumentExportSuccessKind {
equirectangular,
layers,
animation_frames,
depth,
cube_faces,
animation_mp4,
timelapse,
};
enum class DocumentExportSuccessDestination {
suppressed,
photos,
pictures_panopainter,
files_panopainter,
work_directory,
path,
generic_success,
};
struct DocumentExportMenuPlan {
DocumentExportMenuKind kind = DocumentExportMenuKind::jpeg;
DocumentExportMenuAction action = DocumentExportMenuAction::show_jpeg_dialog;
@@ -83,6 +104,13 @@ struct DocumentExportCollectionTargetPlan {
std::string_view suffix;
};
struct DocumentExportSuccessDialogPlan {
DocumentExportSuccessKind kind = DocumentExportSuccessKind::equirectangular;
DocumentExportSuccessDestination destination = DocumentExportSuccessDestination::suppressed;
AppMessageDialogPlan dialog;
bool show_dialog = false;
};
class DocumentExportMenuServices {
public:
virtual ~DocumentExportMenuServices() = default;
@@ -180,6 +208,32 @@ public:
return DocumentExportMenuAction::show_jpeg_dialog;
}
[[nodiscard]] constexpr DocumentExportSuccessDestination document_export_equirectangular_platform_destination() noexcept
{
#if defined(__IOS__)
return DocumentExportSuccessDestination::photos;
#elif defined(__OSX__)
return DocumentExportSuccessDestination::pictures_panopainter;
#elif defined(_WIN32)
return DocumentExportSuccessDestination::work_directory;
#else
return DocumentExportSuccessDestination::suppressed;
#endif
}
[[nodiscard]] constexpr DocumentExportSuccessDestination document_export_media_platform_destination() noexcept
{
#if defined(__IOS__)
return DocumentExportSuccessDestination::files_panopainter;
#elif defined(__OSX__)
return DocumentExportSuccessDestination::pictures_panopainter;
#elif defined(_WIN32)
return DocumentExportSuccessDestination::work_directory;
#else
return DocumentExportSuccessDestination::suppressed;
#endif
}
[[nodiscard]] constexpr DocumentExportMenuPlan plan_document_export_menu_action(
DocumentExportMenuKind kind,
bool has_canvas,
@@ -230,6 +284,99 @@ public:
};
}
[[nodiscard]] inline DocumentExportSuccessDialogPlan plan_document_export_success_dialog(
DocumentExportSuccessKind kind,
DocumentExportSuccessDestination destination,
std::string_view detail = {})
{
DocumentExportSuccessDialogPlan plan;
plan.kind = kind;
plan.destination = destination;
if (destination == DocumentExportSuccessDestination::suppressed) {
return plan;
}
std::string message;
switch (kind) {
case DocumentExportSuccessKind::equirectangular:
plan.dialog.title = "Export Equirectangular";
switch (destination) {
case DocumentExportSuccessDestination::photos:
message = "Image exported to Photos";
break;
case DocumentExportSuccessDestination::pictures_panopainter:
message = "Image exported to Pictures/PanoPainter folder";
break;
case DocumentExportSuccessDestination::work_directory:
message = "Image exported to ";
message += detail;
break;
case DocumentExportSuccessDestination::suppressed:
case DocumentExportSuccessDestination::files_panopainter:
case DocumentExportSuccessDestination::path:
case DocumentExportSuccessDestination::generic_success:
break;
}
break;
case DocumentExportSuccessKind::layers:
case DocumentExportSuccessKind::animation_frames:
plan.dialog.title = "Export Layers";
if (destination == DocumentExportSuccessDestination::files_panopainter) {
message = "Image layers exported to Files/PanoPainter";
} else if (destination == DocumentExportSuccessDestination::path) {
message = "Layers exported to: ";
message += detail;
}
break;
case DocumentExportSuccessKind::depth:
plan.dialog.title = "Export 3D View + Depth";
if (destination == DocumentExportSuccessDestination::files_panopainter) {
message = "Image and depth exported to Files/PanoPainter";
} else if (destination == DocumentExportSuccessDestination::pictures_panopainter) {
message = "Image and depth exported to Pictures/PanoPainter folder";
} else if (destination == DocumentExportSuccessDestination::work_directory) {
message = "Image and depth exported to ";
message += detail;
}
break;
case DocumentExportSuccessKind::cube_faces:
plan.dialog.title = "Export Cube Faces";
if (destination == DocumentExportSuccessDestination::files_panopainter) {
message = "Image and depth exported to Files/PanoPainter";
} else if (destination == DocumentExportSuccessDestination::pictures_panopainter) {
message = "Image and depth exported to Pictures/PanoPainter folder";
} else if (destination == DocumentExportSuccessDestination::work_directory) {
message = "Image and depth exported to ";
message += detail;
}
break;
case DocumentExportSuccessKind::animation_mp4:
plan.dialog.title = "Export Animation";
if (destination == DocumentExportSuccessDestination::path) {
message = "Animation exported to: ";
message += detail;
} else if (destination == DocumentExportSuccessDestination::generic_success) {
message = "Animation exported successfully.";
}
break;
case DocumentExportSuccessKind::timelapse:
plan.dialog.title = "Export Timelapse";
if (destination == DocumentExportSuccessDestination::path) {
message = "Timelapse exported to: ";
message += detail;
} else if (destination == DocumentExportSuccessDestination::generic_success) {
message = "Timelapse exported successfully.";
}
break;
}
if (!plan.dialog.title.empty() && !message.empty()) {
plan.dialog.message = std::move(message);
plan.show_dialog = true;
}
return plan;
}
[[nodiscard]] inline pp::foundation::Result<DocumentExportFileTarget> make_document_export_file_target(
std::string_view work_directory,
std::string_view document_name,