MNE-CPP  beta 1.0
tmsisetupwidget.cpp
Go to the documentation of this file.
1 //=============================================================================================================
37 //*************************************************************************************************************
38 //=============================================================================================================
39 // INCLUDES
40 //=============================================================================================================
41 
42 #include "tmsisetupwidget.h"
43 #include "tmsiaboutwidget.h"
44 #include "../tmsi.h"
45 
46 
47 //*************************************************************************************************************
48 //=============================================================================================================
49 // QT INCLUDES
50 //=============================================================================================================
51 
52 #include <QDebug>
53 
54 
55 //*************************************************************************************************************
56 //=============================================================================================================
57 // USED NAMESPACES
58 //=============================================================================================================
59 
60 using namespace TMSIPlugin;
61 
62 
63 //*************************************************************************************************************
64 //=============================================================================================================
65 // DEFINE MEMBER METHODS
66 //=============================================================================================================
67 
68 TMSISetupWidget::TMSISetupWidget(TMSI* pTMSI, QWidget* parent)
69 : QWidget(parent)
70 , m_pTMSI(pTMSI)
71 {
72  ui.setupUi(this);
73 
74  //Connect device sampling properties
75  connect(ui.m_spinBox_SamplingFreq, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
76  this, &TMSISetupWidget::setDeviceSamplingProperties);
77  connect(ui.m_spinBox_NumberOfChannels, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
78  this, &TMSISetupWidget::setDeviceSamplingProperties);
79  connect(ui.m_spinBox_SamplesPerBlock, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
80  this, &TMSISetupWidget::setDeviceSamplingProperties);
81  connect(ui.m_checkBox_UseCommonAverage, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked),
82  this, &TMSISetupWidget::setDeviceSamplingProperties);
83 
84  //Connect channel corrections
85  connect(ui.m_checkBox_UseChExponent, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked),
86  this, &TMSISetupWidget::setDeviceSamplingProperties);
87  connect(ui.m_checkBox_UseUnitGain, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked),
88  this, &TMSISetupWidget::setDeviceSamplingProperties);
89  connect(ui.m_checkBox_UseUnitOffset, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked),
90  this, &TMSISetupWidget::setDeviceSamplingProperties);
91 
92  //Connect preprocessing
93  connect(ui.m_checkBox_UseFiltering, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked),
94  this, &TMSISetupWidget::setPreprocessing);
95 
96  //Connect postprocessing
97  connect(ui.m_checkBox_UseFFT, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked),
98  this, &TMSISetupWidget::setPostprocessing);
99 
100  //Connect debug file
101  connect(ui.m_checkBox_WriteDriverDebugToFile, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked),
102  this, &TMSISetupWidget::setWriteToFile);
103 
104  //Connect trigger properties
105  connect(ui.m_spinBox_BeepLength, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
106  this, &TMSISetupWidget::setTriggerProperties);
107  connect(ui.m_checkBox_EnableBeep, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked),
108  this, &TMSISetupWidget::setTriggerProperties);
109  connect(ui.m_checkBox_EnableKeyboardTrigger, static_cast<void (QCheckBox::*)(bool)>(&QCheckBox::clicked),
110  this, &TMSISetupWidget::setTriggerProperties);
111 
112  //Connect about button
113  connect(ui.m_qPushButton_About, &QPushButton::released, this, &TMSISetupWidget::showAboutDialog);
114 
115  //Fill info box
116  QFile file(m_pTMSI->m_qStringResourcePath+"readme.txt");
117  if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
118  return;
119 
120  QTextStream in(&file);
121  while (!in.atEnd())
122  {
123  QString line = in.readLine();
124  ui.m_qTextBrowser_Information->insertHtml(line);
125  ui.m_qTextBrowser_Information->insertHtml("<br>");
126  }
127 }
128 
129 
130 //*************************************************************************************************************
131 
133 {
134 
135 }
136 
137 
138 //*************************************************************************************************************
139 
141 {
142  //Init device sampling properties
143  ui.m_spinBox_SamplingFreq->setValue(m_pTMSI->m_iSamplingFreq);
144  ui.m_spinBox_NumberOfChannels->setValue(m_pTMSI->m_iNumberOfChannels);
145  ui.m_spinBox_SamplesPerBlock->setValue(m_pTMSI->m_iSamplesPerBlock);
146  ui.m_checkBox_UseCommonAverage->setChecked(m_pTMSI->m_bUseCommonAverage);
147 
148  //Init channel corrections
149  ui.m_checkBox_UseChExponent->setChecked(m_pTMSI->m_bUseChExponent);
150  ui.m_checkBox_UseUnitGain->setChecked(m_pTMSI->m_bUseUnitGain);
151  ui.m_checkBox_UseUnitOffset->setChecked(m_pTMSI->m_bUseUnitOffset);
152 
153  //Init preprocessing
154  ui.m_checkBox_UseFiltering->setChecked(m_pTMSI->m_bUseFiltering);
155 
156  //Init write to file
157  ui.m_checkBox_WriteDriverDebugToFile->setChecked(m_pTMSI->m_bWriteDriverDebugToFile);
158 
159  //Init trigger properties
160  ui.m_spinBox_BeepLength->setValue(m_pTMSI->m_iTriggerInterval);
161  ui.m_checkBox_EnableBeep->setChecked(m_pTMSI->m_bBeepTrigger);
162 
163  ui.m_checkBox_EnableKeyboardTrigger->setChecked(m_pTMSI->m_bUseKeyboardTrigger);
164 }
165 
166 
167 //*************************************************************************************************************
168 
169 void TMSISetupWidget::setDeviceSamplingProperties()
170 {
171  cout<<"changing "<<endl;
172  m_pTMSI->m_iSamplingFreq = ui.m_spinBox_SamplingFreq->value();
173  m_pTMSI->m_iNumberOfChannels = ui.m_spinBox_NumberOfChannels->value();
174  m_pTMSI->m_iSamplesPerBlock = ui.m_spinBox_SamplesPerBlock->value();
175 
176  m_pTMSI->m_bUseChExponent = ui.m_checkBox_UseChExponent->isChecked();
177  m_pTMSI->m_bUseUnitGain = ui.m_checkBox_UseUnitGain->isChecked();
178  m_pTMSI->m_bUseUnitOffset = ui.m_checkBox_UseUnitOffset->isChecked();
179 
180  m_pTMSI->m_bUseCommonAverage = ui.m_checkBox_UseCommonAverage->isChecked();
181 }
182 
183 
184 //*************************************************************************************************************
185 
186 void TMSISetupWidget::setPreprocessing()
187 {
188  m_pTMSI->m_bUseFiltering = ui.m_checkBox_UseFiltering->isChecked();
189 }
190 
191 
192 //*************************************************************************************************************
193 
194 void TMSISetupWidget::setPostprocessing()
195 {
196  m_pTMSI->m_bUseFFT = ui.m_checkBox_UseFFT->isChecked();
197 }
198 
199 
200 //*************************************************************************************************************
201 
202 void TMSISetupWidget::setWriteToFile()
203 {
204  m_pTMSI->m_bWriteDriverDebugToFile = ui.m_checkBox_WriteDriverDebugToFile->isChecked();
205 }
206 
207 //*************************************************************************************************************
208 
209 void TMSISetupWidget::setTriggerProperties()
210 {
211  m_pTMSI->m_iTriggerInterval = ui.m_spinBox_BeepLength->value();
212  m_pTMSI->m_bBeepTrigger = ui.m_checkBox_EnableBeep->isChecked();
213  m_pTMSI->m_bUseKeyboardTrigger = ui.m_checkBox_EnableKeyboardTrigger->isChecked();
214 }
215 
216 
217 //*************************************************************************************************************
218 
219 void TMSISetupWidget::showAboutDialog()
220 {
221  TMSIAboutWidget aboutDialog(this);
222  aboutDialog.exec();
223 }
TMSISetupWidget(TMSI *pTMSI, QWidget *parent=0)
The TMSIAboutWidget class provides the about dialog for the TMSI.
Contains the declaration of the TMSIAboutWidget class.
The TMSI class provides a EEG connector. In order for this plugin to work properly the driver dll "RT...
Definition: tmsi.h:122
Contains the declaration of the TMSISetupWidget class.