| 
									
										
										
										
											2017-04-27 20:26:05 +02:00
										 |  |  | // SPDX-License-Identifier: GPL-2.0
 | 
					
						
							| 
									
										
										
										
											2013-04-13 20:44:02 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * maintab.h | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * header file for the main tab of Subsurface | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | #ifndef MAINTAB_H
 | 
					
						
							|  |  |  | #define MAINTAB_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QTabWidget>
 | 
					
						
							| 
									
										
										
										
											2013-04-13 10:17:59 -03:00
										 |  |  | #include <QDialog>
 | 
					
						
							| 
									
										
										
										
											2013-08-16 13:31:52 -03:00
										 |  |  | #include <QMap>
 | 
					
						
							| 
									
										
										
										
											2015-02-11 10:14:45 -08:00
										 |  |  | #include <QUuid>
 | 
					
						
							| 
									
										
										
										
											2013-04-13 10:17:59 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-03 11:54:24 -07:00
										 |  |  | #include "ui_maintab.h"
 | 
					
						
							| 
									
										
										
										
											2016-04-04 22:02:03 -07:00
										 |  |  | #include "qt-models/completionmodels.h"
 | 
					
						
							|  |  |  | #include "qt-models/divelocationmodel.h"
 | 
					
						
							|  |  |  | #include "core/dive.h"
 | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-26 14:01:31 -03:00
										 |  |  | class WeightModel; | 
					
						
							|  |  |  | class CylindersModel; | 
					
						
							| 
									
										
										
										
											2014-11-06 11:24:38 -08:00
										 |  |  | class ExtraDataModel; | 
					
						
							| 
									
										
										
										
											2015-05-29 14:42:57 -03:00
										 |  |  | class DivePictureModel; | 
					
						
							| 
									
										
										
										
											2013-08-13 10:49:59 -03:00
										 |  |  | class QCompleter; | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | struct Completers { | 
					
						
							| 
									
										
										
										
											2013-08-13 10:49:59 -03:00
										 |  |  | 	QCompleter *divemaster; | 
					
						
							|  |  |  | 	QCompleter *buddy; | 
					
						
							|  |  |  | 	QCompleter *suit; | 
					
						
							| 
									
										
										
										
											2013-11-02 02:20:02 +01:00
										 |  |  | 	QCompleter *tags; | 
					
						
							| 
									
										
										
										
											2013-08-13 10:49:59 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-04 19:21:30 +02:00
										 |  |  | class TabBase; | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | class MainTab : public QTabWidget { | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 	enum EditMode { | 
					
						
							|  |  |  | 		NONE, | 
					
						
							|  |  |  | 		DIVE, | 
					
						
							|  |  |  | 		TRIP, | 
					
						
							|  |  |  | 		ADD, | 
					
						
							| 
									
										
										
										
											2014-07-02 22:15:08 -07:00
										 |  |  | 		MANUALLY_ADDED_DIVE, | 
					
						
							|  |  |  | 		IGNORE | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2013-11-01 14:06:03 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-09 16:23:30 -02:00
										 |  |  | 	MainTab(QWidget *parent = 0); | 
					
						
							| 
									
										
										
										
											2013-11-28 09:17:30 -02:00
										 |  |  | 	~MainTab(); | 
					
						
							| 
									
										
										
										
											2017-04-04 19:21:30 +02:00
										 |  |  | 	void clearTabs(); | 
					
						
							| 
									
										
										
										
											2013-04-13 10:17:59 -03:00
										 |  |  | 	void clearEquipment(); | 
					
						
							|  |  |  | 	void reload(); | 
					
						
							| 
									
										
										
										
											2013-06-16 14:36:23 -03:00
										 |  |  | 	void initialUiSetup(); | 
					
						
							| 
									
										
										
										
											2013-11-11 06:23:18 +09:00
										 |  |  | 	bool isEditing(); | 
					
						
							| 
									
										
										
										
											2013-11-19 04:12:31 -08:00
										 |  |  | 	void updateCoordinatesText(qreal lat, qreal lon); | 
					
						
							| 
									
										
										
										
											2015-08-30 01:00:22 +02:00
										 |  |  | 	void refreshDisplayedDiveSite(); | 
					
						
							| 
									
										
										
										
											2014-05-16 15:12:46 +09:00
										 |  |  | 	void nextInputField(QKeyEvent *event); | 
					
						
							| 
									
										
										
										
											2014-08-17 08:26:09 -06:00
										 |  |  | 	void showAndTriggerEditSelective(struct dive_components what); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-21 20:34:06 -03:00
										 |  |  | signals: | 
					
						
							|  |  |  | 	void addDiveFinished(); | 
					
						
							| 
									
										
										
										
											2014-10-20 17:36:24 -07:00
										 |  |  | 	void dateTimeChanged(); | 
					
						
							| 
									
										
										
										
											2015-07-16 12:41:04 -07:00
										 |  |  | 	void diveSiteChanged(struct dive_site * ds); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | public | 
					
						
							|  |  |  | slots: | 
					
						
							| 
									
										
										
										
											2013-05-22 09:40:26 -03:00
										 |  |  | 	void addCylinder_clicked(); | 
					
						
							|  |  |  | 	void addWeight_clicked(); | 
					
						
							| 
									
										
										
										
											2015-07-30 21:32:50 -03:00
										 |  |  | 	void refreshDiveInfo(); | 
					
						
							| 
									
										
										
										
											2014-07-02 14:15:17 -07:00
										 |  |  | 	void updateDiveInfo(bool clear = false); | 
					
						
							| 
									
										
										
										
											2017-02-26 12:05:23 -08:00
										 |  |  | 	void updateDepthDuration(); | 
					
						
							| 
									
										
										
										
											2013-09-18 21:56:53 -03:00
										 |  |  | 	void acceptChanges(); | 
					
						
							|  |  |  | 	void rejectChanges(); | 
					
						
							| 
									
										
										
										
											2015-09-23 14:46:29 -03:00
										 |  |  | 	void on_location_diveSiteSelected(); | 
					
						
							| 
									
										
										
										
											2015-06-27 06:50:20 -07:00
										 |  |  | 	void on_location_textChanged(); | 
					
						
							| 
									
										
										
										
											2014-01-19 19:30:47 +02:00
										 |  |  | 	void on_divemaster_textChanged(); | 
					
						
							| 
									
										
										
										
											2014-01-15 22:35:14 +02:00
										 |  |  | 	void on_buddy_textChanged(); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 	void on_suit_textChanged(const QString &text); | 
					
						
							| 
									
										
										
										
											2015-10-01 18:11:03 -03:00
										 |  |  | 	void on_diveTripLocation_textEdited(const QString& text); | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | 	void on_notes_textChanged(); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 	void on_airtemp_textChanged(const QString &text); | 
					
						
							| 
									
										
										
										
											2017-02-04 13:59:20 -08:00
										 |  |  | 	void on_duration_textChanged(const QString &text); | 
					
						
							|  |  |  | 	void on_depth_textChanged(const QString &text); | 
					
						
							| 
									
										
										
										
											2015-01-08 14:42:07 +01:00
										 |  |  | 	void divetype_Changed(int); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 	void on_watertemp_textChanged(const QString &text); | 
					
						
							| 
									
										
										
										
											2014-05-22 11:40:22 -07:00
										 |  |  | 	void validate_temp_field(QLineEdit *tempField, const QString &text); | 
					
						
							| 
									
										
										
										
											2014-06-26 14:57:25 -03:00
										 |  |  | 	void on_dateEdit_dateChanged(const QDate &date); | 
					
						
							| 
									
										
										
										
											2014-06-26 14:54:16 -03:00
										 |  |  | 	void on_timeEdit_timeChanged(const QTime & time); | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | 	void on_rating_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2013-05-20 06:25:16 -07:00
										 |  |  | 	void on_visibility_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2013-11-02 02:20:02 +01:00
										 |  |  | 	void on_tagWidget_textChanged(); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 	void editCylinderWidget(const QModelIndex &index); | 
					
						
							|  |  |  | 	void editWeightWidget(const QModelIndex &index); | 
					
						
							| 
									
										
										
										
											2013-09-18 23:33:39 -05:00
										 |  |  | 	void addDiveStarted(); | 
					
						
							| 
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 |  |  | 	void addMessageAction(QAction *action); | 
					
						
							| 
									
										
										
										
											2013-12-03 21:44:48 +01:00
										 |  |  | 	void hideMessage(); | 
					
						
							|  |  |  | 	void closeMessage(); | 
					
						
							|  |  |  | 	void displayMessage(QString str); | 
					
						
							| 
									
										
										
										
											2013-11-01 11:48:34 -04:00
										 |  |  | 	void enableEdition(EditMode newEditMode = NONE); | 
					
						
							| 
									
										
										
										
											2013-11-28 09:17:30 -02:00
										 |  |  | 	void toggleTriggeredColumn(); | 
					
						
							| 
									
										
										
										
											2014-04-05 11:03:45 -05:00
										 |  |  | 	void updateTextLabels(bool showUnits = true); | 
					
						
							| 
									
										
										
										
											2014-06-03 15:29:28 -07:00
										 |  |  | 	void escDetected(void); | 
					
						
							| 
									
										
										
										
											2015-02-13 23:49:05 -08:00
										 |  |  | 	void showLocation(); | 
					
						
							| 
									
										
										
										
											2015-05-16 00:27:08 +03:00
										 |  |  | 	void enableGeoLookupEdition(); | 
					
						
							|  |  |  | 	void disableGeoLookupEdition(); | 
					
						
							| 
									
										
										
										
											2015-05-29 22:22:24 -03:00
										 |  |  | 	void setCurrentLocationIndex(); | 
					
						
							| 
									
										
										
										
											2015-08-25 21:08:05 -03:00
										 |  |  | 	EditMode getEditMode() const; | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2013-10-03 11:54:25 -07:00
										 |  |  | 	Ui::MainTab ui; | 
					
						
							| 
									
										
										
										
											2013-04-13 10:17:59 -03:00
										 |  |  | 	WeightModel *weightModel; | 
					
						
							|  |  |  | 	CylindersModel *cylindersModel; | 
					
						
							| 
									
										
										
										
											2013-11-14 21:06:31 +09:00
										 |  |  | 	EditMode editMode; | 
					
						
							| 
									
										
										
										
											2014-02-11 18:46:14 +01:00
										 |  |  | 	BuddyCompletionModel buddyModel; | 
					
						
							|  |  |  | 	DiveMasterCompletionModel diveMasterModel; | 
					
						
							|  |  |  | 	SuitCompletionModel suitModel; | 
					
						
							|  |  |  | 	TagCompletionModel tagModel; | 
					
						
							| 
									
										
										
										
											2013-08-13 10:49:59 -03:00
										 |  |  | 	Completers completers; | 
					
						
							| 
									
										
										
										
											2014-07-02 21:33:03 -07:00
										 |  |  | 	bool modified; | 
					
						
							| 
									
										
										
										
											2014-11-05 06:34:29 -08:00
										 |  |  | 	bool copyPaste; | 
					
						
							| 
									
										
										
										
											2013-10-07 11:48:14 -07:00
										 |  |  | 	void resetPallete(); | 
					
						
							| 
									
										
										
										
											2013-11-02 02:20:02 +01:00
										 |  |  | 	void saveTags(); | 
					
						
							| 
									
										
										
										
											2015-05-11 10:38:50 -07:00
										 |  |  | 	void saveTaggedStrings(); | 
					
						
							|  |  |  | 	void diffTaggedStrings(QString currentString, QString displayedString, QStringList &addedList, QStringList &removedList); | 
					
						
							| 
									
										
										
										
											2014-07-02 21:33:03 -07:00
										 |  |  | 	void markChangedWidget(QWidget *w); | 
					
						
							| 
									
										
										
										
											2014-07-30 08:52:11 -07:00
										 |  |  | 	dive_trip_t *currentTrip; | 
					
						
							|  |  |  | 	dive_trip_t displayedTrip; | 
					
						
							| 
									
										
										
										
											2015-01-04 20:06:33 +02:00
										 |  |  | 	bool acceptingEdit; | 
					
						
							| 
									
										
										
										
											2015-09-30 19:58:38 -03:00
										 |  |  | 	uint32_t updateDiveSite(uint32_t pickedUuid, int divenr); | 
					
						
							| 
									
										
										
										
											2017-04-04 19:21:30 +02:00
										 |  |  | 	QList<TabBase*> extraWidgets; | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-11 19:14:46 +01:00
										 |  |  | #endif // MAINTAB_H
 |