2010-09-10 09:14:48 +08:00
|
|
|
/*
|
|
|
|
This file is part of Mitsuba, a physically based rendering system.
|
|
|
|
|
|
|
|
Copyright (c) 2007-2010 by Wenzel Jakob and others.
|
|
|
|
|
|
|
|
Mitsuba is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License Version 3
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
Mitsuba is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-08-10 01:38:37 +08:00
|
|
|
#if !defined(__LOGWIDGET_H)
|
|
|
|
#define __LOGWIDGET_H
|
|
|
|
|
|
|
|
#include "common.h"
|
2010-09-10 09:14:48 +08:00
|
|
|
#include <mitsuba/core/appender.h>
|
2010-08-10 01:38:37 +08:00
|
|
|
|
|
|
|
namespace mitsuba {
|
|
|
|
class RenderJob;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class QConsoleAppender : public QObject, public Appender {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
void append(ELogLevel level, const std::string &message) {
|
|
|
|
emit textMessage(level, QString(message.c_str()));
|
|
|
|
}
|
|
|
|
void logProgress(Float progress, const std::string &name,
|
|
|
|
const std::string &formatted, const std::string &eta,
|
|
|
|
const void *ptr) {
|
|
|
|
emit progressMessage((RenderJob *) ptr,
|
|
|
|
QString(name.c_str()), (float) progress, QString(eta.c_str()));
|
|
|
|
}
|
|
|
|
signals:
|
|
|
|
void textMessage(ELogLevel level, const QString &message);
|
|
|
|
void progressMessage(const RenderJob *job, const QString &name,
|
|
|
|
float progress, const QString &eta);
|
|
|
|
};
|
|
|
|
|
|
|
|
class LogWidget : public QMainWindow {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
LogWidget(QWidget *parent);
|
|
|
|
virtual ~LogWidget();
|
|
|
|
void show();
|
|
|
|
public slots:
|
|
|
|
void onTextMessage(ELogLevel level, const QString &message);
|
|
|
|
void onShowStats();
|
|
|
|
private:
|
|
|
|
QTextEdit *m_contents;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __LOGWIDGET_H */
|