41 #include "ui_triggerdetectionview.h"
49 #include <QColorDialog>
61 using namespace DISPLIB;
62 using namespace FIFFLIB;
72 , m_pUi(new Ui::TriggerDetectionViewWidget)
77 this->setWindowTitle(
"Trigger Detection Settings");
78 this->setMinimumWidth(330);
79 this->setMaximumWidth(330);
102 connect(m_pUi->m_checkBox_activateTriggerDetection,
static_cast<void (QCheckBox::*)(
int)
>(&QCheckBox::stateChanged),
105 m_pUi->m_comboBox_triggerChannels->clear();
109 m_pUi->m_comboBox_triggerChannels->addItem(
m_pFiffInfo->chs[i].ch_name);
113 connect(m_pUi->m_comboBox_triggerChannels,
static_cast<void (QComboBox::*)(
const QString&)
>(&QComboBox::currentTextChanged),
116 connect(m_pUi->m_comboBox_triggerColorType,
static_cast<void (QComboBox::*)(
const QString&)
>(&QComboBox::currentTextChanged),
119 connect(m_pUi->m_pushButton_triggerColor,
static_cast<void (QPushButton::*)(
bool)
>(&QPushButton::clicked),
122 m_pUi->m_pushButton_triggerColor->setAutoFillBackground(
true);
123 m_pUi->m_pushButton_triggerColor->setFlat(
true);
124 QPalette* palette1 =
new QPalette();
125 palette1->setColor(QPalette::Button,QColor(177,0,0));
126 m_pUi->m_pushButton_triggerColor->setPalette(*palette1);
127 m_pUi->m_pushButton_triggerColor->update();
129 connect(m_pUi->m_doubleSpinBox_detectionThresholdFirst,
static_cast<void (QDoubleSpinBox::*)(
double)
>(&QDoubleSpinBox::valueChanged),
132 connect(m_pUi->m_spinBox_detectionThresholdSecond,
static_cast<void (QSpinBox::*)(
int)
>(&QSpinBox::valueChanged),
135 connect(m_pUi->m_pushButton_resetNumberTriggers,
static_cast<void (QPushButton::*)(
bool)
>(&QPushButton::clicked),
138 connect(m_pUi->m_pushButton_DetectTriggers,
static_cast<void (QPushButton::*)(
bool)
>(&QPushButton::clicked),
150 m_pUi->m_label_numberDetectedTriggers->setText(QString(
"%1").arg(numberDetections));
154 QMapIterator<int,QList<QPair<int,double> > > i(mapDetectedTriggers);
155 while (i.hasNext()) {
158 for(
int j = 0; j < i.value().size(); ++j) {
159 if(m_pUi->m_comboBox_triggerColorType->findText(QString::number(i.value().at(j).second)) == -1) {
160 m_pUi->m_comboBox_triggerColorType->addItem(QString::number(i.value().at(j).second));
174 QSettings settings(
"MNECPP");
176 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/Activated"), m_pUi->m_checkBox_activateTriggerDetection->isChecked());
177 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/ChannelIndex"), m_pUi->m_comboBox_triggerChannels->currentIndex());
178 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/FirstThresholdValue"), m_pUi->m_doubleSpinBox_detectionThresholdFirst->value());
179 settings.setValue(
m_sSettingsPath + QString(
"/TriggerDetectionView/SecondThresholdValue"), m_pUi->m_spinBox_detectionThresholdSecond->value());
181 settings.beginGroup(
m_sSettingsPath + QString(
"/TriggerDetectionView/Colors"));
184 settings.setValue(QString::number(i.key()), i.value());
198 QSettings settings(
"MNECPP");
200 m_pUi->m_checkBox_activateTriggerDetection->setChecked(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/Activated"),
false).toBool());
201 m_pUi->m_comboBox_triggerChannels->setCurrentIndex(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/ChannelIndex"), 0).toInt());
202 m_pUi->m_doubleSpinBox_detectionThresholdFirst->setValue(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/FirstThresholdValue"), 0.1).toDouble());
203 m_pUi->m_spinBox_detectionThresholdSecond->setValue(settings.value(
m_sSettingsPath + QString(
"/TriggerDetectionView/SecondThresholdValue"), -1).toInt());
205 settings.beginGroup(
m_sSettingsPath + QString(
"/TriggerDetectionView/Colors"));
206 QStringList keys = settings.childKeys();
207 foreach (QString key, keys) {
208 double dKey = key.toDouble();
221 case GuiMode::Clinical:
233 case ProcessingMode::Offline:
234 m_pUi->label->hide();
235 m_pUi->label_9->hide();
236 m_pUi->m_pushButton_resetNumberTriggers->hide();
237 m_pUi->m_pushButton_triggerColor->hide();
238 m_pUi->m_checkBox_activateTriggerDetection->hide();
239 m_pUi->m_comboBox_triggerColorType->hide();
240 m_pUi->m_label_numberDetectedTriggers->hide();
241 m_pUi->m_pushButton_DetectTriggers->show();
244 m_pUi->label->show();
245 m_pUi->label_9->show();
246 m_pUi->m_pushButton_resetNumberTriggers->show();
247 m_pUi->m_pushButton_triggerColor->show();
248 m_pUi->m_checkBox_activateTriggerDetection->show();
249 m_pUi->m_comboBox_triggerColorType->show();
250 m_pUi->m_label_numberDetectedTriggers->show();
251 m_pUi->m_pushButton_DetectTriggers->hide();
261 m_pUi->m_checkBox_activateTriggerDetection->isChecked(),
262 m_pUi->m_comboBox_triggerChannels->currentText(),
263 m_pUi->m_doubleSpinBox_detectionThresholdFirst->value()*pow(10, m_pUi->m_spinBox_detectionThresholdSecond->value()));
274 QColor color = QColorDialog::getColor(
m_qMapTriggerColor[m_pUi->m_comboBox_triggerColorType->currentText().toDouble()],
this,
"Set trigger color");
277 QPalette* palette1 =
new QPalette();
278 palette1->setColor(QPalette::Button,color);
279 m_pUi->m_pushButton_triggerColor->setPalette(*palette1);
280 m_pUi->m_pushButton_triggerColor->update();
282 m_qMapTriggerColor[m_pUi->m_comboBox_triggerColorType->currentText().toDouble()] = color;
292 QPalette* palette1 =
new QPalette();
294 m_pUi->m_pushButton_triggerColor->setPalette(*palette1);
295 m_pUi->m_pushButton_triggerColor->update();
302 m_pUi->m_label_numberDetectedTriggers->setText(QString(
"0"));
303 m_pUi->m_comboBox_triggerColorType->clear();
314 if(m_pUi->m_comboBox_triggerChannels->currentText() ==
""){
317 emit
detectTriggers(m_pUi->m_comboBox_triggerChannels->currentText(),
318 m_pUi->m_doubleSpinBox_detectionThresholdFirst->value()*pow(10, m_pUi->m_spinBox_detectionThresholdSecond->value()));
325 return m_pUi->m_comboBox_triggerChannels->currentText();