diff --git a/src/datarecorder.cpp b/src/datarecorder.cpp
--- a/src/datarecorder.cpp
+++ b/src/datarecorder.cpp
@@ -29,9 +29,10 @@ DataRecorder::DataRecorder(QObject *pare
disableBuffering = false;
}
-bool DataRecorder::startRecording(QString fileName, QStringList channelNames)
+bool DataRecorder::startRecording(QString fileName, QString separator, QStringList channelNames)
{
Q_ASSERT(!file.isOpen());
+ _sep = separator;
// open file
file.setFileName(fileName);
@@ -45,7 +46,7 @@ bool DataRecorder::startRecording(QStrin
// write header line
if (!channelNames.isEmpty())
{
- fileStream << channelNames.join(",");
+ fileStream << channelNames.join(_sep);
fileStream << "\n";
lastNumChannels = channelNames.length();
}
@@ -71,7 +72,7 @@ void DataRecorder::addData(double* data,
for (unsigned ci = 0; ci < numOfChannels; ci++)
{
fileStream << data[ci * numOfSamples + i];
- if (ci != numOfChannels-1) fileStream << ",";
+ if (ci != numOfChannels-1) fileStream << _sep;
}
fileStream << '\n';
}
diff --git a/src/datarecorder.h b/src/datarecorder.h
--- a/src/datarecorder.h
+++ b/src/datarecorder.h
@@ -39,10 +39,11 @@ public:
* File is opened and header line (names of channels) is written.
*
* @param fileName name of the recording file
+ * @param separator column separator
* @param channelNames names of the channels for header line, if empty no header line is written
* @return false if file operation fails (read only etc.)
*/
- bool startRecording(QString fileName, QStringList channelNames);
+ bool startRecording(QString fileName, QString separator, QStringList channelNames);
/**
* @brief Adds data to a channel.
@@ -70,6 +71,7 @@ private:
unsigned lastNumChannels; ///< used for error message only
QFile file;
QTextStream fileStream;
+ QString _sep;
};
#endif // DATARECORDER_H
diff --git a/src/recordpanel.cpp b/src/recordpanel.cpp
--- a/src/recordpanel.cpp
+++ b/src/recordpanel.cpp
@@ -222,7 +222,7 @@ void RecordPanel::startRecording(void)
{
channelNames = _channelMan->infoModel()->channelNames();
}
- _recorder->startRecording(selectedFile, channelNames);
+ _recorder->startRecording(selectedFile, getSeparator(), channelNames);
emit recordStarted();
}
@@ -240,3 +240,10 @@ void RecordPanel::onPortClose()
recordAction.setChecked(false);
}
}
+
+QString RecordPanel::getSeparator() const
+{
+ QString sep = ui->leSeparator->text();
+ sep.replace("\\t", "\t");
+ return sep;
+}
diff --git a/src/recordpanel.h b/src/recordpanel.h
--- a/src/recordpanel.h
+++ b/src/recordpanel.h
@@ -90,6 +90,10 @@ private:
void startRecording(void);
void stopRecording(void);
+ /// Returns separator text from ui. "\t" is converted to TAB
+ /// character.
+ QString getSeparator() const;
+
private slots:
/**
* @brief Opens up the file select dialog
diff --git a/src/recordpanel.ui b/src/recordpanel.ui
--- a/src/recordpanel.ui
+++ b/src/recordpanel.ui
@@ -7,7 +7,7 @@
0
0
532
- 169
+ 261
@@ -93,6 +93,46 @@
-
+
+
-
+
+
+ Column Separator:
+
+
+
+ -
+
+
+
+ 30
+ 16777215
+
+
+
+ For TAB character enter \t
+
+
+ ,
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
Do not buffer when writing to file. Check this if you are using other software to open the file during recording.
@@ -110,7 +150,7 @@
20
- 40
+ 1
@@ -143,7 +183,7 @@
20
- 40
+ 1