add: Home (Pos1) and End key bindings in graph GUI (based on @mcd1992 change on RRG repo) (#823)

This commit is contained in:
pwpiwi 2019-05-27 07:58:09 +02:00 committed by GitHub
parent 2378bb24c3
commit 5f18b0c45d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 20 deletions

View file

@ -32,6 +32,7 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
- Added `hf mfp ndef` `hf mf ndef` parsing NDEF records (Merlok)
- Added Mifare Mini, Mifare 2K and 4K support to `hf mf sim` (piwi)
- Added Legic detection to `hf search` (dnet)
- Added Home (Pos1) and End key bindings to the plot GUI (based on @mcd1992)
## [v3.1.0][2018-10-10]

View file

@ -34,8 +34,8 @@ extern "C" {
bool g_useOverlays = false;
int g_absVMax = 0;
int startMax;
int PageWidth;
int startMax; // Maximum offset in the graph (right side of graph)
int PageWidth; // How many samples are currently visible on this 'page' / graph
int unlockStart = 0;
void ProxGuiQT::ShowGraphWindow(void)
@ -509,8 +509,9 @@ void Plot::paintEvent(QPaintEvent *event)
if(CursorDPos > GraphTraceLen)
CursorDPos= 0;
QRect plotRect(WIDTH_AXES, 0, width()-WIDTH_AXES, height()-HEIGHT_INFO);
QRect infoRect(0, height()-HEIGHT_INFO, width(), HEIGHT_INFO);
QRect plotRect(WIDTH_AXES, 0, width() - WIDTH_AXES, height() - HEIGHT_INFO);
QRect infoRect(0, height() - HEIGHT_INFO, width(), HEIGHT_INFO);
PageWidth = plotRect.width() / GraphPixelsPerPoint;
//Grey background
painter.fillRect(rect(), QColor(60, 60, 60));
@ -616,7 +617,7 @@ void Plot::mouseMoveEvent(QMouseEvent *event)
void Plot::keyPressEvent(QKeyEvent *event)
{
int offset;
int offset; // Left/right movement offset (in sample size)
if(event->modifiers() & Qt::ShiftModifier) {
if (PlotGridX)
@ -671,20 +672,22 @@ void Plot::keyPressEvent(QKeyEvent *event)
case Qt::Key_H:
puts("Plot Window Keystrokes:\n");
puts(" Key Action\n");
puts(" UP Zoom out");
puts(" DOWN Zoom in");
puts(" G Toggle grid display");
puts(" H Show help");
puts(" L Toggle lock grid relative to samples");
puts(" Q Hide window");
puts(" HOME Move to the start of the graph");
puts(" END Move to the end of the graph");
puts(" LEFT Move left");
puts(" <CTL>LEFT Move left 1 sample");
puts(" <SHIFT>LEFT Page left");
puts(" LEFT-MOUSE-CLICK Set yellow cursor");
puts(" Q Hide window");
puts(" RIGHT Move right");
puts(" <CTL>RIGHT Move right 1 sample");
puts(" <SHIFT>RIGHT Page right");
puts(" RIGHT-MOUSE-CLICK Set purple cursor");
puts(" UP Zoom out");
puts("");
puts("Use client window 'data help' for more plot commands\n");
break;
@ -701,6 +704,14 @@ void Plot::keyPressEvent(QKeyEvent *event)
master->hide();
break;
case Qt::Key_Home:
GraphStart = 0;
break;
case Qt::Key_End:
GraphStart = startMax;
break;
default:
QWidget::keyPressEvent(event);
return;

View file

@ -29,8 +29,8 @@ class Plot: public QWidget
{
private:
QWidget *master;
int GraphStart;
double GraphPixelsPerPoint;
int GraphStart; // Starting point/offset for the left side of the graph
double GraphPixelsPerPoint; // How many visual pixels are between each sample point (x axis)
int CursorAPos;
int CursorBPos;
void PlotGraph(int *buffer, int len, QRect r,QRect r2, QPainter* painter, int graphNum);