From c1523147905345ed5f979b374f766ce42bc9be9b Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Fri, 5 Jun 2015 03:43:26 +0200 Subject: [PATCH 01/10] Printing: fix "if" condition clause in cmake file Check for NO_PRINTING instead of checking for NOT NO_PRINTING. Signed-off-by: Gehad elrobey Signed-off-by: Lubomir I. Ivanov --- CMakeLists.txt | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1b59c849..e31822e0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,11 @@ endif() # setup Grantlee -if(NOT NO_PRINTING) +if(NO_PRINTING) + message(STATUS "building without printing support") + add_definitions(-DNO_PRINTING) + set(GRANTLEE_LIBRARIES "") +else() if(LIBGRANTLEE_FROM_PKGCONFIG) pkg_config_library(GRANTLEE libgrantlee REQUIRED) set(GRANTLEE_LIBRARIES "") @@ -113,12 +117,6 @@ if(NOT NO_PRINTING) ) endif() -if(NO_PRINTING) - message(STATUS "building without printing support") - add_definitions(-DNO_PRINTING) - set(GRANTLEE_LIBRARIES "") -endif() - set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${GRANTLEE_LIBRARIES} -lusb-1.0) # handle out of tree build correctly From 1040f0d4e57ca8ec13f9eb8e0b2214c89b90aaaf Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Wed, 10 Jun 2015 13:39:15 +0200 Subject: [PATCH 02/10] Printing: fix rendering bug for odd number of dives Odd number of dives needs extra space from the buttom, so that when we scroll to the last page extra whitespace is shown under the last dive frame, this is fixed by adding a default footer to the base template. Signed-off-by: Gehad elrobey Signed-off-by: Lubomir I. Ivanov --- printer.cpp | 2 +- printing_templates/base.html | 7 +++++++ templatelayout.cpp | 20 ++++++++++---------- templatelayout.h | 3 ++- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/printer.cpp b/printer.cpp index 5d340055e..e2b88c07e 100644 --- a/printer.cpp +++ b/printer.cpp @@ -30,7 +30,7 @@ void Printer::render() webView->page()->setViewportSize(size); - int Pages = ceil((float)webView->page()->mainFrame()->contentsSize().rheight() / A4_300DPI_HIGHT); + int Pages = ceil(getTotalWork() / 2.0); for (int i = 0; i < Pages; i++) { webView->page()->mainFrame()->render(&painter, QWebFrame::ContentsLayer); webView->page()->mainFrame()->scroll(0, A4_300DPI_HIGHT); diff --git a/printing_templates/base.html b/printing_templates/base.html index c2c6aa59b..c32bc12db 100644 --- a/printing_templates/base.html +++ b/printing_templates/base.html @@ -84,6 +84,11 @@ overflow: hidden !important; text-overflow: ellipsis; } + + #footer { + width: 96%; + height: 50%; + } @@ -200,5 +205,7 @@ {% endfor %} {% endblock %} +