diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-06-21 06:13:22 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-07-05 20:58:24 +0300 |
commit | 1faa198020de343004a7f1db85a83e6bc0ef8b34 (patch) | |
tree | aa588f64eb16c979f98adfea156f90a90b23e8d8 /templatelayout.cpp | |
parent | bc0b443afd73e0bc7c18b293d051aa01bf82d99f (diff) | |
download | subsurface-1faa198020de343004a7f1db85a83e6bc0ef8b34.tar.gz |
Printing: print all dives if 'print selected' is unchecked
User can choose either to print all dives or print selected dives only.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'templatelayout.cpp')
-rw-r--r-- | templatelayout.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/templatelayout.cpp b/templatelayout.cpp index 5f47b64a2..81a4d5f03 100644 --- a/templatelayout.cpp +++ b/templatelayout.cpp @@ -4,11 +4,19 @@ #include "helpers.h" #include "display.h" -int getTotalWork() +int getTotalWork(print_options *printOptions) { - // return the correct number depending on all/selected dives - // but don't return 0 as we might divide by this number - return amount_selected ? amount_selected : 1; + if (printOptions->print_selected) { + // return the correct number depending on all/selected dives + // but don't return 0 as we might divide by this number + return amount_selected ? amount_selected : 1; + } + int dives = 0, i; + struct dive *dive; + for_each_dive (i, dive) { + dives++; + } + return dives; } TemplateLayout::TemplateLayout(print_options *PrintOptions) : @@ -25,7 +33,7 @@ TemplateLayout::~TemplateLayout() QString TemplateLayout::generate() { int progress = 0; - int totalWork = getTotalWork(); + int totalWork = getTotalWork(PrintOptions); QString templateName; QString htmlContent; @@ -45,7 +53,7 @@ QString TemplateLayout::generate() int i; for_each_dive (i, dive) { //TODO check for exporting selected dives only - if (!dive->selected) + if (!dive->selected && PrintOptions->print_selected) continue; Dive d(dive); diveList.append(QVariant::fromValue(d)); |