2015-10-05 01:43:48 +02:00
|
|
|
#ifndef GUI_H
|
|
|
|
#define GUI_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2016-03-05 18:01:13 +01:00
|
|
|
#include <QString>
|
|
|
|
#include <QList>
|
2016-05-21 16:10:24 +02:00
|
|
|
#include <QDate>
|
2016-05-25 23:27:07 +02:00
|
|
|
#include <QPrinter>
|
2015-10-05 01:43:48 +02:00
|
|
|
#include "poi.h"
|
|
|
|
|
2016-03-05 18:01:13 +01:00
|
|
|
class QMenu;
|
|
|
|
class QToolBar;
|
|
|
|
class QTabWidget;
|
|
|
|
class QActionGroup;
|
|
|
|
class QAction;
|
|
|
|
class QLabel;
|
|
|
|
class QSignalMapper;
|
2016-05-15 22:38:15 +02:00
|
|
|
class QPrinter;
|
2015-10-20 22:18:41 +02:00
|
|
|
class FileBrowser;
|
2016-03-21 22:37:55 +01:00
|
|
|
class GraphView;
|
2015-10-12 01:12:12 +02:00
|
|
|
class ElevationGraph;
|
|
|
|
class SpeedGraph;
|
2016-03-21 22:37:55 +01:00
|
|
|
class HeartRateGraph;
|
2016-02-11 20:58:52 +01:00
|
|
|
class TrackView;
|
2015-11-23 02:37:08 +01:00
|
|
|
class Map;
|
2015-10-05 01:43:48 +02:00
|
|
|
|
|
|
|
class GUI : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-02-12 20:12:37 +01:00
|
|
|
GUI(QWidget *parent = 0);
|
2016-05-13 18:48:42 +02:00
|
|
|
~GUI();
|
2015-10-05 01:43:48 +02:00
|
|
|
|
|
|
|
bool openFile(const QString &fileName);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void about();
|
2015-10-21 01:09:17 +02:00
|
|
|
void keys();
|
2015-11-30 22:42:51 +01:00
|
|
|
void dataSources();
|
2016-05-15 22:38:15 +02:00
|
|
|
void printFile();
|
|
|
|
void exportFile();
|
2015-10-05 01:43:48 +02:00
|
|
|
void openFile();
|
2016-03-23 20:56:39 +01:00
|
|
|
void closeAll();
|
2015-10-20 22:18:41 +02:00
|
|
|
void reloadFile();
|
2015-10-05 01:43:48 +02:00
|
|
|
void openPOIFile();
|
2016-03-05 18:01:13 +01:00
|
|
|
void closePOIFiles();
|
2015-11-24 00:24:26 +01:00
|
|
|
void showPOI(bool checked);
|
|
|
|
void showMap(bool checked);
|
|
|
|
void showGraphs(bool checked);
|
|
|
|
void showToolbars(bool checked);
|
2016-04-05 09:10:19 +02:00
|
|
|
void showFullscreen(bool checked);
|
2016-04-01 19:25:34 +02:00
|
|
|
void clearMapCache();
|
2016-04-08 22:33:19 +02:00
|
|
|
void nextMap();
|
|
|
|
void prevMap();
|
2015-10-20 22:18:41 +02:00
|
|
|
|
2015-11-23 02:37:08 +01:00
|
|
|
void mapChanged(int);
|
2015-10-05 01:43:48 +02:00
|
|
|
void graphChanged(int);
|
2016-03-05 18:01:13 +01:00
|
|
|
void poiFileChecked(int);
|
2015-10-05 01:43:48 +02:00
|
|
|
|
2015-12-18 22:21:11 +01:00
|
|
|
void next();
|
|
|
|
void prev();
|
|
|
|
void last();
|
|
|
|
void first();
|
|
|
|
|
2015-12-19 20:23:07 +01:00
|
|
|
void setMetricUnits();
|
|
|
|
void setImperialUnits();
|
|
|
|
|
2016-03-30 20:50:51 +02:00
|
|
|
void sliderPositionChanged(qreal pos);
|
|
|
|
|
2015-10-05 01:43:48 +02:00
|
|
|
private:
|
2016-05-13 18:48:42 +02:00
|
|
|
typedef QPair<GraphView *, QString> GraphTab;
|
2016-05-21 16:10:24 +02:00
|
|
|
typedef QPair<QDate, QDate> DateRange;
|
2016-05-13 18:48:42 +02:00
|
|
|
|
2016-03-24 19:34:46 +01:00
|
|
|
void loadMaps();
|
|
|
|
void loadPOIs();
|
2016-03-23 20:56:39 +01:00
|
|
|
void closeFiles();
|
2016-05-15 22:38:15 +02:00
|
|
|
void plot(QPrinter *printer);
|
2015-11-23 02:37:08 +01:00
|
|
|
|
2016-03-05 22:42:22 +01:00
|
|
|
QAction *createPOIFileAction(int index);
|
2016-03-05 18:01:13 +01:00
|
|
|
void createPOIFilesActions();
|
2016-03-05 22:42:22 +01:00
|
|
|
void createMapActions();
|
2015-10-05 01:43:48 +02:00
|
|
|
void createActions();
|
|
|
|
void createMenus();
|
|
|
|
void createToolBars();
|
|
|
|
void createStatusBar();
|
|
|
|
void createTrackView();
|
|
|
|
void createTrackGraphs();
|
|
|
|
|
2016-03-22 19:47:11 +01:00
|
|
|
bool openPOIFile(const QString &fileName);
|
2015-10-20 22:18:41 +02:00
|
|
|
bool loadFile(const QString &fileName);
|
2016-05-15 22:38:15 +02:00
|
|
|
void exportFile(const QString &fileName);
|
2015-10-20 22:18:41 +02:00
|
|
|
void updateStatusBarInfo();
|
2016-04-19 08:51:11 +02:00
|
|
|
void updateWindowTitle();
|
2015-12-18 22:21:11 +01:00
|
|
|
void updateNavigationActions();
|
2016-03-23 09:38:22 +01:00
|
|
|
void updateGraphTabs();
|
2016-03-25 09:50:19 +01:00
|
|
|
void updateTrackView();
|
2015-10-17 12:08:30 +02:00
|
|
|
|
|
|
|
void keyPressEvent(QKeyEvent * event);
|
2016-04-26 09:39:16 +02:00
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
|
2016-04-26 20:55:29 +02:00
|
|
|
int mapIndex(const QString &name);
|
2016-04-26 09:39:16 +02:00
|
|
|
void readSettings();
|
|
|
|
void writeSettings();
|
2015-10-05 01:43:48 +02:00
|
|
|
|
|
|
|
QMenu *_fileMenu;
|
2015-10-21 01:09:17 +02:00
|
|
|
QMenu *_helpMenu;
|
2015-10-05 01:43:48 +02:00
|
|
|
QMenu *_poiMenu;
|
2015-11-23 02:37:08 +01:00
|
|
|
QMenu *_mapMenu;
|
2015-11-24 00:24:26 +01:00
|
|
|
QMenu *_settingsMenu;
|
2015-12-19 20:23:07 +01:00
|
|
|
QMenu *_unitsMenu;
|
2016-03-05 18:01:13 +01:00
|
|
|
QMenu *_poiFilesMenu;
|
2015-10-05 01:43:48 +02:00
|
|
|
|
|
|
|
QToolBar *_fileToolBar;
|
2015-11-23 02:37:08 +01:00
|
|
|
QToolBar *_showToolBar;
|
2015-12-18 22:21:11 +01:00
|
|
|
QToolBar *_navigationToolBar;
|
2015-10-05 01:43:48 +02:00
|
|
|
QTabWidget *_trackGraphs;
|
|
|
|
QActionGroup *_fileActionGroup;
|
2015-12-18 22:21:11 +01:00
|
|
|
QActionGroup *_navigationActionGroup;
|
2015-10-05 01:43:48 +02:00
|
|
|
|
|
|
|
QAction *_exitAction;
|
2015-10-21 01:09:17 +02:00
|
|
|
QAction *_keysAction;
|
2015-11-30 22:42:51 +01:00
|
|
|
QAction *_dataSourcesAction;
|
2015-10-05 01:43:48 +02:00
|
|
|
QAction *_aboutAction;
|
|
|
|
QAction *_aboutQtAction;
|
2016-05-15 22:38:15 +02:00
|
|
|
QAction *_printFileAction;
|
|
|
|
QAction *_exportFileAction;
|
2015-10-05 01:43:48 +02:00
|
|
|
QAction *_openFileAction;
|
|
|
|
QAction *_closeFileAction;
|
2015-10-20 22:18:41 +02:00
|
|
|
QAction *_reloadFileAction;
|
2015-10-05 01:43:48 +02:00
|
|
|
QAction *_openPOIAction;
|
2016-03-05 18:01:13 +01:00
|
|
|
QAction *_closePOIAction;
|
2015-10-05 01:43:48 +02:00
|
|
|
QAction *_showPOIAction;
|
2015-11-23 02:37:08 +01:00
|
|
|
QAction *_showMapAction;
|
2016-04-05 09:10:19 +02:00
|
|
|
QAction *_fullscreenAction;
|
2016-04-01 19:25:34 +02:00
|
|
|
QAction *_clearMapCacheAction;
|
2015-11-24 00:24:26 +01:00
|
|
|
QAction *_showGraphsAction;
|
|
|
|
QAction *_showToolbarsAction;
|
2015-12-18 22:21:11 +01:00
|
|
|
QAction *_nextAction;
|
|
|
|
QAction *_prevAction;
|
|
|
|
QAction *_lastAction;
|
|
|
|
QAction *_firstAction;
|
2015-12-19 20:23:07 +01:00
|
|
|
QAction *_metricUnitsAction;
|
|
|
|
QAction *_imperialUnitsAction;
|
2016-04-08 22:33:19 +02:00
|
|
|
QAction *_nextMapAction;
|
|
|
|
QAction *_prevMapAction;
|
2015-11-23 02:37:08 +01:00
|
|
|
QList<QAction*> _mapActions;
|
2016-03-05 18:01:13 +01:00
|
|
|
QList<QAction*> _poiFilesActions;
|
|
|
|
|
|
|
|
QSignalMapper *_poiFilesSM;
|
2015-10-05 01:43:48 +02:00
|
|
|
|
2015-10-14 02:54:36 +02:00
|
|
|
QLabel *_fileNameLabel;
|
|
|
|
QLabel *_distanceLabel;
|
|
|
|
QLabel *_timeLabel;
|
2015-10-05 01:43:48 +02:00
|
|
|
|
2016-05-13 18:48:42 +02:00
|
|
|
TrackView *_track;
|
2015-10-12 01:12:12 +02:00
|
|
|
ElevationGraph *_elevationGraph;
|
|
|
|
SpeedGraph *_speedGraph;
|
2016-03-21 22:37:55 +01:00
|
|
|
HeartRateGraph *_heartRateGraph;
|
2016-05-13 18:48:42 +02:00
|
|
|
QList<GraphTab> _tabs;
|
2015-10-05 01:43:48 +02:00
|
|
|
|
|
|
|
POI _poi;
|
2015-11-23 02:37:08 +01:00
|
|
|
QList<Map*> _maps;
|
2015-10-05 01:43:48 +02:00
|
|
|
|
2015-10-20 22:18:41 +02:00
|
|
|
FileBrowser *_browser;
|
|
|
|
QList<QString> _files;
|
2015-11-23 02:37:08 +01:00
|
|
|
Map *_currentMap;
|
2015-10-14 02:54:36 +02:00
|
|
|
|
2016-05-21 16:10:24 +02:00
|
|
|
int _trackCount;
|
2015-10-14 02:54:36 +02:00
|
|
|
qreal _distance;
|
|
|
|
qreal _time;
|
2016-05-21 16:10:24 +02:00
|
|
|
DateRange _dateRange;
|
2016-03-21 22:37:55 +01:00
|
|
|
|
2016-03-30 20:50:51 +02:00
|
|
|
qreal _sliderPos;
|
2016-04-05 09:10:19 +02:00
|
|
|
|
|
|
|
int _frameStyle;
|
|
|
|
bool _showGraphs;
|
2016-05-25 23:27:07 +02:00
|
|
|
|
|
|
|
QString _exportFileName;
|
|
|
|
QPrinter::PaperSize _exportPaperSize;
|
|
|
|
QPrinter::Orientation _exportOrientation;
|
2015-10-05 01:43:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GUI_H
|