MNE-CPP  0.1.9
A Framework for Electrophysiology
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 
57 using 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 
72  loadSettings();
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 
109 {
110  saveSettings();
111 
112  delete m_pUi;
113 }
114 
115 //=============================================================================================================
116 
117 void 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 
136 {
137  return m_pUi->m_comboBox_method->currentText();
138 }
139 
140 //=============================================================================================================
141 
143 {
144  return m_pUi->m_comboBox_windowType->currentText();
145 }
146 
147 //=============================================================================================================
148 
150 {
151  return m_pUi->m_spinBox_numberTrials->value();
152 }
153 
154 //=============================================================================================================
155 
157 {
158  return m_pUi->m_comboBox_triggerType->currentText();
159 }
160 
161 //=============================================================================================================
162 
164 {
165  return m_pUi->m_spinBox_freqLow->value();
166 }
167 
168 //=============================================================================================================
169 
171 {
172  return m_pUi->m_spinBox_freqHigh->value();
173 }
174 
175 //=============================================================================================================
176 
178 {
179  if(m_sSettingsPath.isEmpty()) {
180  return;
181  }
182 
183  QSettings settings("MNECPP");
184 
185  settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connMethod"), m_pUi->m_comboBox_method->currentText());
186  settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connWindowType"), m_pUi->m_comboBox_windowType->currentText());
187  settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), m_pUi->m_spinBox_numberTrials->value());
188  settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connTriggerType"), m_pUi->m_comboBox_triggerType->currentText());
189  settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqLow"), m_pUi->m_spinBox_freqLow->value());
190  settings.setValue(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqHigh"), m_pUi->m_spinBox_freqHigh->value());
191 }
192 
193 //=============================================================================================================
194 
196 {
197  if(m_sSettingsPath.isEmpty()) {
198  return;
199  }
200 
201  QSettings settings("MNECPP");
202 
203  m_pUi->m_comboBox_method->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connMethod"), "COR").toString());
204  m_pUi->m_comboBox_windowType->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connWindowType"), "Hanning").toString());
205  m_pUi->m_spinBox_numberTrials->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), 10).toInt());
206  m_iNumberTrials = settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connNrTrials"), 10).toInt();
207  m_pUi->m_comboBox_triggerType->setCurrentText(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connTriggerType"), "1").toString());
208  m_pUi->m_spinBox_freqLow->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqLow"), 7.0).toDouble());
209  m_pUi->m_spinBox_freqHigh->setValue(settings.value(m_sSettingsPath + QString("/ConnectivitySettingsView/connFreqHigh"), 13.0).toDouble());
210 }
211 
212 //=============================================================================================================
213 
215 {
216  switch(mode) {
217  case GuiMode::Clinical:
218  break;
219  default: // default is research mode
220  break;
221  }
222 }
223 
224 //=============================================================================================================
225 
227 {
228  switch(mode) {
229  case ProcessingMode::Offline:
230  break;
231  default: // default is realtime mode
232  break;
233  }
234 }
235 
236 //=============================================================================================================
237 
238 void ConnectivitySettingsView::onMetricChanged(const QString& sMetric)
239 {
240  emit connectivityMetricChanged(sMetric);
241  saveSettings();
242 }
243 
244 //=============================================================================================================
245 
246 void ConnectivitySettingsView::onWindowTypeChanged(const QString& sWindowType)
247 {
248  emit windowTypeChanged(sWindowType);
249  saveSettings();
250 }
251 
252 //=============================================================================================================
253 
255 {
256  if(m_iNumberTrials == m_pUi->m_spinBox_numberTrials->value()) {
257  return;
258  }
259 
260  m_iNumberTrials = m_pUi->m_spinBox_numberTrials->value();
261 
262  emit numberTrialsChanged(m_pUi->m_spinBox_numberTrials->value());
263  saveSettings();
264 }
265 
266 //=============================================================================================================
267 
268 void ConnectivitySettingsView::onTriggerTypeChanged(const QString& sTriggerType)
269 {
270  emit triggerTypeChanged(sTriggerType);
271  saveSettings();
272 }
273 
274 //=============================================================================================================
275 
277 {
278  //Q_UNUSED(value)
279  emit freqBandChanged(m_pUi->m_spinBox_freqLow->value(),
280  m_pUi->m_spinBox_freqHigh->value());
281  saveSettings();
282 }
283 
284 //=============================================================================================================
285 
287 {
288 
289 }
DISPLIB::ConnectivitySettingsView::getLowerFreq
double getLowerFreq()
Definition: connectivitysettingsview.cpp:163
DISPLIB::ConnectivitySettingsView::windowTypeChanged
void windowTypeChanged(const QString &windowType)
DISPLIB::AbstractView
The AbstractView class provides the base calss for all Disp viewers.
Definition: abstractview.h:75
DISPLIB::ConnectivitySettingsView::getConnectivityMetric
QString getConnectivityMetric()
Definition: connectivitysettingsview.cpp:135
DISPLIB::ConnectivitySettingsView::setNumberTrials
void setNumberTrials(int iNumberTrials)
Definition: connectivitysettingsview.cpp:128
DISPLIB::ConnectivitySettingsView::clearView
void clearView()
Definition: connectivitysettingsview.cpp:286
DISPLIB::ConnectivitySettingsView::triggerTypeChanged
void triggerTypeChanged(const QString &sTriggerType)
DISPLIB::ConnectivitySettingsView::loadSettings
void loadSettings()
Definition: connectivitysettingsview.cpp:195
DISPLIB::ConnectivitySettingsView::getTriggerType
QString getTriggerType()
Definition: connectivitysettingsview.cpp:156
DISPLIB::ConnectivitySettingsView::freqBandChanged
void freqBandChanged(float fFreqLow, float fFreqHigh)
DISPLIB::ConnectivitySettingsView::onMetricChanged
void onMetricChanged(const QString &sMetric)
Definition: connectivitysettingsview.cpp:238
DISPLIB::ConnectivitySettingsView::numberTrialsChanged
void numberTrialsChanged(int iNumberTrials)
DISPLIB::ConnectivitySettingsView::onNumberTrialsChanged
void onNumberTrialsChanged()
Definition: connectivitysettingsview.cpp:254
DISPLIB::ConnectivitySettingsView::~ConnectivitySettingsView
~ConnectivitySettingsView()
Definition: connectivitysettingsview.cpp:108
DISPLIB::ConnectivitySettingsView::saveSettings
void saveSettings()
Definition: connectivitysettingsview.cpp:177
DISPLIB::ConnectivitySettingsView::connectivityMetricChanged
void connectivityMetricChanged(const QString &sMetric)
DISPLIB::ConnectivitySettingsView::getWindowType
QString getWindowType()
Definition: connectivitysettingsview.cpp:142
DISPLIB::ConnectivitySettingsView::setTriggerTypes
void setTriggerTypes(const QStringList &lTriggerTypes)
Definition: connectivitysettingsview.cpp:117
DISPLIB::ConnectivitySettingsView::onFrequencyBandChanged
void onFrequencyBandChanged()
Definition: connectivitysettingsview.cpp:276
DISPLIB::ConnectivitySettingsView::updateProcessingMode
void updateProcessingMode(ProcessingMode mode)
Definition: connectivitysettingsview.cpp:226
DISPLIB::ConnectivitySettingsView::ConnectivitySettingsView
ConnectivitySettingsView(const QString &sSettingsPath="", QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
Definition: connectivitysettingsview.cpp:63
DISPLIB::ConnectivitySettingsView::m_sSettingsPath
QString m_sSettingsPath
Definition: connectivitysettingsview.h:239
DISPLIB::ConnectivitySettingsView::getNumberTrials
int getNumberTrials()
Definition: connectivitysettingsview.cpp:149
DISPLIB::ConnectivitySettingsView::m_iNumberTrials
int m_iNumberTrials
Definition: connectivitysettingsview.h:240
DISPLIB::ConnectivitySettingsView::onTriggerTypeChanged
void onTriggerTypeChanged(const QString &sTriggerType)
Definition: connectivitysettingsview.cpp:268
DISPLIB::ConnectivitySettingsView::updateGuiMode
void updateGuiMode(GuiMode mode)
Definition: connectivitysettingsview.cpp:214
connectivitysettingsview.h
Declaration of the ConnectivitySettingsView Class.
DISPLIB::ConnectivitySettingsView::getUpperFreq
double getUpperFreq()
Definition: connectivitysettingsview.cpp:170
DISPLIB::ConnectivitySettingsView::onWindowTypeChanged
void onWindowTypeChanged(const QString &sWindowType)
Definition: connectivitysettingsview.cpp:246