From b303c76d591dcb7167b227b36e658ad841765174 Mon Sep 17 00:00:00 2001 From: Hiro Protagonist Date: Thu, 23 Mar 2017 19:51:03 +1300 Subject: [PATCH] append investigation --- src/recorder.cpp | 9 +++++---- src/recorder.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/recorder.cpp b/src/recorder.cpp index 6e2fbb8..724d041 100644 --- a/src/recorder.cpp +++ b/src/recorder.cpp @@ -48,14 +48,14 @@ void Recorder::newRecording( QString r_name ) { bool statExists = QFile(record_dir.path() + "/" + ".stat").exists(); // get Status file - QFile stat_file( record_dir.path() + "/" + ".stat" ); - if( !stat_file.open( QIODevice::ReadWrite | QIODevice::Text ) ) { + stat_file = new QFile( record_dir.path() + "/" + ".stat" ); + if( !stat_file->open( QIODevice::ReadWrite | QIODevice::Text ) ) { throw RecorderError::CANT_OPEN_STATFILE; return; } if( !statExists) - stat_file.write( "0\n" ); + stat_file->write( "0\n" ); frame_n = 0; time_c = 0; @@ -84,7 +84,7 @@ void Recorder::newRecording( QString r_name ) { bool Recorder::restoreRecording() { bool ok; qDebug() << "reading statfile"; - qDebug() << QString( stat_file.readLine() ); + frame_n = QString( stat_file->readLine() ).toUInt( &ok, 10 ); qDebug() << "red statfile"; return ok; } @@ -145,6 +145,7 @@ void Recorder::cleanup() { rec_name = ""; capture_frames = false; append = false; + delete stat_file; } }; diff --git a/src/recorder.h b/src/recorder.h index 7667412..9c086dd 100644 --- a/src/recorder.h +++ b/src/recorder.h @@ -102,7 +102,7 @@ class Recorder : public QObject { QString rec_name; // status file for frame count - QFile stat_file; + QFile* stat_file; // Check if recording directory exists. If it does ask for Overwrite or cancelation. RecorderError verifyRecDir();