]> git.zerfleddert.de Git - proxmark3-svn/blame_incremental - client/proxguiqt.h
Merge pull request #277 from pwpiwi/clang_warnings
[proxmark3-svn] / client / proxguiqt.h
... / ...
CommitLineData
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#ifndef PROXGUI_QT
12#define PROXGUI_QT
13
14#include <QApplication>
15#include <QPushButton>
16#include <QObject>
17#include <QWidget>
18#include <QPainter>
19#include <QtGui>
20
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 void setMaxAndStart(int *buffer, int len, QRect plotRect);
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 */
56class ProxWidget : public QWidget
57{
58 Q_OBJECT; //needed for slot/signal classes
59
60 private:
61 ProxGuiQT *master;
62 Plot *plot;
63 Ui::Form *opsController;
64 QWidget* controlWidget;
65
66 public:
67 ProxWidget(QWidget *parent = 0, ProxGuiQT *master = NULL);
68 ~ProxWidget(void);
69 //OpsShow(void);
70
71 protected:
72 // void paintEvent(QPaintEvent *event);
73 void closeEvent(QCloseEvent *event);
74 void showEvent(QShowEvent *event);
75 void hideEvent(QHideEvent *event);
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);
83 void vchange_askedge(int v);
84 void vchange_dthr_up(int v);
85 void vchange_dthr_down(int v);
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);
106 void Exit(void);
107 private slots:
108 void _ShowGraphWindow(void);
109 void _RepaintGraphWindow(void);
110 void _HideGraphWindow(void);
111 void _Exit(void);
112 signals:
113 void ShowGraphWindowSignal(void);
114 void RepaintGraphWindowSignal(void);
115 void HideGraphWindowSignal(void);
116 void ExitSignal(void);
117};
118#endif // PROXGUI_QT
Impressum, Datenschutz