9 #include "common/treenode.h"
10 #include "common/rectc.h"
11 #include "data/graph.h"
15 #include "pdfexportdialog.h"
16 #include "pngexportdialog.h"
17 #include "optionsdialog.h"
27 class QGeoPositionInfoSource
;
38 class NavigationWidget
;
40 class GUI
: public QMainWindow
47 bool openFile(const QString
&fileName
, bool tryUnknown
, int &showError
);
48 bool loadMap(const QString
&fileName
, MapAction
*&action
, int &showError
);
56 #endif // Q_OS_ANDROID
67 void showGraphs(bool show
);
68 void showGraphGrids(bool show
);
69 void showGraphSliderInfo(bool show
);
70 void showPathMarkerInfo(QAction
*action
);
72 void showGraphTabs(bool show
);
74 void showToolbars(bool show
);
75 void showFullscreen(bool show
);
76 #endif // Q_OS_ANDROID
77 void showTracks(bool show
);
78 void showRoutes(bool show
);
79 void showAreas(bool show
);
80 void showWaypoints(bool show
);
90 void mapChanged(QAction
*action
);
91 void graphChanged(int);
92 void poiFileChecked(QAction
*action
);
94 void unselectAllPOIs();
96 void recentFileSelected(QAction
*action
);
97 void clearRecentFiles();
98 #endif // Q_OS_ANDROID
104 void updateNavigationActions();
106 void setTotalTime() {setTimeType(Total
);}
107 void setMovingTime() {setTimeType(Moving
);}
108 void setMetricUnits() {setUnits(Metric
);}
109 void setImperialUnits() {setUnits(Imperial
);}
110 void setNauticalUnits() {setUnits(Nautical
);}
111 void setDistanceGraph() {setGraphType(Distance
);}
112 void setTimeGraph() {setGraphType(Time
);}
113 void setDecimalDegrees() {setCoordinatesFormat(DecimalDegrees
);}
114 void setDegreesMinutes() {setCoordinatesFormat(DegreesMinutes
);}
115 void setDMS() {setCoordinatesFormat(DMS
);}
117 void screenChanged(QScreen
*screen
);
118 void logicalDotsPerInchChanged(qreal dpi
);
122 void mapInitialized();
127 typedef QPair
<QDateTime
, QDateTime
> DateTimeRange
;
130 void plot(QPrinter
*printer
);
131 void plotMainPage(QPainter
*painter
, const QRectF
&rect
, qreal ratio
,
132 bool expand
= false);
133 void plotGraphsPage(QPainter
*painter
, const QRectF
&rect
, qreal ratio
);
134 qreal
graphPlotHeight(const QRectF
&rect
, qreal ratio
);
136 TreeNode
<POIAction
*> createPOIActionsNode(const TreeNode
<QString
> &node
);
137 TreeNode
<MapAction
*> createMapActionsNode(const TreeNode
<Map
*> &node
);
138 void createMapNodeMenu(const TreeNode
<MapAction
*> &node
, QMenu
*menu
,
139 QAction
*action
= 0);
140 void createPOINodeMenu(const TreeNode
<POIAction
*> &node
, QMenu
*menu
,
141 QAction
*action
= 0);
142 void createActions();
145 void createNavigation();
146 #else // Q_OS_ANDROID
147 void createToolBars();
148 #endif // Q_OS_ANDROID
149 void createStatusBar();
150 void createMapView();
151 void createGraphTabs();
152 void createBrowser();
155 void openDir(const QString
&path
, int &showError
);
156 #endif // Q_OS_ANDROID
157 bool openPOIFile(const QString
&fileName
);
158 bool loadFile(const QString
&fileName
, bool tryUnknown
, int &showError
);
159 void loadData(const Data
&data
);
160 bool loadMapNode(const TreeNode
<Map
*> &node
, MapAction
*&action
,
161 const QList
<QAction
*> &existingActions
, int &showError
);
162 void loadMapDirNode(const TreeNode
<Map
*> &node
, QList
<MapAction
*> &actions
,
163 QMenu
*menu
, const QList
<QAction
*> &existingActions
, int &showError
);
164 void updateStatusBarInfo();
165 void updateWindowTitle();
166 bool updateGraphTabs();
167 void updateDEMDownloadAction();
169 void updateRecentFiles(const QString
&fileName
);
170 #endif // Q_OS_ANDROID
172 TimeType
timeType() const;
174 void setTimeType(TimeType type
);
175 void setUnits(Units units
);
176 void setCoordinatesFormat(CoordinatesFormat format
);
177 void setGraphType(GraphType type
);
179 qreal
distance() const;
181 qreal
movingTime() const;
182 QAction
*mapAction(const QString
&name
);
183 QGeoPositionInfoSource
*positionSource(const Options
&options
);
184 void readSettings(QString
&activeMap
, QStringList
&disabledPOIs
,
185 QStringList
&recentFiles
);
187 void loadInitialMaps(const QString
&selected
);
188 void loadInitialPOIs(const QStringList
&disabled
);
190 void loadRecentFiles(const QStringList
&files
);
191 #endif // Q_OS_ANDROID
194 void updateOptions(const Options
&options
);
197 void keyPressEvent(QKeyEvent
*event
);
198 #endif // Q_OS_ANDROID
199 void closeEvent(QCloseEvent
*event
);
200 void dragEnterEvent(QDragEnterEvent
*event
);
201 void dropEvent(QDropEvent
*event
);
204 NavigationWidget
*_navigation
;
205 #else // Q_OS_ANDROID
206 QToolBar
*_fileToolBar
;
207 QToolBar
*_showToolBar
;
208 QToolBar
*_navigationToolBar
;
209 #endif // Q_OS_ANDROID
213 QMenu
*_recentFilesMenu
;
214 #endif // Q_OS_ANDROID
216 QActionGroup
*_fileActionGroup
;
217 QActionGroup
*_navigationActionGroup
;
218 QActionGroup
*_mapsActionGroup
;
219 QActionGroup
*_poisActionGroup
;
221 QActionGroup
*_recentFilesActionGroup
;
222 #endif // Q_OS_ANDROID
223 #if !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID)
224 QAction
*_exitAction
;
225 #endif // Q_OS_MAC + Q_OS_ANDROID
226 QAction
*_pathsAction
;
227 QAction
*_aboutAction
;
228 QAction
*_printFileAction
;
229 QAction
*_exportPDFFileAction
;
230 QAction
*_exportPNGFileAction
;
231 QAction
*_openFileAction
;
232 QAction
*_openDirAction
;
233 QAction
*_closeFileAction
;
234 QAction
*_reloadFileAction
;
235 QAction
*_statisticsAction
;
236 QAction
*_openPOIAction
;
237 QAction
*_selectAllPOIAction
;
238 QAction
*_unselectAllPOIAction
;
239 QAction
*_showPOIAction
;
240 QAction
*_overlapPOIAction
;
241 QAction
*_showPOILabelsAction
;
242 QAction
*_showPOIIconsAction
;
243 QAction
*_showMapAction
;
244 QAction
*_showPositionAction
;
245 QAction
*_followPositionAction
;
246 QAction
*_showPositionCoordinatesAction
;
247 QAction
*_showMotionInfoAction
;
248 QAction
*_loadMapAction
;
249 QAction
*_loadMapDirAction
;
250 QAction
*_clearMapCacheAction
;
251 QAction
*_showGraphsAction
;
252 QAction
*_showGraphGridAction
;
253 QAction
*_showGraphSliderInfoAction
;
254 QAction
*_distanceGraphAction
;
255 QAction
*_timeGraphAction
;
257 QAction
*_showGraphTabsAction
;
258 #else // Q_OS_ANDROID
259 QAction
*_keysAction
;
260 QAction
*_fullscreenAction
;
261 QAction
*_showToolbarsAction
;
262 QAction
*_nextAction
;
263 QAction
*_prevAction
;
264 QAction
*_lastAction
;
265 QAction
*_firstAction
;
266 #endif // Q_OS_ANDROID
267 QAction
*_metricUnitsAction
;
268 QAction
*_imperialUnitsAction
;
269 QAction
*_nauticalUnitsAction
;
270 QAction
*_decimalDegreesAction
;
271 QAction
*_degreesMinutesAction
;
273 QAction
*_totalTimeAction
;
274 QAction
*_movingTimeAction
;
275 QAction
*_nextMapAction
;
276 QAction
*_prevMapAction
;
277 QAction
*_showTracksAction
;
278 QAction
*_showRoutesAction
;
279 QAction
*_showWaypointsAction
;
280 QAction
*_showWaypointLabelsAction
;
281 QAction
*_showWaypointIconsAction
;
282 QAction
*_showAreasAction
;
283 QAction
*_showRouteWaypointsAction
;
284 QAction
*_hideMarkersAction
;
285 QAction
*_showMarkersAction
;
286 QAction
*_showMarkerDateAction
;
287 QAction
*_showMarkerCoordinatesAction
;
288 QAction
*_showTicksAction
;
289 QAction
*_useStylesAction
;
290 QAction
*_showCoordinatesAction
;
291 QAction
*_openOptionsAction
;
292 QAction
*_downloadDEMAction
;
293 QAction
*_showDEMTilesAction
;
297 QAction
*_clearRecentFilesAction
;
298 QAction
*_recentFilesEnd
;
299 #endif // Q_OS_ANDROID
301 QLabel
*_fileNameLabel
;
302 QLabel
*_distanceLabel
;
305 QSplitter
*_splitter
;
307 QTabWidget
*_graphTabWidget
;
308 QList
<GraphTab
*> _tabs
;
313 QGeoPositionInfoSource
*_positionSource
;
316 FileBrowser
*_browser
;
317 QList
<QString
> _files
;
319 int _trackCount
, _routeCount
, _areaCount
, _waypointCount
;
320 qreal _trackDistance
, _routeDistance
;
321 qreal _time
, _movingTime
;
322 DateTimeRange _dateRange
;
326 QList
<QByteArray
> _windowStates
;
327 QList
<QByteArray
> _windowGeometries
;
329 #endif // Q_OS_ANDROID
331 PDFExport _pdfExport
;
332 PNGExport _pngExport
;
335 QString _dataDir
, _mapDir
, _poiDir
;
339 QList
<RectC
> _demRects
;