1 // Copyright (C) 2006-2008 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.
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
19 #include "EditionProc.hxx"
21 #include "QtGuiContext.hxx"
22 #include "LinkInfo.hxx"
26 #include "YacsTrace.hxx"
33 using namespace YACS::HMI;
34 using namespace YACS::ENGINE;
36 EditionProc::EditionProc(Subject* subject,
39 : EditionBloc(subject, parent, name)
41 DEBTRACE("EditionProc::EditionProc");
42 _statusLog = new QTextEdit(this);
43 _wid->gridLayout1->addWidget(_statusLog);
48 EditionProc::~EditionProc()
50 DEBTRACE("EditionProc::~EditionProc");
53 void EditionProc::update(GuiEvent event, int type, Subject* son)
55 DEBTRACE("EditionProc::update " << GuiObserver::eventName(event));
56 EditionBloc::update(event, type, son);
57 YACS::ENGINE::Proc* proc = QtGuiContext::getQtCurrent()->getProc();
59 string statusLog = "";
63 if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
66 _modifLog = "--- some elements are modified and not taken into account. Confirmation or annulation required ---\n";
67 statusLog = _modifLog + _errorLog;
68 _statusLog->setText(statusLog.c_str());
73 _errorLog = "--- YACS schema is not valid ---\n\n";
74 _errorLog += proc->getErrorReport();
78 // --- Check consistency
79 LinkInfo info(LinkInfo::ALL_DONT_STOP);
80 proc->checkConsistency(info);
81 if (info.areWarningsOrErrors())
82 _errorLog = info.getGlobalRepr();
85 _errorLog = "--- No Validity Errors ---\n";
86 _errorLog += "--- No Consistency Errors ---\n";
89 // --- Add initial logger info
90 logger = proc->getLogger("parser");
91 if (!logger->isEmpty())
93 _errorLog += "--- Original file import log ---\n";
94 _errorLog += logger->getStr();
96 statusLog = _modifLog + _errorLog;
97 _statusLog->setText(statusLog.c_str());