This repository has been archived by the owner. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added writing to logFile. Fixed all interfaces
1 parent
2f0ed7a
commit 08adfd9
Showing
13 changed files
with
159 additions
and
117 deletions.
There are no files selected for viewing
Binary file not shown.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#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"; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef LOGFILEWRITER_H | ||
#define LOGFILEWRITER_H | ||
|
||
#include <QObject> | ||
#include <QFile> | ||
#include <QThread> | ||
#include <QDataStream> | ||
#include <QDebug> | ||
#include <QTime> | ||
|
||
class LogFileWriter : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
LogFileWriter(QObject *parent = 0); | ||
private: | ||
QFile logFile; | ||
QIODevice* device; | ||
QTime qTime; | ||
private slots: | ||
void onOpen(QString fileName); | ||
void onClose(); | ||
void onWrite(QString text, uint id, uint counter, QString timeString); | ||
}; | ||
|
||
#endif // LOGFILEWRITER_H |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ private slots: | |
void onStatusMessage(QString statusMessage); | ||
|
||
|
||
|
||
private: | ||
Ui::MainWindow *ui; | ||
|
||
|
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
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
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
Oops, something went wrong.