2017-04-27 20:26:05 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								// SPDX-License-Identifier: GPL-2.0
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-20 12:33:26 -03:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#ifndef DIVEPLANNER_H
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define DIVEPLANNER_H
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <QGraphicsPathItem>
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-26 09:14:19 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QAbstractTableModel>
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-04 12:15:27 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QAbstractButton>
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-28 08:07:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QDateTime>
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-03 23:07:58 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QSignalMapper>
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-26 13:18:21 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-26 08:43:37 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-21 13:54:21 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class QListView;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class QModelIndex;
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-28 16:23:49 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class DivePlannerPointsModel;
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-26 09:14:19 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class DiveHandler : public QObject, public QGraphicsEllipseItem {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-20 14:29:32 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-23 13:09:29 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									DiveHandler();
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-07-04 11:01:59 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								protected:
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-23 20:51:30 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-30 19:08:16 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void mousePressEvent(QGraphicsSceneMouseEvent *event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-23 19:50:09 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								signals:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void moved();
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-30 19:08:16 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void clicked();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void released();
							 | 
						
					
						
							
								
									
										
										
										
											2013-11-19 20:42:05 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int parentIndex();
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								public
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								slots:
							 | 
						
					
						
							
								
									
										
										
										
											2013-11-14 23:29:36 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void selfRemove();
							 | 
						
					
						
							
								
									
										
										
										
											2013-11-19 20:42:05 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void changeGas();
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-18 14:34:00 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									QTime t;
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-20 14:29:32 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							
								
									
										
										
										
											2013-06-20 15:52:27 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-05 00:29:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "ui_diveplanner.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-26 08:43:37 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class DivePlannerWidget : public QWidget {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									explicit DivePlannerWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-04 12:15:27 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void setReplanButton(bool replan);
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								public
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								slots:
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-28 08:07:28 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void setupStartTime(QDateTime startTime);
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-09 07:43:00 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void settingsChanged();
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-26 17:04:39 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void atmPressureChanged(const int pressure);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void heightChanged(const int height);
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-10 23:28:05 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void waterTypeChanged(const int index);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void customSalinityChanged(double density);
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-03 10:06:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void printDecoPlan();
							 | 
						
					
						
							
								
									
										
										
										
											2016-12-15 23:02:32 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void setSurfacePressure(int surface_pressure);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void setSalinity(int salinity);
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-26 08:43:37 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							
								
									
										
										
										
											2013-10-03 11:54:25 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									Ui::DivePlanner ui;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-04 12:15:27 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									QAbstractButton *replanButton;
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-10 23:28:05 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void waterTypeUpdateTexts();
							 | 
						
					
						
							
								
									
										
										
										
											2013-08-26 08:43:37 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-10 17:40:02 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "ui_plannerSettings.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class PlannerSettingsWidget : public QWidget {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									explicit PlannerSettingsWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-15 15:39:13 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									virtual ~PlannerSettingsWidget();
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-10 17:40:02 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								public
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								slots:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void settingsChanged();
							 | 
						
					
						
							
								
									
										
										
										
											2014-08-19 11:13:55 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void bottomSacChanged(const double bottomSac);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void decoSacChanged(const double decosac);
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-10 17:40:02 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void printDecoPlan();
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-03 10:06:15 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void setAscrate75(int rate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void setAscrate50(int rate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void setAscratestops(int rate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void setAscratelast6m(int rate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void setDescrate(int rate);
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-11 20:24:18 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void sacFactorChanged(const double factor);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void problemSolvingTimeChanged(const int min);
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-25 14:00:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void setBottomPo2(double po2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void setDecoPo2(double po2);
							 | 
						
					
						
							
								
									
										
										
										
											2016-05-21 20:14:23 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void setBestmixEND(int depth);
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-02 22:07:38 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void setBackgasBreaks(bool dobreaks);
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-15 15:16:51 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void disableDecoElements(int mode);
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-02 21:00:54 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void disableBackgasBreaks(bool enabled);
							 | 
						
					
						
							
								
									
										
										
										
											2017-04-19 08:05:28 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void setDiveMode(int mode);
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-10 17:40:02 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Ui::plannerSettingsWidget ui;
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-17 08:03:52 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void updateUnitsUI();
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-03 23:07:58 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									QSignalMapper *modeMapper;
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-10 17:40:02 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-09 16:37:26 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "ui_plannerDetails.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class PlannerDetails : public QWidget {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									explicit PlannerDetails(QWidget *parent = 0);
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-09 20:14:08 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									QPushButton *printPlan() const { return ui.printPlan; }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									QTextEdit *divePlanOutput() const { return ui.divePlanOutput; }
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-27 17:36:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									QLabel *divePlannerOutputLabel() const { return ui.divePlanOutputLabel; }
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-09 20:14:08 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-09 16:37:26 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Ui::plannerDetails ui;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-11 19:14:46 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#endif // DIVEPLANNER_H
							 |