348 changes: 182 additions & 166 deletions plugins/openmodeller/openmodellergui.cpp

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions plugins/openmodeller/openmodellergui.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
#include <openmodellerguibase.uic.h>
#include <openmodeller/om.hh>
#endif


#include "qlogcallback.h"

/**
@author Tim Sutton
Expand Down Expand Up @@ -117,7 +116,7 @@ Q_OBJECT
void getProjList();
void createModelImage(QString theBaseName);
bool checkLayersMatch();

QLogCallback * logCallBack;
signals:
void drawModelImage(QString);
void drawRasterLayer(QString);
Expand Down
32 changes: 32 additions & 0 deletions plugins/openmodeller/qlogcallback.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef QLOGCALLBACK_H
#define QLOGCALLBACK_H
#include <om_log.hh>
#include <string>
#include <qtextstream.h>
#include <qtextbrowser.h>
/** Although the call back needs a text stream, all we want is to get the msg.c_str()
* from the logger, so having the textstream is just so that we fit the
* g_log callback model, but its not actually used anywhere
*/
class QLogCallback : public Log::LogCallback {

public:
QLogCallback( QTextStream& qtos )
{}

void operator()(Log::Level level, const std::string& msg )
{
textBrowser->append(msg.c_str());
//std::cout << msg.c_str();
}

void setTextBrowser(QTextBrowser *theTextBrowser)
{
textBrowser = theTextBrowser;

}
private:
QTextBrowser * textBrowser;

};
#endif //LOGCALLBACK_H