# HG changeset patch # User Matti Hamalainen # Date 1505890130 -10800 # Node ID d61405758cc9eabb8da18f8cd2d0c5874d379af7 # Parent 636a24c762328e54c3747a4223d6352ad32b2cd4 Add person counts summary to printed page summaries. diff -r 636a24c76232 -r d61405758cc9 src/printing.cpp --- 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); }