This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
AudioGameGUI/LogFileWriter.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
41 lines (36 sloc)
1.01 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "LogFileWriter.h" | |
LogFileWriter::LogFileWriter(QObject* parent) | |
: QObject(parent) | |
{ | |
} | |
void LogFileWriter::onOpen(QString fileName) | |
{ | |
logFile.setFileName(fileName); | |
logFile.open(QIODevice::WriteOnly | QIODevice::Text); | |
QTextStream out(&logFile); | |
/*Write header*/ | |
out<<QString("#event\tbit_mask\tstate\ttime\n"); | |
} | |
void LogFileWriter::onClose() | |
{ | |
logFile.close(); | |
} | |
void LogFileWriter::onWrite(QString text, uint id, uint counter, QString timeString) | |
{ | |
// QString timeString = QTime::currentTime().toString("hh:mm:ss.zzz"); | |
if(logFile.isOpen()){ | |
QTextStream out(&logFile); | |
out << text << "\t" << id << "\t" << counter << "\t" << timeString << "\n"; | |
} | |
} | |
void LogFileWriter::onWriteTrackingResult(QVector<double> trackingResult) | |
{ | |
if(logFile.isOpen()){ | |
QTextStream out(&logFile); | |
out << "Tracking"; | |
for(double r: trackingResult){ | |
out << "\t" << r; | |
} | |
out << "\n"; | |
} | |
} |