9#include <QFutureWatcher>
51 std::shared_ptr<ui::adapters::ExportAdapter> exportAdapter,
52 std::shared_ptr<core::ports::diagnostics::IErrorReporter> errorReporter,
53 QObject* parent =
nullptr);
98 bool includeFormulas, const QString& locale,
99 const QVariantMap&
payload,
int totalSteps = 1);
135 void onExportFinished();
148 buildRequest(
int format, const QString& path,
bool includeFormulas,
149 const QString& locale, const QVariantMap&
payload) const;
154 void publishExportLog(const
core::
ports::workspace::ExportLogSnapshot& log);
163 core::
ports::workspace::ExportLogSnapshot
164 publishExportLogById(const QString& logId, const QString& path,
165 const QString& status, const QString& message);
171 void finishExport(
bool success, const QString& outputPath = QString());
175 void finishCanceled();
180 core::
ports::workspace::WorkspaceSnapshot stateSnapshot() const;
185 std::shared_ptr<
ui::
adapters::ExportAdapter> exportAdapter_;
186 std::shared_ptr<
core::
ports::diagnostics::IErrorReporter> errorReporter_;
188 QFuture<
core::
ports::exporting::ExportResult> exportFuture_;
189 QFutureWatcher<
core::
ports::exporting::ExportResult> exportWatcher_;
190 bool isRunning_ = false;
191 bool isPaused_ = false;
192 bool cancelRequested_ = false;
193 double progress_ = 0.0;
196 int completedSteps_ = 0;
197 QString activeExportLogId_;
198 QString activeExportPath_;
Declares the export execution result port contract.
Declares the structured diagnostics reporting port.
Immutable workspace read-model snapshot exposed through workspace ports.
void exportDataWithPayload(int format, const QString &path, bool includeFormulas, const QString &locale, const QVariantMap &payload, int totalSteps=1)
Starts an export using a QML selection payload.
void exportFailed(const QString &error)
Emitted when an export failed.
int currentMode() const noexcept
Returns the current export workflow mode.
void setExportLogSink(ExportLogSink sink)
Sets the sink used to save export logs through workspace commands.
void pauseExport()
Pauses the running export.
std::function< void(const core::ports::workspace::ExportLogSnapshot &)> ExportLogSink
QString error() const
Returns current export error text.
void clearActiveExportLog()
Clears the active export log selection.
void cancelExport()
Requests cancellation of the running export.
ExportWorkflow(StateSnapshotProvider stateSnapshotProvider, std::shared_ptr< ui::adapters::ExportAdapter > exportAdapter, std::shared_ptr< core::ports::diagnostics::IErrorReporter > errorReporter, QObject *parent=nullptr)
Creates an export workflow backed by a snapshot provider and runner.
bool isRunning() const noexcept
Reports whether an export is running.
bool isPaused() const noexcept
Reports whether the export is paused.
void stateChanged()
Emitted when export workflow state changed.
QString phase() const
Returns current export phase text.
std::function< core::ports::workspace::WorkspaceSnapshot()> StateSnapshotProvider
void exportFinished(bool success)
Emitted when an export finished or stopped.
double progress() const noexcept
Returns export progress.
void resumeExport()
Resumes the paused export.