diff options
-rw-r--r-- | backend-shared/plannershared.cpp | 56 | ||||
-rw-r--r-- | backend-shared/plannershared.h | 29 | ||||
-rw-r--r-- | tests/testplannershared.cpp | 100 | ||||
-rw-r--r-- | tests/testplannershared.h | 1 |
4 files changed, 0 insertions, 186 deletions
diff --git a/backend-shared/plannershared.cpp b/backend-shared/plannershared.cpp index f4d21fa21..bf92f21a2 100644 --- a/backend-shared/plannershared.cpp +++ b/backend-shared/plannershared.cpp @@ -17,56 +17,6 @@ plannerShared::plannerShared() connect(qPrefUnits::instance(), &qPrefUnits::lengthChanged, this, &unit_lengthChangedSlot); } - -// Used to convert between meter/feet and keep the qPref variables independent -#define TO_MM_BY_SEC ((prefs.units.length == units::METERS) ? 1000.0 / 60.0 : feet_to_mm(1) / 60.0) - -// Converted meter/feet qPrefDivePlanner values -int plannerShared::ascratelast6m() -{ - return lrint((float)prefs.ascratelast6m / TO_MM_BY_SEC); -} -void plannerShared::set_ascratelast6m(int value) -{ - qPrefDivePlanner::set_ascratelast6m(lrint((float)value * TO_MM_BY_SEC)); -} - -int plannerShared::ascratestops() -{ - return lrint((float)prefs.ascratestops / TO_MM_BY_SEC); -} -void plannerShared::set_ascratestops(int value) -{ - qPrefDivePlanner::set_ascratestops(lrint((float)value * TO_MM_BY_SEC)); -} - -int plannerShared::ascrate50() -{ - return lrint((float)prefs.ascrate50 / TO_MM_BY_SEC); -} -void plannerShared::set_ascrate50(int value) -{ - qPrefDivePlanner::set_ascrate50(lrint((float)value * TO_MM_BY_SEC)); -} - -int plannerShared::ascrate75() -{ - return lrint((float)prefs.ascrate75 / TO_MM_BY_SEC); -} -void plannerShared::set_ascrate75(int value) -{ - qPrefDivePlanner::set_ascrate75(lrint((float)value * TO_MM_BY_SEC)); -} - -int plannerShared::descrate() -{ - return lrint((float)prefs.descrate / TO_MM_BY_SEC); -} -void plannerShared::set_descrate(int value) -{ - qPrefDivePlanner::set_descrate(lrint((float)value * TO_MM_BY_SEC)); -} - // Planning values deco_mode plannerShared::planner_deco_mode() { @@ -312,10 +262,4 @@ void plannerShared::set_display_variations(bool value) // Handle when user changes length measurement type void plannerShared::unit_lengthChangedSlot(int value) { - // Provoke recalculation of model and send of signals - set_ascratelast6m(ascratelast6m()); - set_ascratestops(ascratestops()); - set_ascrate50(ascrate50()); - set_ascrate75(ascrate75()); - set_descrate(descrate()); } diff --git a/backend-shared/plannershared.h b/backend-shared/plannershared.h index 4add244a2..d044cf987 100644 --- a/backend-shared/plannershared.h +++ b/backend-shared/plannershared.h @@ -15,15 +15,6 @@ class plannerShared: public QObject { Q_OBJECT - // Ascend/Descend data, converted to meter/feet depending on user selection - // Settings these will automatically update the corresponding qPrefDivePlanner - // Variables - Q_PROPERTY(int ascratelast6m READ ascratelast6m WRITE set_ascratelast6m NOTIFY ascratelast6mChanged); - Q_PROPERTY(int ascratestops READ ascratestops WRITE set_ascratestops NOTIFY ascratestopsChanged); - Q_PROPERTY(int ascrate50 READ ascrate50 WRITE set_ascrate50 NOTIFY ascrate50Changed); - Q_PROPERTY(int ascrate75 READ ascrate75 WRITE set_ascrate75 NOTIFY ascrate75Changed); - Q_PROPERTY(int descrate READ descrate WRITE set_descrate NOTIFY descrateChanged); - // Planning data Q_PROPERTY(deco_mode planner_deco_mode READ planner_deco_mode WRITE set_planner_deco_mode NOTIFY planner_deco_modeChanged); Q_PROPERTY(int reserve_gas READ reserve_gas WRITE set_reserve_gas NOTIFY reserve_gasChanged); @@ -58,13 +49,6 @@ class plannerShared: public QObject { public: static plannerShared *instance(); - // Ascend/Descend data, converted to meter/feet depending on user selection - static int ascratelast6m(); - static int ascratestops(); - static int ascrate50(); - static int ascrate75(); - static int descrate(); - // Planning data static deco_mode planner_deco_mode(); static int reserve_gas(); @@ -97,12 +81,6 @@ public: static bool display_variations(); public slots: - // Ascend/Descend data, converted to meter/feet depending on user selection - static void set_ascratelast6m(int value); - static void set_ascratestops(int value); - static void set_ascrate50(int value); - static void set_ascrate75(int value); - static void set_descrate(int value); // Planning data static void set_planner_deco_mode(deco_mode value); @@ -136,13 +114,6 @@ public slots: static void set_display_variations(bool value); signals: - // Ascend/Descend data, converted to meter/feet depending on user selection - void ascratelast6mChanged(int value); - void ascratestopsChanged(int value); - void ascrate50Changed(int value); - void ascrate75Changed(int value); - void descrateChanged(int value); - // Planning data void planner_deco_modeChanged(deco_mode value); void dobailoutChanged(bool value); diff --git a/tests/testplannershared.cpp b/tests/testplannershared.cpp index d9b03c247..f4c4546ee 100644 --- a/tests/testplannershared.cpp +++ b/tests/testplannershared.cpp @@ -57,106 +57,6 @@ void TestPlannerShared::initTestCase() -void TestPlannerShared::test_rates() - -{ - // Set system to use meters - qPrefUnits::set_unit_system(METRIC); - - plannerShared::set_ascratelast6m(16); - QCOMPARE(qPrefDivePlanner::ascratelast6m(), 267); - plannerShared::set_ascratelast6m(7); - QCOMPARE(qPrefDivePlanner::ascratelast6m(), 117); - qPrefDivePlanner::set_ascratelast6m(133); - QCOMPARE(plannerShared::ascratelast6m(), 8); - qPrefDivePlanner::set_ascratelast6m(167); - QCOMPARE(plannerShared::ascratelast6m(), 10); - - plannerShared::set_ascratestops(16); - QCOMPARE(qPrefDivePlanner::ascratestops(), 267); - plannerShared::set_ascratestops(7); - QCOMPARE(qPrefDivePlanner::ascratestops(), 117); - qPrefDivePlanner::set_ascratestops(133); - QCOMPARE(plannerShared::ascratestops(), 8); - qPrefDivePlanner::set_ascratestops(167); - QCOMPARE(plannerShared::ascratestops(), 10); - - plannerShared::set_ascrate50(16); - QCOMPARE(qPrefDivePlanner::ascrate50(), 267); - plannerShared::set_ascrate50(7); - QCOMPARE(qPrefDivePlanner::ascrate50(), 117); - qPrefDivePlanner::set_ascrate50(133); - QCOMPARE(plannerShared::ascrate50(), 8); - qPrefDivePlanner::set_ascrate50(167); - QCOMPARE(plannerShared::ascrate50(), 10); - - plannerShared::set_ascrate75(16); - QCOMPARE(qPrefDivePlanner::ascrate75(), 267); - plannerShared::set_ascrate75(7); - QCOMPARE(qPrefDivePlanner::ascrate75(), 117); - qPrefDivePlanner::set_ascrate75(133); - QCOMPARE(plannerShared::ascrate75(), 8); - qPrefDivePlanner::set_ascrate75(167); - QCOMPARE(plannerShared::ascrate75(), 10); - - plannerShared::set_descrate(16); - QCOMPARE(qPrefDivePlanner::descrate(), 267); - plannerShared::set_descrate(7); - QCOMPARE(qPrefDivePlanner::descrate(), 117); - qPrefDivePlanner::set_descrate(133); - QCOMPARE(plannerShared::descrate(), 8); - qPrefDivePlanner::set_descrate(167); - QCOMPARE(plannerShared::descrate(), 10); - - // Set system to use feet - qPrefUnits::set_unit_system(IMPERIAL); - - plannerShared::set_ascratelast6m(33); - QCOMPARE(qPrefDivePlanner::ascratelast6m(), 168); - plannerShared::set_ascratelast6m(27); - QCOMPARE(qPrefDivePlanner::ascratelast6m(), 137); - qPrefDivePlanner::set_ascratelast6m(203); - QCOMPARE(plannerShared::ascratelast6m(), 40); - qPrefDivePlanner::set_ascratelast6m(178); - QCOMPARE(plannerShared::ascratelast6m(), 35); - - plannerShared::set_ascratestops(33); - QCOMPARE(qPrefDivePlanner::ascratestops(), 168); - plannerShared::set_ascratestops(27); - QCOMPARE(qPrefDivePlanner::ascratestops(), 137); - qPrefDivePlanner::set_ascratestops(203); - QCOMPARE(plannerShared::ascratestops(), 40); - qPrefDivePlanner::set_ascratestops(178); - QCOMPARE(plannerShared::ascratestops(), 35); - - plannerShared::set_ascrate50(33); - QCOMPARE(qPrefDivePlanner::ascrate50(), 168); - plannerShared::set_ascrate50(27); - QCOMPARE(qPrefDivePlanner::ascrate50(), 137); - qPrefDivePlanner::set_ascrate50(203); - QCOMPARE(plannerShared::ascrate50(), 40); - qPrefDivePlanner::set_ascrate50(178); - QCOMPARE(plannerShared::ascrate50(), 35); - - plannerShared::set_ascrate75(33); - QCOMPARE(qPrefDivePlanner::ascrate75(), 168); - plannerShared::set_ascrate75(27); - QCOMPARE(qPrefDivePlanner::ascrate75(), 137); - qPrefDivePlanner::set_ascrate75(203); - QCOMPARE(plannerShared::ascrate75(), 40); - qPrefDivePlanner::set_ascrate75(178); - QCOMPARE(plannerShared::ascrate75(), 35); - - plannerShared::set_descrate(33); - QCOMPARE(qPrefDivePlanner::descrate(), 168); - plannerShared::set_descrate(27); - QCOMPARE(qPrefDivePlanner::descrate(), 137); - qPrefDivePlanner::set_descrate(203); - QCOMPARE(plannerShared::descrate(), 40); - qPrefDivePlanner::set_descrate(178); - QCOMPARE(plannerShared::descrate(), 35); -} - void TestPlannerShared::test_planning() { // Variables currently not tested diff --git a/tests/testplannershared.h b/tests/testplannershared.h index fb483149b..73ce8aa9c 100644 --- a/tests/testplannershared.h +++ b/tests/testplannershared.h @@ -10,7 +10,6 @@ private slots: void initTestCase(); // test case grouping correspond to panels diveplanner window - void test_rates(); void test_planning(); void test_gas(); void test_notes(); |