]> git.zerfleddert.de Git - proxmark3-svn/blame - client/proxguiqt.h
fix: hf mf hardnested failed with new WUPA timing
[proxmark3-svn] / client / proxguiqt.h
CommitLineData
a553f267 1//-----------------------------------------------------------------------------
212ef3a0 2// Copyright (C) 2009 Michael Gernoth <michael at gernoth.net>
3//
a553f267 4// This code is licensed to you under the terms of the GNU GPL, version 2 or,
5// at your option, any later version. See the LICENSE.txt file for the text of
6// the license.
7//-----------------------------------------------------------------------------
8// GUI (QT)
9//-----------------------------------------------------------------------------
10
1a3c0064 11#ifndef PROXGUI_QT
12#define PROXGUI_QT
13
b8208bda 14#include <stdint.h>
15#include <string.h>
16
6658905f 17#include <QApplication>
18#include <QPushButton>
19#include <QObject>
20#include <QWidget>
21#include <QPainter>
b8fdac9e 22#include <QtGui>
6658905f 23
b8fdac9e 24#include "ui/ui_overlays.h"
25/**
26 * @brief The actual plot, black area were we paint the graph
27 */
28class Plot: public QWidget
29{
30private:
31 int GraphStart;
32 double GraphPixelsPerPoint;
33 int CursorAPos;
34 int CursorBPos;
35 void PlotGraph(int *buffer, int len, QRect r,QRect r2, QPainter* painter, int graphNum);
36 void PlotDemod(uint8_t *buffer, size_t len, QRect r,QRect r2, QPainter* painter, int graphNum, int plotOffset);
37 void plotGridLines(QPainter* painter,QRect r);
38 int xCoordOf(int i, QRect r );
39 int yCoordOf(int v, QRect r, int maxVal);
40 int valueOf_yCoord(int y, QRect r, int maxVal);
999d57c2 41 void setMaxAndStart(int *buffer, int len, QRect plotRect);
b8fdac9e 42 QColor getColor(int graphNum);
43public:
44 Plot(QWidget *parent = 0);
45
46protected:
47 void paintEvent(QPaintEvent *event);
48 void closeEvent(QCloseEvent *event);
49 void mouseMoveEvent(QMouseEvent *event);
50 void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
51 void keyPressEvent(QKeyEvent *event);
52
53};
54class ProxGuiQT;
55
56/**
57 * The window with plot and controls
58 */
6658905f 59class ProxWidget : public QWidget
60{
1a3c0064 61 Q_OBJECT; //needed for slot/signal classes
6658905f 62
63 private:
1a3c0064 64 ProxGuiQT *master;
b8fdac9e 65 Plot *plot;
66 Ui::Form *opsController;
1a3c0064 67 QWidget* controlWidget;
68
6658905f 69 public:
b8fdac9e 70 ProxWidget(QWidget *parent = 0, ProxGuiQT *master = NULL);
1a3c0064 71 ~ProxWidget(void);
72 //OpsShow(void);
6658905f 73
1a3c0064 74 protected:
b8fdac9e 75 // void paintEvent(QPaintEvent *event);
1a3c0064 76 void closeEvent(QCloseEvent *event);
77 void showEvent(QShowEvent *event);
78 void hideEvent(QHideEvent *event);
b8fdac9e 79 // void mouseMoveEvent(QMouseEvent *event);
80 // void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
81 // void keyPressEvent(QKeyEvent *event);
82 public slots:
83 void applyOperation();
84 void stickOperation();
85 void vchange_autocorr(int v);
c4f51073 86 void vchange_askedge(int v);
b8fdac9e 87 void vchange_dthr_up(int v);
88 void vchange_dthr_down(int v);
6658905f 89};
90
aa757f71
OM
91class WorkerThread : public QThread {
92 Q_OBJECT;
93 public:
3851172d 94 WorkerThread(char*, char*, bool);
aa757f71
OM
95 ~WorkerThread();
96 void run();
97 private:
98 char *script_cmds_file = NULL;
99 char *script_cmd = NULL;
100 bool usb_present;
101};
102
6658905f 103class ProxGuiQT : public QObject
104{
105 Q_OBJECT;
106
107 private:
108 QApplication *plotapp;
109 ProxWidget *plotwidget;
110 int argc;
111 char **argv;
112 void (*main_func)(void);
aa757f71 113 WorkerThread *proxmarkThread;
6658905f 114
115 public:
aa757f71 116 ProxGuiQT(int argc, char **argv, WorkerThread *wthread);
6658905f 117 ~ProxGuiQT(void);
118 void ShowGraphWindow(void);
119 void RepaintGraphWindow(void);
120 void HideGraphWindow(void);
121 void MainLoop(void);
1a3c0064 122 void Exit(void);
6658905f 123 private slots:
124 void _ShowGraphWindow(void);
125 void _RepaintGraphWindow(void);
126 void _HideGraphWindow(void);
1a3c0064 127 void _Exit(void);
aa757f71 128 void _StartProxmarkThread(void);
6658905f 129 signals:
130 void ShowGraphWindowSignal(void);
131 void RepaintGraphWindowSignal(void);
132 void HideGraphWindowSignal(void);
1a3c0064 133 void ExitSignal(void);
6658905f 134};
5acd195d 135
1a3c0064 136#endif // PROXGUI_QT
Impressum, Datenschutz