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(std::make_unique<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
93
94//=============================================================================================================
95
96void ConnectivitySettingsView::setTriggerTypes(const QStringList& lTriggerTypes)
97{
98 for (const QString& sTriggerType : lTriggerTypes) {
99 if (m_pUi->m_comboBox_triggerType->findText(sTriggerType) == -1) {
100 m_pUi->m_comboBox_triggerType->addItem(sTriggerType);
101 }
102 }
103}
104
105//=============================================================================================================
106
108{
109 m_pUi->m_spinBox_numberTrials->setValue(iNumberTrials);
110}
111
112//=============================================================================================================
113
114void ConnectivitySettingsView::setFrequencyBand(double dFreqLow, double dFreqHigh)
115{
116 m_pUi->m_spinBox_freqLow->setValue(dFreqLow);
117 m_pUi->m_spinBox_freqHigh->setValue(dFreqHigh);
118}
119
120//=============================================================================================================
121
123{
124 return m_pUi->m_comboBox_method->currentText();
125}
126
127//=============================================================================================================
128
130{
131 return m_pUi->m_comboBox_windowType->currentText();
132}
133
134//=============================================================================================================
135
137{
138 return m_pUi->m_spinBox_numberTrials->value();
139}
140
141//=============================================================================================================
142
144{
145 return m_pUi->m_comboBox_triggerType->currentText();
146}
147
148//=============================================================================================================
149
151{
152 return m_pUi->m_spinBox_freqLow->value();
153}
154
155//=============================================================================================================
156
158{
159 return m_pUi->m_spinBox_freqHigh->value();
160}
161
162//=============================================================================================================
163
165{
166 if (m_sSettingsPath.isEmpty()) {
167 return;
168 }
169
170 QSettings settings("MNECPP");
171
172 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connMethod"), m_pUi->m_comboBox_method->currentText());
173 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connWindowType"), m_pUi->m_comboBox_windowType->currentText());
174 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), m_pUi->m_spinBox_numberTrials->value());
175 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connTriggerType"), m_pUi->m_comboBox_triggerType->currentText());
176 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqLow"), m_pUi->m_spinBox_freqLow->value());
177 settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqHigh"), m_pUi->m_spinBox_freqHigh->value());
178}
179
180//=============================================================================================================
181
183{
184 if (m_sSettingsPath.isEmpty()) {
185 return;
186 }
187
188 QSettings settings("MNECPP");
189
190 m_pUi->m_comboBox_method->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connMethod"), "COR").toString());
191 m_pUi->m_comboBox_windowType->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connWindowType"), "Hanning").toString());
192 m_pUi->m_spinBox_numberTrials->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), 10).toInt());
193 m_iNumberTrials = settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), 10).toInt();
194 m_pUi->m_comboBox_triggerType->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connTriggerType"), "1").toString());
195 m_pUi->m_spinBox_freqLow->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqLow"), 7.0).toDouble());
196 m_pUi->m_spinBox_freqHigh->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqHigh"), 13.0).toDouble());
197}
198
199//=============================================================================================================
200
202{
203 switch (mode) {
205 break;
206 default: // default is research mode
207 break;
208 }
209}
210
211//=============================================================================================================
212
214{
215 switch (mode) {
217 break;
218 default: // default is realtime mode
219 break;
220 }
221}
222
223//=============================================================================================================
224
226{
227 emit connectivityMetricChanged(sMetric);
228 saveSettings();
229}
230
231//=============================================================================================================
232
233void ConnectivitySettingsView::onWindowTypeChanged(const QString& sWindowType)
234{
235 emit windowTypeChanged(sWindowType);
236 saveSettings();
237}
238
239//=============================================================================================================
240
242{
243 if (m_iNumberTrials == m_pUi->m_spinBox_numberTrials->value()) {
244 return;
245 }
246
247 m_iNumberTrials = m_pUi->m_spinBox_numberTrials->value();
248
249 emit numberTrialsChanged(m_pUi->m_spinBox_numberTrials->value());
250 saveSettings();
251}
252
253//=============================================================================================================
254
255void ConnectivitySettingsView::onTriggerTypeChanged(const QString& sTriggerType)
256{
257 emit triggerTypeChanged(sTriggerType);
258 saveSettings();
259}
260
261//=============================================================================================================
262
264{
265 //Q_UNUSED(value)
266 emit freqBandChanged(m_pUi->m_spinBox_freqLow->value(),
267 m_pUi->m_spinBox_freqHigh->value());
268 saveSettings();
269}
270
271//=============================================================================================================
272
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)
std::unique_ptr< 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)