]>
Commit | Line | Data |
---|---|---|
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> | |
0d704c7f | 16 | #include <QtGui> |
6658905f | 17 | |
0d704c7f MHS |
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; | |
58a0fa74 | 29 | void PlotGraph(int *buffer, int len, QRect r,QRect r2, QPainter* painter, int graphNum); |
0d704c7f | 30 | void plotGridLines(QPainter* painter,QRect r); |
58a0fa74 | 31 | int xCoordOf(int i, QRect r ); |
0d704c7f MHS |
32 | int yCoordOf(int v, QRect r, int maxVal); |
33 | int valueOf_yCoord(int y, QRect r, int maxVal); | |
34 | QColor getColor(int graphNum); | |
35 | public: | |
36 | Plot(QWidget *parent = 0); | |
37 | ||
38 | protected: | |
39 | void paintEvent(QPaintEvent *event); | |
40 | void closeEvent(QCloseEvent *event); | |
41 | void mouseMoveEvent(QMouseEvent *event); | |
42 | void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); } | |
43 | void keyPressEvent(QKeyEvent *event); | |
44 | ||
45 | }; | |
46 | class ProxGuiQT; | |
47 | ||
48 | /** | |
49 | * The window with plot and controls | |
50 | */ | |
6658905f | 51 | class ProxWidget : public QWidget |
52 | { | |
53 | Q_OBJECT; | |
0d704c7f MHS |
54 | private: |
55 | Plot *plot; | |
56 | Ui::Form *opsController; | |
57 | ProxGuiQT *master; | |
58 | public: | |
59 | ProxWidget(QWidget *parent = 0, ProxGuiQT *master = NULL); | |
6658905f | 60 | |
0d704c7f MHS |
61 | //signals: |
62 | // void mySignal(); | |
6658905f | 63 | |
0d704c7f MHS |
64 | public slots: |
65 | void applyOperation(); | |
66 | void stickOperation(); | |
67 | void vchange_autocorr(int v); | |
68 | void vchange_dthr_up(int v); | |
69 | void vchange_dthr_down(int v); | |
70 | //void tabChange(int currentTab); | |
6658905f | 71 | }; |
0d704c7f MHS |
72 | /* |
73 | class ProxGuiOverlayController: public UI_form | |
74 | { | |
75 | Q_OBJECT; | |
76 | public: | |
77 | void setupOverlayUi(QWidget *Form) | |
78 | { | |
79 | //Let auto-generated class setup the UI | |
80 | Ui_Form::setupUi(Form); | |
81 | //Then connect the signals | |
82 | ||
83 | QObject::connect(UI_form::pushButton_apply, SIGNAL(clicked()), label_4, SLOT(clear())); | |
84 | QObject::connect(pushButton_sticky, SIGNAL(clicked()), label_4, SLOT(clear())); | |
85 | QObject::connect(horizontalSlider_window, SIGNAL(valueChanged(int)), label_4, SLOT(setNum(int))); | |
86 | QObject::connect(horizontalSlider_window, SIGNAL(valueChanged(int)), label_5, SLOT(setNum(int))); | |
87 | QObject::connect(horizontalSlider_dirthr_up, SIGNAL(valueChanged(int)), label_6, SLOT(setNum(int))); | |
88 | QObject::connect(horizontalSlider_dirthr_down, SIGNAL(valueChanged(int)), label_7, SLOT(setNum(int))); | |
89 | QMetaObject::connectSlotsByName(Form); | |
6658905f | 90 | |
0d704c7f MHS |
91 | } |
92 | }; | |
93 | */ | |
6658905f | 94 | class ProxGuiQT : public QObject |
95 | { | |
96 | Q_OBJECT; | |
97 | ||
98 | private: | |
99 | QApplication *plotapp; | |
100 | ProxWidget *plotwidget; | |
0d704c7f | 101 | //ProxGuiOverlayController *overlayController; |
6658905f | 102 | int argc; |
103 | char **argv; | |
104 | void (*main_func)(void); | |
0d704c7f | 105 | |
6658905f | 106 | public: |
107 | ProxGuiQT(int argc, char **argv); | |
108 | ~ProxGuiQT(void); | |
109 | void ShowGraphWindow(void); | |
110 | void RepaintGraphWindow(void); | |
111 | void HideGraphWindow(void); | |
112 | void MainLoop(void); | |
113 | ||
114 | private slots: | |
115 | void _ShowGraphWindow(void); | |
116 | void _RepaintGraphWindow(void); | |
117 | void _HideGraphWindow(void); | |
118 | ||
119 | signals: | |
120 | void ShowGraphWindowSignal(void); | |
121 | void RepaintGraphWindowSignal(void); | |
122 | void HideGraphWindowSignal(void); | |
123 | }; |