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