aboutsummaryrefslogtreecommitdiffstats
path: root/printer.h
AgeCommit message (Collapse)Author
2015-08-22Printing: use the same code for both statistics and divelist printGravatar Gehad elrobey
- use the same generic code for both types of templates - check for the printing type before generating the template - remove unused printStatistics() method Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15Printing: don't break dives into successive pagesGravatar Gehad elrobey
While rendering a template with "0" dives per page value, try to fit as many dives per page but don't break a dive into 2 pages. Use a dynamically sized view port to fit the rendered area only, and don't render the full page. All the Template elements that shouldn't be broken should have the CSS class "dontbreak". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-08-15Printing: add statistics printGravatar Gehad elrobey
Add statistics table print option. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
2015-07-20Printing: add preview to TemplateEdit dialogGravatar Gehad elrobey
Show QPixmap in QLabel, Use Printer class to render the Preview on the QPixmap. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20Printing: check for different printing modesGravatar Gehad elrobey
Add PRINT/PREVIEW print modes, check for printing modes before casting. We must pass a QPaintDevice with type QPixmap for previewing and with type QPrinter for actual printing. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20Printing: change QPrinter to parent class QPaintDeviceGravatar Gehad elrobey
Use general class QPaintDevice to be used for printing and previewing instances, printing uses a QPrinter object while previewing uses a QPixmap instance. We use static_cast to use the needed object. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20Printing: refactoring printer classGravatar Gehad elrobey
- Render specific number of pages only. - Move printer related code to print(). Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20Printing: handle memory leak in printer classGravatar Gehad elrobey
Don't initialize new webview each time we print. Delete the QWebView object in the destructor. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-05Printing: pass the template_options struct to TemplateLayoutGravatar Gehad elrobey
The template_options struct needs to be passed to TemplateLayout constructor. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19Printing: add support for printing on any page sizeGravatar Gehad elrobey
Make page size and orientation customizable. The user can select any page size and orientation and then the rendering resolution will be calculated based on the selected preferences and the printer DPI. The HTML templates must be responsive, also the font-size must be based on the viewport width so that we don't lose quality. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19Printing: pass the print_options struct to TemplateLayout and PrinterGravatar Gehad elrobey
As the print_options struct is needed by both TemplateLayout and Printer class, it can be passed to their constructor. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-19Printing: render the dive profile on top of QWebViewGravatar Gehad elrobey
We render the dive profile over the QWebView to the QPainter. This helps us not to save the SVG images to disk and then render them again to the webview. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-06-04Printing: Add progress updating ability to print dialogGravatar Gehad elrobey
The progress bar shows the progress of both the rendering part and the templating part, unfortunately we can't check the progress of Grantlee templating engine so the progess bar doesn't have a constant pace it stops a little around 20%. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-04Printing: Add Printer class that holds the rendering logic.Gravatar Gehad elrobey
Render Html pages into a QWebView then print it using QPainter. the Printer::print() is called that prepare the HTML file to be rendered by the QWebView. Printer::render() will do the rendering task. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>