]> git.zerfleddert.de Git - proxmark3-svn/blob - client/proxguiqt.h
fa1ba018d756874da56182ce6658e8c53e3798bb
[proxmark3-svn] / client / proxguiqt.h
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2009 Michael Gernoth <michael at gernoth.net>
3 //
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
11 #include <QApplication>
12 #include <QPushButton>
13 #include <QObject>
14 #include <QWidget>
15 #include <QPainter>
16 #include <QtGui>
17
18 #include "ui/ui_overlays.h"
19 /**
20 * @brief The actual plot, black area were we paint the graph
21 */
22 class Plot: public QWidget
23 {
24 private:
25 int GraphStart;
26 double GraphPixelsPerPoint;
27 int CursorAPos;
28 int CursorBPos;
29 void PlotGraph(int *buffer, int len, QRect r,QRect r2, QPainter* painter, int graphNum);
30 void PlotDemod(uint8_t *buffer, size_t len, QRect r,QRect r2, QPainter* painter, int graphNum, int plotOffset);
31 void plotGridLines(QPainter* painter,QRect r);
32 int xCoordOf(int i, QRect r );
33 int yCoordOf(int v, QRect r, int maxVal);
34 int valueOf_yCoord(int y, QRect r, int maxVal);
35 QColor getColor(int graphNum);
36 public:
37 Plot(QWidget *parent = 0);
38
39 protected:
40 void paintEvent(QPaintEvent *event);
41 void closeEvent(QCloseEvent *event);
42 void mouseMoveEvent(QMouseEvent *event);
43 void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
44 void keyPressEvent(QKeyEvent *event);
45
46 };
47 class ProxGuiQT;
48
49 /**
50 * The window with plot and controls
51 */
52 class ProxWidget : public QWidget
53 {
54 Q_OBJECT;
55
56 private:
57 Plot *plot;
58 Ui::Form *opsController;
59 ProxGuiQT *master;
60
61 public:
62 ProxWidget(QWidget *parent = 0, ProxGuiQT *master = NULL);
63
64 //protected:
65 // void paintEvent(QPaintEvent *event);
66 // void closeEvent(QCloseEvent *event);
67 // void mouseMoveEvent(QMouseEvent *event);
68 // void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
69 // void keyPressEvent(QKeyEvent *event);
70 public slots:
71 void applyOperation();
72 void stickOperation();
73 void vchange_autocorr(int v);
74 void vchange_askedge(int v);
75 void vchange_dthr_up(int v);
76 void vchange_dthr_down(int v);
77 };
78
79 class ProxGuiQT : public QObject
80 {
81 Q_OBJECT;
82
83 private:
84 QApplication *plotapp;
85 ProxWidget *plotwidget;
86 int argc;
87 char **argv;
88 void (*main_func)(void);
89
90 public:
91 ProxGuiQT(int argc, char **argv);
92 ~ProxGuiQT(void);
93 void ShowGraphWindow(void);
94 void RepaintGraphWindow(void);
95 void HideGraphWindow(void);
96 void MainLoop(void);
97
98 private slots:
99 void _ShowGraphWindow(void);
100 void _RepaintGraphWindow(void);
101 void _HideGraphWindow(void);
102
103 signals:
104 void ShowGraphWindowSignal(void);
105 void RepaintGraphWindowSignal(void);
106 void HideGraphWindowSignal(void);
107 };
Impressum, Datenschutz