qmca  0.0.20
mcacontrolpanel.cpp
Go to the documentation of this file.
1 #include "mcacontrolpanel.h"
2 #include "epicsmca.h"
3 #include <QGridLayout>
4 #include <QLabel>
5 #include <QPushButton>
6 #include "epicsdoubledisplay.h"
7 #include "epicsdoubleinput.h"
8 #include "epicsstringlineedit.h"
9 #include "epicsdoublelineedit.h"
10 #include "mcagroup.h"
11 #include "mcacontroller.h"
12 
14  : QFrame(parent),
15  m_Controller(ctl),
16  m_GridLayout(NULL),
17  m_Erase(NULL),
18  m_Start(NULL),
19  m_Stop(NULL),
20  m_EraseStart(NULL),
21  m_SaveData(NULL),
22  m_MCAGroup(NULL)
23 {
24  QFont f;
25  f.setPointSize(8);
26  setFont(f);
27  setContentsMargins(2,2,2,2);
28 
29  m_GridLayout = new QGridLayout(this);
30 
31  m_PresetRealTime = new QDoubleSpinBox();
32  m_PresetLiveTime = new QDoubleSpinBox();
33 
34  m_MCAGroup = new MCAGroup(this);
35 
36  m_GridLayout -> addWidget(new QLabel(tr("Preset Real Time:")), 0, 0, 1, 1);
37  m_GridLayout -> addWidget(m_PresetRealTime, 0, 1, 1, 1);
38  m_GridLayout -> addWidget(new QLabel(tr("Preset Live Time:")), 1, 0, 1, 1);
39  m_GridLayout -> addWidget(m_PresetLiveTime, 1, 1, 1, 1);
40 
41  m_Erase = new QPushButton(tr("Erase"));
42  m_Start = new QPushButton(tr("Start"));
43  m_Stop = new QPushButton(tr("Stop"));
44  m_SaveData = new QPushButton(tr("Save"));
45  m_EraseStart = new QPushButton(tr("Erase and Start"));
46 
47  m_GridLayout -> addWidget(m_Erase, 2, 0, 1, 1);
48  m_GridLayout -> addWidget(m_Start, 2, 1, 1, 1);
49  m_GridLayout -> addWidget(m_Stop, 3, 0, 1, 1);
50  m_GridLayout -> addWidget(m_SaveData, 3, 1, 1, 1);
51  m_GridLayout -> addWidget(m_EraseStart, 4, 0, 1, 2);
52 
53  m_SaveAButton = new QPushButton(tr("Save A"));
54  m_SaveBButton = new QPushButton(tr("Save B"));
55  m_SaveCButton = new QPushButton(tr("Save C"));
56  m_ClearAButton = new QPushButton(tr("Clear A"));
57  m_ClearBButton = new QPushButton(tr("Clear B"));
58  m_ClearCButton = new QPushButton(tr("Clear C"));
59 
60  m_GridLayout -> addWidget(m_SaveAButton, 5, 0, 1, 1);
61  m_GridLayout -> addWidget(m_ClearAButton, 5, 1, 1, 1);
62  m_GridLayout -> addWidget(m_SaveBButton, 6, 0, 1, 1);
63  m_GridLayout -> addWidget(m_ClearBButton, 6, 1, 1, 1);
64  m_GridLayout -> addWidget(m_SaveCButton, 7, 0, 1, 1);
65  m_GridLayout -> addWidget(m_ClearCButton, 7, 1, 1, 1);
66 
67  QLabel *namelbl = new QLabel(tr("Name"));
68  QLabel *reallbl = new QLabel(tr("Real"));
69  QLabel *livelbl = new QLabel(tr("Live"));
70 
71  reallbl -> setAlignment(Qt::AlignRight);
72  livelbl -> setAlignment(Qt::AlignRight);
73 
74  m_GridLayout -> addWidget(namelbl, 8,0,1,1);
75  m_GridLayout -> addWidget(reallbl, 9,0,1,1);
76  m_GridLayout -> addWidget(livelbl, 9,1,1,1);
77 
78  connect(m_PresetRealTime, SIGNAL(editingFinished()), this, SLOT(editedRealTime()));
79  connect(m_PresetLiveTime, SIGNAL(editingFinished()), this, SLOT(editedLiveTime()));
80 
81  connect(m_Erase, SIGNAL(clicked()), m_MCAGroup, SLOT(erase_mcas()));
82  connect(m_Start, SIGNAL(clicked()), m_MCAGroup, SLOT(start_mcas()));
83  connect(m_Stop, SIGNAL(clicked()), m_MCAGroup, SLOT(stop_mcas()));
84  connect(m_SaveData, SIGNAL(clicked()), m_MCAGroup, SLOT(save_data()));
85  connect(m_EraseStart, SIGNAL(clicked()), m_MCAGroup, SLOT(erase_start_mcas()));
86 
87  connect(m_SaveAButton, SIGNAL(clicked()), m_Controller, SLOT(save_a()));
88  connect(m_ClearAButton, SIGNAL(clicked()), m_Controller, SLOT(clear_a()));
89  connect(m_SaveBButton, SIGNAL(clicked()), m_Controller, SLOT(save_b()));
90  connect(m_ClearBButton, SIGNAL(clicked()), m_Controller, SLOT(clear_b()));
91  connect(m_SaveCButton, SIGNAL(clicked()), m_Controller, SLOT(save_c()));
92  connect(m_ClearCButton, SIGNAL(clicked()), m_Controller, SLOT(clear_c()));
93 }
94 
96 {
97 }
98 
100 {
101  int row = m_MCAGroup -> count()*2+10;
102  m_MCAGroup -> append(mca);
103 
104  QLabel *mcaLabel = new QLabel(mca->pvName());
105  EpicsDoubleDisplay *ert =
107  EpicsDoubleDisplay *elt =
109 
110 // EpicsDoubleLineEdit *mcaEdit =
111 // new EpicsDoubleLineEdit(new EpicsDouble(mca->pvName(), this));
112 
113  ert -> setAlignment(Qt::AlignRight);
114  elt -> setAlignment(Qt::AlignRight);
115 
116  m_GridLayout -> addWidget(mcaLabel, row, 0, 1, 1);
117  m_GridLayout -> addWidget(ert, row+1, 0, 1, 1);
118  m_GridLayout -> addWidget(elt, row+1, 1, 1, 1);
119 // m_GridLayout -> addWidget(mcaEdit,row, 3, 1, 1);
120 }
121 
123 {
124  m_MCAGroup -> setPresetRealTime(m_PresetRealTime->value());
125 }
126 
128 {
129  m_MCAGroup -> setPresetLiveTime(m_PresetLiveTime->value());
130 }
virtual ~MCAControlPanel()
QPushButton * m_Erase
QPushButton * m_SaveCButton
QPushButton * m_ClearCButton
QPushButton * m_Start
EpicsDouble * elapsedRealTime()
Definition: epicsmca.cpp:45
QString pvName()
Definition: epicsobject.cpp:30
QPushButton * m_SaveAButton
MCAController * m_Controller
QGridLayout * m_GridLayout
EpicsDouble * elapsedLiveTime()
Definition: epicsmca.cpp:50
QDoubleSpinBox * m_PresetRealTime
QPushButton * m_SaveBButton
QPushButton * m_ClearBButton
QPushButton * m_ClearAButton
MCAControlPanel(MCAController *ctl, QWidget *parent)
QPushButton * m_EraseStart
QDoubleSpinBox * m_PresetLiveTime
QPushButton * m_SaveData
void append(EpicsMCA *mca)
MCAGroup * m_MCAGroup
QPushButton * m_Stop