Salome HOME
24153e0014744e87c3be85a7191aea53c7cd326c
[modules/gui.git] / src / PVViewer / PVViewer_OutputWindow.cxx
1 // Copyright (C) 2014-2023  CEA, EDF, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "PVViewer_OutputWindow.h"
21
22 #include <vtkObjectFactory.h>
23
24 vtkStandardNewMacro(PVViewer_OutputWindow)
25
26 PVViewer_OutputWindow::PVViewer_OutputWindow()
27 {
28 }
29
30 PVViewer_OutputWindow::~PVViewer_OutputWindow()
31 {
32 }
33
34 unsigned int PVViewer_OutputWindow::getTextCount() const
35 {
36   return count(MESSAGE_TYPE_TEXT);
37 }
38
39 unsigned int PVViewer_OutputWindow::getErrorCount() const
40 {
41   return count(MESSAGE_TYPE_ERROR);
42 }
43
44 unsigned int PVViewer_OutputWindow::getWarningCount() const
45 {
46   return count(MESSAGE_TYPE_WARNING);
47 }
48
49 unsigned int PVViewer_OutputWindow::getGenericWarningCount() const
50 {
51   return count(MESSAGE_TYPE_GENERIC_WARNING);
52 }
53
54 unsigned int PVViewer_OutputWindow::getDebugCount() const
55 {
56   return count(MESSAGE_TYPE_DEBUG);
57 }
58
59 void PVViewer_OutputWindow::DisplayText(const char* text)
60 {
61   MessageTypes type = GetCurrentMessageType();
62   myCounter[type] = count(type) + 1;
63   switch (type)
64   {
65   case MESSAGE_TYPE_ERROR:
66     qCritical(text);
67     break;
68   case MESSAGE_TYPE_WARNING:
69   case MESSAGE_TYPE_GENERIC_WARNING:
70     qWarning(text);
71     break;
72   case MESSAGE_TYPE_DEBUG:
73     qDebug(text);
74     break;
75   case MESSAGE_TYPE_TEXT:
76   default:
77     qInfo(text);
78     break;
79   }
80 }
81
82 int PVViewer_OutputWindow::count(const MessageTypes& type) const
83 {
84   return myCounter.value(type, 0);
85 }