MNE-CPP  beta 1.0
noiseestimatesetupwidget.cpp
Go to the documentation of this file.
1 //=============================================================================================================
37 //*************************************************************************************************************
38 //=============================================================================================================
39 // INCLUDES
40 //=============================================================================================================
41 
43 #include "../noiseestimate.h"
44 
45 //*************************************************************************************************************
46 //=============================================================================================================
47 // QT INCLUDES
48 //=============================================================================================================
49 
50 #include <QDebug>
51 
52 
53 //*************************************************************************************************************
54 //=============================================================================================================
55 // USED NAMESPACES
56 //=============================================================================================================
57 
58 using namespace NoiseEstimatePlugin;
59 
60 
61 //*************************************************************************************************************
62 //=============================================================================================================
63 // DEFINE MEMBER METHODS
64 //=============================================================================================================
65 
67 : QWidget(parent)
68 , m_pNoiseEstimate(toolbox)
69 {
70  ui.setupUi(this);
71 
72  init();
73 
74  connect(ui.m_qComboBoxnFFT, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &NoiseEstimateSetupWidget::chgnFFT);
75  connect(ui.m_qSpinDataLen, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NoiseEstimateSetupWidget::chgDataLen);
76  connect(ui.m_cb_logscale, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked), this, &NoiseEstimateSetupWidget::chgXAxisType);
77 
78 }
79 
80 
81 //*************************************************************************************************************
82 
84 {
85 
86 }
87 
88 
89 //*************************************************************************************************************
90 
91 void NoiseEstimateSetupWidget::init()
92 {
93  ui.m_qComboBoxnFFT->insertItem(0, "512");
94  ui.m_qComboBoxnFFT->insertItem(1, "1024");
95  ui.m_qComboBoxnFFT->insertItem(2, "2048");
96  ui.m_qComboBoxnFFT->insertItem(3, "4096");
97  ui.m_qComboBoxnFFT->insertItem(4, "8192");
98  ui.m_qComboBoxnFFT->insertItem(5, "16384");
99 
100  qint32 i = 0;
101  for(i = 0; i < ui.m_qComboBoxnFFT->count(); ++i)
102  if(ui.m_qComboBoxnFFT->itemText(i).toInt() == m_pNoiseEstimate->m_iFFTlength)
103  break;
104 
105  ui.m_qComboBoxnFFT->setCurrentIndex(i);
106 
107 
108  //set up the data length for spectrum calculation
109  ui.m_qSpinDataLen->setValue(6);
110 
111  //set up the default x-scale type of spectrum
112  if ( m_pNoiseEstimate->m_x_scale_type == 0)
113  ui.m_cb_logscale->setChecked(false);
114  else
115  ui.m_cb_logscale->setChecked(true);
116 
117 }
118 
119 
120 //*************************************************************************************************************
121 
122 void NoiseEstimateSetupWidget::chgnFFT(int idx)
123 {
124  //qDebug() << "ui.m_qComboBoxnFFT->itemData(idx).toInt();" << ui.m_qComboBoxnFFT->itemText(idx).toInt();
125  m_pNoiseEstimate->m_iFFTlength = ui.m_qComboBoxnFFT->itemText(idx).toInt();
126 }
127 
128 //*************************************************************************************************************
129 
130 void NoiseEstimateSetupWidget::chgDataLen(int idx)
131 {
132  m_pNoiseEstimate->m_DataLen = idx;
133  //qDebug() << "m_pNoiseEstimate->m_DataLen" <<m_pNoiseEstimate->m_DataLen;
134 }
135 
136 //*************************************************************************************************************
137 
138 void NoiseEstimateSetupWidget::chgXAxisType()
139 {
140 
141  //qDebug()<<"Check state1";
142  bool checkstatus = ui.m_cb_logscale->isChecked();
143  if ( checkstatus)
144  m_pNoiseEstimate->m_x_scale_type = 1;
145  else
146  m_pNoiseEstimate->m_x_scale_type = 0;
147 
148  qDebug() << "setup widget scale type" << m_pNoiseEstimate->m_x_scale_type ;
149 }
150 
NoiseEstimateSetupWidget(NoiseEstimate *toolbox, QWidget *parent=0)
The NoiseEstimate class provides a NoiseEstimate algorithm structure.
Contains the declaration of the NoiseEstimateSetupWidget class.