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>
|
2013-04-13 13:17:59 +00:00
|
|
|
|
|
|
|
#include "models.h"
|
2013-04-07 22:20:43 +00:00
|
|
|
|
2013-08-13 13:49:59 +00:00
|
|
|
class QCompleter;
|
2013-08-16 16:31:52 +00:00
|
|
|
struct dive;
|
2013-04-07 22:20:43 +00:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class MainTab;
|
|
|
|
}
|
|
|
|
|
2013-05-18 23:42:59 +00:00
|
|
|
struct NotesBackup{
|
|
|
|
QString location;
|
|
|
|
QString notes;
|
|
|
|
QString buddy;
|
|
|
|
QString suit;
|
|
|
|
int rating;
|
2013-05-20 13:25:16 +00:00
|
|
|
int visibility;
|
2013-05-18 23:42:59 +00:00
|
|
|
QString divemaster;
|
|
|
|
};
|
|
|
|
|
2013-08-13 13:49:59 +00:00
|
|
|
struct Completers{
|
|
|
|
QCompleter *location;
|
|
|
|
QCompleter *divemaster;
|
|
|
|
QCompleter *buddy;
|
|
|
|
QCompleter *suit;
|
|
|
|
};
|
|
|
|
|
2013-04-07 22:20:43 +00:00
|
|
|
class MainTab : public QTabWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
MainTab(QWidget *parent);
|
2013-04-13 13:17:59 +00:00
|
|
|
void clearStats();
|
|
|
|
void clearInfo();
|
|
|
|
void clearEquipment();
|
|
|
|
void reload();
|
|
|
|
|
2013-05-19 14:45:01 +00:00
|
|
|
bool eventFilter(QObject* , QEvent*);
|
2013-05-23 04:25:05 +00:00
|
|
|
virtual void resizeEvent(QResizeEvent*);
|
|
|
|
virtual void showEvent(QShowEvent*);
|
2013-06-16 17:36:23 +00:00
|
|
|
virtual void hideEvent(QHideEvent* );
|
|
|
|
|
|
|
|
void initialUiSetup();
|
2013-06-27 12:33:43 +00:00
|
|
|
void equipmentPlusUpdate();
|
2013-06-16 17:36:23 +00:00
|
|
|
|
2013-05-19 14:45:01 +00:00
|
|
|
|
2013-06-19 17:20:16 +00:00
|
|
|
public slots:
|
2013-05-22 12:40:26 +00:00
|
|
|
void addCylinder_clicked();
|
|
|
|
void addWeight_clicked();
|
2013-05-06 16:23:14 +00:00
|
|
|
void updateDiveInfo(int dive);
|
2013-05-19 19:56:27 +00:00
|
|
|
void on_editAccept_clicked(bool edit);
|
|
|
|
void on_editReset_clicked();
|
2013-05-18 23:42:59 +00:00
|
|
|
void on_location_textChanged(const QString& text);
|
|
|
|
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();
|
|
|
|
void on_rating_valueChanged(int value);
|
2013-05-20 13:25:16 +00:00
|
|
|
void on_visibility_valueChanged(int value);
|
2013-06-27 12:33:43 +00:00
|
|
|
void tabChanged(int idx);
|
2013-07-17 15:13:04 +00:00
|
|
|
void editCylinderWidget(const QModelIndex& index);
|
|
|
|
void editWeigthWidget(const QModelIndex& index);
|
2013-05-06 16:23:14 +00:00
|
|
|
|
2013-04-07 22:20:43 +00:00
|
|
|
private:
|
|
|
|
Ui::MainTab *ui;
|
2013-04-13 13:17:59 +00:00
|
|
|
WeightModel *weightModel;
|
|
|
|
CylindersModel *cylindersModel;
|
2013-08-16 16:31:52 +00:00
|
|
|
QMap<dive*, NotesBackup> notesBackup;
|
2013-05-22 12:17:18 +00:00
|
|
|
QPushButton *addCylinder;
|
|
|
|
QPushButton *addWeight;
|
2013-06-14 16:17:46 +00:00
|
|
|
enum { NONE, DIVE, TRIP } editMode;
|
2013-08-13 13:49:59 +00:00
|
|
|
Completers completers;
|
2013-08-13 11:34:04 +00:00
|
|
|
void enableEdition();
|
2013-04-07 22:20:43 +00:00
|
|
|
};
|
|
|
|
|
2013-04-13 13:17:59 +00:00
|
|
|
#endif
|