1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D, OPEN CASCADE
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);
32 * Put the message in the log window.
34 class TEvent: public SALOME_Event {
40 TEvent( LogWindow* theWindow, const QString theMsg, const QColor theColor, const int flags) :
41 myWindow ( theWindow ),
47 virtual void Execute() {
49 myWindow->putMessage(myMsg, myColor, myFlags);
54 PVViewer_LogWindowAdapter::PVViewer_LogWindowAdapter() :
58 GenericWarningCount(0),
63 PVViewer_LogWindowAdapter::~PVViewer_LogWindowAdapter()
67 const unsigned int PVViewer_LogWindowAdapter::getTextCount()
69 return this->TextCount;
72 const unsigned int PVViewer_LogWindowAdapter::getErrorCount()
74 return this->ErrorCount;
77 const unsigned int PVViewer_LogWindowAdapter::getWarningCount()
79 return this->WarningCount;
82 const unsigned int PVViewer_LogWindowAdapter::getGenericWarningCount()
84 return this->GenericWarningCount;
87 void PVViewer_LogWindowAdapter::DisplayText(const char* text)
90 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkGreen, LogWindow::DisplayNormal ));
93 void PVViewer_LogWindowAdapter::DisplayErrorText(const char* text)
96 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::darkRed, LogWindow::DisplayNormal ));
99 void PVViewer_LogWindowAdapter::DisplayWarningText(const char* text)
101 ++this->WarningCount;
102 ProcessVoidEvent( new TEvent( getLogWindow(), text, Qt::black, LogWindow::DisplayNormal ));
105 void PVViewer_LogWindowAdapter::DisplayGenericWarningText(const char* text)
107 ++this->GenericWarningCount;
108 ProcessVoidEvent( new TEvent( getLogWindow() , text, Qt::black, LogWindow::DisplayNormal ));