subsurface/backend-shared/exportfuncs.h
Berthold Stoeger 9ee8807af7 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>
2021-05-06 08:21:04 -07:00

34 lines
1.1 KiB
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef EXPORTFUNCS_H
#define EXPORTFUNCS_H
#include <QString>
#include <QFuture>
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, 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);
// prepareDivesForUploadDiveLog
// prepareDivesForUploadDiveShare
// WARNING
// exportProfile uses the UI and are therefore different between
// Desktop (UI) and Mobile (QML)
// In order to solve this difference, the actual implementations
// are done in
// desktop-widgets/divelogexportdialog.cpp and
// mobile-widgets/qmlmanager.cpp
void exportProfile(const struct dive *dive, const QString filename);
#endif // EXPORT_FUNCS_H