summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-12-04 15:16:20 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-12-04 15:16:20 +0200
commitac7126b84a3bc573342abcc2e042ba58f8e1f0cd (patch)
tree2c1b2edcd317ee8a75631ce37914e139fd720583
parent08cf1be2123e38541e83eb159a3580e2354c4c47 (diff)
downloadsubsurface-ac7126b84a3bc573342abcc2e042ba58f8e1f0cd.tar.gz
PrintLayout: emit progress from printProfileDives()
printProfileDives() now emits a 'signalProgress' each time a dive is done processing. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
-rw-r--r--qt-ui/printlayout.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-ui/printlayout.cpp b/qt-ui/printlayout.cpp
index 7e5e57533..3e7408702 100644
--- a/qt-ui/printlayout.cpp
+++ b/qt-ui/printlayout.cpp
@@ -115,6 +115,12 @@ void PrintLayout::estimateTotalDives(struct dive *dive, int *i, int *total) cons
void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
{
+ int i, row = 0, col = 0, printed = 0, total = 0;
+ struct dive *dive;
+ estimateTotalDives(dive, &i, &total);
+ if (!total)
+ return;
+
// setup a painter
QPainter painter;
painter.begin(printer);
@@ -159,8 +165,6 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
yOffsetTable = scaledH - tableH;
// plot the dives at specific rows and columns on the page
- int i, row = 0, col = 0;
- struct dive *dive;
for_each_dive(i, dive) {
if (!dive->selected && printOptions->print_selected)
continue;
@@ -186,6 +190,8 @@ void PrintLayout::printProfileDives(int divesPerRow, int divesPerColumn)
table->render(&painter);
painter.setTransform(origTransform);
col++;
+ printed++;
+ emit signalProgress((printed * 100) / total);
}
// cleanup