QXRD  0.11.16
qxrdzingerdialog.cpp
Go to the documentation of this file.
1 #include "qxrdzingerdialog.h"
2 #include "ui_qxrdzingerdialog.h"
3 #include "qxrdmaskstack.h"
4 #include "qxrdmaskstack-ptr.h"
5 #include "qxrddataprocessor.h"
6 
8  QDialog(parent),
9  m_Processor(procw)
10 {
11  setupUi(this);
12 
14 
15  if (proc) {
16  QxrdMaskStackPtr masks(proc->maskStack());
17 
18  if (masks) {
19  m_ZingerAlgorithm -> addItem("Default", 0);
20 
21  int nmasks = masks->size();
22 
23  m_ZingerMask -> addItem("No Mask", QxrdDataProcessor::ZingerNoMask);
24  m_ZingerMask -> addItem("Mask from data", QxrdDataProcessor::ZingerDataMask);
25 
26  for (int i=0; i<nmasks; i++) {
27  QcepMaskDataPtr p = masks->at(i);
28 
29  if (p) {
30  QString lvl = masks->stackLevelName(i);
31 
32  m_ZingerMask -> addItem(lvl, i);
33  m_ZingerDestination -> addItem(lvl, i);
34  }
35  }
36 
37  m_ZingerDestination -> addItem("Top of stack", QxrdDataProcessor::ZingerTopStack);
38 
39  int algIndex = m_ZingerAlgorithm -> findData(proc->get_ZingerAlgorithm());
40  int mskIndex = m_ZingerMask -> findData(proc->get_ZingerMask());
41  int dstIndex = m_ZingerDestination -> findData(proc->get_ZingerDestination());
42 
43  m_ZingerAlgorithm -> setCurrentIndex(algIndex);
44  m_ZingerMask -> setCurrentIndex(mskIndex);
45  m_ZingerDestination -> setCurrentIndex(dstIndex);
46 
47  m_ZingerSize1 -> setValue(proc->get_ZingerSize1());
48  m_ZingerSize2 -> setValue(proc->get_ZingerSize2());
49  m_ZingerThreshold -> setValue(proc->get_ZingerThreshold());
50  }
51  }
52 }
53 
55 {
56 }
57 
59 {
61 
62  if (proc) {
63  proc->set_ZingerAlgorithm (m_ZingerAlgorithm -> currentData().toInt());
64  proc->set_ZingerMask (m_ZingerMask -> currentData().toInt());
65  proc->set_ZingerDestination (m_ZingerDestination -> currentData().toInt());
66  proc->set_ZingerSize1 (m_ZingerSize1 -> value());
67  proc->set_ZingerSize2 (m_ZingerSize2 -> value());
68  proc->set_ZingerThreshold (m_ZingerThreshold -> value());
69 
70  proc->findZingers();
71  }
72 
73  QDialog::accept();
74 }
QWeakPointer< QxrdDataProcessor > QxrdDataProcessorWPtr
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdZingerDialog(QxrdDataProcessorWPtr procw, QWidget *parent=0)
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QxrdDataProcessorWPtr m_Processor