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
,
57 #endif // Q_OS_ANDROID
65 #endif // Q_OS_ANDROID
70 void showGraphs(bool show
);
71 void showGraphGrids(bool show
);
72 void showGraphSliderInfo(bool show
);
73 void showPathMarkerInfo(QAction
*action
);
75 void showGraphTabs(bool show
);
77 void showToolbars(bool show
);
78 void showFullscreen(bool show
);
79 #endif // Q_OS_ANDROID
80 void showTracks(bool show
);
81 void showRoutes(bool show
);
82 void showAreas(bool show
);
83 void showWaypoints(bool show
);
93 void mapChanged(QAction
*action
);
94 void graphChanged(int);
95 void poiFileChecked(QAction
*action
);
97 void unselectAllPOIs();
103 void updateNavigationActions();
105 void setTotalTime() {setTimeType(Total
);}
106 void setMovingTime() {setTimeType(Moving
);}
107 void setMetricUnits() {setUnits(Metric
);}
108 void setImperialUnits() {setUnits(Imperial
);}
109 void setNauticalUnits() {setUnits(Nautical
);}
110 void setDistanceGraph() {setGraphType(Distance
);}
111 void setTimeGraph() {setGraphType(Time
);}
112 void setDecimalDegrees() {setCoordinatesFormat(DecimalDegrees
);}
113 void setDegreesMinutes() {setCoordinatesFormat(DegreesMinutes
);}
114 void setDMS() {setCoordinatesFormat(DMS
);}
116 void screenChanged(QScreen
*screen
);
117 void logicalDotsPerInchChanged(qreal dpi
);
121 void mapInitialized();
126 typedef QPair
<QDateTime
, QDateTime
> DateTimeRange
;
129 void plot(QPrinter
*printer
);
130 void plotMainPage(QPainter
*painter
, const QRectF
&rect
, qreal ratio
,
131 bool expand
= false);
132 void plotGraphsPage(QPainter
*painter
, const QRectF
&rect
, qreal ratio
);
133 qreal
graphPlotHeight(const QRectF
&rect
, qreal ratio
);
135 TreeNode
<POIAction
*> createPOIActionsNode(const TreeNode
<QString
> &node
);
136 TreeNode
<MapAction
*> createMapActionsNode(const TreeNode
<Map
*> &node
);
137 void createMapNodeMenu(const TreeNode
<MapAction
*> &node
, QMenu
*menu
,
138 QAction
*action
= 0);
139 void createPOINodeMenu(const TreeNode
<POIAction
*> &node
, QMenu
*menu
,
140 QAction
*action
= 0);
141 void createActions();
144 void createNavigation();
145 #else // Q_OS_ANDROID
146 void createToolBars();
147 #endif // Q_OS_ANDROID
148 void createStatusBar();
149 void createMapView();
150 void createGraphTabs();
151 void createBrowser();
153 bool openPOIFile(const QString
&fileName
);
154 bool loadFile(const QString
&fileName
, bool tryUnknown
, int &showError
);
155 void loadData(const Data
&data
);
156 bool loadMapNode(const TreeNode
<Map
*> &node
, MapAction
*&action
,
157 bool silent
, const QList
<QAction
*> &existingActions
);
158 void loadMapDirNode(const TreeNode
<Map
*> &node
, QList
<MapAction
*> &actions
,
159 QMenu
*menu
, const QList
<QAction
*> &existingActions
);
160 void updateStatusBarInfo();
161 void updateWindowTitle();
162 bool updateGraphTabs();
163 void updateDEMDownloadAction();
165 TimeType
timeType() const;
167 void setTimeType(TimeType type
);
168 void setUnits(Units units
);
169 void setCoordinatesFormat(CoordinatesFormat format
);
170 void setGraphType(GraphType type
);
172 qreal
distance() const;
174 qreal
movingTime() const;
175 QAction
*mapAction(const QString
&name
);
176 QGeoPositionInfoSource
*positionSource(const Options
&options
);
177 void readSettings(QString
&activeMap
, QStringList
&disabledPOIs
);
179 void loadInitialMaps(const QString
&selected
);
180 void loadInitialPOIs(const QStringList
&disabled
);
183 void updateOptions(const Options
&options
);
186 void keyPressEvent(QKeyEvent
*event
);
187 #endif // Q_OS_ANDROID
188 void closeEvent(QCloseEvent
*event
);
189 void dragEnterEvent(QDragEnterEvent
*event
);
190 void dropEvent(QDropEvent
*event
);
193 NavigationWidget
*_navigation
;
194 #else // Q_OS_ANDROID
195 QToolBar
*_fileToolBar
;
196 QToolBar
*_showToolBar
;
197 QToolBar
*_navigationToolBar
;
198 #endif // Q_OS_ANDROID
202 QActionGroup
*_fileActionGroup
;
203 QActionGroup
*_navigationActionGroup
;
204 QActionGroup
*_mapsActionGroup
;
205 QActionGroup
*_poisActionGroup
;
206 #if !defined(Q_OS_MAC) && !defined(Q_OS_ANDROID)
207 QAction
*_exitAction
;
208 #endif // Q_OS_MAC + Q_OS_ANDROID
209 QAction
*_pathsAction
;
210 QAction
*_aboutAction
;
211 QAction
*_printFileAction
;
212 QAction
*_exportPDFFileAction
;
213 QAction
*_exportPNGFileAction
;
214 QAction
*_openFileAction
;
215 QAction
*_openDirAction
;
216 QAction
*_closeFileAction
;
217 QAction
*_reloadFileAction
;
218 QAction
*_statisticsAction
;
219 QAction
*_openPOIAction
;
220 QAction
*_selectAllPOIAction
;
221 QAction
*_unselectAllPOIAction
;
222 QAction
*_showPOIAction
;
223 QAction
*_overlapPOIAction
;
224 QAction
*_showPOILabelsAction
;
225 QAction
*_showPOIIconsAction
;
226 QAction
*_showMapAction
;
227 QAction
*_showPositionAction
;
228 QAction
*_followPositionAction
;
229 QAction
*_showPositionCoordinatesAction
;
230 QAction
*_showMotionInfoAction
;
231 QAction
*_loadMapAction
;
232 QAction
*_loadMapDirAction
;
233 QAction
*_clearMapCacheAction
;
234 QAction
*_showGraphsAction
;
235 QAction
*_showGraphGridAction
;
236 QAction
*_showGraphSliderInfoAction
;
237 QAction
*_distanceGraphAction
;
238 QAction
*_timeGraphAction
;
240 QAction
*_showGraphTabsAction
;
241 #else // Q_OS_ANDROID
242 QAction
*_keysAction
;
243 QAction
*_fullscreenAction
;
244 QAction
*_showToolbarsAction
;
245 QAction
*_nextAction
;
246 QAction
*_prevAction
;
247 QAction
*_lastAction
;
248 QAction
*_firstAction
;
249 #endif // Q_OS_ANDROID
250 QAction
*_metricUnitsAction
;
251 QAction
*_imperialUnitsAction
;
252 QAction
*_nauticalUnitsAction
;
253 QAction
*_decimalDegreesAction
;
254 QAction
*_degreesMinutesAction
;
256 QAction
*_totalTimeAction
;
257 QAction
*_movingTimeAction
;
258 QAction
*_nextMapAction
;
259 QAction
*_prevMapAction
;
260 QAction
*_showTracksAction
;
261 QAction
*_showRoutesAction
;
262 QAction
*_showWaypointsAction
;
263 QAction
*_showWaypointLabelsAction
;
264 QAction
*_showWaypointIconsAction
;
265 QAction
*_showAreasAction
;
266 QAction
*_showRouteWaypointsAction
;
267 QAction
*_hideMarkersAction
;
268 QAction
*_showMarkersAction
;
269 QAction
*_showMarkerDateAction
;
270 QAction
*_showMarkerCoordinatesAction
;
271 QAction
*_showTicksAction
;
272 QAction
*_useStylesAction
;
273 QAction
*_showCoordinatesAction
;
274 QAction
*_openOptionsAction
;
275 QAction
*_downloadDEMAction
;
276 QAction
*_showDEMTilesAction
;
280 QLabel
*_fileNameLabel
;
281 QLabel
*_distanceLabel
;
284 QSplitter
*_splitter
;
286 QTabWidget
*_graphTabWidget
;
287 QList
<GraphTab
*> _tabs
;
292 QGeoPositionInfoSource
*_positionSource
;
295 FileBrowser
*_browser
;
296 QList
<QString
> _files
;
298 int _trackCount
, _routeCount
, _areaCount
, _waypointCount
;
299 qreal _trackDistance
, _routeDistance
;
300 qreal _time
, _movingTime
;
301 DateTimeRange _dateRange
;
305 QList
<QByteArray
> _windowStates
;
306 QList
<QByteArray
> _windowGeometries
;
308 #endif // Q_OS_ANDROID
310 PDFExport _pdfExport
;
311 PNGExport _pngExport
;
314 QString _dataDir
, _mapDir
, _poiDir
;
318 QList
<RectC
> _demRects
;