Commit ba515798 authored by Thiago Santini's avatar Thiago Santini

Fixes timer offset estimation and updates uvcengine/libuvc

libuvc: 69e45682220ff93abc6d675acfaa8fc6de8f5fca

uvcengine: fce1f275eb53cc87725f7232944813bc36da75cf
parent 3ae7a8e0
...@@ -47,7 +47,8 @@ SOURCES +=\ ...@@ -47,7 +47,8 @@ SOURCES +=\
$${TOP}/src/ERWidget.cpp \ $${TOP}/src/ERWidget.cpp \
src/pupil-tracking/PupiTtrackingMethod.cpp \ src/pupil-tracking/PupiTtrackingMethod.cpp \
src/pupil-tracking/PuReTy.cpp \ src/pupil-tracking/PuReTy.cpp \
src/pupil-detection/PuRe.cpp src/pupil-detection/PuRe.cpp \
src/Evaluation.cpp
HEADERS += \ HEADERS += \
$${TOP}/src/MainWindow.h\ $${TOP}/src/MainWindow.h\
...@@ -80,14 +81,16 @@ HEADERS += \ ...@@ -80,14 +81,16 @@ HEADERS += \
$${TOP}/src/ERWidget.h \ $${TOP}/src/ERWidget.h \
$${TOP}/src/pupil-tracking/PupilTrackingMethod.h \ $${TOP}/src/pupil-tracking/PupilTrackingMethod.h \
src/pupil-tracking/PuReTy.h \ src/pupil-tracking/PuReTy.h \
src/pupil-detection/PuRe.h src/pupil-detection/PuRe.h \
src/Evaluation.h
FORMS += \ FORMS += \
$${TOP}/src/MainWindow.ui \ $${TOP}/src/MainWindow.ui \
$${TOP}/src/CameraWidget.ui \ $${TOP}/src/CameraWidget.ui \
$${TOP}/src/GazeEstimationWidget.ui \ $${TOP}/src/GazeEstimationWidget.ui \
$${TOP}/src/LogWidget.ui \ $${TOP}/src/LogWidget.ui \
$${TOP}/src/PerformanceMonitorWidget.ui $${TOP}/src/PerformanceMonitorWidget.ui \
src/Evaluation.ui
RESOURCES += \ RESOURCES += \
$${TOP}/resources.qrc $${TOP}/resources.qrc
...@@ -117,7 +120,8 @@ LIBS += \ ...@@ -117,7 +120,8 @@ LIBS += \
-lopencv_imgcodecs$${CV_SUFFIX} \ -lopencv_imgcodecs$${CV_SUFFIX} \
-lopencv_imgproc$${CV_SUFFIX} \ -lopencv_imgproc$${CV_SUFFIX} \
-lopencv_videoio$${CV_SUFFIX} \ -lopencv_videoio$${CV_SUFFIX} \
-lopencv_aruco$${CV_SUFFIX} -lopencv_video$${CV_SUFFIX} \
-lopencv_aruco$${CV_SUFFIX}
# JPEG-TURBO # JPEG-TURBO
contains(DEFINES, TURBOJPEG) { contains(DEFINES, TURBOJPEG) {
......
...@@ -11,14 +11,14 @@ public: ...@@ -11,14 +11,14 @@ public:
explicit ERWidget(QWidget *parent = 0); explicit ERWidget(QWidget *parent = 0);
signals: signals:
void closed(); void closed(bool b);
void keyPress(QKeyEvent *event); void keyPress(QKeyEvent *event);
void keyRelease(QKeyEvent *event); void keyRelease(QKeyEvent *event);
public slots: public slots:
protected: protected:
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE { Q_UNUSED(event) emit closed(); } void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE { Q_UNUSED(event) emit closed(false); }
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE { emit keyPress(event); } void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE { emit keyPress(event); }
void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE { emit keyRelease(event); } void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE { emit keyRelease(event); }
}; };
......
...@@ -54,8 +54,8 @@ EyeImageProcessor::~EyeImageProcessor() ...@@ -54,8 +54,8 @@ EyeImageProcessor::~EyeImageProcessor()
void EyeImageProcessor::process(Timestamp timestamp, const Mat &frame) void EyeImageProcessor::process(Timestamp timestamp, const Mat &frame)
{ {
// TODO: parametrize frame drop due to lack of processing power // TODO: parametrize frame drop due to lack of processing power
if ( gPerformanceMonitor.shouldDrop(pmIdx, gTimer.elapsed() - timestamp, 50) ) //if ( gPerformanceMonitor.shouldDrop(pmIdx, gTimer.elapsed() - timestamp, 50) )
return; // return;
QMutexLocker locker(&cfgMutex); QMutexLocker locker(&cfgMutex);
...@@ -109,8 +109,7 @@ void EyeImageProcessor::process(Timestamp timestamp, const Mat &frame) ...@@ -109,8 +109,7 @@ void EyeImageProcessor::process(Timestamp timestamp, const Mat &frame)
} else } else
data.coarseROI = Rect(); data.coarseROI = Rect();
bool tracking = true; if (cfg.tracking && pupilTrackingMethod) {
if (tracking && pupilTrackingMethod) {
pupilTrackingMethod->run(timestamp, downscaled, coarseROI, data.pupil, *pupilDetectionMethod); pupilTrackingMethod->run(timestamp, downscaled, coarseROI, data.pupil, *pupilDetectionMethod);
} else { } else {
pupilDetectionMethod->run( downscaled, coarseROI, data.pupil ); pupilDetectionMethod->run( downscaled, coarseROI, data.pupil );
......
...@@ -111,7 +111,8 @@ public: ...@@ -111,7 +111,8 @@ public:
undistort(false), undistort(false),
coarseDetection(true), coarseDetection(true),
processingDownscalingFactor(2), processingDownscalingFactor(2),
pupilDetectionMethod(PuRe::desc.c_str()) pupilDetectionMethod(PuRe::desc.c_str()),
tracking(true)
{} {}
cv::Size inputSize; cv::Size inputSize;
...@@ -119,7 +120,8 @@ public: ...@@ -119,7 +120,8 @@ public:
bool undistort; bool undistort;
bool coarseDetection; bool coarseDetection;
double processingDownscalingFactor; double processingDownscalingFactor;
QString pupilDetectionMethod; QString pupilDetectionMethod;
bool tracking;
void save(QSettings *settings) void save(QSettings *settings)
{ {
...@@ -131,7 +133,8 @@ public: ...@@ -131,7 +133,8 @@ public:
settings->setValue("coarseDetection", coarseDetection); settings->setValue("coarseDetection", coarseDetection);
settings->setValue("processingDownscalingFactor", processingDownscalingFactor); settings->setValue("processingDownscalingFactor", processingDownscalingFactor);
settings->setValue("pupilDetectionMethod", pupilDetectionMethod); settings->setValue("pupilDetectionMethod", pupilDetectionMethod);
} settings->setValue("tracking", tracking);
}
void load(QSettings *settings) void load(QSettings *settings)
{ {
...@@ -143,7 +146,8 @@ public: ...@@ -143,7 +146,8 @@ public:
set(settings, "coarseDetection", coarseDetection); set(settings, "coarseDetection", coarseDetection);
set(settings, "processingDownscalingFactor", processingDownscalingFactor); set(settings, "processingDownscalingFactor", processingDownscalingFactor);
set(settings, "pupilDetectionMethod", pupilDetectionMethod); set(settings, "pupilDetectionMethod", pupilDetectionMethod);
} set(settings, "tracking", tracking);
}
}; };
class EyeImageProcessorUI : public QDialog class EyeImageProcessorUI : public QDialog
...@@ -216,7 +220,11 @@ public: ...@@ -216,7 +220,11 @@ public:
formLayout->addRow( new QLabel("Coarse Detection:"), coarseDetectionBox ); formLayout->addRow( new QLabel("Coarse Detection:"), coarseDetectionBox );
pupilDetectionComboBox = new QComboBox(); pupilDetectionComboBox = new QComboBox();
formLayout->addRow(pupilDetectionComboBox); formLayout->addRow(pupilDetectionComboBox);
layout->addWidget(box); trackingBox = new QCheckBox();
trackingBox->setWhatsThis("Track the pupil after detection.");
trackingBox->setToolTip(box->whatsThis());
formLayout->addRow( new QLabel("Tracking:"), trackingBox );
layout->addWidget(box);
applyButton = new QPushButton("Apply"); applyButton = new QPushButton("Apply");
applyButton->setWhatsThis("Applies current configuration."); applyButton->setWhatsThis("Applies current configuration.");
...@@ -248,7 +256,8 @@ public slots: ...@@ -248,7 +256,8 @@ public slots:
for (int i=0; i<pupilDetectionComboBox->count(); i++) for (int i=0; i<pupilDetectionComboBox->count(); i++)
if (pupilDetectionComboBox->itemData(i).toString() == cfg.pupilDetectionMethod) if (pupilDetectionComboBox->itemData(i).toString() == cfg.pupilDetectionMethod)
pupilDetectionComboBox->setCurrentIndex(i); pupilDetectionComboBox->setCurrentIndex(i);
move(pos); trackingBox->setChecked(cfg.tracking);
move(pos);
show(); show();
} }
void applyConfig() void applyConfig()
...@@ -260,7 +269,8 @@ public slots: ...@@ -260,7 +269,8 @@ public slots:
cfg.flip = (CVFlip) flipComboBox->currentData().toInt(); cfg.flip = (CVFlip) flipComboBox->currentData().toInt();
cfg.coarseDetection = coarseDetectionBox->isChecked(); cfg.coarseDetection = coarseDetectionBox->isChecked();
cfg.pupilDetectionMethod = pupilDetectionComboBox->currentData().toString(); cfg.pupilDetectionMethod = pupilDetectionComboBox->currentData().toString();
cfg.save(settings); cfg.tracking = trackingBox->isChecked();
cfg.save(settings);
emit updateConfig(); emit updateConfig();
} }
...@@ -271,6 +281,7 @@ private: ...@@ -271,6 +281,7 @@ private:
QCheckBox *coarseDetectionBox; QCheckBox *coarseDetectionBox;
QComboBox *flipComboBox; QComboBox *flipComboBox;
QDoubleSpinBox *downscalingSB; QDoubleSpinBox *downscalingSB;
QCheckBox *trackingBox;
}; };
class EyeImageProcessor : public QObject class EyeImageProcessor : public QObject
...@@ -281,6 +292,8 @@ public: ...@@ -281,6 +292,8 @@ public:
~EyeImageProcessor(); ~EyeImageProcessor();
QSettings *settings; QSettings *settings;
QVector<PupilDetectionMethod*> availablePupilDetectionMethods; QVector<PupilDetectionMethod*> availablePupilDetectionMethods;
EyeImageProcessorConfig cfg;
EyeData data;
signals: signals:
void newData(EyeData data); void newData(EyeData data);
...@@ -292,15 +305,13 @@ public slots: ...@@ -292,15 +305,13 @@ public slots:
private: private:
QString id; QString id;
EyeImageProcessorConfig cfg; QMutex cfgMutex;
QMutex cfgMutex;
EyeData data;
QPointF sROI, eROI; QPointF sROI, eROI;
PupilDetectionMethod *pupilDetectionMethod; PupilDetectionMethod *pupilDetectionMethod;
PupilTrackingMethod *pupilTrackingMethod; PupilTrackingMethod *pupilTrackingMethod;
unsigned int pmIdx; unsigned int pmIdx;
}; };
#endif // EYEIMAGEPROCESSOR_H #endif // EYEIMAGEPROCESSOR_H
...@@ -83,7 +83,7 @@ void FieldImageProcessor::process(Timestamp timestamp, const Mat &frame) ...@@ -83,7 +83,7 @@ void FieldImageProcessor::process(Timestamp timestamp, const Mat &frame)
downscaled = data.input; downscaled = data.input;
} }
if (cfg.markerDetectionMethod == "aruco") { if (cfg.markerDetectionMethod == "aruco" || gCalibrating) {
detectMarkers(downscaled, dict, corners, ids, detectorParameters); detectMarkers(downscaled, dict, corners, ids, detectorParameters);
......
...@@ -261,8 +261,8 @@ void GazeEstimation::estimate(DataTuple dataTuple) ...@@ -261,8 +261,8 @@ void GazeEstimation::estimate(DataTuple dataTuple)
if (calibrated) { if (calibrated) {
GazeEstimationMethod::InputType inputType = cfg.inputType; GazeEstimationMethod::InputType inputType = cfg.inputType;
bool lValid = dataTuple.lEye.pupil.center.x > 0 && dataTuple.lEye.pupil.center.y > 0; bool lValid = dataTuple.lEye.pupil.center.x > 0 && dataTuple.lEye.pupil.center.y > 0 && dataTuple.lEye.pupil.confidence > 0.66;
bool rValid = dataTuple.rEye.pupil.center.x > 0 && dataTuple.rEye.pupil.center.y > 0; bool rValid = dataTuple.rEye.pupil.center.x > 0 && dataTuple.rEye.pupil.center.y > 0 && dataTuple.rEye.pupil.confidence > 0.66;
switch(inputType) { switch(inputType) {
case GazeEstimationMethod::BINOCULAR: case GazeEstimationMethod::BINOCULAR:
......
...@@ -254,7 +254,8 @@ void GazeEstimationWidget::on_loadTuples_clicked() ...@@ -254,7 +254,8 @@ void GazeEstimationWidget::on_loadTuples_clicked()
void GazeEstimationWidget::on_startFinishButton_toggled(bool checked) void GazeEstimationWidget::on_startFinishButton_toggled(bool checked)
{ {
if (checked) { if (checked) {
gCalibrating = true;
ui->startFinishButton->setText("Finish"); ui->startFinishButton->setText("Finish");
statusBarLabel->setText("Calibrating: click on the field widget\nor hold 'c' to collect from marker."); statusBarLabel->setText("Calibrating: click on the field widget\nor hold 'c' to collect from marker.");
statusBarLabel->setStyleSheet("QLabel { color : black; font : bold }"); statusBarLabel->setStyleSheet("QLabel { color : black; font : bold }");
...@@ -267,7 +268,8 @@ void GazeEstimationWidget::on_startFinishButton_toggled(bool checked) ...@@ -267,7 +268,8 @@ void GazeEstimationWidget::on_startFinishButton_toggled(bool checked)
startSound.play(); startSound.play();
isCollecting = true; isCollecting = true;
} else { } else {
ui->startFinishButton->setText("Start"); gCalibrating = false;
ui->startFinishButton->setText("Start");
ui->loadTuples->setEnabled(true); ui->loadTuples->setEnabled(true);
ui->saveTuples->setEnabled(true); ui->saveTuples->setEnabled(true);
disconnect(this, SIGNAL(newClick(Timestamp,QPoint,QSize)), disconnect(this, SIGNAL(newClick(Timestamp,QPoint,QSize)),
......
...@@ -17,7 +17,9 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -17,7 +17,9 @@ MainWindow::MainWindow(QWidget *parent) :
synchronizer(NULL), synchronizer(NULL),
ui(new Ui::MainWindow) ui(new Ui::MainWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
//#define EYEREC
#ifdef EYEREC
createExtraMenus(); createExtraMenus();
connect(ui->menuBar, SIGNAL(triggered(QAction*)), this, SLOT(menuOption(QAction*)) ); connect(ui->menuBar, SIGNAL(triggered(QAction*)), this, SLOT(menuOption(QAction*)) );
...@@ -29,15 +31,13 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -29,15 +31,13 @@ MainWindow::MainWindow(QWidget *parent) :
setWindowIcon(QIcon(":/icons/EyeRecToo.png")); setWindowIcon(QIcon(":/icons/EyeRecToo.png"));
if (!cfg.workingDirectory.isEmpty()) if (!cfg.workingDirectory.isEmpty())
setWorkingDirectory(cfg.workingDirectory); setWorkingDirectory(cfg.workingDirectory);
ui->pwd->setText(QDir::currentPath()); ui->pwd->setText(QDir::currentPath());
ui->blinker->hide(); ui->blinker->hide();
logWidget = new LogWidget(); logWidget = new LogWidget();
setupWidget(logWidget, cfg.logWidgetPos, cfg.logWidgetSize, cfg.logWidgetVisible, ui->log); setupWidget(logWidget, cfg.logWidgetPos, cfg.logWidgetSize, cfg.logWidgetVisible, ui->log);
connect(logWidget, SIGNAL(closed()),
this, SLOT(logWidgetClosed()) );
gLogWidget = logWidget; gLogWidget = logWidget;
/* /*
...@@ -62,8 +62,6 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -62,8 +62,6 @@ MainWindow::MainWindow(QWidget *parent) :
fieldWidget = new CameraWidget("Field", ImageProcessor::Field); fieldWidget = new CameraWidget("Field", ImageProcessor::Field);
fieldWidget->setWindowIcon(QIcon(":/icons/fieldWidget.png")); fieldWidget->setWindowIcon(QIcon(":/icons/fieldWidget.png"));
setupWidget(fieldWidget, cfg.fieldWidgetPos, cfg.fieldWidgetSize, cfg.fieldWidgetVisible, ui->fieldCam); setupWidget(fieldWidget, cfg.fieldWidgetPos, cfg.fieldWidgetSize, cfg.fieldWidgetVisible, ui->fieldCam);
connect(fieldWidget, SIGNAL(closed()),
this, SLOT(fieldWidgetClosed()) );
/* /*
* Synchronizer * Synchronizer
...@@ -85,8 +83,6 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -85,8 +83,6 @@ MainWindow::MainWindow(QWidget *parent) :
gazeEstimationWidget, SIGNAL(inDataTuple(DataTuple)) ); gazeEstimationWidget, SIGNAL(inDataTuple(DataTuple)) );
connect(fieldWidget, SIGNAL(newClick(Timestamp,QPoint,QSize)), connect(fieldWidget, SIGNAL(newClick(Timestamp,QPoint,QSize)),
gazeEstimationWidget, SIGNAL(newClick(Timestamp,QPoint,QSize)) ); gazeEstimationWidget, SIGNAL(newClick(Timestamp,QPoint,QSize)) );
connect(gazeEstimationWidget, SIGNAL(closed()),
this, SLOT(gazeEstimationWidgetClosed()) );
connect(gazeEstimationWidget, SIGNAL(outDataTuple(DataTuple)), connect(gazeEstimationWidget, SIGNAL(outDataTuple(DataTuple)),
fieldWidget, SLOT(preview(DataTuple)) ); fieldWidget, SLOT(preview(DataTuple)) );
...@@ -106,8 +102,6 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -106,8 +102,6 @@ MainWindow::MainWindow(QWidget *parent) :
performanceMonitorWidget = new PerformanceMonitorWidget(); performanceMonitorWidget = new PerformanceMonitorWidget();
setupWidget(performanceMonitorWidget, cfg.performanceMonitorWidgetPos, cfg.performanceMonitorWidgetSize, cfg.performanceMonitorWidgetVisible, ui->performanceMonitor); setupWidget(performanceMonitorWidget, cfg.performanceMonitorWidgetPos, cfg.performanceMonitorWidgetSize, cfg.performanceMonitorWidgetVisible, ui->performanceMonitor);
connect(performanceMonitorWidget, SIGNAL(closed()),
this, SLOT(performanceMonitorWidgetClosed()) );
// GUI to Widgets signals // GUI to Widgets signals
connect(this, SIGNAL(startRecording()), connect(this, SIGNAL(startRecording()),
...@@ -147,6 +141,11 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -147,6 +141,11 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(freezeCameraImages()) ); this, SLOT(freezeCameraImages()) );
connect(&commandManager, SIGNAL(unfreezeCameraImages()), connect(&commandManager, SIGNAL(unfreezeCameraImages()),
this, SLOT(unfreezeCameraImages()) ); this, SLOT(unfreezeCameraImages()) );
#else
evaluation = new Evaluation();
evaluation->show();
QMetaObject::invokeMethod(evaluation, "run", Qt::QueuedConnection);
#endif
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
...@@ -157,6 +156,7 @@ MainWindow::~MainWindow() ...@@ -157,6 +156,7 @@ MainWindow::~MainWindow()
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
{ {
#ifdef EYEREC
if (ui->recordingToggle->isChecked()) { if (ui->recordingToggle->isChecked()) {
ui->recordingToggle->setChecked(false); ui->recordingToggle->setChecked(false);
on_recordingToggle_clicked(); on_recordingToggle_clicked();
...@@ -166,25 +166,25 @@ void MainWindow::closeEvent(QCloseEvent *event) ...@@ -166,25 +166,25 @@ void MainWindow::closeEvent(QCloseEvent *event)
} }
cfg.mainWindowPos = pos(); cfg.mainWindowPos = pos();
cfg.mainWindowSize = size(); cfg.mainWindowSize = size();
cfg.logWidgetPos = logWidget->pos(); cfg.logWidgetPos = logWidget->pos();
cfg.logWidgetSize = logWidget->size(); cfg.logWidgetSize = logWidget->size();
cfg.logWidgetVisible = logWidget->isVisible(); cfg.logWidgetVisible = logWidget->isVisible();
cfg.leftEyeWidgetPos = lEyeWidget->pos(); cfg.leftEyeWidgetPos = lEyeWidget->pos();
cfg.leftEyeWidgetSize = lEyeWidget->size(); cfg.leftEyeWidgetSize = lEyeWidget->size();
cfg.leftEyeWidgetVisible = lEyeWidget->isVisible(); cfg.leftEyeWidgetVisible = lEyeWidget->isVisible();
cfg.rightEyeWidgetPos = rEyeWidget->pos(); cfg.rightEyeWidgetPos = rEyeWidget->pos();
cfg.rightEyeWidgetSize = rEyeWidget->size(); cfg.rightEyeWidgetSize = rEyeWidget->size();
cfg.rightEyeWidgetVisible = rEyeWidget->isVisible(); cfg.rightEyeWidgetVisible = rEyeWidget->isVisible();
cfg.fieldWidgetPos = fieldWidget->pos(); cfg.fieldWidgetPos = fieldWidget->pos();
cfg.fieldWidgetSize = fieldWidget->size(); cfg.fieldWidgetSize = fieldWidget->size();
cfg.fieldWidgetVisible = fieldWidget->isVisible(); cfg.fieldWidgetVisible = fieldWidget->isVisible();
cfg.gazeEstimationWidgetPos = gazeEstimationWidget->pos(); cfg.gazeEstimationWidgetPos = gazeEstimationWidget->pos();
cfg.gazeEstimationWidgetSize = gazeEstimationWidget->size(); cfg.gazeEstimationWidgetSize = gazeEstimationWidget->size();
cfg.gazeEstimationWidgetVisible = gazeEstimationWidget->isVisible(); cfg.gazeEstimationWidgetVisible = gazeEstimationWidget->isVisible();
cfg.performanceMonitorWidgetPos = performanceMonitorWidget->pos(); cfg.performanceMonitorWidgetPos = performanceMonitorWidget->pos();
cfg.performanceMonitorWidgetSize = performanceMonitorWidget->size(); cfg.performanceMonitorWidgetSize = performanceMonitorWidget->size();
cfg.performanceMonitorWidgetVisible = performanceMonitorWidget->isVisible(); cfg.performanceMonitorWidgetVisible = performanceMonitorWidget->isVisible();
cfg.workingDirectory = QDir::currentPath(); cfg.workingDirectory = QDir::currentPath();
if (settings) if (settings)
cfg.save(settings); cfg.save(settings);
...@@ -218,7 +218,7 @@ void MainWindow::closeEvent(QCloseEvent *event) ...@@ -218,7 +218,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
if (networkStream) if (networkStream)
networkStream->deleteLater(); networkStream->deleteLater();
gPerformanceMonitor.report(); gPerformanceMonitor.report();
qInfo() << "Closing Performance Monitor Widget..."; qInfo() << "Closing Performance Monitor Widget...";
if (performanceMonitorWidget) { if (performanceMonitorWidget) {
...@@ -250,7 +250,14 @@ void MainWindow::closeEvent(QCloseEvent *event) ...@@ -250,7 +250,14 @@ void MainWindow::closeEvent(QCloseEvent *event)
if (settings) { if (settings) {
settings->deleteLater(); settings->deleteLater();
settings = NULL; settings = NULL;
} }
#else
if ( evaluation ) {
evaluation->close();
evaluation->deleteLater();
evaluation = NULL;
}
#endif
event->accept(); event->accept();
} }
...@@ -556,21 +563,18 @@ void MainWindow::setupWidget(ERWidget *widget, QPoint &position, const QSize &si ...@@ -556,21 +563,18 @@ void MainWindow::setupWidget(ERWidget *widget, QPoint &position, const QSize &si
if (visible) if (visible)
widget->show(); widget->show();
if (button) if (button) {
button->setChecked(visible); button->setChecked(visible);
connect(widget, SIGNAL(closed(bool)),
button, SLOT(setChecked(bool)) );
}
connect(widget, SIGNAL(keyPress(QKeyEvent*)), connect(widget, SIGNAL(keyPress(QKeyEvent*)),
&commandManager, SLOT(keyPress(QKeyEvent*)) ); &commandManager, SLOT(keyPress(QKeyEvent*)) );
connect(widget, SIGNAL(keyRelease(QKeyEvent*)), connect(widget, SIGNAL(keyRelease(QKeyEvent*)),
&commandManager, SLOT(keyRelease(QKeyEvent*)) ); &commandManager, SLOT(keyRelease(QKeyEvent*)) );
}
void MainWindow::logWidgetClosed() { ui->log->setChecked(false); } }
void MainWindow::lEyeWidgetClosed() { ui->leftEyeCam->setChecked(false); }
void MainWindow::rEyeWidgetClosed() { ui->rightEyeCam->setChecked(false); }
void MainWindow::fieldWidgetClosed() { ui->fieldCam->setChecked(false); }
void MainWindow::gazeEstimationWidgetClosed() { ui->gazeEstimation->setChecked(false); }
void MainWindow::performanceMonitorWidgetClosed() { ui->performanceMonitor->setChecked(false); }
void MainWindow::toggleRecording() void MainWindow::toggleRecording()
{ {
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "utils.h" #include "utils.h"
#include "Evaluation.h"
class MainWindowConfig class MainWindowConfig
{ {
public: public:
...@@ -166,6 +168,7 @@ private: ...@@ -166,6 +168,7 @@ private:
LogWidget *logWidget; LogWidget *logWidget;
PerformanceMonitorWidget *performanceMonitorWidget; PerformanceMonitorWidget *performanceMonitorWidget;
CommandManager commandManager; CommandManager commandManager;
Evaluation *evaluation;
QElapsedTimer elapsedTime; QElapsedTimer elapsedTime;
int elapsedTimeUpdateTimer; int elapsedTimeUpdateTimer;
...@@ -205,12 +208,6 @@ private slots: ...@@ -205,12 +208,6 @@ private slots:
void freezeCameraImages(); void freezeCameraImages();
void unfreezeCameraImages(); void unfreezeCameraImages();
void logWidgetClosed();
void lEyeWidgetClosed();
void rEyeWidgetClosed();
void fieldWidgetClosed();
void gazeEstimationWidgetClosed();
void performanceMonitorWidgetClosed();
}; };
#endif // MAINWINDOW_H