summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--printer.cpp2
-rw-r--r--printing_templates/base.html7
-rw-r--r--templatelayout.cpp20
-rw-r--r--templatelayout.h3
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%;
+ }
</style>
</head>
<body>
@@ -200,5 +205,7 @@
</div>
{% endfor %}
{% endblock %}
+<div id="footer">
+<div>
</body>
</html>
diff --git a/templatelayout.cpp b/templatelayout.cpp
index a5d4b2329..6083d7b91 100644
--- a/templatelayout.cpp
+++ b/templatelayout.cpp
@@ -3,16 +3,7 @@
#include "templatelayout.h"
#include "helpers.h"
-TemplateLayout::TemplateLayout()
-{
-}
-
-TemplateLayout::~TemplateLayout()
-{
- delete m_engine;
-}
-
-int TemplateLayout::getTotalWork()
+int getTotalWork()
{
int dives = 0, i;
struct dive *dive;
@@ -25,6 +16,15 @@ int TemplateLayout::getTotalWork()
return dives;
}
+TemplateLayout::TemplateLayout()
+{
+}
+
+TemplateLayout::~TemplateLayout()
+{
+ delete m_engine;
+}
+
QString TemplateLayout::generate()
{
int progress = 0;
diff --git a/templatelayout.h b/templatelayout.h
index db2fb30d3..d8ada1c86 100644
--- a/templatelayout.h
+++ b/templatelayout.h
@@ -4,6 +4,8 @@
#include <grantlee_templates.h>
#include "mainwindow.h"
+int getTotalWork();
+
class TemplateLayout : public QObject {
Q_OBJECT
public:
@@ -13,7 +15,6 @@ public:
private:
Grantlee::Engine *m_engine;
- int getTotalWork();
signals:
void progressUpdated(int value);