Plan cloud bulk upload progress in app core

This commit is contained in:
2026-06-02 23:42:27 +02:00
parent 8a7db3bca8
commit d9be3f910a
9 changed files with 148 additions and 8 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include <cstddef>
#include <limits>
#include <string_view>
namespace pp::app {
@@ -25,6 +27,12 @@ struct CloudUploadPlan {
bool save_before_upload = false;
};
struct CloudBulkUploadPlan {
std::size_t file_count = 0;
int progress_total = 0;
bool show_progress = false;
};
[[nodiscard]] constexpr CloudUploadPlan plan_cloud_upload(
bool has_canvas,
bool is_new_document,
@@ -56,4 +64,16 @@ struct CloudUploadPlan {
: CloudDownloadSelectionAction::start_download;
}
[[nodiscard]] constexpr CloudBulkUploadPlan plan_cloud_bulk_upload(
std::size_t file_count,
bool progress_ui_available) noexcept
{
const auto max_progress_total = static_cast<std::size_t>(std::numeric_limits<int>::max());
return {
file_count,
file_count > max_progress_total ? std::numeric_limits<int>::max() : static_cast<int>(file_count),
progress_ui_available,
};
}
}