v2.0.0
Loading...
Searching...
No Matches
fiffrawviewsettings.cpp
Go to the documentation of this file.
1//=============================================================================================================
14
15//=============================================================================================================
16// INCLUDES
17//=============================================================================================================
18
19#include "fiffrawviewsettings.h"
20
21#include "ui_fiffrawviewsettings.h"
22
23//=============================================================================================================
24// QT INCLUDES
25//=============================================================================================================
26
27#include <QColorDialog>
28#include <QSettings>
29#include <QDebug>
30
31//=============================================================================================================
32// EIGEN INCLUDES
33//=============================================================================================================
34
35//=============================================================================================================
36// USED NAMESPACES
37//=============================================================================================================
38
39using namespace DISPLIB;
40
41//========================================= ====================================================================
42// DEFINE MEMBER METHODS
43//=============================================================================================================
44
45FiffRawViewSettings::FiffRawViewSettings(const QString &sSettingsPath,
46 QWidget *parent,
47 Qt::WindowFlags f)
48: AbstractView(parent, f)
49, m_pUi(new Ui::FiffRawViewSettingsWidget)
50{
51 m_sSettingsPath = sSettingsPath;
52 m_pUi->setupUi(this);
53
54 this->setWindowTitle("Fiff Raw View Settings");
55 this->setMinimumWidth(330);
56
58
60}
61
62//=============================================================================================================
63
69
70//=============================================================================================================
71
72void FiffRawViewSettings::setWidgetList(const QStringList& lVisibleWidgets)
73{
74 if(lVisibleWidgets.contains("numberChannels", Qt::CaseInsensitive) || lVisibleWidgets.isEmpty()) {
75 //Number of visible channels
76 connect(m_pUi->m_doubleSpinBox_numberVisibleChannels, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
78 } else {
79 m_pUi->m_doubleSpinBox_numberVisibleChannels->hide();
80 m_pUi->label_numberChannels->hide();
81 }
82
83 if(lVisibleWidgets.contains("windowSize", Qt::CaseInsensitive) || lVisibleWidgets.isEmpty()) {
84 //Window size
85 connect(m_pUi->m_spinBox_windowSize, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
87 } else {
88 m_pUi->m_spinBox_windowSize->hide();
89 m_pUi->label_windowSize->hide();
90 }
91
92 if(lVisibleWidgets.contains("distanceSpacers", Qt::CaseInsensitive) || lVisibleWidgets.isEmpty()) {
93 //Distance for timer spacer
94 connect(m_pUi->m_comboBox_distaceTimeSpacer, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
96 } else {
97 m_pUi->m_comboBox_distaceTimeSpacer->hide();
98 m_pUi->label_timeSpacers->hide();
99 }
100
101 if(lVisibleWidgets.contains("backgroundColor", Qt::CaseInsensitive) || lVisibleWidgets.isEmpty()) {
102 //Background Colors
103 connect(m_pUi->m_pushButton_backgroundColor, static_cast<void (QPushButton::*)(bool)>(&QPushButton::clicked),
105 } else {
106 m_pUi->m_pushButton_backgroundColor->hide();
107 m_pUi->label_backgroundColor->hide();
108 }
109
110 if(lVisibleWidgets.contains("signalColor", Qt::CaseInsensitive) || lVisibleWidgets.isEmpty()) {
111 //Signal Colors
112 connect(m_pUi->m_pushButton_signalColor, static_cast<void (QPushButton::*)(bool)>(&QPushButton::clicked),
114 } else {
115 m_pUi->m_pushButton_signalColor->hide();
116 m_pUi->label_signalColor->hide();
117 }
118
119 if(lVisibleWidgets.contains("screenshot", Qt::CaseInsensitive) || lVisibleWidgets.isEmpty()) {
120 //Signal Colors
121 connect(m_pUi->m_pushButton_makeScreenshot, static_cast<void (QPushButton::*)(bool)>(&QPushButton::clicked),
123 } else {
124 m_pUi->m_pushButton_makeScreenshot->hide();
125 m_pUi->m_comboBox_imageType->hide();
126 }
127
128 this->adjustSize();
129}
130
131//=============================================================================================================
132
134{
135 m_pUi->m_spinBox_windowSize->setValue(windowSize);
136}
137
138//=============================================================================================================
139
140void FiffRawViewSettings::setZoom(double zoomFactor)
141{
142 m_pUi->m_doubleSpinBox_numberVisibleChannels->setValue(zoomFactor);
143}
144
145//=============================================================================================================
146
148{
149 return m_pUi->m_comboBox_distaceTimeSpacer->currentText().toInt();
150}
151
152//=============================================================================================================
153
155{
156 m_pUi->m_comboBox_distaceTimeSpacer->setCurrentText(QString::number(value));
157}
158
159//=============================================================================================================
160
161void FiffRawViewSettings::setBackgroundColor(const QColor& backgroundColor)
162{
163 m_pUi->m_pushButton_backgroundColor->setStyleSheet(QString("background-color: rgb(%1, %2, %3);").arg(backgroundColor.red()).arg(backgroundColor.green()).arg(backgroundColor.blue()));
164
165 m_colCurrentBackgroundColor = backgroundColor;
166}
167
168//=============================================================================================================
169
170void FiffRawViewSettings::setSignalColor(const QColor& signalColor)
171{
172 m_pUi->m_pushButton_signalColor->setStyleSheet(QString("background-color: rgb(%1, %2, %3);").arg(signalColor.red()).arg(signalColor.green()).arg(signalColor.blue()));
173
174 m_colCurrentSignalColor = signalColor;
175}
176
177//=============================================================================================================
178
183
184//=============================================================================================================
185
190
191//=============================================================================================================
192
194{
195 return m_pUi->m_doubleSpinBox_numberVisibleChannels->value();
196}
197
198//=============================================================================================================
199
201{
202 return m_pUi->m_spinBox_windowSize->value();
203}
204
205//=============================================================================================================
206
208{
209 if(m_sSettingsPath.isEmpty()) {
210 return;
211 }
212
213 QSettings settings("MNECPP");
214
215 settings.setValue(m_sSettingsPath + QString("/FiffRawViewSettings/viewZoomFactor"), getZoom());
216 settings.setValue(m_sSettingsPath + QString("/FiffRawViewSettings/viewWindowSize"), getWindowSize());
217 settings.setValue(m_sSettingsPath + QString("/FiffRawViewSettings/signalColor"), getSignalColor());
218 settings.setValue(m_sSettingsPath + QString("/FiffRawViewSettings/backgroundColor"), getBackgroundColor());
219 settings.setValue(m_sSettingsPath + QString("/FiffRawViewSettings/distanceTimeSpacer"), getDistanceTimeSpacer());
220}
221
222//=============================================================================================================
223
225{
226 if(m_sSettingsPath.isEmpty()) {
227 return;
228 }
229
230 QSettings settings("MNECPP");
231
232 m_pUi->m_doubleSpinBox_numberVisibleChannels->setValue(settings.value(m_sSettingsPath + QString("/FiffRawViewSettings/viewZoomFactor"), 16).toDouble());
233 m_pUi->m_spinBox_windowSize->setValue(settings.value(m_sSettingsPath + QString("/FiffRawViewSettings/viewWindowSize"), 10).toInt());
234
235 QColor colorDefault = Qt::blue;
236 m_colCurrentSignalColor = settings.value(m_sSettingsPath + QString("/FiffRawViewSettings/signalColor"), colorDefault).value<QColor>();
237 m_pUi->m_pushButton_signalColor->setStyleSheet(QString("background-color: rgb(%1, %2, %3);").arg(m_colCurrentSignalColor.red()).arg(m_colCurrentSignalColor.green()).arg(m_colCurrentSignalColor.blue()));
238
239 colorDefault = Qt::white;
240 m_colCurrentBackgroundColor = settings.value(m_sSettingsPath + QString("/FiffRawViewSettings/backgroundColor"), colorDefault).value<QColor>();
241 m_pUi->m_pushButton_backgroundColor->setStyleSheet(QString("background-color: rgb(%1, %2, %3);").arg(m_colCurrentBackgroundColor.red()).arg(m_colCurrentBackgroundColor.green()).arg(m_colCurrentBackgroundColor.blue()));
242
243 m_pUi->m_comboBox_distaceTimeSpacer->setCurrentText(QString::number(settings.value(m_sSettingsPath + QString("/FiffRawViewSettings/distanceTimeSpacer"), 1000).toInt()));
244}
245
246//=============================================================================================================
247
249{
250 switch(mode) {
252 break;
253 default: // default is research mode
254 break;
255 }
256}
257
258//=============================================================================================================
259
261{
262 switch(mode) {
264 break;
265 default: // default is realtime mode
266 break;
267 }
268}
269
270//=============================================================================================================
271
273{
274 switch(value) {
275 case 0:
277 break;
278
279 case 1:
281 break;
282
283 case 2:
285 break;
286
287 case 3:
288 emit distanceTimeSpacerChanged(1000);
289 break;
290 }
291
292 //emit updateConnectedView();
293
294 saveSettings();
295}
296
297//=============================================================================================================
298
300{
301 QColorDialog* pDialog = new QColorDialog(m_colCurrentSignalColor, this);
302
303 QObject* obj = sender();
304 if(obj == m_pUi->m_pushButton_signalColor) {
305 pDialog->setCurrentColor(m_colCurrentSignalColor);
306 pDialog->setWindowTitle("Signal Color");
307
308 pDialog->exec();
309 m_colCurrentSignalColor = pDialog->currentColor();
310
311 //Set color of button new new scene color
312 m_pUi->m_pushButton_signalColor->setStyleSheet(QString("background-color: rgb(%1, %2, %3);").arg(m_colCurrentSignalColor.red()).arg(m_colCurrentSignalColor.green()).arg(m_colCurrentSignalColor.blue()));
313
315 }
316
317 if( obj == m_pUi->m_pushButton_backgroundColor ) {
318 pDialog->setCurrentColor(m_colCurrentBackgroundColor);
319 pDialog->setWindowTitle("Background Color");
320
321 pDialog->exec();
322 m_colCurrentBackgroundColor = pDialog->currentColor();
323
324 //Set color of button new new scene color
325 m_pUi->m_pushButton_backgroundColor->setStyleSheet(QString("background-color: rgb(%1, %2, %3);").arg(m_colCurrentBackgroundColor.red()).arg(m_colCurrentBackgroundColor.green()).arg(m_colCurrentBackgroundColor.blue()));
326
328 }
329
330 saveSettings();
331}
332
333//=============================================================================================================
334
336{
337 emit timeWindowChanged(value);
338
339 saveSettings();
340}
341
342//=============================================================================================================
343
345{
346 emit zoomChanged(value);
347
348 saveSettings();
349}
350
351//=============================================================================================================
352
354{
355 emit makeScreenshot(m_pUi->m_comboBox_imageType->currentText());
356}
357
358//=============================================================================================================
359
Display-style settings for the FIFF raw browser (zoom, time window, signal / background colours).
2-D display widgets and visualisation helpers (charts, topography, colour maps).
AbstractView(QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
void updateProcessingMode(ProcessingMode mode)
void backgroundColorChanged(const QColor &backgroundColor)
void makeScreenshot(const QString &imageType)
void setBackgroundColor(const QColor &backgroundColor)
FiffRawViewSettings(const QString &sSettingsPath="", QWidget *parent=0, Qt::WindowFlags f=Qt::Widget)
Ui::FiffRawViewSettingsWidget * m_pUi
void distanceTimeSpacerChanged(int value)
void timeWindowChanged(int value)
void setSignalColor(const QColor &signalColor)
void setWidgetList(const QStringList &lVisibleWidgets=QStringList())
void onDistanceTimeSpacerChanged(qint32 value)
void zoomChanged(double value)
void signalColorChanged(const QColor &signalColor)