v2.0.0
Loading...
Searching...
No Matches
connectivitysettingsview.cpp
Go to the documentation of this file.
1//=============================================================================================================
15
16//=============================================================================================================
17// INCLUDES
18//=============================================================================================================
19
21
22#include "ui_connectivitysettingsview.h"
23
24//=============================================================================================================
25// QT INCLUDES
26//=============================================================================================================
27
28#include <QSettings>
29
30//=============================================================================================================
31// EIGEN INCLUDES
32//=============================================================================================================
33
34//=============================================================================================================
35// USED NAMESPACES
36//=============================================================================================================
37
38using namespace DISPLIB;
39
40//=============================================================================================================
41// DEFINE MEMBER METHODS
42//=============================================================================================================
43
45 QWidget *parent,
46 Qt::WindowFlags f)
47: AbstractView(parent, f)
48, m_pUi(new Ui::ConnectivitySettingsViewWidget)
49{
50 m_sSettingsPath = sSettingsPath;
51 m_pUi->setupUi(this);
52
54
55 connect(m_pUi->m_comboBox_method, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
57
58 connect(m_pUi->m_comboBox_windowType, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
60
61// connect(m_pUi->m_spinBox_numberTrials, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
62// this, &ConnectivitySettingsView::onNumberTrialsChanged);
63
64 connect(m_pUi->m_spinBox_numberTrials, &QSpinBox::editingFinished,
66
67 connect(m_pUi->m_comboBox_triggerType, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
69
70// connect(m_pUi->m_spinBox_freqLow, &QDoubleSpinBox::editingFinished,
71// this, &ConnectivitySettingsView::onFrequencyBandChanged);
72
73// connect(m_pUi->m_spinBox_freqHigh, &QDoubleSpinBox::editingFinished,
74// this, &ConnectivitySettingsView::onFrequencyBandChanged);
75
76 connect(m_pUi->m_spinBox_freqLow, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
78
79 connect(m_pUi->m_spinBox_freqHigh, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
81
82 this->setWindowTitle("Connectivity Settings");
83 this->setMinimumWidth(330);
84 this->setMaximumWidth(330);
85}
86
87//=============================================================================================================
88
95
96//=============================================================================================================
97
98void ConnectivitySettingsView::setTriggerTypes(const QStringList& lTriggerTypes)
99{
100 for(const QString &sTriggerType : lTriggerTypes) {
101 if(m_pUi->m_comboBox_triggerType->findText(sTriggerType) == -1) {
102 m_pUi->m_comboBox_triggerType->addItem(sTriggerType);
103 }
104 }
105}
106
107//=============================================================================================================
108
110{
111 m_pUi->m_spinBox_numberTrials->setValue(iNumberTrials);
112}
113
114//=============================================================================================================
115
116void ConnectivitySettingsView::setFrequencyBand(double dFreqLow, double dFreqHigh)
117{
118 m_pUi->m_spinBox_freqLow->setValue(dFreqLow);
119 m_pUi->m_spinBox_freqHigh->setValue(dFreqHigh);
120}
121
122//=============================================================================================================
123
125{
126 return m_pUi->m_comboBox_method->currentText();
127}
128
129//=============================================================================================================
130
132{
133 return m_pUi->m_comboBox_windowType->currentText();
134}
135
136//=============================================================================================================
137
139{
140 return m_pUi->m_spinBox_numberTrials->value();
141}
142
143//=============================================================================================================
144
146{
147 return m_pUi->m_comboBox_triggerType->currentText();
148}
149
150//=============================================================================================================
151
153{
154 return m_pUi->m_spinBox_freqLow->value();
155}
156
157//=============================================================================================================
158
160{
161 return m_pUi->m_spinBox_freqHigh->value();
162}
163
164//=============================================================================================================
165
167{
168 if(m_sSettingsPath.isEmpty()) {
169 return;
170 }
171
172 QSettings settings("MNECPP");
173
174 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connMethod"), m_pUi->m_comboBox_method->currentText());
175 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connWindowType"), m_pUi->m_comboBox_windowType->currentText());
176 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), m_pUi->m_spinBox_numberTrials->value());
177 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connTriggerType"), m_pUi->m_comboBox_triggerType->currentText());
178 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqLow"), m_pUi->m_spinBox_freqLow->value());
179 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqHigh"), m_pUi->m_spinBox_freqHigh->value());
180}
181
182//=============================================================================================================
183
185{
186 if(m_sSettingsPath.isEmpty()) {
187 return;
188 }
189
190 QSettings settings("MNECPP");
191
192 m_pUi->m_comboBox_method->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connMethod"), "COR").toString());
193 m_pUi->m_comboBox_windowType->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connWindowType"), "Hanning").toString());
194 m_pUi->m_spinBox_numberTrials->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), 10).toInt());
195 m_iNumberTrials = settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), 10).toInt();
196 m_pUi->m_comboBox_triggerType->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connTriggerType"), "1").toString());
197 m_pUi->m_spinBox_freqLow->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqLow"), 7.0).toDouble());
198 m_pUi->m_spinBox_freqHigh->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqHigh"), 13.0).toDouble());
199}
200
201//=============================================================================================================
202
204{
205 switch(mode) {
207 break;
208 default: // default is research mode
209 break;
210 }
211}
212
213//=============================================================================================================
214
216{
217 switch(mode) {
219 break;
220 default: // default is realtime mode
221 break;
222 }
223}
224
225//=============================================================================================================
226
228{
229 emit connectivityMetricChanged(sMetric);
230 saveSettings();
231}
232
233//=============================================================================================================
234
235void ConnectivitySettingsView::onWindowTypeChanged(const QString& sWindowType)
236{
237 emit windowTypeChanged(sWindowType);
238 saveSettings();
239}
240
241//=============================================================================================================
242
244{
245 if(m_iNumberTrials == m_pUi->m_spinBox_numberTrials->value()) {
246 return;
247 }
248
249 m_iNumberTrials = m_pUi->m_spinBox_numberTrials->value();
250
251 emit numberTrialsChanged(m_pUi->m_spinBox_numberTrials->value());
252 saveSettings();
253}
254
255//=============================================================================================================
256
257void ConnectivitySettingsView::onTriggerTypeChanged(const QString& sTriggerType)
258{
259 emit triggerTypeChanged(sTriggerType);
260 saveSettings();
261}
262
263//=============================================================================================================
264
266{
267 //Q_UNUSED(value)
268 emit freqBandChanged(m_pUi->m_spinBox_freqLow->value(),
269 m_pUi->m_spinBox_freqHigh->value());
270 saveSettings();
271}
272
273//=============================================================================================================
274
Settings panel choosing connectivity metric, window length and FFT parameters.
2-D display widgets and visualisation helpers (charts, topography, colour maps).
AbstractView(QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
void setFrequencyBand(double dFreqLow, double dFreqHigh)
void windowTypeChanged(const QString &windowType)
void freqBandChanged(float fFreqLow, float fFreqHigh)
Ui::ConnectivitySettingsViewWidget * m_pUi
void setTriggerTypes(const QStringList &lTriggerTypes)
void onTriggerTypeChanged(const QString &sTriggerType)
ConnectivitySettingsView(const QString &sSettingsPath="", QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
void onMetricChanged(const QString &sMetric)
void triggerTypeChanged(const QString &sTriggerType)
void connectivityMetricChanged(const QString &sMetric)
void numberTrialsChanged(int iNumberTrials)
void onWindowTypeChanged(const QString &sWindowType)