1 // Copyright (C) 2010-2015 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 "PVViewer_LogWindowAdapter.h"
22 #include <vtkObjectFactory.h>
24 #include <LogWindow.h>
25 #include <LogWindow.h>
26 #include <SUIT_Session.h>
27 #include <SALOME_Event.h>
29 vtkStandardNewMacro(PVViewer_LogWindowAdapter);
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 PVViewer_LogWindowAdapter::PVViewer_LogWindowAdapter() :
60 GenericWarningCount(0),
65 PVViewer_LogWindowAdapter::~PVViewer_LogWindowAdapter()
69 const unsigned int PVViewer_LogWindowAdapter::getTextCount()
71 return this->TextCount;
74 const unsigned int PVViewer_LogWindowAdapter::getErrorCount()
76 return this->ErrorCount;
79 const unsigned int PVViewer_LogWindowAdapter::getWarningCount()
81 return this->WarningCount;
84 const unsigned int PVViewer_LogWindowAdapter::getGenericWarningCount()
86 return this->GenericWarningCount;
89 //LogWindow* PVViewer_LogWindowAdapter::getLogWindow()
91 // LogWindow* wnd = 0;
92 // LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() );
94 // wnd = anApp->logWindow();
98 void PVViewer_LogWindowAdapter::DisplayText(const char* text)
101 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkGreen, LogWindow::DisplayNormal ));
104 void PVViewer_LogWindowAdapter::DisplayErrorText(const char* text)
107 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkRed, LogWindow::DisplayNormal ));
110 void PVViewer_LogWindowAdapter::DisplayWarningText(const char* text)
112 ++this->WarningCount;
113 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::black, LogWindow::DisplayNormal ));
116 void PVViewer_LogWindowAdapter::DisplayGenericWarningText(const char* text)
118 ++this->GenericWarningCount;
119 ProcessVoidEvent( new TEvent( getLogWindow() , text, Qt::black, LogWindow::DisplayNormal ));