1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Improved graph type/time type switching

This commit is contained in:
Martin Tůma 2017-09-26 07:46:46 +02:00
parent 00ef815738
commit 11196c0e35
2 changed files with 22 additions and 5 deletions

View File

@ -412,14 +412,12 @@ void GUI::createActions()
_distanceGraphAction = new QAction(tr("Distance"), this);
_distanceGraphAction->setCheckable(true);
_distanceGraphAction->setActionGroup(ag);
_distanceGraphAction->setShortcut(DISTANCE_GRAPH_SHORTCUT);
connect(_distanceGraphAction, SIGNAL(triggered()), this,
SLOT(setDistanceGraph()));
addAction(_distanceGraphAction);
_timeGraphAction = new QAction(tr("Time"), this);
_timeGraphAction->setCheckable(true);
_timeGraphAction->setActionGroup(ag);
_timeGraphAction->setShortcut(TIME_GRAPH_SHORTCUT);
connect(_timeGraphAction, SIGNAL(triggered()), this,
SLOT(setTimeGraph()));
addAction(_timeGraphAction);
@ -671,7 +669,12 @@ void GUI::keys()
+ tr("Last file") + "</td><td><i>" + QKeySequence(LAST_KEY).toString()
+ "</i></td></tr><tr><td>" + tr("Append file")
+ "</td><td><i>" + QKeySequence(MODIFIER).toString() + tr("Next/Previous")
+ "</i></td></tr><tr><td></td><td></td></tr><tr><td>" + tr("Next map")
+ "</i></td></tr><tr><td></td><td></td></tr><tr><td>"
+ tr("Toggle graph type") + "</td><td><i>"
+ QKeySequence(TOGGLE_GRAPH_TYPE_KEY).toString() + "</i></td></tr><tr><td>"
+ tr("Toggle time type") + "</td><td><i>"
+ QKeySequence(TOGGLE_TIME_TYPE_KEY).toString()
+ "<tr><td></td><td></td></tr><tr><td>" + tr("Next map")
+ "</td><td><i>" + NEXT_MAP_SHORTCUT.toString() + "</i></td></tr><tr><td>"
+ tr("Previous map") + "</td><td><i>" + PREV_MAP_SHORTCUT.toString()
+ "</i></td></tr><tr><td></td><td></td></tr><tr><td>" + tr("Zoom in")
@ -1433,6 +1436,19 @@ void GUI::keyPressEvent(QKeyEvent *event)
file = _browser->last();
break;
case TOGGLE_GRAPH_TYPE_KEY:
if (_timeGraphAction->isChecked())
_distanceGraphAction->activate(QAction::Trigger);
else
_timeGraphAction->activate(QAction::Trigger);
break;
case TOGGLE_TIME_TYPE_KEY:
if (_movingTimeAction->isChecked())
_totalTimeAction->activate(QAction::Trigger);
else
_movingTimeAction->activate(QAction::Trigger);
break;
case Qt::Key_Escape:
if (_fullscreenAction->isChecked()) {
_fullscreenAction->setChecked(false);

View File

@ -13,6 +13,9 @@
#define ZOOM_IN QKeySequence::ZoomIn
#define ZOOM_OUT QKeySequence::ZoomOut
#define TOGGLE_GRAPH_TYPE_KEY Qt::Key_X
#define TOGGLE_TIME_TYPE_KEY Qt::Key_T
#define QUIT_SHORTCUT QKeySequence(QKeySequence::Quit)
#define OPEN_SHORTCUT QKeySequence(QKeySequence::Open)
#define CLOSE_SHORTCUT QKeySequence(QKeySequence::Close)
@ -23,8 +26,6 @@
#define NEXT_MAP_SHORTCUT QKeySequence(QKeySequence::Forward)
#define PREV_MAP_SHORTCUT QKeySequence(QKeySequence::Back)
#define SHOW_GRAPHS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_G)
#define DISTANCE_GRAPH_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_D)
#define TIME_GRAPH_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_T)
#ifdef Q_OS_MAC
#define FULLSCREEN_SHORTCUT QKeySequence(Qt::META + Qt::CTRL + Qt::Key_F)