| 
									
										
										
										
											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>
 | 
					
						
							| 
									
										
										
										
											2013-04-13 10:17:59 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "models.h"
 | 
					
						
							| 
									
										
										
										
											2013-10-03 11:54:24 -07:00
										 |  |  | #include "ui_maintab.h"
 | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-13 10:49:59 -03:00
										 |  |  | class QCompleter; | 
					
						
							| 
									
										
										
										
											2013-08-16 13:31:52 -03:00
										 |  |  | struct dive; | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | struct NotesBackup{ | 
					
						
							| 
									
										
										
										
											2013-09-20 16:41:42 -07:00
										 |  |  | 	QString airtemp; | 
					
						
							|  |  |  | 	QString watertemp; | 
					
						
							|  |  |  | 	QString datetime; | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | 	QString location; | 
					
						
							| 
									
										
										
										
											2013-09-17 21:50:15 +02:00
										 |  |  | 	QString coordinates; | 
					
						
							|  |  |  | 	degrees_t latitude; | 
					
						
							|  |  |  | 	degrees_t longitude; | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | 	QString notes; | 
					
						
							|  |  |  | 	QString buddy; | 
					
						
							|  |  |  | 	QString suit; | 
					
						
							|  |  |  | 	int rating; | 
					
						
							| 
									
										
										
										
											2013-05-20 06:25:16 -07:00
										 |  |  | 	int visibility; | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | 	QString divemaster; | 
					
						
							| 
									
										
										
										
											2013-11-02 02:20:02 +01:00
										 |  |  | 	QString tags; | 
					
						
							| 
									
										
										
										
											2013-09-25 14:10:15 -03:00
										 |  |  | 	cylinder_t cylinders[MAX_CYLINDERS]; | 
					
						
							| 
									
										
										
										
											2013-10-04 02:04:51 +03:00
										 |  |  | 	weightsystem_t weightsystem[MAX_WEIGHTSYSTEMS ]; | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-08-13 10:49:59 -03:00
										 |  |  | struct Completers{ | 
					
						
							|  |  |  | 	QCompleter *location; | 
					
						
							|  |  |  | 	QCompleter *divemaster; | 
					
						
							|  |  |  | 	QCompleter *buddy; | 
					
						
							|  |  |  | 	QCompleter *suit; | 
					
						
							| 
									
										
										
										
											2013-11-02 02:20:02 +01:00
										 |  |  | 	QCompleter *tags; | 
					
						
							| 
									
										
										
										
											2013-08-13 10:49:59 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | class MainTab : public QTabWidget | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2013-11-01 14:06:03 -04:00
										 |  |  | 	enum EditMode { NONE, DIVE, TRIP, ADD, MANUALLY_ADDED_DIVE }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | 	MainTab(QWidget *parent); | 
					
						
							| 
									
										
										
										
											2013-11-28 09:17:30 -02:00
										 |  |  | 	~MainTab(); | 
					
						
							| 
									
										
										
										
											2013-04-13 10:17:59 -03:00
										 |  |  | 	void clearStats(); | 
					
						
							|  |  |  | 	void clearInfo(); | 
					
						
							|  |  |  | 	void clearEquipment(); | 
					
						
							|  |  |  | 	void reload(); | 
					
						
							| 
									
										
										
										
											2013-05-19 11:45:01 -03:00
										 |  |  | 	bool eventFilter(QObject* , QEvent*); | 
					
						
							| 
									
										
										
										
											2013-06-16 14:36:23 -03:00
										 |  |  | 	void initialUiSetup(); | 
					
						
							| 
									
										
										
										
											2013-06-27 15:33:43 +03:00
										 |  |  | 	void equipmentPlusUpdate(); | 
					
						
							| 
									
										
										
										
											2013-11-11 06:23:18 +09:00
										 |  |  | 	bool isEditing(); | 
					
						
							| 
									
										
										
										
											2013-11-19 04:12:31 -08:00
										 |  |  | 	void updateCoordinatesText(qreal lat, qreal lon); | 
					
						
							| 
									
										
										
										
											2013-06-19 10:20:16 -07:00
										 |  |  | public slots: | 
					
						
							| 
									
										
										
										
											2013-05-22 09:40:26 -03:00
										 |  |  | 	void addCylinder_clicked(); | 
					
						
							|  |  |  | 	void addWeight_clicked(); | 
					
						
							| 
									
										
										
										
											2013-11-19 23:08:20 -08:00
										 |  |  | 	void updateDiveInfo(int dive = selected_dive); | 
					
						
							| 
									
										
										
										
											2013-09-18 21:56:53 -03:00
										 |  |  | 	void acceptChanges(); | 
					
						
							|  |  |  | 	void rejectChanges(); | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | 	void on_location_textChanged(const QString& text); | 
					
						
							| 
									
										
										
										
											2013-09-17 21:50:15 +02:00
										 |  |  | 	void on_coordinates_textChanged(const QString& text); | 
					
						
							| 
									
										
										
										
											2013-05-18 20:42:59 -03:00
										 |  |  | 	void on_divemaster_textChanged(const QString& text); | 
					
						
							|  |  |  | 	void on_buddy_textChanged(const QString& text); | 
					
						
							|  |  |  | 	void on_suit_textChanged(const QString& text); | 
					
						
							|  |  |  | 	void on_notes_textChanged(); | 
					
						
							| 
									
										
										
										
											2013-09-20 16:41:42 -07:00
										 |  |  | 	void on_airtemp_textChanged(const QString& text); | 
					
						
							|  |  |  | 	void on_watertemp_textChanged(const QString& text); | 
					
						
							|  |  |  | 	void on_dateTimeEdit_dateTimeChanged(const QDateTime& datetime); | 
					
						
							| 
									
										
										
										
											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(); | 
					
						
							| 
									
										
										
										
											2013-07-17 12:13:04 -03:00
										 |  |  | 	void editCylinderWidget(const QModelIndex& index); | 
					
						
							| 
									
										
										
										
											2013-10-04 02:04:51 +03:00
										 |  |  | 	void editWeightWidget(const QModelIndex& index); | 
					
						
							| 
									
										
										
										
											2013-09-18 23:33:39 -05:00
										 |  |  | 	void addDiveStarted(); | 
					
						
							| 
									
										
										
										
											2013-12-03 21:44:48 +01:00
										 |  |  | 	void addMessageAction(QAction* action); | 
					
						
							|  |  |  | 	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(); | 
					
						
							| 
									
										
										
										
											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-08-16 13:31:52 -03:00
										 |  |  | 	QMap<dive*, NotesBackup> notesBackup; | 
					
						
							| 
									
										
										
										
											2013-11-14 21:06:31 +09:00
										 |  |  | 	EditMode editMode; | 
					
						
							| 
									
										
										
										
											2013-09-25 13:30:51 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* since the multi-edition of the equipment is fairly more
 | 
					
						
							|  |  |  | 	 * complex than a single item, because it involves a Qt | 
					
						
							|  |  |  | 	 * Model to edit things, we are copying the first selected | 
					
						
							|  |  |  | 	 * dive to this structure, making all editions there, | 
					
						
							|  |  |  | 	 * then applying the changes on the other dives.*/ | 
					
						
							|  |  |  | 	struct dive multiEditEquipmentPlaceholder; | 
					
						
							| 
									
										
										
										
											2013-08-13 10:49:59 -03:00
										 |  |  | 	Completers completers; | 
					
						
							| 
									
										
										
										
											2013-10-07 11:48:14 -07:00
										 |  |  | 	void resetPallete(); | 
					
						
							| 
									
										
										
										
											2013-11-02 02:20:02 +01:00
										 |  |  | 	void saveTags(); | 
					
						
							| 
									
										
										
										
											2013-10-07 11:48:14 -07:00
										 |  |  | 	QString printGPSCoords(int lat, int lon); | 
					
						
							| 
									
										
										
										
											2013-11-12 00:21:45 +01:00
										 |  |  | 	void updateGpsCoordinates(const struct dive *dive); | 
					
						
							| 
									
										
										
										
											2013-04-07 15:20:43 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-13 10:17:59 -03:00
										 |  |  | #endif
 |