changeset 175:d61405758cc9

Add person counts summary to printed page summaries.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 20 Sep 2017 09:48:50 +0300
parents 636a24c76232
children c29a1078d601
files src/printing.cpp
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/printing.cpp	Wed Sep 20 09:43:11 2017 +0300
+++ b/src/printing.cpp	Wed Sep 20 09:48:50 2017 +0300
@@ -116,12 +116,13 @@
         "FROM people ORDER BY last_name ASC,first_name ASC");
 
     // If we are fetching page info, we need to process all entries
+    int noffset = (npage - 1) * pinfo.nlinesPerPage;
     if (!getPageInfo)
     {
         // Otherwise we can limit to given page number
         querystr += QStringLiteral(" LIMIT %1 OFFSET %2").
             arg(pinfo.nlinesPerPage).
-            arg((npage - 1) * pinfo.nlinesPerPage);
+            arg(noffset);
     }
 
     QSqlQuery query;
@@ -149,11 +150,12 @@
     SLDrawContext ctx(pt);
     ctx.setFont(font1);
 
-    int nline = 0;
+    int nline = 0, nperson = noffset;
     while (query.next())
     {
         SLPersonInfo info;
         slGetPersonInfoRec(query, info);
+        nperson++;
 
         // Check for end of page
         // KLUDGE for now
@@ -219,11 +221,14 @@
     {
         ctx.setPos(0, APP_PRINT_HEIGHT - ctx.boundRect().height());
         ctx.drawText(0, APP_PRINT_WIDTH,
-            tr("Sivu %1 / %2 (%3 / %4)").
+            tr("Sivu %1 / %2 (%3 / %4) - Henkilöt %5 - %6 / %7").
             arg(npage - printer->fromPage() + 1).
             arg(printer->toPage() - printer->fromPage() + 1).
             arg(npage).
-            arg(printer->toPage()),
+            arg(printer->toPage()).
+            arg(noffset + 1).
+            arg(nperson).
+            arg(totalPeople),
             Qt::AlignHCenter);
     }