qse  0.5.4
qsescanaveragerui.cpp
Go to the documentation of this file.
1 #include "qsescanaveragerui.h"
2 #include "qsescanaverager.h"
3 #include "qsescanaveragermodel.h"
4 #include "qsegraphcontroller.h"
5 #include "qsegraphscansmodel.h"
6 #include "qsedataset.h"
7 
9 (QseScanAverager* scanAverager, QWidget* parent)
10  : QseEXAFSOperatorUI(scanAverager, parent),
11  m_ScanAverager(scanAverager),
12  m_ScanAveragerModel(NULL),
13  m_InputData(scanAverager->inputData()),
14  m_OutputData(scanAverager->outputData())
15 {
16  setupUi(this);
17 
18  connect(m_SelectNoneButton, SIGNAL(clicked()), this, SLOT(selectNone()));
19  connect(m_SelectAllButton, SIGNAL(clicked()), this, SLOT(selectAll()));
20  connect(m_AverageSelectedButton, SIGNAL(clicked()), this, SLOT(averageSelected()));
21  connect(m_RemoveSelectedButton, SIGNAL(clicked()), this, SLOT(removeSelected()));
22  connect(m_ExportButton, SIGNAL(clicked()), this, SLOT(exportSelected()));
23 
24  m_ScanAveragerModel =
25  new QseScanAveragerModel(m_ScanAverager, m_ScanAveragerTable, NULL);
26  m_ScanAveragerTable -> setModel(m_ScanAveragerModel);
27 
28  m_OutputDataModel =
29  new QseGraphScansModel(m_OutputData, m_OutputDataTable, this);
30  m_OutputDataTable -> setModel(m_OutputDataModel);
31 };
32 
34 {
35  if (editorValidate()) {
36  editorApply();
37 
38  // patternApply -> setEnabled(false);
39 // patternCancel-> setEnabled(false);
40  }
41 }
42 
44 {
45  editorCancel();
46 
47  // patternApply -> setEnabled(false);
48 // patternCancel-> setEnabled(false);
49 }
50 
52 {
53  m_ScanAveragerTable -> selectAll();
54 }
55 
57 {
58  m_ScanAveragerTable -> clearSelection();
59 }
60 
62 {
63  QItemSelectionModel *m = m_ScanAveragerTable -> selectionModel();
64 
65  int nscans = m_InputData -> scanCount();
66 
67  m_ScanAverager -> startAveraging();
68 
69  for(int i=0; i<nscans; i++) {
70  if (m -> rowIntersectsSelection(i, QModelIndex())) {
71  m_ScanAverager -> addScanToAverage(i);
72  }
73  }
74 
75  m_ScanAverager -> finishAveraging();
76 }
77 
79 {
80 }
81 
83 {
84 }
QseDataSet * m_InputData
QseScanAverager * m_ScanAverager
QseDataSet * outputData()
QseDataSet * inputData()
QseScanAveragerUI(QseScanAverager *avrg, QWidget *parent=0)