diff --git a/app/SandboxSetup/croppingmask.cpp b/app/SandboxSetup/croppingmask.cpp index e2c984cd1a4aab33fe45bcf8cc45cff8434d884e..934b5dcffa88cb9faf63af0285b90d13bdefccbd 100644 --- a/app/SandboxSetup/croppingmask.cpp +++ b/app/SandboxSetup/croppingmask.cpp @@ -43,23 +43,28 @@ void CroppingMask::cancelRoutine(){ void CroppingMask::showEvent(QShowEvent *event){ QWidget::showEvent(event); - QTimer::singleShot(100, this, &CroppingMask::takePicture); + takePicture(); } void CroppingMask::on_btnTakePicture_clicked() -{ +{ + takePicture(); +} + +void CroppingMask::takePicture(){ + // take picture of blue screen if(!blueScreenInitilized){ blueScreenInitilized = true; projBlueScreen->setGeometry(mg->getResolution()); } + cv::Mat blueMat = cv::Mat(1, 1, CV_8UC3, cv::Scalar(0, 0, 255)); projBlueScreen->imShow(blueMat); - QTimer::singleShot(1000, this, &CroppingMask::takePicture); + QTimer::singleShot(1000, this, &CroppingMask::capture); } -void CroppingMask::takePicture(){ - +void CroppingMask::capture(){ setup->getCamera()->capture(); projBlueScreen->close(); diff --git a/app/SandboxSetup/croppingmask.h b/app/SandboxSetup/croppingmask.h index d0ea80e3df50a23d30d28278979c943b9dc4bcaf..32391f72aac28f64e5dc84ef1b392615c525f7a8 100644 --- a/app/SandboxSetup/croppingmask.h +++ b/app/SandboxSetup/croppingmask.h @@ -44,6 +44,7 @@ private: bool maskValideInFrame(cv::Mat *rgb); void takePicture(); + void capture(); }; #endif // CROPPINGMASK_H diff --git a/app/SandboxSetup/initcamera.cpp b/app/SandboxSetup/initcamera.cpp index fc2caa2a0ffc3a5c08b63114f16510cec1d2614b..410fe2479ca19a0fc61918cbdadc8442597c939b 100644 --- a/app/SandboxSetup/initcamera.cpp +++ b/app/SandboxSetup/initcamera.cpp @@ -11,7 +11,6 @@ void CameraStartThread::run() { camera->start(); camera->warmUpDepthLens(); - std::cout << "camera ready" << std::endl; emit setupReady(); } diff --git a/app/SandboxSetup/mainwindow.cpp b/app/SandboxSetup/mainwindow.cpp index 6036ea71518752827f2ab0dd789196ef9fd187d0..ba4bca6baba57e66183ad03904bda02db5b6bc27 100644 --- a/app/SandboxSetup/mainwindow.cpp +++ b/app/SandboxSetup/mainwindow.cpp @@ -108,7 +108,6 @@ void MainWindow::nextApp(){ if(verifyApp()){ applist.at(step)->valideRoutine(); closeApp(); - if((uint)step < applist.size()-1){ step++; loadApp(); diff --git a/app/SandboxSetup/maskedit.cpp b/app/SandboxSetup/maskedit.cpp index 16632d36b79d4376053b29fd68aadf9721c6cbb6..36f4220f749a2cc196ea72e7879374bd733d4d00 100644 --- a/app/SandboxSetup/maskedit.cpp +++ b/app/SandboxSetup/maskedit.cpp @@ -99,7 +99,7 @@ int MaskEdit::selectCorner(QMouseEvent* eMouse){ if(capture != nullptr && rectPoints != nullptr){ - int margin = 20; + int margin = 10; // x and y relative to the captured frame, not the UI int mouseX = (int)( (float)eMouse->x() * ratioX ); diff --git a/app/SandboxSetup/projectiongui.cpp b/app/SandboxSetup/projectiongui.cpp index c537ba1d9a532f52d4e7a2eb8211fd5fc7a468ce..8dda8478e3e10e93ac344626721cb84b428a4d08 100644 --- a/app/SandboxSetup/projectiongui.cpp +++ b/app/SandboxSetup/projectiongui.cpp @@ -10,7 +10,7 @@ ProjectionGui::ProjectionGui(SandboxSetup *_setup, MonitorGui *_mg, QWidget *par ui->setupUi(this); ui->lblFrame->setGeometry(0, 0, ui->fContainer->width(), ui->fContainer->height()); - blueScreen = new QtFullScreen(mg->getResolution(), false); + blueScreen = new QtFullScreen(mg->getResolution(), true, this); frameTimer = new QTimer(this); connect(frameTimer, &QTimer::timeout, this, &ProjectionGui::refreshFrame); @@ -44,9 +44,7 @@ void ProjectionGui::on_btnStart_clicked() cv::Mat blue = cv::Mat(1, 1, CV_8UC3, cv::Scalar(0, 0, 255)); blueScreen->setGeometry(mg->getResolution()); blueScreen->imShow(blue); - cameraUsed = true; - //ui->fContainer->hide(); frameTimer->start(100); } } diff --git a/app/SandboxSetup/qtfullscreen.cpp b/app/SandboxSetup/qtfullscreen.cpp index d4e20c5410f707cfe23e4ae6de572b714e708488..62849ea85ba38889a84bf32904fcd574be04164d 100644 --- a/app/SandboxSetup/qtfullscreen.cpp +++ b/app/SandboxSetup/qtfullscreen.cpp @@ -1,12 +1,14 @@ #include "qtfullscreen.h" -QtFullScreen::QtFullScreen(QRect _resolution, bool _isBorderless, QWidget *parent) : QWidget(parent) +QtFullScreen::QtFullScreen(QRect reso, bool _isBorderless, QWidget *parent) : QObject() { p = parent; - win = new QDialog; - resolution = &_resolution; + resolution = new QRect(reso.left(), reso.top(), reso.width(), reso.height()); isBorderless = _isBorderless; - //win->setWindowFlags(Qt::Window); + + win = new QDialog(parent); + win->setWindowFlags(Qt::Window); + win->setFocusPolicy(Qt::NoFocus); win->setGeometry(*resolution); image = new QLabel(win); @@ -18,15 +20,7 @@ QtFullScreen::~QtFullScreen() { delete image; delete win; -} - -void QtFullScreen::showEvent(QShowEvent* event){ - - QWidget::showEvent( event ); - if(win->parent() != 0) - std::cout << "QtFullScreen showEvent : " << win->parent()->objectName().toStdString() << std::endl; - if(p != nullptr) - p->setFocus(); + delete resolution; } void QtFullScreen::setGeometry(QRect reso){ @@ -45,12 +39,17 @@ void QtFullScreen::imShow(cv::Mat frame){ QPixmap px = QPixmap::fromImage(src); image->setPixmap(px); - if(isBorderless && !win->windowState().testFlag(Qt::WindowFullScreen)){ - win->setWindowState(Qt::WindowFullScreen); + if(!win->isVisible()){ + if(isBorderless){ + win->showFullScreen(); + }else{ + win->show(); + } } - if(!win->isVisible()) - win->show(); + if(p != nullptr) + p->setFocus(); + } void QtFullScreen::close(){ diff --git a/app/SandboxSetup/qtfullscreen.h b/app/SandboxSetup/qtfullscreen.h index 0a31916626cc2a859e7a6542cd993e00c5df402b..c42dd50609278f1ac477379825e2db735722a0ac 100644 --- a/app/SandboxSetup/qtfullscreen.h +++ b/app/SandboxSetup/qtfullscreen.h @@ -7,7 +7,7 @@ #include <QScreen> #include <QDialog> -class QtFullScreen : public QWidget +class QtFullScreen : public QObject { Q_OBJECT public: @@ -18,13 +18,6 @@ public: void setGeometry(QRect resolution); void setGeometry(int x, int y, int w, int h); -signals: - -public slots: - -protected: - void showEvent(QShowEvent* event); - private: QDialog *win; QLabel *image; diff --git a/app/SandboxSetup/subapp.h b/app/SandboxSetup/subapp.h index 1549ec8378ab8b3cb65addc387031b4ab230d308..b016f6ada6ffcb0a0604d15564d6fe2cb46151e0 100644 --- a/app/SandboxSetup/subapp.h +++ b/app/SandboxSetup/subapp.h @@ -13,9 +13,9 @@ public: bool getEndState(){ return endSuccess; }; std::string getErrorMessage(){ return error_msg; }; void setErrorMessage(std::string msg){ error_msg = msg; }; - bool checkRoutine(); - void valideRoutine(); - void cancelRoutine(); + virtual bool checkRoutine(); + virtual void valideRoutine(); + virtual void cancelRoutine(); signals: void sendNotif();