Commit 2c6c911f authored by Sylvain Thery's avatar Sylvain Thery
Browse files

bug cgognStream

parent 2824f2ae
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
//forward definitions //forward definitions
namespace CGoGN { namespace Utils { namespace QT { class SimpleQT; } } } namespace CGoGN { namespace Utils { namespace QT { class SimpleQT; } } }
namespace CGoGN { namespace Utils { namespace QT { class SimpleQGLV; } } }
class QTextEdit; class QTextEdit;
namespace CGoGN namespace CGoGN
...@@ -56,11 +57,13 @@ void allToFile(const std::string& filename); ...@@ -56,11 +57,13 @@ void allToFile(const std::string& filename);
* set all outputs to status bar of Qt interface * set all outputs to status bar of Qt interface
*/ */
void allToStatusBar(Utils::QT::SimpleQT* sqt); void allToStatusBar(Utils::QT::SimpleQT* sqt);
void allToStatusBar(Utils::QT::SimpleQGLV* sqglv);
/** /**
* set all outputs to console of Qt interface * set all outputs to console of Qt interface
*/ */
void allToConsole(Utils::QT::SimpleQT* sqt); void allToConsole(Utils::QT::SimpleQT* sqt);
void allToConsole(Utils::QT::SimpleQGLV* sqglv);
#endif #endif
...@@ -92,9 +95,12 @@ protected: ...@@ -92,9 +95,12 @@ protected:
#ifdef WITH_QT #ifdef WITH_QT
Utils::QT::SimpleQT* m_sqt_bar; Utils::QT::SimpleQT* m_sqt_bar;
Utils::QT::SimpleQT* m_sqt_console; Utils::QT::SimpleQT* m_sqt_console;
Utils::QT::SimpleQGLV* m_sqglv_bar;
Utils::QT::SimpleQGLV* m_sqglv_console;
QTextEdit* m_qte; QTextEdit* m_qte;
#endif #endif
...@@ -126,6 +132,11 @@ public: ...@@ -126,6 +132,11 @@ public:
void toFile(const std::string& filename); void toFile(const std::string& filename);
#ifdef WITH_QT #ifdef WITH_QT
void toStatusBar(void* ptr);
void toConsole(void* ptr);
/** /**
* set output to status bar of Qt interface * set output to status bar of Qt interface
*/ */
...@@ -135,6 +146,17 @@ public: ...@@ -135,6 +146,17 @@ public:
* set output to console of Qt interface * set output to console of Qt interface
*/ */
void toConsole(Utils::QT::SimpleQT* sqt); void toConsole(Utils::QT::SimpleQT* sqt);
/**
* set output to status bar of Qt interface
*/
void toStatusBar(Utils::QT::SimpleQGLV* sqglv);
/**
* set output to console of Qt interface
*/
void toConsole(Utils::QT::SimpleQGLV* sqglv);
#endif #endif
/** /**
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "Utils/cgognStream.h" #include "Utils/cgognStream.h"
#ifdef WITH_QT #ifdef WITH_QT
#include "Utils/Qt/qtSimple.h" #include "Utils/Qt/qtSimple.h"
#include "Utils/Qt/qtQGLV.h"
#include <QtGui/QTextEdit> #include <QtGui/QTextEdit>
#endif #endif
namespace CGoGN namespace CGoGN
...@@ -61,7 +62,6 @@ void allToStatusBar(Utils::QT::SimpleQT* sqt) ...@@ -61,7 +62,6 @@ void allToStatusBar(Utils::QT::SimpleQT* sqt)
CGoGNout.toStatusBar(sqt); CGoGNout.toStatusBar(sqt);
CGoGNerr.toStatusBar(sqt); CGoGNerr.toStatusBar(sqt);
CGoGNdbg.toStatusBar(sqt); CGoGNdbg.toStatusBar(sqt);
} }
void allToConsole(Utils::QT::SimpleQT* sqt) void allToConsole(Utils::QT::SimpleQT* sqt)
...@@ -70,6 +70,21 @@ void allToConsole(Utils::QT::SimpleQT* sqt) ...@@ -70,6 +70,21 @@ void allToConsole(Utils::QT::SimpleQT* sqt)
CGoGNerr.toConsole(sqt); CGoGNerr.toConsole(sqt);
CGoGNdbg.toConsole(sqt); CGoGNdbg.toConsole(sqt);
}
void allToStatusBar(Utils::QT::SimpleQGLV* sqglv)
{
CGoGNout.toStatusBar(sqglv);
CGoGNerr.toStatusBar(sqglv);
CGoGNdbg.toStatusBar(sqglv);
}
void allToConsole(Utils::QT::SimpleQGLV* sqglv)
{
CGoGNout.toConsole(sqglv);
CGoGNerr.toConsole(sqglv);
CGoGNdbg.toConsole(sqglv);
} }
#endif #endif
...@@ -90,6 +105,8 @@ Out::Out(): ...@@ -90,6 +105,8 @@ Out::Out():
#ifdef WITH_QT #ifdef WITH_QT
m_sqt_bar(NULL), m_sqt_bar(NULL),
m_sqt_console(NULL), m_sqt_console(NULL),
m_sqglv_bar(NULL),
m_sqglv_console(NULL),
m_qte(NULL), m_qte(NULL),
#endif #endif
m_ofs(NULL), m_ofs(NULL),
...@@ -145,6 +162,18 @@ void Out::toFile(const std::string& filename ) ...@@ -145,6 +162,18 @@ void Out::toFile(const std::string& filename )
} }
#ifdef WITH_QT #ifdef WITH_QT
void Out::toStatusBar(void* ptr)
{
if (ptr == NULL)
m_out_mode &= ~QTSTATUSBAR;
}
void Out::toConsole(void* ptr)
{
if (ptr == NULL)
m_out_mode &= ~QTCONSOLE;
}
void Out::toStatusBar(Utils::QT::SimpleQT* sqt) void Out::toStatusBar(Utils::QT::SimpleQT* sqt)
{ {
if (sqt != NULL) if (sqt != NULL)
...@@ -163,6 +192,26 @@ void Out::toConsole(Utils::QT::SimpleQT* sqt) ...@@ -163,6 +192,26 @@ void Out::toConsole(Utils::QT::SimpleQT* sqt)
m_out_mode &= ~QTCONSOLE; m_out_mode &= ~QTCONSOLE;
m_sqt_console = sqt; m_sqt_console = sqt;
} }
void Out::toStatusBar(Utils::QT::SimpleQGLV* sqglv)
{
if (sqglv != NULL)
m_out_mode |= QTSTATUSBAR;
else
m_out_mode &= ~QTSTATUSBAR;
m_sqglv_bar = sqglv;
}
void Out::toConsole(Utils::QT::SimpleQGLV* sqglv)
{
if (sqglv)
m_out_mode |= QTCONSOLE;
else
m_out_mode &= ~QTCONSOLE;
m_sqglv_console = sqglv;
}
#endif #endif
void Out::toBuffer(std::stringstream* ss) void Out::toBuffer(std::stringstream* ss)
...@@ -222,20 +271,41 @@ Out& Out::operator<< (Special& os ) ...@@ -222,20 +271,41 @@ Out& Out::operator<< (Special& os )
if (m_out_mode & QTCONSOLE) if (m_out_mode & QTCONSOLE)
{ {
while (! m_buffer.eof()) if (m_sqt_console)
{ {
m_buffer.getline(bufc,512); while (! m_buffer.eof())
{
m_buffer.getline(bufc,512);
if (m_code >= 100) if (m_code >= 100)
m_sqt_console->console()->setTextColor(QColor(0, 150 - (m_code-100) * 20, 50 + (m_code-100) * 20)); m_sqt_console->console()->setTextColor(QColor(0, 150 - (m_code-100) * 20, 50 + (m_code-100) * 20));
else else
{
if (m_code > 0)
m_sqt_console->console()->setTextColor(QColor(150, 0, 0));
else
m_sqt_console->console()->setTextColor(QColor(0, 0, 150));
}
m_sqt_console->console()->append(QString(bufc));
}
}
if (m_sqglv_console)
{
while (! m_buffer.eof())
{ {
if (m_code > 0) m_buffer.getline(bufc,512);
m_sqt_console->console()->setTextColor(QColor(150, 0, 0));
if (m_code >= 100)
m_sqglv_console->console()->setTextColor(QColor(0, 150 - (m_code-100) * 20, 50 + (m_code-100) * 20));
else else
m_sqt_console->console()->setTextColor(QColor(0, 0, 150)); {
if (m_code > 0)
m_sqglv_console->console()->setTextColor(QColor(150, 0, 0));
else
m_sqglv_console->console()->setTextColor(QColor(0, 0, 150));
}
m_sqglv_console->console()->append(QString(bufc));
} }
m_sqt_console->console()->append(QString(bufc));
} }
} }
#endif #endif
...@@ -278,22 +348,45 @@ Out& Out::operator<< (Special& os ) ...@@ -278,22 +348,45 @@ Out& Out::operator<< (Special& os )
if (m_out_mode & QTCONSOLE) if (m_out_mode & QTCONSOLE)
{ {
while (! m_buffer.eof()) if (m_sqt_console)
{ {
m_buffer.getline(bufc,512); while (! m_buffer.eof())
if (m_code >= 100)
m_sqt_console->console()->setTextColor(QColor(0, 150 - (m_code-100) * 20, 50 + (m_code-100) * 20));
else
{ {
if (m_code > 0) m_buffer.getline(bufc,512);
m_sqt_console->console()->setTextColor(QColor(150, 0, 0));
if (m_code >= 100)
m_sqt_console->console()->setTextColor(QColor(0, 150 - (m_code-100) * 20, 50 + (m_code-100) * 20));
else else
m_sqt_console->console()->setTextColor(QColor(0, 0, 150)); {
if (m_code > 0)
m_sqt_console->console()->setTextColor(QColor(150, 0, 0));
else
m_sqt_console->console()->setTextColor(QColor(0, 0, 150));
}
m_sqt_console->console()->moveCursor(QTextCursor::End);
m_sqt_console->console()->insertPlainText(QString(bufc));
} }
}
if (m_sqglv_console)
{
while (! m_buffer.eof())
{
m_buffer.getline(bufc,512);
m_sqt_console->console()->moveCursor(QTextCursor::End); if (m_code >= 100)
m_sqt_console->console()->insertPlainText(QString(bufc)); m_sqglv_console->console()->setTextColor(QColor(0, 150 - (m_code-100) * 20, 50 + (m_code-100) * 20));
else
{
if (m_code > 0)
m_sqglv_console->console()->setTextColor(QColor(150, 0, 0));
else
m_sqglv_console->console()->setTextColor(QColor(0, 0, 150));
}
m_sqglv_console->console()->moveCursor(QTextCursor::End);
m_sqglv_console->console()->insertPlainText(QString(bufc));
}
} }
} }
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment