1 // Copyright (C) 2010-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "PVGUI_OutputWindowAdapter.h"
22 #include <vtkObjectFactory.h>
24 #include <LightApp_Application.h>
25 #include <LogWindow.h>
26 #include <SUIT_Session.h>
27 #include <SALOME_Event.h>
29 vtkStandardNewMacro(PVGUI_OutputWindowAdapter);
30 vtkCxxRevisionMacro(PVGUI_OutputWindowAdapter, "$Revision$");
35 * Put the message in the log window.
37 class TEvent: public SALOME_Event {
43 TEvent( LogWindow* theWindow, const QString theMsg, const QColor theColor, const int flags) :
44 myWindow ( theWindow ),
50 virtual void Execute() {
52 myWindow->putMessage(myMsg, myColor, myFlags);
57 PVGUI_OutputWindowAdapter::PVGUI_OutputWindowAdapter() :
61 GenericWarningCount(0)
65 PVGUI_OutputWindowAdapter::~PVGUI_OutputWindowAdapter()
69 const unsigned int PVGUI_OutputWindowAdapter::getTextCount()
71 return this->TextCount;
74 const unsigned int PVGUI_OutputWindowAdapter::getErrorCount()
76 return this->ErrorCount;
79 const unsigned int PVGUI_OutputWindowAdapter::getWarningCount()
81 return this->WarningCount;
84 const unsigned int PVGUI_OutputWindowAdapter::getGenericWarningCount()
86 return this->GenericWarningCount;
89 static LogWindow* getLogWindow()
92 LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() );
94 wnd = anApp->logWindow();
98 void PVGUI_OutputWindowAdapter::DisplayText(const char* text)
101 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkGreen, LogWindow::DisplayNormal ));
104 void PVGUI_OutputWindowAdapter::DisplayErrorText(const char* text)
107 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkRed, LogWindow::DisplayNormal ));
110 void PVGUI_OutputWindowAdapter::DisplayWarningText(const char* text)
112 ++this->WarningCount;
113 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::black, LogWindow::DisplayNormal ));
116 void PVGUI_OutputWindowAdapter::DisplayGenericWarningText(const char* text)
118 ++this->GenericWarningCount;
119 ProcessVoidEvent( new TEvent( getLogWindow() , text, Qt::black, LogWindow::DisplayNormal ));