[RFC PATCH] Drop like a stone mode in planner
Anton Lundin
glance at acc.umu.se
Sun Mar 30 05:37:43 PDT 2014
On 19 March, 2014 - Anton Lundin wrote:
> Anyone with a better idea for a name?
No comments, thus its perfect? =)
//Anton
> ---
> qt-ui/diveplanner.cpp | 13 +++++++++++++
> qt-ui/diveplanner.h | 2 ++
> qt-ui/diveplanner.ui | 7 +++++++
> 3 files changed, 22 insertions(+)
>
> diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
> index 63a00f7..25a547b 100644
> --- a/qt-ui/diveplanner.cpp
> +++ b/qt-ui/diveplanner.cpp
> @@ -959,6 +959,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
> connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int)));
> connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
> connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
> + connect(ui.drop_stone_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setDropStoneMode(bool)));
>
> // Creating the plan
> connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan()));
> @@ -1154,6 +1155,12 @@ void DivePlannerPointsModel::setLastStop6m(bool value)
> emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
> }
>
> +void DivePlannerPointsModel::setDropStoneMode(bool value)
> +{
> + drop_stone_mode = value;
> + emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
> +}
> +
> void DivePlannerPointsModel::setStartTime(const QTime &t)
> {
> diveplan.when = (t.msec() + QDateTime::currentMSecsSinceEpoch()) / 1000 - gettimezoneoffset();
> @@ -1410,6 +1417,12 @@ void DivePlannerPointsModel::createTemporaryPlan()
> divedatapoint p = at(i);
> int deltaT = lastIndex != -1 ? p.time - at(lastIndex).time : p.time;
> lastIndex = i;
> + if (i == 0 && drop_stone_mode) {
> + /* Okay, we add a fist segment where we go down to depth */
> + /* 18 m/s */
> + plan_add_segment(&diveplan, p.depth / 300, p.depth, p.o2, p.he, p.po2);
> + deltaT -= p.depth / 300;
> + }
> plan_add_segment(&diveplan, deltaT, p.depth, p.o2, p.he, p.po2);
> }
> char *cache = NULL;
> diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
> index 4679d06..cbb32bc 100644
> --- a/qt-ui/diveplanner.h
> +++ b/qt-ui/diveplanner.h
> @@ -66,6 +66,7 @@ slots:
> void setDecoSac(int sac);
> void setStartTime(const QTime &t);
> void setLastStop6m(bool value);
> + void setDropStoneMode(bool value);
> void createPlan();
> void remove(const QModelIndex &index);
> void cancelPlan();
> @@ -89,6 +90,7 @@ private:
> QVector<sample> backupSamples; // For editing added dives.
> struct dive *stagingDive;
> QVector<QPair<int, int> > oldGases;
> + bool drop_stone_mode;
> };
>
> class Button : public QObject, public QGraphicsRectItem {
> diff --git a/qt-ui/diveplanner.ui b/qt-ui/diveplanner.ui
> index 558be06..d869735 100644
> --- a/qt-ui/diveplanner.ui
> +++ b/qt-ui/diveplanner.ui
> @@ -182,6 +182,13 @@
> </property>
> </widget>
> </item>
> + <item row="6" column="1">
> + <widget class="QCheckBox" name="drop_stone_mode">
> + <property name="text">
> + <string>Drop like a stone mode</string>
> + </property>
> + </widget>
> + </item>
> </layout>
> </widget>
> </widget>
> --
> 1.8.3.2
--
Anton Lundin +46702-161604
More information about the subsurface
mailing list