From 91509a35e457d8af40c8b1df573fc3ae69f05ba9 Mon Sep 17 00:00:00 2001 From: Hiro Protagonist Date: Sun, 26 Mar 2017 18:24:11 +1300 Subject: [PATCH] write t'll it is over --- src/mainwindow.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 05cb6d9..4777bdc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -34,7 +34,7 @@ MainWindow::MainWindow( QWidget * parent ) : ui->projectName->setText( "Taevitas_Rec_" + QDateTime::currentDateTime().toString( "dd_MM_yyyy_hh_mm_ss" ) ); // Set default dir - recorder.setProjectDir(QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation )); + recorder.setProjectDir( QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation ) ); // Connect Frame Counts, Time Captured LCD connect( &recorder, &Recorder::frameSaved, this, [this] { @@ -269,7 +269,7 @@ void MainWindow::startStopRecording() { } catch ( RecorderError ) { showError( "Could not start Recording!" ); ui->saveFrames->setProperty( "enabled", true ); - stopCapture(); + resetCapture(); return; } @@ -286,7 +286,7 @@ void MainWindow::startStopRecording() { } if ( !stopped ) { - setStatus(STOPPING); + setStatus( STOPPING ); // We just wait... return; } @@ -298,21 +298,14 @@ void MainWindow::startStopRecording() { return; } - // Restart Preview - if ( ui->preview_button->isChecked() ) { - try { - camMan.startCapture(); - } catch ( FlyCapture2::Error e ) { - showError( e ); - } - } + resetCapture(); ui->saveFrames->setProperty( "enabled", true ); setStatus( CONNECTED ); } } -void MainWindow::stopCapture() { +void MainWindow::resetCapture() { if ( !ui->preview_button->isChecked() ) { try { camMan.stopCapture(); @@ -320,5 +313,11 @@ void MainWindow::stopCapture() { showError( e ); return; } + } else { + try { + camMan.startCapture(); + } catch ( FlyCapture2::Error e ) { + showError( e ); + } } }