Salome HOME
PARAVIS HTML docs
[modules/paravis.git] / src / PVGUI / PVGUI_OutputWindowAdapter.cxx
1
2 #include "PVGUI_OutputWindowAdapter.h"
3
4 #include <vtkObjectFactory.h>
5
6 #include <LightApp_Application.h>
7 #include <LogWindow.h>
8 #include <SUIT_Session.h>
9
10 vtkStandardNewMacro(PVGUI_OutputWindowAdapter);
11 vtkCxxRevisionMacro(PVGUI_OutputWindowAdapter, "$Revision$");
12
13 PVGUI_OutputWindowAdapter::PVGUI_OutputWindowAdapter() :
14   TextCount(0),
15   ErrorCount(0),
16   WarningCount(0),
17   GenericWarningCount(0)
18 {
19 }
20
21 PVGUI_OutputWindowAdapter::~PVGUI_OutputWindowAdapter()
22 {
23 }
24
25 const unsigned int PVGUI_OutputWindowAdapter::getTextCount()
26 {
27   return this->TextCount;
28 }
29
30 const unsigned int PVGUI_OutputWindowAdapter::getErrorCount()
31 {
32   return this->ErrorCount;
33 }
34
35 const unsigned int PVGUI_OutputWindowAdapter::getWarningCount()
36 {
37   return this->WarningCount;
38 }
39
40 const unsigned int PVGUI_OutputWindowAdapter::getGenericWarningCount()
41 {
42   return this->GenericWarningCount;
43 }
44
45 static LogWindow* getLogWindow()
46 {
47   LogWindow* wnd = 0;
48   LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() );
49   if ( anApp )
50     wnd = anApp->logWindow();
51   return wnd;
52 }
53
54 void PVGUI_OutputWindowAdapter::DisplayText(const char* text)
55 {
56   ++this->TextCount;
57   LogWindow* wnd = getLogWindow();
58   if ( wnd )
59     wnd->putMessage( text, Qt::darkGreen, LogWindow::DisplayNormal );
60 }
61
62 void PVGUI_OutputWindowAdapter::DisplayErrorText(const char* text)
63 {
64   ++this->ErrorCount;
65   LogWindow* wnd = getLogWindow();
66   if ( wnd )
67     wnd->putMessage( text, Qt::darkRed, LogWindow::DisplayNormal );
68 }
69
70 void PVGUI_OutputWindowAdapter::DisplayWarningText(const char* text)
71 {
72   ++this->WarningCount;
73   LogWindow* wnd = getLogWindow();
74   if ( wnd )
75     wnd->putMessage( text, Qt::black, LogWindow::DisplayNormal );
76 }
77
78 void PVGUI_OutputWindowAdapter::DisplayGenericWarningText(const char* text)
79 {
80   ++this->GenericWarningCount;
81   LogWindow* wnd = getLogWindow();
82   if ( wnd )
83     wnd->putMessage( text, Qt::black, LogWindow::DisplayNormal );
84 }