1 | /***************************************************************************
|
---|
2 | mirrorselector.h - description
|
---|
3 | -------------------
|
---|
4 | begin : Sat Nov 23 2002
|
---|
5 | copyright : (C) 2002 by Martin Merck
|
---|
6 | email : merck@astro.uni-wuerzburg.de
|
---|
7 | ***************************************************************************/
|
---|
8 |
|
---|
9 | /***************************************************************************
|
---|
10 | * *
|
---|
11 | * This program is part of the MAGIC control software for the AMC. *
|
---|
12 | * The software is only intended for use in the MAGIC telescope project *
|
---|
13 | * All rights remain with the author. *
|
---|
14 | ***************************************************************************/
|
---|
15 |
|
---|
16 | #ifndef MIRRORSELECTOR_H
|
---|
17 | #define MIRRORSELECTOR_H
|
---|
18 |
|
---|
19 | #include <qbuttongroup.h>
|
---|
20 |
|
---|
21 | class AMCPushButton;
|
---|
22 | class AMCMirrorPanel;
|
---|
23 | class QGridLayout;
|
---|
24 |
|
---|
25 | /**This widget contains a Buttongroup for all
|
---|
26 | * the mirror panels.
|
---|
27 | *@author Martin Merck
|
---|
28 | */
|
---|
29 |
|
---|
30 | class MirrorSelector : public QButtonGroup {
|
---|
31 | Q_OBJECT
|
---|
32 | public:
|
---|
33 | MirrorSelector(QWidget *parent=0, const char *name=0);
|
---|
34 | ~MirrorSelector();
|
---|
35 |
|
---|
36 | /** No descriptions */
|
---|
37 | // void saveMirrorPanels();
|
---|
38 | /** Check to see if the right mouse button was pressed and show the context menu in this case. */
|
---|
39 | void mousePressEvent( QMouseEvent* p_pEvent );
|
---|
40 |
|
---|
41 | public: // Public attributes
|
---|
42 |
|
---|
43 | /** Array containing the buttons for the individual mirror panels */
|
---|
44 | AMCPushButton* m_mirrorButton[17][17];
|
---|
45 | /** Our own widget for selecting individual mirror panels */
|
---|
46 | QGridLayout* m_mirrorGroupLayout;
|
---|
47 |
|
---|
48 | protected slots: // Protected slots
|
---|
49 |
|
---|
50 | /** Hanling a selection of a panel by the user */
|
---|
51 | virtual void buttonSelectedSlot( int );
|
---|
52 | /** Save the positions to the file. */
|
---|
53 | void savePositionsSlot();
|
---|
54 |
|
---|
55 | private: // Private attributes
|
---|
56 |
|
---|
57 | /** Array containing the abstraction of the mirror definitions */
|
---|
58 | AMCMirrorPanel* m_Panel[17][17];
|
---|
59 | /** Number of panels really installed */
|
---|
60 | int m_iNumPanels;
|
---|
61 | /** Context menu, shown when the user hits the right mouse button. */
|
---|
62 | QPopupMenu* m_contextMenu;
|
---|
63 |
|
---|
64 | signals: // Signals
|
---|
65 |
|
---|
66 | /** We propagate the selection with the pointer to the AMCMirrorPanel
|
---|
67 | datastructure as a parameter.
|
---|
68 | */
|
---|
69 | void panelSelectedSignal( AMCMirrorPanel* );
|
---|
70 |
|
---|
71 | private: // Private methods
|
---|
72 |
|
---|
73 | /** Read he panel descriptions from the file "Panels.txt".
|
---|
74 | This file contains for each panel a line with the following contents:
|
---|
75 | i j type port box driver installed
|
---|
76 |
|
---|
77 | i: is the first panel index (counting from left to right)
|
---|
78 | j: is the second panel index (counting from bottom to top)
|
---|
79 | type: the panel type (see the file for a description of types)
|
---|
80 | port: the serial port this box is connected to.
|
---|
81 | (The numbering corresponds to the numbers on the cables.
|
---|
82 | If only 1 Meilhaus ME8100 card is installed on linux boxes
|
---|
83 | we have the following correspondance to device files
|
---|
84 | port 1 == /dev/ttyS4 ... port 8 = /dev/ttyS11)
|
---|
85 | box: the number of the AMC box.
|
---|
86 | driver: The internal AMC driver to which this panel is connected.
|
---|
87 | installed: Flag indicating if this panel is installed (0=no, 1=yes)
|
---|
88 | */
|
---|
89 | // void readPanelDescription();
|
---|
90 |
|
---|
91 | /** Here we read the stored panel positions from the file PanelPos.txt
|
---|
92 | We then go through all panels, center them and go to the stored position.
|
---|
93 | */
|
---|
94 | void initPanelPositions();
|
---|
95 |
|
---|
96 | /** Read the stored panel positions from the file "PanelPos.txt"
|
---|
97 | This file contains for each panel a line with the following contents:
|
---|
98 | i j X Y
|
---|
99 |
|
---|
100 | i: is the first panel index (counting from left to right)
|
---|
101 | j: is the second panel index (counting from bottom to top)
|
---|
102 | X: position of the X motor relative to the center position
|
---|
103 | Y: position of the Y motor relative to the center position
|
---|
104 | */
|
---|
105 | // void readPanelPositions();
|
---|
106 | };
|
---|
107 |
|
---|
108 | #endif
|
---|