Added check box to add a stop at 5m. Please review patch.

-- 
Harshal Jalan
From 2c467825467c652c6301b9ba9fedb58d44d53e65 Mon Sep 17 00:00:00 2001
From: Harshal Jalan <[email protected]>
Date: Sun, 22 Mar 2015 00:28:04 +0530
Subject: [PATCH] [PATCH] #839 adds stop at 5m Added a checkbox to add a stop
 at 5m

Signed-off-by: Harshal Jalan <[email protected]>
---
 planner.c                | 10 +++++++++-
 planner.h                |  1 +
 qt-ui/diveplanner.cpp    |  7 +++++++
 qt-ui/diveplanner.h      |  1 +
 qt-ui/plannerSettings.ui | 39 +++++++++++++++++++++++----------------
 5 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/planner.c b/planner.c
index d12f660..ba30478 100644
--- a/planner.c
+++ b/planner.c
@@ -17,7 +17,7 @@
 #define TIMESTEP 3 /* second */
 #define DECOTIMESTEP 60 /* seconds. Unit of deco stop times */
 
-int decostoplevels[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000, 27000,
+int decostoplevels[] = { 0, 3000, 6000, 6000, 9000, 12000, 15000, 18000, 21000, 24000, 27000,
 				  30000, 33000, 36000, 39000, 42000, 45000, 48000, 51000, 54000, 57000,
 				  60000, 63000, 66000, 69000, 72000, 75000, 78000, 81000, 84000, 87000,
 				  90000, 100000, 110000, 120000, 130000, 140000, 150000, 160000, 170000,
@@ -74,6 +74,14 @@ void set_last_stop(bool last_stop_6m)
 		decostoplevels[1] = 3000;
 }
 
+void set_stop_5m(bool set_5m)
+{
+	if (set_5m == true)
+		decostoplevels[2] = 5000;
+	else
+		decostoplevels[2] = 6000;
+}
+
 void set_verbatim(bool verbatim)
 {
 	plan_verbatim = verbatim;
diff --git a/planner.h b/planner.h
index b1e37d5..f8a3ca5 100644
--- a/planner.h
+++ b/planner.h
@@ -12,6 +12,7 @@ extern int validate_po2(const char *text, int *mbar_po2);
 extern timestamp_t current_time_notz(void);
 extern void show_planned_dive(char **error_string_p);
 extern void set_last_stop(bool last_stop_6m);
+extern void set_stop_5m(bool set_5m);
 extern void set_verbatim(bool verbatim);
 extern void set_display_runtime(bool display);
 extern void set_display_duration(bool display);
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 7831cc6..c9faaf1 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -420,6 +420,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
 	ui.rebreathermode->insertItems(0, rebreater_modes);
 
 	connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
+	connect(ui.stop5m, SIGNAL(toggled(bool)), plannerModel, SLOT(setStop5m(bool)));
 	connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool)));
 	connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
 	connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
@@ -823,6 +824,12 @@ void DivePlannerPointsModel::setLastStop6m(bool value)
 	emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
 }
 
+void DivePlannerPointsModel::setStop5m(bool value)
+{
+	set_stop_5m(value);
+	emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
+}
+
 void DivePlannerPointsModel::setVerbatim(bool value)
 {
 	set_verbatim(value);
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 4093bac..a9fadba 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -77,6 +77,7 @@ slots:
 	void setStartTime(const QTime &t);
 	void setStartDate(const QDate &date);
 	void setLastStop6m(bool value);
+	void setStop5m(bool value);
 	void setDropStoneMode(bool value);
 	void setVerbatim(bool value);
 	void setDisplayRuntime(bool value);
diff --git a/qt-ui/plannerSettings.ui b/qt-ui/plannerSettings.ui
index af03fd1..09f8b39 100644
--- a/qt-ui/plannerSettings.ui
+++ b/qt-ui/plannerSettings.ui
@@ -30,8 +30,8 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>1078</width>
-        <height>418</height>
+        <width>1084</width>
+        <height>424</height>
        </rect>
       </property>
       <layout class="QHBoxLayout" name="horizontalLayout">
@@ -296,7 +296,7 @@
             </property>
            </widget>
           </item>
-          <item row="6" column="1">
+          <item row="7" column="1">
            <spacer name="verticalSpacer_2">
             <property name="orientation">
              <enum>Qt::Vertical</enum>
@@ -316,6 +316,23 @@
             </property>
            </widget>
           </item>
+          <item row="6" column="1">
+           <widget class="QComboBox" name="rebreathermode">
+            <property name="currentText">
+             <string/>
+            </property>
+            <property name="maxVisibleItems">
+             <number>6</number>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1" colspan="2">
+           <widget class="QCheckBox" name="drop_stone_mode">
+            <property name="text">
+             <string>Drop to first depth</string>
+            </property>
+           </widget>
+          </item>
           <item row="1" column="2">
            <widget class="QSpinBox" name="gfhigh">
             <property name="suffix">
@@ -329,20 +346,10 @@
             </property>
            </widget>
           </item>
-          <item row="2" column="1" colspan="2">
-           <widget class="QCheckBox" name="drop_stone_mode">
+          <item row="5" column="1" colspan="2">
+           <widget class="QCheckBox" name="stop5m">
             <property name="text">
-             <string>Drop to first depth</string>
-            </property>
-           </widget>
-          </item>
-          <item row="5" column="1">
-           <widget class="QComboBox" name="rebreathermode">
-            <property name="currentText">
-             <string/>
-            </property>
-            <property name="maxVisibleItems">
-             <number>6</number>
+             <string>Stop at 5m</string>
             </property>
            </widget>
           </item>
-- 
2.3.3

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to