]> git.zerfleddert.de Git - proxmark3-svn/blame - client/proxguiqt.h
apply @holiman s graph changes +
[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
6658905f 11#include <QApplication>
12#include <QPushButton>
13#include <QObject>
14#include <QWidget>
15#include <QPainter>
b8fdac9e 16#include <QtGui>
6658905f 17
b8fdac9e 18#include "ui/ui_overlays.h"
19/**
20 * @brief The actual plot, black area were we paint the graph
21 */
22class Plot: public QWidget
23{
24private:
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);
36public:
37 Plot(QWidget *parent = 0);
38
39protected:
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};
47class ProxGuiQT;
48
49/**
50 * The window with plot and controls
51 */
6658905f 52class ProxWidget : public QWidget
53{
54 Q_OBJECT;
55
56 private:
b8fdac9e 57 Plot *plot;
58 Ui::Form *opsController;
59 ProxGuiQT *master;
60
6658905f 61 public:
b8fdac9e 62 ProxWidget(QWidget *parent = 0, ProxGuiQT *master = NULL);
6658905f 63
b8fdac9e 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_dthr_up(int v);
75 void vchange_dthr_down(int v);
6658905f 76};
77
78class ProxGuiQT : public QObject
79{
80 Q_OBJECT;
81
82 private:
83 QApplication *plotapp;
84 ProxWidget *plotwidget;
85 int argc;
86 char **argv;
87 void (*main_func)(void);
88
89 public:
90 ProxGuiQT(int argc, char **argv);
91 ~ProxGuiQT(void);
92 void ShowGraphWindow(void);
93 void RepaintGraphWindow(void);
94 void HideGraphWindow(void);
95 void MainLoop(void);
96
97 private slots:
98 void _ShowGraphWindow(void);
99 void _RepaintGraphWindow(void);
100 void _HideGraphWindow(void);
101
102 signals:
103 void ShowGraphWindowSignal(void);
104 void RepaintGraphWindowSignal(void);
105 void HideGraphWindowSignal(void);
106};
Impressum, Datenschutz