Changeset - e70ba1409177
[Not reviewed]
recording
0 5 0
Hasan Yavuz Ă–ZDERYA - 9 years ago 2017-02-14 09:42:52
hy@ozderya.net
added checkbox to disable write buffering
5 files changed with 22 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/abstractreader.cpp
Show inline comments
 
@@ -19,8 +19,6 @@
 

	
 
#include "abstractreader.h"
 

	
 
#include <QtDebug>
 

	
 
AbstractReader::AbstractReader(QIODevice* device, ChannelManager* channelMan,
 
                               DataRecorder* recorder, QObject* parent) :
 
    QObject(parent)
 
@@ -56,7 +54,6 @@ void AbstractReader::addData(double* sam
 
    if (recording)
 
    {
 
        _recorder->addData(samples, length, numOfChannels());
 
        qDebug() << "adding data";
 
    }
 
    sampleCount += length;
 
}
src/datarecorder.cpp
Show inline comments
 
@@ -26,6 +26,7 @@ DataRecorder::DataRecorder(QObject *pare
 
    fileStream(&file)
 
{
 
    lastNumChannels = 0;
 
    disableBuffering = false;
 
}
 

	
 
bool DataRecorder::startRecording(QString fileName, QStringList channelNames)
 
@@ -74,6 +75,8 @@ void DataRecorder::addData(double* data,
 
        }
 
        fileStream << '\n';
 
    }
 

	
 
    if (disableBuffering) fileStream.flush();
 
}
 

	
 
void DataRecorder::stopRecording()
src/datarecorder.h
Show inline comments
 
@@ -30,6 +30,9 @@ class DataRecorder : public QObject
 
public:
 
    explicit DataRecorder(QObject *parent = 0);
 

	
 
    /// Disables file buffering
 
    bool disableBuffering;
 

	
 
    /**
 
     * @brief Starts recording data to a file in CSV format.
 
     *
src/recordpanel.cpp
Show inline comments
 
@@ -53,6 +53,12 @@ RecordPanel::RecordPanel(DataRecorder* r
 

	
 
    connect(ui->cbRecordPaused, SIGNAL(toggled(bool)),
 
            this, SIGNAL(recordPausedChanged(bool)));
 

	
 
    connect(ui->cbDisableBuffering, &QCheckBox::toggled,
 
            [this](bool enabled)
 
            {
 
                _recorder->disableBuffering = enabled;
 
            });
 
}
 

	
 
RecordPanel::~RecordPanel()
src/recordpanel.ui
Show inline comments
 
@@ -80,6 +80,16 @@
 
      </widget>
 
     </item>
 
     <item>
 
      <widget class="QCheckBox" name="cbDisableBuffering">
 
       <property name="toolTip">
 
        <string>Do not buffer when writing to file. Check this if you are using other software to open the file during recording.</string>
 
       </property>
 
       <property name="text">
 
        <string>Disable buffering</string>
 
       </property>
 
      </widget>
 
     </item>
 
     <item>
 
      <spacer name="verticalSpacer">
 
       <property name="orientation">
 
        <enum>Qt::Vertical</enum>
0 comments (0 inline, 0 general)