| 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: 174 $"
|
|---|
| 26 |
|
|---|
| 27 | QWidget *OpenHistory(char *, int);
|
|---|
| 28 |
|
|---|
| 29 | // Time scale for axis
|
|---|
| 30 | class 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
|
|---|
| 41 | class EddLineDisplay: 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 | EddLineDisplay(QString, int=0, QWidget * = NULL);
|
|---|
| 57 | ~EddLineDisplay();
|
|---|
| 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
|
|---|
| 70 | class EddPlot: public QwtPlot {
|
|---|
| 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 | EddPlot(QString = QString(), int = 0, QWidget * = NULL);
|
|---|
| 102 | ~EddPlot();
|
|---|
| 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
|
|---|
| 121 | class EddText: public QTextEdit {
|
|---|
| 122 | Q_OBJECT
|
|---|
| 123 |
|
|---|
| 124 | QString Name;
|
|---|
| 125 | bool Pure;
|
|---|
| 126 |
|
|---|
| 127 | public:
|
|---|
| 128 | EddText(QString, bool = false, QWidget * = NULL);
|
|---|
| 129 | ~EddText();
|
|---|
| 130 |
|
|---|
| 131 | bool Accumulate;
|
|---|
| 132 |
|
|---|
| 133 | private slots:
|
|---|
| 134 | void Update(QString, int, QByteArray, QString, QString);
|
|---|
| 135 | };
|
|---|
| 136 |
|
|---|
| 137 | // Interface to DIM system
|
|---|
| 138 | class EddDim: 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 | struct HistItem {
|
|---|
| 154 | QString Name;
|
|---|
| 155 | int Count;
|
|---|
| 156 | class EvidenceHistory *HistClass;
|
|---|
| 157 | };
|
|---|
| 158 | QList<HistItem> HistoryList;
|
|---|
| 159 |
|
|---|
| 160 | long long TotalVolume;
|
|---|
| 161 | long long MinuteVolume;
|
|---|
| 162 |
|
|---|
| 163 | void infoHandler();
|
|---|
| 164 |
|
|---|
| 165 | private slots:
|
|---|
| 166 | void Update(QString, int, QByteArray, QString, QString);
|
|---|
| 167 | void UpdateStatistics();
|
|---|
| 168 |
|
|---|
| 169 | public:
|
|---|
| 170 | EddDim();
|
|---|
| 171 | ~EddDim();
|
|---|
| 172 |
|
|---|
| 173 | void Subscribe(QString);
|
|---|
| 174 | void Unsubscribe (QString);
|
|---|
| 175 | class EvidenceHistory *GetHistory(QString);
|
|---|
| 176 |
|
|---|
| 177 | signals:
|
|---|
| 178 | void YEP(QString, int, QByteArray = QByteArray(), QString = QString(), QString = QString());
|
|---|
| 179 | };
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 | // Main window class
|
|---|
| 183 | class GUI: public QMainWindow, public DimBrowser {
|
|---|
| 184 | Q_OBJECT
|
|---|
| 185 |
|
|---|
| 186 | QwtAnalogClock *Clock;
|
|---|
| 187 |
|
|---|
| 188 | QWidget *Central, *MainWidget, *BiasWidget, *FeedbackWidget, *FeedbackDetailsWidget, *EnvironmentWidget;
|
|---|
| 189 | QGridLayout *MainLayout, *BiasLayout, *FeedbackLayout, *FeedbackDetailsLayout, *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 | void FeedbackDetails();
|
|---|
| 204 | };
|
|---|
| 205 |
|
|---|
| 206 | #endif
|
|---|