1 // Copyright (C) 2010-2014 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, or (at your option) any later version.
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);
34 * Put the message in the log window.
36 class TEvent: public SALOME_Event {
42 TEvent( LogWindow* theWindow, const QString theMsg, const QColor theColor, const int flags) :
43 myWindow ( theWindow ),
49 virtual void Execute() {
51 myWindow->putMessage(myMsg, myColor, myFlags);
56 PVGUI_OutputWindowAdapter::PVGUI_OutputWindowAdapter() :
60 GenericWarningCount(0)
64 PVGUI_OutputWindowAdapter::~PVGUI_OutputWindowAdapter()
68 const unsigned int PVGUI_OutputWindowAdapter::getTextCount()
70 return this->TextCount;
73 const unsigned int PVGUI_OutputWindowAdapter::getErrorCount()
75 return this->ErrorCount;
78 const unsigned int PVGUI_OutputWindowAdapter::getWarningCount()
80 return this->WarningCount;
83 const unsigned int PVGUI_OutputWindowAdapter::getGenericWarningCount()
85 return this->GenericWarningCount;
88 static LogWindow* getLogWindow()
91 LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() );
93 wnd = anApp->logWindow();
97 void PVGUI_OutputWindowAdapter::DisplayText(const char* text)
100 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkGreen, LogWindow::DisplayNormal ));
103 void PVGUI_OutputWindowAdapter::DisplayErrorText(const char* text)
106 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkRed, LogWindow::DisplayNormal ));
109 void PVGUI_OutputWindowAdapter::DisplayWarningText(const char* text)
111 ++this->WarningCount;
112 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::black, LogWindow::DisplayNormal ));
115 void PVGUI_OutputWindowAdapter::DisplayGenericWarningText(const char* text)
117 ++this->GenericWarningCount;
118 ProcessVoidEvent( new TEvent( getLogWindow() , text, Qt::black, LogWindow::DisplayNormal ));