2 #include "ui_qxrdacquisitionextrainputsdialog.h"
5 #include <QDoubleSpinBox>
18 printf(
"QxrdAcquisitionExtraInputsDialog::QxrdAcquisitionExtraInputsDialog(%p)\n",
this);
40 QStringList devices = nidaq->deviceNames();
42 foreach(QString device, devices) {
43 QString desc = nidaq->deviceType(device);
44 int isSim = nidaq->deviceIsSimulated(device);
46 QString item = device+
" : "+desc;
49 item +=
" [simulated]";
52 m_AcquisitionDevice->addItem(item, device);
56 xtra->prop_SampleRate()->linkTo(m_SampleRate);
57 xtra->prop_AcquireDelay()->linkTo(m_AcquisitionDelay);
58 xtra->prop_DeviceName()->linkTo(m_AcquisitionDevice);
72 m_AcquisitionWaveforms -> init(setg->plotSettings());
81 printf(
"QxrdAcquisitionExtraInputsDialog::~QxrdAcquisitionExtraInputsDialog(%p)\n",
this);
88 QCheckBox *cb =
new QCheckBox();
89 ch->prop_Enabled()->linkTo(cb);
91 QCheckBox *cb2 =
new QCheckBox();
92 ch->prop_Plotted()->linkTo(cb2);
94 QComboBox *nm =
new QComboBox();
99 QString deviceName = xtra->get_DeviceName();
103 QStringList aiChannels = nidaq->deviceAIChannels(deviceName);
104 QStringList ctrChannels = nidaq->deviceCIChannels(deviceName);
106 nm->addItem(
"Analog Inputs");
107 foreach(QString chan, aiChannels) {
108 nm->addItem(chan, chan);
111 nm->addItem(
"Counter Inputs");
112 foreach(QString chan, ctrChannels) {
113 nm->addItem(chan, chan);
118 ch->prop_ChannelName()->linkTo(nm);
120 QComboBox *md =
new QComboBox();
127 md->setItemData(0,
"Value = Sum(wfm)", Qt::ToolTipRole);
128 md->setItemData(1,
"Value = Avg(wfm)", Qt::ToolTipRole);
129 md->setItemData(2,
"Value = Max(wfm)", Qt::ToolTipRole);
130 md->setItemData(3,
"Value = Min(wfm)", Qt::ToolTipRole);
132 ch->prop_Mode()->linkTo(md);
134 QCheckBox *wf =
new QCheckBox();
135 ch->prop_SaveWave()->linkTo(wf);
137 QDoubleSpinBox *min =
new QDoubleSpinBox();
138 min->setMinimum(-20.0);
139 min->setMaximum(20.0);
140 min->setSingleStep(0.1);
141 ch->prop_Min()->linkTo(min);
143 QDoubleSpinBox *max =
new QDoubleSpinBox();
144 max->setMinimum(-20.0);
145 max->setMaximum(20.0);
146 max->setSingleStep(0.1);
147 ch->prop_Max()->linkTo(max);
149 QDoubleSpinBox *stt =
new QDoubleSpinBox();
150 stt->setMinimum(-0.2);
151 stt->setMaximum(10.0);
152 stt->setSingleStep(0.1);
153 ch->prop_Start()->linkTo(stt);
155 QDoubleSpinBox *end =
new QDoubleSpinBox();
156 end->setMinimum(-0.2);
157 end->setMaximum(10.0);
158 end->setSingleStep(0.1);
159 ch->prop_End()->linkTo(end);
161 QComboBox *tmode =
new QComboBox();
162 tmode -> addItem(
"No Trigger");
163 tmode -> addItem(
"Positive Edge");
164 tmode -> addItem(
"Negative Edge");
165 tmode -> addItem(
"Positive Level");
166 tmode -> addItem(
"Negative Level");
167 ch->prop_TriggerMode()->linkTo(tmode);
169 QDoubleSpinBox *tlevel =
new QDoubleSpinBox();
170 tlevel -> setMinimum(-20.0);
171 tlevel -> setMaximum(+20.0);
172 tlevel -> setSingleStep(0.1);
173 ch->prop_TriggerLevel()->linkTo(tlevel);
175 QDoubleSpinBox *thyst =
new QDoubleSpinBox();
176 thyst -> setMinimum(0.0);
177 thyst -> setMaximum(+20.0);
178 thyst -> setSingleStep(0.1);
179 ch->prop_TriggerHysteresis()->linkTo(thyst);
181 QLabel *phy =
new QLabel();
182 ch->prop_PhysicalChannel()->linkTo(phy);
184 QLabel *val =
new QLabel();
185 ch->prop_Value()->linkTo(val);
187 QCheckBox *trig =
new QCheckBox();
188 ch->prop_Triggered()->linkTo(trig);
193 m_ExtraInputsTable->setCellWidget(i, c++, cb);
194 m_ExtraInputsTable->setCellWidget(i, c++, cb2);
195 m_ExtraInputsTable->setCellWidget(i, c++, nm);
196 m_ExtraInputsTable->setCellWidget(i, c++, md);
197 m_ExtraInputsTable->setCellWidget(i, c++, wf);
198 m_ExtraInputsTable->setCellWidget(i, c++, min);
199 m_ExtraInputsTable->setCellWidget(i, c++, max);
200 m_ExtraInputsTable->setCellWidget(i, c++, stt);
201 m_ExtraInputsTable->setCellWidget(i, c++, end);
202 m_ExtraInputsTable->setCellWidget(i, c++, tmode);
203 m_ExtraInputsTable->setCellWidget(i, c++, tlevel);
204 m_ExtraInputsTable->setCellWidget(i, c++, thyst);
205 m_ExtraInputsTable->setCellWidget(i, c++, phy);
206 m_ExtraInputsTable->setCellWidget(i, c++, val);
207 m_ExtraInputsTable->setCellWidget(i, c++, trig);
209 m_ExtraInputsTable->setCellWidget(c++, i, cb);
210 m_ExtraInputsTable->setCellWidget(c++, i, cb2);
211 m_ExtraInputsTable->setCellWidget(c++, i, nm);
212 m_ExtraInputsTable->setCellWidget(c++, i, md);
213 m_ExtraInputsTable->setCellWidget(c++, i, wf);
214 m_ExtraInputsTable->setCellWidget(c++, i, min);
215 m_ExtraInputsTable->setCellWidget(c++, i, max);
216 m_ExtraInputsTable->setCellWidget(c++, i, stt);
217 m_ExtraInputsTable->setCellWidget(c++, i, end);
218 m_ExtraInputsTable->setCellWidget(c++, i, tmode);
219 m_ExtraInputsTable->setCellWidget(c++, i, tlevel);
220 m_ExtraInputsTable->setCellWidget(c++, i, thyst);
221 m_ExtraInputsTable->setCellWidget(c++, i, phy);
222 m_ExtraInputsTable->setCellWidget(c++, i, val);
223 m_ExtraInputsTable->setCellWidget(c++, i, trig);
242 int nInputs = xtra->channels().count();
244 m_ExtraInputsTable->clear();
248 labels <<
"Enabled" <<
"Plotted" <<
"Device Name" <<
"Mode" <<
"SaveWfm?"
249 <<
"Min V" <<
"Max V"
251 <<
"Trigger Mode" <<
"Trigger Level" <<
"Trigger Hysteresis"
252 <<
"Phys Chan" <<
"Value" <<
"Triggered?";
254 QStringList chanLabels;
256 for (
int i=0; i<nInputs; i++) {
257 chanLabels << tr(
"Chan %1").arg(i);
261 m_ExtraInputsTable->setRowCount(nInputs);
262 m_ExtraInputsTable->setColumnCount(labels.count());
264 m_ExtraInputsTable->setRowCount(labels.count());
265 m_ExtraInputsTable->setColumnCount(nInputs);
268 for (
int i=0; i<nInputs; i++) {
274 m_ExtraInputsTable->setHorizontalHeaderLabels(labels);
275 m_ExtraInputsTable->setVerticalHeaderLabels(chanLabels);
277 m_ExtraInputsTable->setHorizontalHeaderLabels(chanLabels);
278 m_ExtraInputsTable->setVerticalHeaderLabels(labels);
281 if (m_ExtraInputsTable->columnCount() && m_ExtraInputsTable->rowCount()) {
282 m_ExtraInputsTable->resizeColumnsToContents();
283 m_ExtraInputsTable->resizeRowsToContents();
302 int nch = xtra->channels().count();
305 m_ExtraInputsTable->currentRow() :
306 m_ExtraInputsTable->currentColumn());
308 int ch = (n<0 ? nch-1 : n);
310 QString titleString = tr(
"New Channel after Channel %1").arg(ch);
311 QString questString = tr(
"Do you really want to create a new extra input channel after channel %1").arg(ch);
313 int reply = QMessageBox::question(
this, titleString, questString,
314 QMessageBox::Ok | QMessageBox::Cancel,
315 QMessageBox::Cancel);
317 if (reply== QMessageBox::Ok) {
319 xtra->appendChannel();
321 xtra->appendChannel(ch);
343 int nch = xtra->channels().count();
346 m_ExtraInputsTable->currentRow() :
347 m_ExtraInputsTable->currentColumn());
349 int ch = (n<0 ? nch-1 : n);
351 QString titleString = tr(
"Delete Channel %1").arg(ch);
352 QString questString = tr(
"Do you really want to delete extra input channel %1").arg(ch);
354 int reply = QMessageBox::question(
this, titleString, questString,
355 QMessageBox::Ok | QMessageBox::Cancel,
356 QMessageBox::Cancel);
358 if (reply== QMessageBox::Ok) {
360 xtra->removeChannel();
362 xtra->removeChannel(n);
386 int nchan = xtra->channels().count();
388 m_AcquisitionWaveforms->setNChannels(nchan);
390 for (
int i=0; i<nchan; i++) {
393 if (chanp && chanp->get_Enabled() && chanp->get_Plotted()) {
394 m_AcquisitionWaveforms->plotChannel(i,
397 xtra->readXChannel(),
398 xtra->readChannel(i));
404 m_AcquisitionWaveforms->replot();
qint64 qcepDebug(int cond)
void valueChanged(QString val, int index)
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QVector< double > QcepDoubleVector
QSharedPointer< QxrdNIDAQPluginInterface > QxrdNIDAQPluginInterfacePtr
QWeakPointer< QxrdAcquisition > QxrdAcquisitionWPtr