Make background calculation optional

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2017-11-27 22:07:09 +01:00 committed by Dirk Hohndel
parent a9703628c4
commit 1e678d52b2

View file

@ -13,6 +13,8 @@
#include <QtConcurrent> #include <QtConcurrent>
#include <desktop-widgets/mainwindow.h> #include <desktop-widgets/mainwindow.h>
#define VARIATIONS_IN_BACKGROUND 1
#define UNIT_FACTOR ((prefs.units.length == units::METERS) ? 1000.0 / 60.0 : feet_to_mm(1.0) / 60.0) #define UNIT_FACTOR ((prefs.units.length == units::METERS) ? 1000.0 / 60.0 : feet_to_mm(1.0) / 60.0)
/* TODO: Port this to CleanerTableModel to remove a bit of boilerplate and /* TODO: Port this to CleanerTableModel to remove a bit of boilerplate and
@ -930,7 +932,11 @@ void DivePlannerPointsModel::createTemporaryPlan()
lock_planner(); lock_planner();
cloneDiveplan(&diveplan, plan_copy); cloneDiveplan(&diveplan, plan_copy);
unlock_planner(); unlock_planner();
#ifdef VARIATIONS_IN_BACKGROUND
QtConcurrent::run(this, &DivePlannerPointsModel::computeVariations, plan_copy, &plan_deco_state); QtConcurrent::run(this, &DivePlannerPointsModel::computeVariations, plan_copy, &plan_deco_state);
#else
computeVariations(plan_copy, &plan_deco_state);
#endif
final_deco_state = plan_deco_state; final_deco_state = plan_deco_state;
emit calculatedPlanNotes(); emit calculatedPlanNotes();
} }