append investigation

This commit is contained in:
Hiro Protagonist 2017-03-23 19:51:03 +13:00
parent 5d9500f6fe
commit b303c76d59
2 changed files with 6 additions and 5 deletions

View file

@ -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;
}
};

View file

@ -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();