aboutsummaryrefslogtreecommitdiffstats
path: root/backend-shared/exportfuncs.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-04-30 15:51:13 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-05-06 08:21:04 -0700
commit9ee8807af7276ee8a910561f671a8cd1936babf9 (patch)
treeda8118aa59d7bb8e7495647dc25450db6f2b8f34 /backend-shared/exportfuncs.h
parent573de51e48c71c1acff87a9a44841f0a2068eb9c (diff)
downloadsubsurface-9ee8807af7276ee8a910561f671a8cd1936babf9.tar.gz
export: show progress dialog for TeX exports
The TeX exports may hang the UI for a long time. Show a progress-dialog that is updated after every exported dive and allows the user to cancel the export. This is pretty lame, because it is synchronous (export still runs in UI thread) and therefore the UI still is sluggish. But it is an improvement. Since the TeX-exporting code is in a shared directory (desktop and mobile), this uses a slim interface class. Mobile does not yet use TeX export, but you never know. Better than #ifdefs sprinkled all around, I reckon. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'backend-shared/exportfuncs.h')
-rw-r--r--backend-shared/exportfuncs.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/backend-shared/exportfuncs.h b/backend-shared/exportfuncs.h
index 250e8e60f..3eb83c9b1 100644
--- a/backend-shared/exportfuncs.h
+++ b/backend-shared/exportfuncs.h
@@ -7,8 +7,14 @@
struct dive_site;
+// A synchrounous callback interface to signal progress / check for user abort
+struct ExportCallback {
+ virtual void setProgress(int progress); // 0-1000
+ virtual bool canceled() const;
+};
+
void exportProfile(QString filename, bool selected_only);
-void export_TeX(const char *filename, bool selected_only, bool plain);
+void export_TeX(const char *filename, bool selected_only, bool plain, ExportCallback &cb);
void export_depths(const char *filename, bool selected_only);
std::vector<const dive_site *> getDiveSitesToExport(bool selectedOnly);
QFuture<int> exportUsingStyleSheet(QString filename, bool doExport, int units, QString stylesheet, bool anonymize);