Commit 12743c1e authored by Thiago Santini's avatar Thiago Santini

Unchecks widgets' button when window is closed

Man, I really need to make a base class for the widgets...
parent 8aad4435
......@@ -43,6 +43,7 @@ signals:
void newData(EyeData data);
void newData(FieldData data);
void newClick(Timestamp,QPoint,QSize);
void closed();
public slots:
void preview(Timestamp t, const cv::Mat &frame);
......@@ -109,6 +110,9 @@ private:
void drawPupil(const cv::RotatedRect ellipse, QPainter &painter);
void drawMarker(const Marker &marker, QPainter &painter, QColor color);
void drawGaze(const FieldData &field, QPainter &painter);
protected:
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE { Q_UNUSED(event) emit closed(); }
};
#endif // CAMERAWIDGET_H
......@@ -35,6 +35,7 @@ signals:
void loadTuplesFromFile(CollectionTuple::TupleType type, QString fileName);
void calibrationRequest();
void setCalibrating(bool v);
void closed();
public slots:
......@@ -88,6 +89,9 @@ private slots:
void on_rangeFactorSB_valueChanged(int arg1);
void on_visualizationGroupBox_toggled(bool arg1);
void on_visualizationTimeSpinBox_valueChanged(int arg1);
protected:
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE { Q_UNUSED(event) emit closed(); }
};
#endif // GAZEESTIMATIONWIDGET_H
......@@ -16,6 +16,9 @@ public:
explicit LogWidget(QWidget *parent = 0);
~LogWidget();
signals:
void closed();
public slots:
void appendMessage(const QString &msg);
......@@ -26,6 +29,9 @@ private slots:
private:
Ui::LogWidget *ui;
protected:
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE { Q_UNUSED(event) emit closed(); }
};
#endif // LOGWIDGET_H
......@@ -2,7 +2,7 @@
#include "ui_MainWindow.h"
// TODO: refactor MainWindow into a config aware class that can be shared by the
// widgets
// widgets. Also add the gui interface there.
void MainWindow::createExtraMenus()
{
......@@ -37,6 +37,8 @@ MainWindow::MainWindow(QWidget *parent) :
logWidget = new LogWidget();
setupWidget(logWidget, cfg.logWidgetPos, cfg.logWidgetSize, cfg.logWidgetVisible, ui->log);
connect(logWidget, SIGNAL(closed()),
this, SLOT(logWidgetClosed()) );
gLogWidget = logWidget;
/*
......@@ -53,14 +55,20 @@ MainWindow::MainWindow(QWidget *parent) :
lEyeWidget = new CameraWidget("LeftEye", ImageProcessor::Eye);
lEyeWidget->setWindowIcon(QIcon(":/icons/lEyeWidget.png"));
setupWidget(lEyeWidget, cfg.leftEyeWidgetPos, cfg.leftEyeWidgetSize, cfg.leftEyeWidgetVisible, ui->leftEyeCam);
connect(lEyeWidget, SIGNAL(closed()),
this, SLOT(lEyeWidgetClosed()) );
QThread::msleep(200);
rEyeWidget = new CameraWidget("RightEye", ImageProcessor::Eye);
rEyeWidget->setWindowIcon(QIcon(":/icons/rEyeWidget.png"));
setupWidget(rEyeWidget, cfg.rightEyeWidgetPos, cfg.rightEyeWidgetSize, cfg.rightEyeWidgetVisible, ui->rightEyeCam);
connect(rEyeWidget, SIGNAL(closed()),
this, SLOT(rEyeWidgetClosed()) );
QThread::msleep(200);
fieldWidget = new CameraWidget("Field", ImageProcessor::Field);
fieldWidget->setWindowIcon(QIcon(":/icons/fieldWidget.png"));
setupWidget(fieldWidget, cfg.fieldWidgetPos, cfg.fieldWidgetSize, cfg.fieldWidgetVisible, ui->fieldCam);
connect(fieldWidget, SIGNAL(closed()),
this, SLOT(fieldWidgetClosed()) );
/*
* Synchronizer
......@@ -82,6 +90,8 @@ MainWindow::MainWindow(QWidget *parent) :
gazeEstimationWidget, SIGNAL(inDataTuple(DataTuple)) );
connect(fieldWidget, SIGNAL(newClick(Timestamp,QPoint,QSize)),
gazeEstimationWidget, SIGNAL(newClick(Timestamp,QPoint,QSize)) );
connect(gazeEstimationWidget, SIGNAL(closed()),
this, SLOT(gazeEstimationWidgetClosed()) );
connect(gazeEstimationWidget, SIGNAL(outDataTuple(DataTuple)),
fieldWidget, SLOT(preview(DataTuple)) );
......@@ -101,6 +111,8 @@ MainWindow::MainWindow(QWidget *parent) :
performanceMonitorWidget = new PerformanceMonitorWidget();
setupWidget(performanceMonitorWidget, cfg.performanceMonitorWidgetPos, cfg.performanceMonitorWidgetSize, cfg.performanceMonitorWidgetVisible, ui->performanceMonitor);
connect(performanceMonitorWidget, SIGNAL(closed()),
this, SLOT(performanceMonitorWidgetClosed()) );
// GUI to Widgets signals
connect(this, SIGNAL(startRecording()),
......@@ -553,3 +565,10 @@ void MainWindow::setupWidget(QMainWindow *window, QPoint &position, const QSize
if (button)
button->setChecked(visible);
}
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); }
......@@ -197,6 +197,13 @@ private slots:
void showAboutDialog();
void on_log_clicked();
void on_performanceMonitor_clicked();
void logWidgetClosed();
void lEyeWidgetClosed();
void rEyeWidgetClosed();
void fieldWidgetClosed();
void gazeEstimationWidgetClosed();
void performanceMonitorWidgetClosed();
};
#endif // MAINWINDOW_H
......@@ -17,7 +17,6 @@ public:
QString getEnrolled(const unsigned int &idx) { return idx < enrolled.size() ? enrolled[idx] : QString(); }
unsigned int enrolledCount() { return (unsigned int) enrolled.size(); }
void report();
private:
......
......@@ -22,6 +22,9 @@ public:
explicit PerformanceMonitorWidget(QWidget *parent = 0);
~PerformanceMonitorWidget();
signals:
void closed();
private:
Ui::PerformanceMonitorWidget *ui;
......@@ -35,6 +38,9 @@ private:
private slots:
void update();
void on_resetCounters_clicked();
protected:
void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE { Q_UNUSED(event) emit closed(); }
};
#endif // PERFORMANCEMONITORWIDGET_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment