From 1e678d52b275805f9d9d313a6593fcbc50878e2d Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Mon, 27 Nov 2017 22:07:09 +0100 Subject: [PATCH] Make background calculation optional Signed-off-by: Robert C. Helling --- qt-models/diveplannermodel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 6413fc251..2d03a672b 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -13,6 +13,8 @@ #include #include +#define VARIATIONS_IN_BACKGROUND 1 + #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 @@ -930,7 +932,11 @@ void DivePlannerPointsModel::createTemporaryPlan() lock_planner(); cloneDiveplan(&diveplan, plan_copy); unlock_planner(); +#ifdef VARIATIONS_IN_BACKGROUND QtConcurrent::run(this, &DivePlannerPointsModel::computeVariations, plan_copy, &plan_deco_state); +#else + computeVariations(plan_copy, &plan_deco_state); +#endif final_deco_state = plan_deco_state; emit calculatedPlanNotes(); }