23 std::atomic<bool> mCancelled {
false};
24 std::atomic<bool> mStopped {
false};
25 std::atomic<double> mProgress {};
54 constexpr long long ProgressSteps = 1000ul;
59 mProgressDialog->SetMessage(mStatus);
61 const auto result = mProgressDialog->Poll(mProgress * ProgressSteps, ProgressSteps);
82 assert(exportTask.valid());
84 auto f = exportTask.get_future();
85 DialogExportProgressDelegate delegate;
86 std::thread(std::move(exportTask), std::ref(delegate)).detach();
88 while(f.wait_for(std::chrono::milliseconds(50)) != std::future_status::ready)
96 {},
XO(
"Export error"),
97 XO(
"Export completed with error."), {},
Toolkit-neutral facade for basic user interface services.
std::packaged_task< ExportResult(ExportProcessorDelegate &)> ExportTask
MessageBoxException for failures of file operations.
Holds a msgid for the translation catalog; may also bind format arguments.
TranslatableString mStatus
void OnProgress(double progress) override
std::unique_ptr< BasicUI::ProgressDialog > mProgressDialog
bool IsCancelled() const override
bool IsStopped() const override
void SetStatusString(const TranslatableString &str) override
void ShowErrorDialog(const WindowPlacement &placement, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const ErrorDialogOptions &options={})
Show an error dialog with a link to the manual for further help.
std::unique_ptr< ProgressDialog > MakeProgress(const TranslatableString &title, const TranslatableString &message, unsigned flags=(ProgressShowStop|ProgressShowCancel), const TranslatableString &remainingLabelText={})
Create and display a progress dialog.
IMPORT_EXPORT_API ExportResult Show(ExportTask exportTask)
void ExceptionWrappedCall(Callable callable)
Options for variations of error dialogs; the default is for modal dialogs.