source: Evidence/Edd/Edd.h@ 168

Last change on this file since 168 was 168, checked in by ogrimm, 15 years ago
Conversion to string can now handle arrays and structures
  • Property svn:keywords set to Revision
File size: 4.1 KB
Line 
1#ifndef EDD_H_SEEN
2#define EDD_H_SEEN
3
4#include <QtGui>
5
6#include <qwt_plot.h>
7#include <qwt_plot_curve.h>
8#include <qwt_plot_grid.h>
9#include <qwt_plot_zoomer.h>
10#include <qwt_plot_panner.h>
11#include <qwt_scale_engine.h>
12#include <qwt_analog_clock.h>
13#include <qwt_scale_widget.h>
14#include <qwt_plot_layout.h>
15#include <qwt_legend.h>
16#include <qwt_legend_item.h>
17#include <qwt_symbol.h>
18
19#include <limits.h>
20#include <float.h>
21
22#include "dic.hxx"
23#include "Evidence.h"
24
25#define SVN_REVISION "$Revision: 168 $"
26
27QWidget *OpenHistory(char *, int);
28
29// Time scale for axis
30class TimeScale: public QwtScaleDraw {
31 public:
32 TimeScale() { }
33 virtual QwtText label(double v) const {
34 QDateTime t = QDateTime::fromTime_t((int) v);
35 return t.toString("dMMM'\n'hh:mm:ss");
36 }
37};
38
39
40// General indicator for DIM service
41class Edd_Indicator: public QLineEdit {
42 Q_OBJECT
43
44 QMenu *Menu;
45 QPoint dragStart;
46 QWidget *LastPlot;
47
48 QString ServiceName;
49 int Index;
50
51 void mousePressEvent(QMouseEvent *);
52 void mouseReleaseEvent(QMouseEvent *);
53 void mouseMoveEvent(QMouseEvent *);
54
55 public:
56 Edd_Indicator(QString, int=0, QWidget * = NULL);
57 ~Edd_Indicator();
58
59 bool ShowAsTime;
60
61 private slots:
62 void Update(DimInfo *, int, QByteArray, QString);
63 void contextMenuEvent(QContextMenuEvent *);
64 void MenuOpenHistory();
65 void MenuCopyService();
66 void MenuCopyData();
67};
68
69// Graph class for history display
70class Edd_Plot: public QwtPlot, public EvidenceHistory {
71 Q_OBJECT
72
73 struct PlotItem {
74 QString Name;
75 QwtPlotCurve *Signal;
76 double Smallest;
77 double Largest;
78 int SizeLimit;
79 QVector<double> x;
80 QVector<double> y;
81 int Index;
82 };
83
84 QList<struct PlotItem> Items;
85 QMutex *Mutex;
86
87 QMenu *Menu;
88 QAction *YLogAction;
89 QAction *NormAction;
90 QAction *StyleAction;
91
92 QwtPlotPanner *Panner;
93 QwtPlotGrid *Grid;
94 QwtPlotZoomer *Zoomer;
95 QwtLegend *Legend;
96
97 void dragEnterEvent(QDragEnterEvent *);
98 void dropEvent(QDropEvent *);
99
100 public:
101 Edd_Plot(QString = QString(), int = 0, QWidget * = NULL);
102 ~Edd_Plot();
103 void AddService(QString, int = 0);
104
105 private slots:
106 void UpdatePlot();
107 void Update(DimInfo* Info, int, QByteArray, QString);
108
109 void HandleZoom(const QwtDoubleRect &);
110 void contextMenuEvent(QContextMenuEvent *);
111 void LegendClicked(QwtPlotItem *);
112 void MenuZoomOut();
113 void MenuSingleTrace();
114 void MenuSaveASCII();
115 void MenuSave();
116 void MenuPrint();
117 void MenuPasteService();
118};
119
120// Text history class
121class Edd_TextHist: public QTextEdit, public EvidenceHistory {
122 Q_OBJECT
123
124 QString Name;
125
126 public:
127 Edd_TextHist(QString, QWidget * = NULL);
128 ~Edd_TextHist();
129
130 private slots:
131 void Update(DimInfo* Info, int, QByteArray, QString);
132};
133
134// Textout indicator for DIM service
135class Edd_Textout: public QTextEdit, public EvidenceHistory {
136 Q_OBJECT
137
138 QString Name;
139
140 public:
141 Edd_Textout(QString, QWidget * = NULL);
142 ~Edd_Textout();
143
144 bool Accumulate;
145
146 private slots:
147 void Update(DimInfo* Info, int, QByteArray, QString);
148};
149
150// Interface to DIM system
151class Edd_DIM: public QObject, public DimInfo {
152 Q_OBJECT
153
154 struct Item {
155 QString Name;
156 DimStampedInfo *DIMService;
157 int Count;
158 int TimeStamp;
159 QByteArray ByteArray;
160 QString Text;
161 };
162 QList<Item> ServiceList;
163 QMutex *Mutex;
164
165 void infoHandler();
166
167 private slots:
168 void Update(DimInfo *, int, QByteArray, QString);
169
170 public:
171 Edd_DIM();
172 ~Edd_DIM();
173
174 void Subscribe(QString);
175 void Unsubscribe (QString);
176
177 signals:
178 void YEP(DimInfo *, int, QByteArray = QByteArray(), QString = QString());
179};
180
181
182// Main window class
183class GUI: public QMainWindow, public DimBrowser {
184 Q_OBJECT
185
186 QwtAnalogClock *Clock;
187
188 QWidget *Central, *MainWidget, *BiasWidget, *FeedbackWidget, *EnvironmentWidget;
189 QGridLayout *MainLayout, *BiasLayout, *FeedbackLayout, *EnvironmentLayout;
190
191 QTabWidget *TabWidget;
192
193 void closeEvent(QCloseEvent *);
194
195 public:
196 GUI();
197 ~GUI();
198
199 private slots:
200 void MenuAbout();
201 void MenuNewHistory();
202 void StartDIMBrowser();
203};
204
205#endif
Note: See TracBrowser for help on using the repository browser.