mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-17 16:20:48 +01:00
Yet another graph tabs polishing
Code cleanup
This commit is contained in:
parent
23576cd52c
commit
11a9d75d8f
@ -2,6 +2,9 @@
|
|||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
#define APP_NAME "GPXSee"
|
#define APP_NAME "GPXSee"
|
||||||
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
||||||
|
37
src/gui.cpp
37
src/gui.cpp
@ -178,7 +178,7 @@ void GUI::createActions()
|
|||||||
|
|
||||||
// General actions
|
// General actions
|
||||||
_exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this);
|
_exitAction = new QAction(QIcon(QPixmap(QUIT_ICON)), tr("Quit"), this);
|
||||||
_exitAction->setShortcut(QKeySequence::Quit);
|
_exitAction->setShortcut(QUIT_SHORTCUT);
|
||||||
connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()));
|
connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()));
|
||||||
addAction(_exitAction);
|
addAction(_exitAction);
|
||||||
|
|
||||||
@ -196,30 +196,30 @@ void GUI::createActions()
|
|||||||
// File related actions
|
// File related actions
|
||||||
_openFileAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
|
_openFileAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
|
||||||
tr("Open"), this);
|
tr("Open"), this);
|
||||||
_openFileAction->setShortcut(QKeySequence::Open);
|
_openFileAction->setShortcut(OPEN_SHORTCUT);
|
||||||
connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
|
connect(_openFileAction, SIGNAL(triggered()), this, SLOT(openFile()));
|
||||||
addAction(_openFileAction);
|
addAction(_openFileAction);
|
||||||
_saveFileAction = new QAction(QIcon(QPixmap(SAVE_FILE_ICON)),
|
_saveFileAction = new QAction(QIcon(QPixmap(SAVE_FILE_ICON)),
|
||||||
tr("Save"), this);
|
tr("Save"), this);
|
||||||
_saveFileAction->setShortcut(QKeySequence::Save);
|
_saveFileAction->setShortcut(SAVE_SHORTCUT);
|
||||||
_saveFileAction->setActionGroup(_fileActionGroup);
|
_saveFileAction->setActionGroup(_fileActionGroup);
|
||||||
connect(_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile()));
|
connect(_saveFileAction, SIGNAL(triggered()), this, SLOT(saveFile()));
|
||||||
addAction(_saveFileAction);
|
addAction(_saveFileAction);
|
||||||
_saveAsAction = new QAction(QIcon(QPixmap(SAVE_AS_ICON)),
|
_saveAsAction = new QAction(QIcon(QPixmap(SAVE_AS_ICON)),
|
||||||
tr("Save as"), this);
|
tr("Save as"), this);
|
||||||
_saveAsAction->setShortcut(QKeySequence::SaveAs);
|
_saveAsAction->setShortcut(SAVE_AS_SHORTCUT);
|
||||||
_saveAsAction->setActionGroup(_fileActionGroup);
|
_saveAsAction->setActionGroup(_fileActionGroup);
|
||||||
connect(_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));
|
connect(_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));
|
||||||
addAction(_saveAsAction);
|
addAction(_saveAsAction);
|
||||||
_closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)),
|
_closeFileAction = new QAction(QIcon(QPixmap(CLOSE_FILE_ICON)),
|
||||||
tr("Close"), this);
|
tr("Close"), this);
|
||||||
_closeFileAction->setShortcut(QKeySequence::Close);
|
_closeFileAction->setShortcut(CLOSE_SHORTCUT);
|
||||||
_closeFileAction->setActionGroup(_fileActionGroup);
|
_closeFileAction->setActionGroup(_fileActionGroup);
|
||||||
connect(_closeFileAction, SIGNAL(triggered()), this, SLOT(closeAll()));
|
connect(_closeFileAction, SIGNAL(triggered()), this, SLOT(closeAll()));
|
||||||
addAction(_closeFileAction);
|
addAction(_closeFileAction);
|
||||||
_reloadFileAction = new QAction(QIcon(QPixmap(RELOAD_FILE_ICON)),
|
_reloadFileAction = new QAction(QIcon(QPixmap(RELOAD_FILE_ICON)),
|
||||||
tr("Reload"), this);
|
tr("Reload"), this);
|
||||||
_reloadFileAction->setShortcut(QKeySequence::Refresh);
|
_reloadFileAction->setShortcut(RELOAD_SHORTCUT);
|
||||||
_reloadFileAction->setActionGroup(_fileActionGroup);
|
_reloadFileAction->setActionGroup(_fileActionGroup);
|
||||||
connect(_reloadFileAction, SIGNAL(triggered()), this, SLOT(reloadFile()));
|
connect(_reloadFileAction, SIGNAL(triggered()), this, SLOT(reloadFile()));
|
||||||
addAction(_reloadFileAction);
|
addAction(_reloadFileAction);
|
||||||
@ -234,7 +234,7 @@ void GUI::createActions()
|
|||||||
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
|
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
|
||||||
tr("Show POIs"), this);
|
tr("Show POIs"), this);
|
||||||
_showPOIAction->setCheckable(true);
|
_showPOIAction->setCheckable(true);
|
||||||
_showPOIAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
|
_showPOIAction->setShortcut(SHOW_POI_SHORTCUT);
|
||||||
connect(_showPOIAction, SIGNAL(triggered(bool)), this, SLOT(showPOI(bool)));
|
connect(_showPOIAction, SIGNAL(triggered(bool)), this, SLOT(showPOI(bool)));
|
||||||
addAction(_showPOIAction);
|
addAction(_showPOIAction);
|
||||||
createPOIFilesActions();
|
createPOIFilesActions();
|
||||||
@ -243,7 +243,7 @@ void GUI::createActions()
|
|||||||
_showMapAction = new QAction(QIcon(QPixmap(SHOW_MAP_ICON)), tr("Show map"),
|
_showMapAction = new QAction(QIcon(QPixmap(SHOW_MAP_ICON)), tr("Show map"),
|
||||||
this);
|
this);
|
||||||
_showMapAction->setCheckable(true);
|
_showMapAction->setCheckable(true);
|
||||||
_showMapAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
|
_showMapAction->setShortcut(SHOW_MAP_SHORTCUT);
|
||||||
connect(_showMapAction, SIGNAL(triggered(bool)), this, SLOT(showMap(bool)));
|
connect(_showMapAction, SIGNAL(triggered(bool)), this, SLOT(showMap(bool)));
|
||||||
addAction(_showMapAction);
|
addAction(_showMapAction);
|
||||||
_clearMapCacheAction = new QAction(tr("Clear tile cache"), this);
|
_clearMapCacheAction = new QAction(tr("Clear tile cache"), this);
|
||||||
@ -257,11 +257,11 @@ void GUI::createActions()
|
|||||||
_showMapAction->setChecked(true);
|
_showMapAction->setChecked(true);
|
||||||
|
|
||||||
_nextMapAction = new QAction(tr("Next map"), this);
|
_nextMapAction = new QAction(tr("Next map"), this);
|
||||||
_nextMapAction->setShortcut(QKeySequence::Forward);
|
_nextMapAction->setShortcut(NEXT_MAP_SHORTCUT);
|
||||||
connect(_nextMapAction, SIGNAL(triggered()), this, SLOT(nextMap()));
|
connect(_nextMapAction, SIGNAL(triggered()), this, SLOT(nextMap()));
|
||||||
addAction(_nextMapAction);
|
addAction(_nextMapAction);
|
||||||
_prevMapAction = new QAction(tr("Next map"), this);
|
_prevMapAction = new QAction(tr("Next map"), this);
|
||||||
_prevMapAction->setShortcut(QKeySequence::Back);
|
_prevMapAction->setShortcut(PREV_MAP_SHORTCUT);
|
||||||
connect(_prevMapAction, SIGNAL(triggered()), this, SLOT(prevMap()));
|
connect(_prevMapAction, SIGNAL(triggered()), this, SLOT(prevMap()));
|
||||||
addAction(_prevMapAction);
|
addAction(_prevMapAction);
|
||||||
}
|
}
|
||||||
@ -270,7 +270,7 @@ void GUI::createActions()
|
|||||||
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
||||||
_showGraphsAction->setCheckable(true);
|
_showGraphsAction->setCheckable(true);
|
||||||
_showGraphsAction->setChecked(true);
|
_showGraphsAction->setChecked(true);
|
||||||
_showGraphsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
|
_showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT);
|
||||||
connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
|
connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
|
||||||
SLOT(showGraphs(bool)));
|
SLOT(showGraphs(bool)));
|
||||||
addAction(_showGraphsAction);
|
addAction(_showGraphsAction);
|
||||||
@ -295,7 +295,7 @@ void GUI::createActions()
|
|||||||
_fullscreenAction = new QAction(QIcon(QPixmap(FULLSCREEN_ICON)),
|
_fullscreenAction = new QAction(QIcon(QPixmap(FULLSCREEN_ICON)),
|
||||||
tr("Fullscreen mode"), this);
|
tr("Fullscreen mode"), this);
|
||||||
_fullscreenAction->setCheckable(true);
|
_fullscreenAction->setCheckable(true);
|
||||||
_fullscreenAction->setShortcut(QKeySequence("F11"));
|
_fullscreenAction->setShortcut(FULLSCREEN_SHORTCUT);
|
||||||
connect(_fullscreenAction, SIGNAL(triggered(bool)), this,
|
connect(_fullscreenAction, SIGNAL(triggered(bool)), this,
|
||||||
SLOT(showFullscreen(bool)));
|
SLOT(showFullscreen(bool)));
|
||||||
addAction(_fullscreenAction);
|
addAction(_fullscreenAction);
|
||||||
@ -406,8 +406,11 @@ void GUI::createTrackView()
|
|||||||
void GUI::createTrackGraphs()
|
void GUI::createTrackGraphs()
|
||||||
{
|
{
|
||||||
_elevationGraph = new ElevationGraph;
|
_elevationGraph = new ElevationGraph;
|
||||||
|
_elevationGraph->setFrameShape(QFrame::NoFrame);
|
||||||
_speedGraph = new SpeedGraph;
|
_speedGraph = new SpeedGraph;
|
||||||
|
_speedGraph->setFrameShape(QFrame::NoFrame);
|
||||||
_heartRateGraph = new HeartRateGraph;
|
_heartRateGraph = new HeartRateGraph;
|
||||||
|
_heartRateGraph->setFrameShape(QFrame::NoFrame);
|
||||||
|
|
||||||
_trackGraphs = new QTabWidget;
|
_trackGraphs = new QTabWidget;
|
||||||
connect(_trackGraphs, SIGNAL(currentChanged(int)), this,
|
connect(_trackGraphs, SIGNAL(currentChanged(int)), this,
|
||||||
@ -416,9 +419,6 @@ void GUI::createTrackGraphs()
|
|||||||
_trackGraphs->setFixedHeight(200);
|
_trackGraphs->setFixedHeight(200);
|
||||||
_trackGraphs->setSizePolicy(
|
_trackGraphs->setSizePolicy(
|
||||||
QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
|
QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
|
||||||
#ifndef Q_OS_MAC
|
|
||||||
_trackGraphs->setDocumentMode(true);
|
|
||||||
#endif // Q_OS_MAC
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::createStatusBar()
|
void GUI::createStatusBar()
|
||||||
@ -1028,6 +1028,13 @@ void GUI::keyPressEvent(QKeyEvent *event)
|
|||||||
case LAST_KEY:
|
case LAST_KEY:
|
||||||
file = _browser->last();
|
file = _browser->last();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Qt::Key_Escape:
|
||||||
|
if (_fullscreenAction->isChecked()) {
|
||||||
|
_fullscreenAction->setChecked(false);
|
||||||
|
showFullscreen(false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file.isNull()) {
|
if (!file.isNull()) {
|
||||||
|
26
src/keys.h
26
src/keys.h
@ -1,10 +1,26 @@
|
|||||||
#ifndef KEYS_H
|
#ifndef KEYS_H
|
||||||
#define KEYS_H
|
#define KEYS_H
|
||||||
|
|
||||||
#define NEXT_KEY Qt::Key_Space
|
#include <Qt>
|
||||||
#define PREV_KEY Qt::Key_Backspace
|
#include <QKeySequence>
|
||||||
#define FIRST_KEY Qt::Key_Home
|
|
||||||
#define LAST_KEY Qt::Key_End
|
#define NEXT_KEY Qt::Key_Space
|
||||||
#define MODIFIER Qt::ShiftModifier
|
#define PREV_KEY Qt::Key_Backspace
|
||||||
|
#define FIRST_KEY Qt::Key_Home
|
||||||
|
#define LAST_KEY Qt::Key_End
|
||||||
|
#define MODIFIER Qt::ShiftModifier
|
||||||
|
|
||||||
|
#define QUIT_SHORTCUT QKeySequence::Quit
|
||||||
|
#define OPEN_SHORTCUT QKeySequence::Open
|
||||||
|
#define SAVE_SHORTCUT QKeySequence::Save
|
||||||
|
#define SAVE_AS_SHORTCUT QKeySequence::SaveAs
|
||||||
|
#define CLOSE_SHORTCUT QKeySequence::Close
|
||||||
|
#define RELOAD_SHORTCUT QKeySequence::Refresh
|
||||||
|
#define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_P)
|
||||||
|
#define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_M)
|
||||||
|
#define NEXT_MAP_SHORTCUT QKeySequence::Forward
|
||||||
|
#define PREV_MAP_SHORTCUT QKeySequence::Back
|
||||||
|
#define SHOW_GRAPHS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_G)
|
||||||
|
#define FULLSCREEN_SHORTCUT QKeySequence(Qt::Key_F11)
|
||||||
|
|
||||||
#endif // KEYS_H
|
#endif // KEYS_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user