summaryrefslogtreecommitdiffstats
path: root/qt-ui/printlayout.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-12-04 15:13:40 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-12-04 15:13:40 +0200
commit08cf1be2123e38541e83eb159a3580e2354c4c47 (patch)
tree500c637a5764ce72483e1598a5f1f372951ec0d7 /qt-ui/printlayout.cpp
parentecf483db460e78d8dc08e5f1eb6b57ccbe7aa6ba (diff)
downloadsubsurface-08cf1be2123e38541e83eb159a3580e2354c4c47.tar.gz
PrintLayout: add estimateTotalDives()
estimateTotalDives() is used to calculate the total dives to be printed, it requires a 'struct dive' pointer and a couple of 'int' pointers for the iterator 'i' and 'total' return. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'qt-ui/printlayout.cpp')
-rw-r--r--qt-ui/printlayout.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/qt-ui/printlayout.cpp b/qt-ui/printlayout.cpp
index afc6dd036..7e5e57533 100644
--- a/qt-ui/printlayout.cpp
+++ b/qt-ui/printlayout.cpp
@@ -91,6 +91,17 @@ void PrintLayout::setup()
scaledPageH = pageRect.height() / scaleY;
}
+// go trought the dive table and find how many dives we are a going to print
+void PrintLayout::estimateTotalDives(struct dive *dive, int *i, int *total) const
+{
+ *total = 0;
+ for_each_dive(*i, dive) {
+ if (!dive->selected && printOptions->print_selected)
+ continue;
+ (*total)++;
+ }
+}
+
/* the used formula here is:
* s = (S - (n - 1) * p) / n
* where: