summaryrefslogtreecommitdiffstats
path: root/printer.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-06-14 06:34:58 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-06-19 21:41:58 +0300
commit6c54781e170a2c6ec556834d18a2d951a4c75253 (patch)
treed71596bcd394ff6293d35a277a08b29092e9afd0 /printer.cpp
parent60c5e3cf25e0966fa7ec5f90d5e04404e7fae81f (diff)
downloadsubsurface-6c54781e170a2c6ec556834d18a2d951a4c75253.tar.gz
Printing: use selected print preferences while printing
Having a pointer to the printing_options struct, it should be used to privide the selected options while printing. Print options used ATM: - number of dives per page - template file name - print in colors Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'printer.cpp')
-rw-r--r--printer.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/printer.cpp b/printer.cpp
index 5116521fa..f21ff478d 100644
--- a/printer.cpp
+++ b/printer.cpp
@@ -44,7 +44,7 @@ void Printer::render()
// apply printing settings to profile
profile->setFrameStyle(QFrame::NoFrame);
- profile->setPrintMode(true);
+ profile->setPrintMode(true, !printOptions->color_selected);
profile->setFontPrintScale(0.6);
profile->setToolTipVisibile(false);
prefs.animation_speed = 0;
@@ -56,9 +56,18 @@ void Printer::render()
painter.begin(printer);
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::SmoothPixmapTransform);
-
webView->page()->setViewportSize(size);
- int Pages = ceil(getTotalWork() / 2.0);
+
+ int divesPerPage;
+ switch (printOptions->p_template) {
+ case print_options::ONE_DIVE:
+ divesPerPage = 1;
+ break;
+ case print_options::TWO_DIVE:
+ divesPerPage = 2;
+ break;
+ }
+ int Pages = ceil(getTotalWork() / (float)divesPerPage);
// get all refereces to diveprofile class in the Html template
QWebElementCollection collection = webView->page()->mainFrame()->findAllElements(".diveprofile");