Cosmetics
[GPXSee.git] / src / gui.h
blob0b513ff5b0ba6fd0aa0064a4e0ea567ce8dce859
1 #ifndef GUI_H
2 #define GUI_H
4 #include <QMainWindow>
5 #include <QString>
6 #include <QList>
7 #include <QDate>
8 #include <QPrinter>
9 #include "units.h"
10 #include "timetype.h"
11 #include "graph.h"
12 #include "poi.h"
13 #include "exportdialog.h"
14 #include "optionsdialog.h"
17 class QMenu;
18 class QToolBar;
19 class QTabWidget;
20 class QActionGroup;
21 class QAction;
22 class QLabel;
23 class QSignalMapper;
24 class QPrinter;
25 class FileBrowser;
26 class GraphTab;
27 class PathView;
28 class Map;
29 class MapList;
31 class GUI : public QMainWindow
33 Q_OBJECT
35 public:
36 GUI();
37 ~GUI();
39 bool openFile(const QString &fileName);
41 private slots:
42 void about();
43 void keys();
44 void dataSources();
45 void printFile();
46 void exportFile();
47 void openFile();
48 void closeAll();
49 void reloadFile();
50 void openPOIFile();
51 void closePOIFiles();
52 void showGraphs(bool show);
53 void showGraphGrids(bool show);
54 void showToolbars(bool show);
55 void showFullscreen(bool show);
56 void showTracks(bool show);
57 void showRoutes(bool show);
58 void loadMap();
59 void clearMapCache();
60 void nextMap();
61 void prevMap();
62 void openOptions();
64 void mapChanged(int);
65 void graphChanged(int);
66 void poiFileChecked(int);
68 void next();
69 void prev();
70 void last();
71 void first();
73 void setTotalTime() {setTimeType(Total);}
74 void setMovingTime() {setTimeType(Moving);}
75 void setMetricUnits() {setUnits(Metric);}
76 void setImperialUnits() {setUnits(Imperial);}
77 void setDistanceGraph() {setGraphType(Distance);}
78 void setTimeGraph() {setGraphType(Time);}
80 void sliderPositionChanged(qreal pos);
82 private:
83 typedef QPair<QDate, QDate> DateRange;
85 void loadDatums();
86 void loadMaps();
87 void loadPOIs();
88 void closeFiles();
89 void plot(QPrinter *printer);
91 QAction *createPOIFileAction(int index);
92 void createPOIFilesActions();
93 void createMapActions();
94 void createActions();
95 void createMenus();
96 void createToolBars();
97 void createStatusBar();
98 void createPathView();
99 void createGraphTabs();
100 void createBrowser();
102 bool openPOIFile(const QString &fileName);
103 bool loadFile(const QString &fileName);
104 void exportFile(const QString &fileName);
105 void updateStatusBarInfo();
106 void updateWindowTitle();
107 void updateNavigationActions();
108 void updateGraphTabs();
109 void updatePathView();
111 TimeType timeType() const;
112 Units units() const;
113 void setTimeType(TimeType type);
114 void setUnits(Units units);
115 void setGraphType(GraphType type);
117 qreal distance() const;
118 qreal time() const;
119 qreal movingTime() const;
120 int mapIndex(const QString &name);
121 void readSettings();
122 void writeSettings();
124 const QString fileFormats() const;
126 void keyPressEvent(QKeyEvent *event);
127 void closeEvent(QCloseEvent *event);
128 void dragEnterEvent(QDragEnterEvent *event);
129 void dropEvent(QDropEvent *event);
131 QToolBar *_fileToolBar;
132 QToolBar *_showToolBar;
133 QToolBar *_navigationToolBar;
134 QMenu *_poiFilesMenu;
135 QMenu *_mapMenu;
137 QActionGroup *_fileActionGroup;
138 QActionGroup *_navigationActionGroup;
139 QActionGroup *_mapsActionGroup;
140 QAction *_exitAction;
141 QAction *_keysAction;
142 QAction *_dataSourcesAction;
143 QAction *_aboutAction;
144 QAction *_aboutQtAction;
145 QAction *_printFileAction;
146 QAction *_exportFileAction;
147 QAction *_openFileAction;
148 QAction *_closeFileAction;
149 QAction *_reloadFileAction;
150 QAction *_openPOIAction;
151 QAction *_closePOIAction;
152 QAction *_showPOIAction;
153 QAction *_overlapPOIAction;
154 QAction *_showPOILabelsAction;
155 QAction *_showMapAction;
156 QAction *_fullscreenAction;
157 QAction *_loadMapAction;
158 QAction *_clearMapCacheAction;
159 QAction *_showGraphsAction;
160 QAction *_showGraphGridAction;
161 QAction *_distanceGraphAction;
162 QAction *_timeGraphAction;
163 QAction *_showToolbarsAction;
164 QAction *_nextAction;
165 QAction *_prevAction;
166 QAction *_lastAction;
167 QAction *_firstAction;
168 QAction *_metricUnitsAction;
169 QAction *_imperialUnitsAction;
170 QAction *_totalTimeAction;
171 QAction *_movingTimeAction;
172 QAction *_nextMapAction;
173 QAction *_prevMapAction;
174 QAction *_showTracksAction;
175 QAction *_showRoutesAction;
176 QAction *_showWaypointsAction;
177 QAction *_showWaypointLabelsAction;
178 QAction *_showRouteWaypointsAction;
179 QAction *_openOptionsAction;
180 QAction *_mapsEnd;
181 QList<QAction*> _mapActions;
182 QList<QAction*> _poiFilesActions;
184 QSignalMapper *_poiFilesSignalMapper;
185 QSignalMapper *_mapsSignalMapper;
187 QLabel *_fileNameLabel;
188 QLabel *_distanceLabel;
189 QLabel *_timeLabel;
191 PathView *_pathView;
192 QTabWidget *_graphTabWidget;
193 QList<GraphTab*> _tabs;
195 POI *_poi;
196 MapList *_ml;
198 FileBrowser *_browser;
199 QList<QString> _files;
201 Map *_map;
202 int _trackCount;
203 int _routeCount;
204 int _waypointCount;
205 qreal _trackDistance;
206 qreal _routeDistance;
207 qreal _time;
208 qreal _movingTime;
209 DateRange _dateRange;
210 QString _pathName;
212 qreal _sliderPos;
214 int _frameStyle;
215 bool _showGraphs;
217 Export _export;
218 Options _options;
221 #endif // GUI_H