| 1 | #include <string>
|
|---|
| 2 |
|
|---|
| 3 | #include <QtGui>
|
|---|
| 4 | #include <QtNetwork/QTcpSocket>
|
|---|
| 5 | #include <QtNetwork/QAbstractSocket>
|
|---|
| 6 |
|
|---|
| 7 | #include <qwt_plot.h>
|
|---|
| 8 | #include <qwt_plot_curve.h>
|
|---|
| 9 | #include <qwt_plot_grid.h>
|
|---|
| 10 | #include <qwt_plot_zoomer.h>
|
|---|
| 11 | #include <qwt_plot_panner.h>
|
|---|
| 12 |
|
|---|
| 13 | #include "../../drsdaq/RawDataCTX.h"
|
|---|
| 14 | #include "../../pixelmap/PixelMap.h"
|
|---|
| 15 |
|
|---|
| 16 | #define SOCKET_TIMEOUT 10000 // Milliseconds to wait for socket connection
|
|---|
| 17 | #define MAX_OUTPUT_LINES 200 // Maximum number of lines in socket output window
|
|---|
| 18 | #define MAX_COM_SIZE 10000
|
|---|
| 19 | #define INITIAL_DIRECTORY ""
|
|---|
| 20 |
|
|---|
| 21 | // Main window class
|
|---|
| 22 | class ddd : public QMainWindow {
|
|---|
| 23 | Q_OBJECT
|
|---|
| 24 |
|
|---|
| 25 | QPushButton *GetButton, *SocketButton, *Connect;
|
|---|
| 26 | QCheckBox *ContinuousBox;
|
|---|
| 27 | QToolButton *LoadButton;
|
|---|
| 28 | QLineEdit *FilenameBox, *IPAddress, *Command, *PixelID;
|
|---|
| 29 | QSpinBox *EventNo, *ChannelNo, *BoardNo, *Port;
|
|---|
| 30 | QPlainTextEdit *RunHeaderDisplay, *EventHeaderDisplay, *SocketOutput;
|
|---|
| 31 | QTabWidget *TabWidget;
|
|---|
| 32 | QTcpSocket *Socket;
|
|---|
| 33 | QWidget *SocketWindow, *Central;
|
|---|
| 34 | QAction *OpenAction, *ConnectAction;
|
|---|
| 35 | QGridLayout *SocketLayout, *MainLayout;
|
|---|
| 36 | QFormLayout *CommandLayout, *PortLayout, *AddressLayout, *FormLayout, *SpinLayout;
|
|---|
| 37 |
|
|---|
| 38 | QwtPlot *Graph;
|
|---|
| 39 | QwtPlotZoomer *Zoomer;
|
|---|
| 40 | QwtPlotCurve *Signal;
|
|---|
| 41 | QwtPlotPanner *Panner;
|
|---|
| 42 | QwtPlotGrid *Grid;
|
|---|
| 43 |
|
|---|
| 44 | void closeEvent(QCloseEvent *);
|
|---|
| 45 |
|
|---|
| 46 | bool ManualDisconnect, WaitForData;
|
|---|
| 47 | RawDataCTX *RD;
|
|---|
| 48 | PixelMap *PixMap;
|
|---|
| 49 |
|
|---|
| 50 | public:
|
|---|
| 51 | ddd();
|
|---|
| 52 | ~ddd();
|
|---|
| 53 | void CloseDatafile();
|
|---|
| 54 |
|
|---|
| 55 | private slots:
|
|---|
| 56 | void OpenDatafile();
|
|---|
| 57 | void DisplayEvent(int=0);
|
|---|
| 58 | void FileDialog();
|
|---|
| 59 | void OpenSocketWindow();
|
|---|
| 60 | void GetSignalFromSocket();
|
|---|
| 61 | void MakeConnection();
|
|---|
| 62 | void SendToSocket();
|
|---|
| 63 | void ReadFromSocket();
|
|---|
| 64 | void GotDisconnected();
|
|---|
| 65 | void TranslatePixelID();
|
|---|
| 66 |
|
|---|
| 67 | void MenuSave();
|
|---|
| 68 | void MenuPrint();
|
|---|
| 69 | void MenuHelp();
|
|---|
| 70 | void MenuAbout();
|
|---|
| 71 | };
|
|---|
| 72 |
|
|---|