summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-09-18 16:10:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-09-20 08:54:41 -0700
commita6f186279fcce9631623b94bfdc00fa3fd071b4c (patch)
tree22e907959336c94887f210da14f7fc5c54496b6d /desktop-widgets
parent5e9bdce195c1ec3ca077ce75cf2c0a221d6029de (diff)
downloadsubsurface-a6f186279fcce9631623b94bfdc00fa3fd071b4c.tar.gz
Add a checkbox to turn off plan variations
... as those come with a performance penalty Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/diveplanner.cpp2
-rw-r--r--desktop-widgets/plannerSettings.ui35
-rw-r--r--desktop-widgets/templatelayout.cpp24
3 files changed, 41 insertions, 20 deletions
diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp
index dd91e88c7..b90772f39 100644
--- a/desktop-widgets/diveplanner.cpp
+++ b/desktop-widgets/diveplanner.cpp
@@ -322,6 +322,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.display_duration->setChecked(prefs.display_duration);
ui.display_runtime->setChecked(prefs.display_runtime);
ui.display_transitions->setChecked(prefs.display_transitions);
+ ui.display_variations->setChecked(prefs.display_variations);
ui.safetystop->setChecked(prefs.safetystop);
ui.sacfactor->setValue(prefs.sacfactor / 100.0);
ui.problemsolvingtime->setValue(prefs.problemsolvingtime);
@@ -355,6 +356,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
+ connect(ui.display_variations, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayVariations(bool)));
connect(ui.safetystop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSafetyStop(bool)));
connect(ui.reserve_gas, SIGNAL(valueChanged(int)), plannerModel, SLOT(setReserveGas(int)));
connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
diff --git a/desktop-widgets/plannerSettings.ui b/desktop-widgets/plannerSettings.ui
index 22dcda86a..44cc45e27 100644
--- a/desktop-widgets/plannerSettings.ui
+++ b/desktop-widgets/plannerSettings.ui
@@ -685,6 +685,23 @@
<property name="spacing">
<number>2</number>
</property>
+ <item row="3" column="0">
+ <widget class="QCheckBox" name="verbatim_plan">
+ <property name="text">
+ <string>Verbatim dive plan</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="display_transitions">
+ <property name="toolTip">
+ <string>In diveplan, list transitions or treat them as implicit</string>
+ </property>
+ <property name="text">
+ <string>Display transitions in deco</string>
+ </property>
+ </widget>
+ </item>
<item row="0" column="0">
<widget class="QCheckBox" name="display_runtime">
<property name="toolTip">
@@ -708,20 +725,16 @@
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QCheckBox" name="display_transitions">
- <property name="toolTip">
- <string>In diveplan, list transitions or treat them as implicit</string>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="display_variations">
+ <property name="enabled">
+ <bool>true</bool>
</property>
- <property name="text">
- <string>Display transitions in deco</string>
+ <property name="toolTip">
+ <string>Compute variations of plan (performance cost)</string>
</property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QCheckBox" name="verbatim_plan">
<property name="text">
- <string>Verbatim dive plan</string>
+ <string>Display plan variations</string>
</property>
</widget>
</item>
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp
index a059a2dad..9f933e91c 100644
--- a/desktop-widgets/templatelayout.cpp
+++ b/desktop-widgets/templatelayout.cpp
@@ -12,7 +12,7 @@ int getTotalWork(print_options *printOptions)
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;
+ return amount_selected && !in_planner() ? amount_selected : 1;
}
return dive_table.nr;
}
@@ -98,15 +98,21 @@ QString TemplateLayout::generate()
QVariantList diveList;
struct dive *dive;
- int i;
- for_each_dive (i, dive) {
- //TODO check for exporting selected dives only
- if (!dive->selected && PrintOptions->print_selected)
- continue;
- DiveObjectHelper *d = new DiveObjectHelper(dive);
+ if (in_planner()) {
+ DiveObjectHelper *d = new DiveObjectHelper(&displayed_dive);
diveList.append(QVariant::fromValue(d));
- progress++;
- emit progressUpdated(lrint(progress * 100.0 / totalWork));
+ emit progressUpdated(100.0);
+ } else {
+ int i;
+ for_each_dive (i, dive) {
+ //TODO check for exporting selected dives only
+ if (!dive->selected && PrintOptions->print_selected)
+ continue;
+ DiveObjectHelper *d = new DiveObjectHelper(dive);
+ diveList.append(QVariant::fromValue(d));
+ progress++;
+ emit progressUpdated(lrint(progress * 100.0 / totalWork));
+ }
}
Grantlee::Context c;
c.insert("dives", diveList);