Commit 8696d543 authored by Thiago Santini's avatar Thiago Santini

Allows users to toggle preview for all cameras simultaneously

parent f6960011
......@@ -4,46 +4,35 @@
// TODO: make these keys configurable
CommandManager::CommandManager(QObject *parent)
{
}
void CommandManager::keyPress(QKeyEvent *event)
{
if (event->isAutoRepeat())
return;
switch (event->key()) {
case Qt::Key_C:
case Qt::Key_PageDown:
if (calibrating) {
calibrating = false;
emit disableMarkerCollection();
emit toggleCalibration();
} else {
calibrating = true;
emit toggleCalibration();
emit enableMarkerCollection();
}
break;
case Qt::Key_R:
case Qt::Key_B:
emit toggleRecording();
break;
case Qt::Key_F:
case Qt::Key_PageUp:
emit freezeCameraImages();
break;
default:
break;
}
if (event->isAutoRepeat())
return;
if (event->key() == calibrationToggleKey) {
if (calibrating) {
calibrating = false;
emit disableMarkerCollection();
emit toggleCalibration();
} else {
calibrating = true;
emit toggleCalibration();
emit enableMarkerCollection();
}
} else if (event->key() == recordingToggleKey) {
emit toggleRecording();
} else if (event->key() == previewToggleKey ){
emit togglePreview();
}
}
void CommandManager::keyRelease(QKeyEvent *event)
{
if (event->isAutoRepeat())
return;
switch (event->key()) {
case Qt::Key_F:
case Qt::Key_PageUp:
emit unfreezeCameraImages();
break;
default:
break;
}
}
......@@ -4,25 +4,33 @@
#include <QObject>
#include <QEvent>
#include <QKeyEvent>
#include <QSettings>
class CommandManager : public QObject
{
Q_OBJECT
public:
explicit CommandManager(QObject *parent = 0);
public slots:
void keyPress(QKeyEvent *event);
void keyRelease(QKeyEvent *event);
signals:
void toggleCalibration();
void toggleRecording();
void toggleRecording();
void togglePreview();
void enableMarkerCollection();
void disableMarkerCollection();
void freezeCameraImages();
void unfreezeCameraImages();
void unfreezeCameraImages();
private:
bool calibrating = false;
bool calibrating = false;
int calibrationToggleKey = Qt::Key_PageDown;
int recordingToggleKey = Qt::Key_B;
int previewToggleKey = Qt::Key_PageUp;
};
#endif // COMMANDMANAGER_H
......@@ -18,7 +18,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//#define EYEREC
#define EYEREC
#ifdef EYEREC
createExtraMenus();
......@@ -145,6 +145,8 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(freezeCameraImages()) );
connect(&commandManager, SIGNAL(unfreezeCameraImages()),
this, SLOT(unfreezeCameraImages()) );
connect(&commandManager, SIGNAL(togglePreview()),
this, SLOT(togglePreview()) );
#else
gPerformanceMonitor.setFrameDrop(false);
evaluation = new Evaluation();
......@@ -585,7 +587,17 @@ void MainWindow::toggleRecording()
{
if ( ! ui->recordingToggle->isChecked()) {
if (ui->subject->text().isEmpty()) // Unset remote recording
setSubjectName("remote");
}
setSubjectName("remote");
QMetaObject::invokeMethod(performanceMonitorWidget, "on_resetCounters_clicked");
} else {
gPerformanceMonitor.report();
}
ui->recordingToggle->click();
}
void MainWindow::togglePreview()
{
ui->fieldCam->click();
ui->leftEyeCam->click();
ui->rightEyeCam->click();
}
......@@ -206,7 +206,8 @@ private slots:
void toggleRecording();
void freezeCameraImages();
void unfreezeCameraImages();
void unfreezeCameraImages();
void togglePreview();
};
......
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