]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/proxguiqt.h
new grid X offset calcs to fix some issues
[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
6658905f 14#include <QApplication>
15#include <QPushButton>
16#include <QObject>
17#include <QWidget>
18#include <QPainter>
b8fdac9e 19#include <QtGui>
6658905f 20
b8fdac9e 21#include "ui/ui_overlays.h"
22/**
23 * @brief The actual plot, black area were we paint the graph
24 */
25class Plot: public QWidget
26{
27private:
28 int GraphStart;
29 double GraphPixelsPerPoint;
30 int CursorAPos;
31 int CursorBPos;
32 void PlotGraph(int *buffer, int len, QRect r,QRect r2, QPainter* painter, int graphNum);
33 void PlotDemod(uint8_t *buffer, size_t len, QRect r,QRect r2, QPainter* painter, int graphNum, int plotOffset);
34 void plotGridLines(QPainter* painter,QRect r);
35 int xCoordOf(int i, QRect r );
36 int yCoordOf(int v, QRect r, int maxVal);
37 int valueOf_yCoord(int y, QRect r, int maxVal);
999d57c2 38 void setMaxAndStart(int *buffer, int len, QRect plotRect);
b8fdac9e 39 QColor getColor(int graphNum);
40public:
41 Plot(QWidget *parent = 0);
42
43protected:
44 void paintEvent(QPaintEvent *event);
45 void closeEvent(QCloseEvent *event);
46 void mouseMoveEvent(QMouseEvent *event);
47 void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
48 void keyPressEvent(QKeyEvent *event);
49
50};
51class ProxGuiQT;
52
53/**
54 * The window with plot and controls
55 */
6658905f 56class ProxWidget : public QWidget
57{
1a3c0064 58 Q_OBJECT; //needed for slot/signal classes
6658905f 59
60 private:
1a3c0064 61 ProxGuiQT *master;
b8fdac9e 62 Plot *plot;
63 Ui::Form *opsController;
1a3c0064 64 QWidget* controlWidget;
65
6658905f 66 public:
b8fdac9e 67 ProxWidget(QWidget *parent = 0, ProxGuiQT *master = NULL);
1a3c0064 68 ~ProxWidget(void);
69 //OpsShow(void);
6658905f 70
1a3c0064 71 protected:
b8fdac9e 72 // void paintEvent(QPaintEvent *event);
1a3c0064 73 void closeEvent(QCloseEvent *event);
74 void showEvent(QShowEvent *event);
75 void hideEvent(QHideEvent *event);
b8fdac9e 76 // void mouseMoveEvent(QMouseEvent *event);
77 // void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
78 // void keyPressEvent(QKeyEvent *event);
79 public slots:
80 void applyOperation();
81 void stickOperation();
82 void vchange_autocorr(int v);
c4f51073 83 void vchange_askedge(int v);
b8fdac9e 84 void vchange_dthr_up(int v);
85 void vchange_dthr_down(int v);
6658905f 86};
87
88class ProxGuiQT : public QObject
89{
90 Q_OBJECT;
91
92 private:
93 QApplication *plotapp;
94 ProxWidget *plotwidget;
95 int argc;
96 char **argv;
97 void (*main_func)(void);
98
99 public:
100 ProxGuiQT(int argc, char **argv);
101 ~ProxGuiQT(void);
102 void ShowGraphWindow(void);
103 void RepaintGraphWindow(void);
104 void HideGraphWindow(void);
105 void MainLoop(void);
1a3c0064 106 void Exit(void);
6658905f 107 private slots:
108 void _ShowGraphWindow(void);
109 void _RepaintGraphWindow(void);
110 void _HideGraphWindow(void);
1a3c0064 111 void _Exit(void);
6658905f 112 signals:
113 void ShowGraphWindowSignal(void);
114 void RepaintGraphWindowSignal(void);
115 void HideGraphWindowSignal(void);
1a3c0064 116 void ExitSignal(void);
6658905f 117};
1a3c0064 118#endif // PROXGUI_QT
Impressum, Datenschutz