MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
connectivitysettingsview.cpp
Go to the documentation of this file.
1//=============================================================================================================
35//=============================================================================================================
36// INCLUDES
37//=============================================================================================================
38
40
41#include "ui_connectivitysettingsview.h"
42
43//=============================================================================================================
44// QT INCLUDES
45//=============================================================================================================
46
47#include <QSettings>
48
49//=============================================================================================================
50// EIGEN INCLUDES
51//=============================================================================================================
52
53//=============================================================================================================
54// USED NAMESPACES
55//=============================================================================================================
56
57using namespace DISPLIB;
58
59//=============================================================================================================
60// DEFINE MEMBER METHODS
61//=============================================================================================================
62
64 QWidget *parent,
65 Qt::WindowFlags f)
66: AbstractView(parent, f)
67, m_pUi(new Ui::ConnectivitySettingsViewWidget)
68{
69 m_sSettingsPath = sSettingsPath;
70 m_pUi->setupUi(this);
71
73
74 connect(m_pUi->m_comboBox_method, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
76
77 connect(m_pUi->m_comboBox_windowType, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
79
80// connect(m_pUi->m_spinBox_numberTrials, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
81// this, &ConnectivitySettingsView::onNumberTrialsChanged);
82
83 connect(m_pUi->m_spinBox_numberTrials, &QSpinBox::editingFinished,
85
86 connect(m_pUi->m_comboBox_triggerType, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
88
89// connect(m_pUi->m_spinBox_freqLow, &QDoubleSpinBox::editingFinished,
90// this, &ConnectivitySettingsView::onFrequencyBandChanged);
91
92// connect(m_pUi->m_spinBox_freqHigh, &QDoubleSpinBox::editingFinished,
93// this, &ConnectivitySettingsView::onFrequencyBandChanged);
94
95 connect(m_pUi->m_spinBox_freqLow, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
97
98 connect(m_pUi->m_spinBox_freqHigh, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
100
101 this->setWindowTitle("Connectivity Settings");
102 this->setMinimumWidth(330);
103 this->setMaximumWidth(330);
104}
105
106//=============================================================================================================
107
114
115//=============================================================================================================
116
117void ConnectivitySettingsView::setTriggerTypes(const QStringList& lTriggerTypes)
118{
119 for(const QString &sTriggerType : lTriggerTypes) {
120 if(m_pUi->m_comboBox_triggerType->findText(sTriggerType) == -1) {
121 m_pUi->m_comboBox_triggerType->addItem(sTriggerType);
122 }
123 }
124}
125
126//=============================================================================================================
127
129{
130 m_pUi->m_spinBox_numberTrials->setValue(iNumberTrials);
131}
132
133//=============================================================================================================
134
135void ConnectivitySettingsView::setFrequencyBand(double dFreqLow, double dFreqHigh)
136{
137 m_pUi->m_spinBox_freqLow->setValue(dFreqLow);
138 m_pUi->m_spinBox_freqHigh->setValue(dFreqHigh);
139}
140
141//=============================================================================================================
142
144{
145 return m_pUi->m_comboBox_method->currentText();
146}
147
148//=============================================================================================================
149
151{
152 return m_pUi->m_comboBox_windowType->currentText();
153}
154
155//=============================================================================================================
156
158{
159 return m_pUi->m_spinBox_numberTrials->value();
160}
161
162//=============================================================================================================
163
165{
166 return m_pUi->m_comboBox_triggerType->currentText();
167}
168
169//=============================================================================================================
170
172{
173 return m_pUi->m_spinBox_freqLow->value();
174}
175
176//=============================================================================================================
177
179{
180 return m_pUi->m_spinBox_freqHigh->value();
181}
182
183//=============================================================================================================
184
186{
187 if(m_sSettingsPath.isEmpty()) {
188 return;
189 }
190
191 QSettings settings("MNECPP");
192
193 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connMethod"), m_pUi->m_comboBox_method->currentText());
194 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connWindowType"), m_pUi->m_comboBox_windowType->currentText());
195 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), m_pUi->m_spinBox_numberTrials->value());
196 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connTriggerType"), m_pUi->m_comboBox_triggerType->currentText());
197 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqLow"), m_pUi->m_spinBox_freqLow->value());
198 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqHigh"), m_pUi->m_spinBox_freqHigh->value());
199}
200
201//=============================================================================================================
202
204{
205 if(m_sSettingsPath.isEmpty()) {
206 return;
207 }
208
209 QSettings settings("MNECPP");
210
211 m_pUi->m_comboBox_method->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connMethod"), "COR").toString());
212 m_pUi->m_comboBox_windowType->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connWindowType"), "Hanning").toString());
213 m_pUi->m_spinBox_numberTrials->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), 10).toInt());
214 m_iNumberTrials = settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), 10).toInt();
215 m_pUi->m_comboBox_triggerType->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connTriggerType"), "1").toString());
216 m_pUi->m_spinBox_freqLow->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqLow"), 7.0).toDouble());
217 m_pUi->m_spinBox_freqHigh->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqHigh"), 13.0).toDouble());
218}
219
220//=============================================================================================================
221
223{
224 switch(mode) {
225 case GuiMode::Clinical:
226 break;
227 default: // default is research mode
228 break;
229 }
230}
231
232//=============================================================================================================
233
235{
236 switch(mode) {
237 case ProcessingMode::Offline:
238 break;
239 default: // default is realtime mode
240 break;
241 }
242}
243
244//=============================================================================================================
245
247{
248 emit connectivityMetricChanged(sMetric);
249 saveSettings();
250}
251
252//=============================================================================================================
253
254void ConnectivitySettingsView::onWindowTypeChanged(const QString& sWindowType)
255{
256 emit windowTypeChanged(sWindowType);
257 saveSettings();
258}
259
260//=============================================================================================================
261
263{
264 if(m_iNumberTrials == m_pUi->m_spinBox_numberTrials->value()) {
265 return;
266 }
267
268 m_iNumberTrials = m_pUi->m_spinBox_numberTrials->value();
269
270 emit numberTrialsChanged(m_pUi->m_spinBox_numberTrials->value());
271 saveSettings();
272}
273
274//=============================================================================================================
275
276void ConnectivitySettingsView::onTriggerTypeChanged(const QString& sTriggerType)
277{
278 emit triggerTypeChanged(sTriggerType);
279 saveSettings();
280}
281
282//=============================================================================================================
283
285{
286 //Q_UNUSED(value)
287 emit freqBandChanged(m_pUi->m_spinBox_freqLow->value(),
288 m_pUi->m_spinBox_freqHigh->value());
289 saveSettings();
290}
291
292//=============================================================================================================
293
Declaration of the ConnectivitySettingsView Class.
The AbstractView class provides the base calss for all Disp viewers.
void setFrequencyBand(double dFreqLow, double dFreqHigh)
void windowTypeChanged(const QString &windowType)
void freqBandChanged(float fFreqLow, float fFreqHigh)
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)