]> git.zerfleddert.de Git - proxmark3-svn/blame - client/proxguiqt.h
adjust lf search to not use save/restore if...
[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);
38 QColor getColor(int graphNum);
39public:
40 Plot(QWidget *parent = 0);
41
42protected:
43 void paintEvent(QPaintEvent *event);
44 void closeEvent(QCloseEvent *event);
45 void mouseMoveEvent(QMouseEvent *event);
46 void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
47 void keyPressEvent(QKeyEvent *event);
48
49};
50class ProxGuiQT;
51
52/**
53 * The window with plot and controls
54 */
6658905f 55class ProxWidget : public QWidget
56{
1a3c0064 57 Q_OBJECT; //needed for slot/signal classes
6658905f 58
59 private:
1a3c0064 60 ProxGuiQT *master;
b8fdac9e 61 Plot *plot;
62 Ui::Form *opsController;
1a3c0064 63 QWidget* controlWidget;
64
6658905f 65 public:
b8fdac9e 66 ProxWidget(QWidget *parent = 0, ProxGuiQT *master = NULL);
1a3c0064 67 ~ProxWidget(void);
68 //OpsShow(void);
6658905f 69
1a3c0064 70 protected:
b8fdac9e 71 // void paintEvent(QPaintEvent *event);
1a3c0064 72 void closeEvent(QCloseEvent *event);
73 void showEvent(QShowEvent *event);
74 void hideEvent(QHideEvent *event);
b8fdac9e 75 // void mouseMoveEvent(QMouseEvent *event);
76 // void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
77 // void keyPressEvent(QKeyEvent *event);
78 public slots:
79 void applyOperation();
80 void stickOperation();
81 void vchange_autocorr(int v);
c4f51073 82 void vchange_askedge(int v);
b8fdac9e 83 void vchange_dthr_up(int v);
84 void vchange_dthr_down(int v);
6658905f 85};
86
87class ProxGuiQT : public QObject
88{
89 Q_OBJECT;
90
91 private:
92 QApplication *plotapp;
93 ProxWidget *plotwidget;
94 int argc;
95 char **argv;
96 void (*main_func)(void);
97
98 public:
99 ProxGuiQT(int argc, char **argv);
100 ~ProxGuiQT(void);
101 void ShowGraphWindow(void);
102 void RepaintGraphWindow(void);
103 void HideGraphWindow(void);
104 void MainLoop(void);
1a3c0064 105 void Exit(void);
6658905f 106 private slots:
107 void _ShowGraphWindow(void);
108 void _RepaintGraphWindow(void);
109 void _HideGraphWindow(void);
1a3c0064 110 void _Exit(void);
6658905f 111 signals:
112 void ShowGraphWindowSignal(void);
113 void RepaintGraphWindowSignal(void);
114 void HideGraphWindowSignal(void);
1a3c0064 115 void ExitSignal(void);
6658905f 116};
1a3c0064 117#endif // PROXGUI_QT
Impressum, Datenschutz