]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/proxguiqt.cpp
Merge branch 'graphwork2' into graphwork
[proxmark3-svn] / client / proxguiqt.cpp
index c0aff8b6a5ce3b89035bab3e8ca8c37aec708f00..c1541999265ec80786f23f90e91e03606c80df70 100644 (file)
@@ -7,6 +7,7 @@
 //-----------------------------------------------------------------------------
 // GUI (QT)
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // GUI (QT)
 //-----------------------------------------------------------------------------
+#include "proxguiqt.h"
 
 #include <iostream>
 #include <QPainterPath>
 
 #include <iostream>
 #include <QPainterPath>
@@ -19,6 +20,7 @@
 #include <math.h>
 #include <limits.h>
 #include <stdio.h>
 #include <math.h>
 #include <limits.h>
 #include <stdio.h>
+#include <QSlider>
 #include <QHBoxLayout>
 #include <string.h>
 #include "proxguiqt.h"
 #include <QHBoxLayout>
 #include <string.h>
 #include "proxguiqt.h"
@@ -108,7 +110,7 @@ void ProxWidget::applyOperation()
 {
        printf("ApplyOperation()");
        save_restoreGB(1);
 {
        printf("ApplyOperation()");
        save_restoreGB(1);
-       memcpy(GraphBuffer,s_Buff, sizeof(int) * GraphTraceLen);
+       memcpy(GraphBuffer, s_Buff, sizeof(int) * GraphTraceLen);
        RepaintGraphWindow();
 
 }
        RepaintGraphWindow();
 
 }
@@ -119,14 +121,23 @@ void ProxWidget::stickOperation()
 }
 void ProxWidget::vchange_autocorr(int v)
 {
 }
 void ProxWidget::vchange_autocorr(int v)
 {
-       autoCorr(GraphBuffer,s_Buff, GraphTraceLen, v);
-       printf("vchange_autocorr(%d)\n", v);
+       int ans;
+       ans = AutoCorrelate(GraphBuffer, s_Buff, GraphTraceLen, v, true, false);
+       printf("vchange_autocorr(w:%d): %d\n", v, ans);
+       RepaintGraphWindow();
+}
+void ProxWidget::vchange_askedge(int v)
+{
+       int ans;
+       //extern int AskEdgeDetect(const int *in, int *out, int len, int threshold);
+       ans = AskEdgeDetect(GraphBuffer, s_Buff, GraphTraceLen, v);
+       printf("vchange_askedge(w:%d)\n", v);
        RepaintGraphWindow();
 }
 void ProxWidget::vchange_dthr_up(int v)
 {
        int down = opsController->horizontalSlider_dirthr_down->value();
        RepaintGraphWindow();
 }
 void ProxWidget::vchange_dthr_up(int v)
 {
        int down = opsController->horizontalSlider_dirthr_down->value();
-       directionalThreshold(GraphBuffer,s_Buff, GraphTraceLen, v, down);
+       directionalThreshold(GraphBuffer, s_Buff, GraphTraceLen, v, down);
        printf("vchange_dthr_up(%d)", v);
        RepaintGraphWindow();
 
        printf("vchange_dthr_up(%d)", v);
        RepaintGraphWindow();
 
@@ -160,6 +171,7 @@ ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent)
        QObject::connect(opsController->horizontalSlider_window, SIGNAL(valueChanged(int)), this, SLOT(vchange_autocorr(int)));
        QObject::connect(opsController->horizontalSlider_dirthr_up, SIGNAL(valueChanged(int)), this, SLOT(vchange_dthr_up(int)));
        QObject::connect(opsController->horizontalSlider_dirthr_down, SIGNAL(valueChanged(int)), this, SLOT(vchange_dthr_down(int)));
        QObject::connect(opsController->horizontalSlider_window, SIGNAL(valueChanged(int)), this, SLOT(vchange_autocorr(int)));
        QObject::connect(opsController->horizontalSlider_dirthr_up, SIGNAL(valueChanged(int)), this, SLOT(vchange_dthr_up(int)));
        QObject::connect(opsController->horizontalSlider_dirthr_down, SIGNAL(valueChanged(int)), this, SLOT(vchange_dthr_down(int)));
+       QObject::connect(opsController->horizontalSlider_askedge, SIGNAL(valueChanged(int)), this, SLOT(vchange_askedge(int)));
 
        controlWidget->show();
 
 
        controlWidget->show();
 
@@ -177,7 +189,7 @@ ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent)
        //layout->addWidget(slider);
        layout->addWidget(plot);
        setLayout(layout);
        //layout->addWidget(slider);
        layout->addWidget(plot);
        setLayout(layout);
-       //printf("Proxwidget Constructor just set layout\r\n");
+       printf("Proxwidget Constructor just set layout\r\n");
 }
 
 
 }
 
 
@@ -431,11 +443,11 @@ void Plot::paintEvent(QPaintEvent *event)
        plotGridLines(&painter, plotRect);
 
        //Start painting graph
        plotGridLines(&painter, plotRect);
 
        //Start painting graph
-       PlotGraph(GraphBuffer, GraphTraceLen,plotRect,infoRect,&painter,0);
-       PlotGraph(s_Buff, GraphTraceLen,plotRect,infoRect,&painter,1);
        if (showDemod && DemodBufferLen > 8) {
                PlotDemod(DemodBuffer, DemodBufferLen,plotRect,infoRect,&painter,2,g_DemodStartIdx);
        }
        if (showDemod && DemodBufferLen > 8) {
                PlotDemod(DemodBuffer, DemodBufferLen,plotRect,infoRect,&painter,2,g_DemodStartIdx);
        }
+       PlotGraph(s_Buff, GraphTraceLen,plotRect,infoRect,&painter,1);
+       PlotGraph(GraphBuffer, GraphTraceLen,plotRect,infoRect,&painter,0);
        // End graph drawing
 
        //Draw the cursors
        // End graph drawing
 
        //Draw the cursors
@@ -472,6 +484,7 @@ void Plot::paintEvent(QPaintEvent *event)
 
 Plot::Plot(QWidget *parent) : QWidget(parent), GraphStart(0), GraphPixelsPerPoint(1)
 {
 
 Plot::Plot(QWidget *parent) : QWidget(parent), GraphStart(0), GraphPixelsPerPoint(1)
 {
+       //Need to set this, otherwise we don't receive keypress events
        setFocusPolicy( Qt::StrongFocus);
        resize(600, 300);
 
        setFocusPolicy( Qt::StrongFocus);
        resize(600, 300);
 
Impressum, Datenschutz