exporter.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef EXPORTER_H
  2. #define EXPORTER_H
  3. #include <QObject>
  4. #include <QStringList>
  5. #include "exportdata.h"
  6. namespace vnotex
  7. {
  8. class Notebook;
  9. class Node;
  10. class Buffer;
  11. class File;
  12. class WebViewExporter;
  13. class Exporter : public QObject
  14. {
  15. Q_OBJECT
  16. public:
  17. // We need the QWidget as parent.
  18. explicit Exporter(QWidget *p_parent);
  19. // Return exported output file.
  20. QString doExport(const ExportOption &p_option, Buffer *p_buffer);
  21. // Return exported output files.
  22. QStringList doExport(const ExportOption &p_option, Node *p_folder);
  23. QStringList doExport(const ExportOption &p_option, Notebook *p_notebook);
  24. void stop();
  25. signals:
  26. void progressUpdated(int p_val, int p_maximum);
  27. void logRequested(const QString &p_log);
  28. private:
  29. QStringList doExport(const ExportOption &p_option, const QString &p_outputDir, Node *p_folder);
  30. QString doExport(const ExportOption &p_option, const QString &p_outputDir, const File *p_file);
  31. QString doExportMarkdown(const ExportOption &p_option, const QString &p_outputDir, const File *p_file);
  32. QString doExportHtml(const ExportOption &p_option, const QString &p_outputDir, const File *p_file);
  33. QString doExportPdf(const ExportOption &p_option, const QString &p_outputDir, const File *p_file);
  34. void exportAttachments(Node *p_node,
  35. const QString &p_srcFilePath,
  36. const QString &p_outputFolder,
  37. const QString &p_destFilePath);
  38. WebViewExporter *getWebViewExporter(const ExportOption &p_option);
  39. void cleanUpWebViewExporter();
  40. void cleanUp();
  41. bool checkAskedToStop() const;
  42. // Managed by QObject.
  43. WebViewExporter *m_webViewExporter = nullptr;
  44. bool m_askedToStop = false;
  45. };
  46. }
  47. #endif // EXPORTER_H