source: Evidence/Edd/Edd.h@ 172

Last change on this file since 172 was 171, checked in by ogrimm, 15 years ago
Various updates
  • Property svn:keywords set to Revision
File size: 4.0 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: 171 $"
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(QString, int, QByteArray, QString, 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 Update(QString, int, QByteArray, QString, QString);
107 void UpdatePlot();
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 and output class
121class Edd_TextHist: public QTextEdit, public EvidenceHistory {
122 Q_OBJECT
123
124 QString Name;
125 bool Pure;
126
127 public:
128 Edd_TextHist(QString, bool = false, QWidget * = NULL);
129 ~Edd_TextHist();
130
131 bool Accumulate;
132
133 private slots:
134 void Update(QString, int, QByteArray, QString, QString);
135};
136
137// Interface to DIM system
138class Edd_DIM: public QObject, public DimInfo {
139 Q_OBJECT
140
141 struct Item {
142 QString Name;
143 DimStampedInfo *DIMService;
144 int Count;
145 int TimeStamp;
146 QByteArray ByteArray;
147 QString Format;
148 QString Text;
149 };
150 QList<Item> ServiceList;
151 QMutex *Mutex;
152
153 long long TotalVolume;
154 long long MinuteVolume;
155
156 void infoHandler();
157
158 private slots:
159 void Update(QString, int, QByteArray, QString, QString);
160 void UpdateStatistics();
161
162 public:
163 Edd_DIM();
164 ~Edd_DIM();
165
166 void Subscribe(QString);
167 void Unsubscribe (QString);
168
169 signals:
170 void YEP(QString, int, QByteArray = QByteArray(), QString = QString(), QString = QString());
171};
172
173
174// Main window class
175class GUI: public QMainWindow, public DimBrowser {
176 Q_OBJECT
177
178 QwtAnalogClock *Clock;
179
180 QWidget *Central, *MainWidget, *BiasWidget, *FeedbackWidget, *EnvironmentWidget;
181 QGridLayout *MainLayout, *BiasLayout, *FeedbackLayout, *EnvironmentLayout;
182
183 QTabWidget *TabWidget;
184
185 void closeEvent(QCloseEvent *);
186
187 public:
188 GUI();
189 ~GUI();
190
191 private slots:
192 void MenuAbout();
193 void MenuNewHistory();
194 void StartDIMBrowser();
195};
196
197#endif
Note: See TracBrowser for help on using the repository browser.