xournalpp icon indicating copy to clipboard operation
xournalpp copied to clipboard

Refactor export jobs

Open forgedOctopus opened this issue 3 years ago • 3 comments

~~Closes~~ related to #4150.

~~Work in Progress.~~

EDIT:

Refactoring of the Pdf- & ImageExport.

The reason for the refactoring is described in #4150.

Does not close #4150, because #4150 mentions many export related issues which are not fixed with this PR, and the ExportJobs (BaseExportJob, CustomExportJob, PdfExportJob) have not been refactored yet (will be done in other PR to reduce this PR's size)

Below you can find an illustration of the current state of the refactoring. An illustration of the previous state can be found in #4150.

I tried to reduce code/logic duplication as much as possible by grouping shared code/logic in the abstract superclass ExportTemplate.

Furthermore, I tried to improve readability by splitting up methods.

Overall the previous behavior is kept, with one exception: When exporting multiple pages as PNG/SVG (ImageExport), the added filename identifier is now based on the exported page number with leading zeros instead of an identifier starting from 1.

export_refactor_class_diagram_current_state

forgedOctopus avatar Jul 21 '22 20:07 forgedOctopus

Thanks for already having a look at!

I will update the code according to your comments. There's still a lot of work to be done. Once I consider it ready for review, I'll also update the PR's description with an illustration of the refactoring.

forgedOctopus avatar Jul 24 '22 10:07 forgedOctopus

It took me a while, but now I think the PR is ready for a first review.

I didn't manage to pack everything in a concise commit history. However, I hope to give you a good idea of the refactoring with the included illustration in the PR description.

Things where especially a closer look might be needed:

  • Constructors & Deconstructors
  • When to lock the document (s. 36f0ac35fe15c0c0c5242545651565eb68e774cb)

forgedOctopus avatar Aug 15 '22 22:08 forgedOctopus

Hey,

thanks for your review. I'll address your comments soon. Furthermore, I'll try to split up the classes more. I think cohesion & coupling need to be improved. ExportTemplate seems still too large and complex, and ImageExport may better be split up into PNG & SVG export classes.

forgedOctopus avatar Sep 08 '22 13:09 forgedOctopus