Began proof-of-concept memory module.
[aesalon.git] / src / visualizer / LogInput.cpp
blobfe4fbb425ac6485ff5989c1e097211d5d4aea649
1 /** Aesalon, a tool to visualize program behaviour in real time.
2 Copyright (C) 2009-2011, Aesalon development team.
4 Aesalon is distributed under the terms of the GNU GPLv3. See
5 the included file LICENSE for more information.
7 @file src/visualizer/LogInput.cpp
8 */
10 #include <QString>
12 #include "visualizer/LogInput.h"
13 #include "util/MessageSystem.h"
15 namespace Visualizer {
17 LogInput::LogInput(const std::string& filename, Visualizer::ArtisanManager *artisanManager)
18 : DataInput(artisanManager) {
19 m_file.setFileName(QString::fromStdString(filename));
21 m_file.open(QIODevice::ReadOnly);
23 connect(&m_timer, SIGNAL(timeout()), this, SLOT(readMore()));
24 connect(this, SIGNAL(moreData(QByteArray)), this, SLOT(addData(QByteArray)));
26 m_timer.start(10);
29 LogInput::~LogInput() {
33 void LogInput::readMore() {
34 QByteArray more = m_file.read(1048576);
36 if(more.size() == 0) m_timer.stop();
37 else {
38 emit moreData(more);
42 } // namespace Visualizer