summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.h
blob: bac74689dd208a3d21284a88f4b876df1b26c708 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * mainwindow.h
 *
 * header file for the main window of Subsurface
 *
 */
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QAction>

struct DiveList;
class QSortFilterProxyModel;
class DiveTripModel;


namespace Ui
{
	class MainWindow;
}

class DiveInfo;
class DiveNotes;
class Stats;
class Equipment;
class QItemSelection;
class DiveListView;
class GlobeGPS;
class MainTab;
class ProfileGraphicsView;
class QTextBrowser;

enum MainWindowTitleFormat { MWTF_DEFAULT, MWTF_FILENAME };

class MainWindow : public QMainWindow
{
Q_OBJECT
public:
	enum {COLLAPSED, EXPANDED};

	MainWindow();
	ProfileGraphicsView *graphics();
	MainTab *information();
	DiveListView *dive_list();
	GlobeGPS *globe();
	void showError(QString message);
	void setTitle(enum MainWindowTitleFormat format);

private slots:


	/* file menu action */
	void on_actionNew_triggered();
	void on_actionOpen_triggered();
	void on_actionSave_triggered();
	void on_actionSaveAs_triggered();
	void on_actionClose_triggered();
	void on_actionImport_triggered();
	void on_actionExportUDDF_triggered();
	void on_actionPrint_triggered();
	void on_actionPreferences_triggered();
	void on_actionQuit_triggered();

	/* log menu actions */
	void on_actionDownloadDC_triggered();
	void on_actionDownloadWeb_triggered();
	void on_actionEditDeviceNames_triggered();
	void on_actionAddDive_triggered();
	void on_actionRenumber_triggered();
	void on_actionAutoGroup_triggered();
	void on_actionToggleZoom_triggered();
	void on_actionYearlyStatistics_triggered();

	/* view menu actions */
	void on_actionViewList_triggered();
	void on_actionViewProfile_triggered();
	void on_actionViewInfo_triggered();
	void on_actionViewGlobe_triggered();
	void on_actionViewAll_triggered();
	void on_actionPreviousDC_triggered();
	void on_actionNextDC_triggered();

	/* other menu actions */
	void on_actionSelectEvents_triggered();
	void on_actionInputPlan_triggered();
	void on_actionAboutSubsurface_triggered();
	void on_actionUserManual_triggered();
	void on_actionDivePlanner_triggered();

	void current_dive_changed(int divenr);
	void initialUiSetup();

protected:
	void closeEvent(QCloseEvent *);

public slots:
	void readSettings();
	void refreshDisplay();

private:
	Ui::MainWindow *ui;
	QAction *actionNextDive;
	QAction *actionPreviousDive;
	QTextBrowser *helpView;
	QString filter();
	bool askSaveChanges();
	void writeSettings();
	void redrawProfile();
	void file_save();
	void file_save_as();
    void setupSplitters();
};

MainWindow *mainWindow();

#endif