Version: 8.3.0
YACS::HMI::EditionProc Class Reference

#include <EditionProc.hxx>

Inheritance diagram for YACS::HMI::EditionProc:
Collaboration diagram for YACS::HMI::EditionProc:

Public Slots

virtual void onLevelChange (int index)
 

Public Member Functions

 EditionProc (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionProc ()
 
virtual void update (GuiEvent event, int type, Subject *son)
 
virtual void synchronize ()
 
- Public Member Functions inherited from YACS::HMI::EditionBloc
 EditionBloc (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionBloc ()
 
- Public Member Functions inherited from YACS::HMI::EditionNode
 EditionNode (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~EditionNode ()
 
- Public Member Functions inherited from YACS::HMI::ItemEdition
 ItemEdition (Subject *subject, QWidget *parent=0, const char *name=0)
 
virtual ~ItemEdition ()
 
virtual void select (bool isSelected)
 
virtual void setName (std::string name)
 
virtual void setEdited (bool isEdited)
 
- Public Member Functions inherited from FormEditItem
 FormEditItem (QWidget *parent=0)
 
virtual ~FormEditItem ()
 
- Public Member Functions inherited from YACS::HMI::ItemEditionBase
 ItemEditionBase (Subject *subject)
 
virtual ~ItemEditionBase ()
 
virtual SubjectgetSubject ()
 
- Public Member Functions inherited from YACS::HMI::GuiObserver
 GuiObserver ()
 
virtual ~GuiObserver ()
 
virtual void incrementSubjects (Subject *subject)
 
virtual void decrementSubjects (Subject *subject)
 
int getNbSubjects ()
 
bool isDestructible ()
 

Protected Attributes

QTextEdit * _statusLog
 
std::string _errorLog
 
std::string _modifLog
 
- Protected Attributes inherited from YACS::HMI::EditionBloc
PropertyEditor_propeditor
 
- Protected Attributes inherited from YACS::HMI::EditionNode
QLineEdit_le_fullName
 
SubjectNode_subjectNode
 
- Protected Attributes inherited from YACS::HMI::ItemEdition
bool _isEdited
 
bool _haveScript
 
- Protected Attributes inherited from FormEditItem
WidEditItem_wid
 
- Protected Attributes inherited from YACS::HMI::ItemEditionBase
Subject_subject
 
int _stackId
 
std::string _name
 
std::string _type
 
std::string _category
 
- Protected Attributes inherited from YACS::HMI::GuiObserver
std::set< Subject * > _subjectSet
 
bool _destructible
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::HMI::ItemEdition
static std::string filterName (const std::string &name)
 
- Static Protected Attributes inherited from YACS::HMI::GuiObserver
static std::map< int, std::string > _eventNameMap
 

Detailed Description

Definition at line 33 of file EditionProc.hxx.

Constructor & Destructor Documentation

EditionProc::EditionProc ( Subject subject,
QWidget parent = 0,
const char *  name = 0 
)

Definition at line 38 of file EditionProc.cxx.

References _errorLog, _modifLog, _statusLog, FormEditItem::_wid, DEBTRACE, YACS::HMI::QtGuiContext::getGuiExecutor(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::HMI::GuiExecutor::getShutdownLevel(), and onLevelChange().

41  : EditionBloc(subject, parent, name)
42 {
43  DEBTRACE("EditionProc::EditionProc");
44  _statusLog = new QTextEdit(this);
45  _wid->gridLayout1->addWidget(_statusLog);
46  _errorLog = "";
47  _modifLog = "";
48 
49  if (!QtGuiContext::getQtCurrent()->isEdition())
50  {
51  QHBoxLayout* hbox = new QHBoxLayout();
52  QLabel* la = new QLabel("Shutdown level:",this);
53  QComboBox* cb = new QComboBox(this);
54  cb->addItem("0",0 );
55  cb->addItem("1",1 );
56  cb->addItem("2",2 );
57  cb->addItem("3",3 );
58  int level=1;
59  if (QtGuiContext::getQtCurrent()->getGuiExecutor())
61  DEBTRACE(level);
62  cb->setCurrentIndex(level);
63  connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(onLevelChange(int)));
64  hbox->addWidget(la);
65  hbox->addWidget(cb);
66  _wid->gridLayout1->addLayout(hbox,4,0);
67  }
68 }
EditionProc::~EditionProc ( )
virtual

Definition at line 70 of file EditionProc.cxx.

References DEBTRACE.

71 {
72  DEBTRACE("EditionProc::~EditionProc");
73 }

Member Function Documentation

void EditionProc::onLevelChange ( int  index)
virtualslot

Definition at line 155 of file EditionProc.cxx.

References DEBTRACE, YACS::HMI::QtGuiContext::getGuiExecutor(), YACS::HMI::QtGuiContext::getQtCurrent(), and YACS::HMI::GuiExecutor::setShutdownLevel().

Referenced by EditionProc().

156 {
157  DEBTRACE("EditionProc::onLevelChange " << index);
158  if (QtGuiContext::getQtCurrent()->getGuiExecutor())
160 }
void EditionProc::synchronize ( )
virtual

used in derived nodes for synchronisation with schema model.

Reimplemented from YACS::HMI::ItemEdition.

Definition at line 106 of file EditionProc.cxx.

References _errorLog, _modifLog, _statusLog, YACS::ENGINE::LinkInfo::areWarningsOrErrors(), YACS::ENGINE::ComposedNode::checkConsistency(), DEBTRACE, YACS::ENGINE::ComposedNode::getErrorReport(), YACS::ENGINE::LinkInfo::getGlobalRepr(), YACS::ENGINE::Proc::getLogger(), YACS::HMI::GuiContext::getProc(), YACS::HMI::QtGuiContext::getQtCurrent(), YACS::ENGINE::Logger::getStr(), YACS::ENGINE::Logger::isEmpty(), YACS::ENGINE::Node::isValid(), and YACS::Exception::what().

Referenced by update().

107 {
108  DEBTRACE("EditionProc::synchronize");
110  Logger* logger = 0;
111  string statusLog = "";
112 
113  if (!QtGuiContext::getQtCurrent()->isEdition())
114  return;
115  if (!proc->isValid())
116  {
117  _errorLog = "--- YACS schema is not valid ---\n\n";
118  _errorLog += proc->getErrorReport();
120  }
121  else
122  {
123  // --- Check consistency
124  LinkInfo info(LinkInfo::ALL_DONT_STOP);
125  _errorLog="";
126  try
127  {
128  proc->checkConsistency(info);
129  if (info.areWarningsOrErrors())
130  _errorLog += info.getGlobalRepr();
131  else
132  {
133  _errorLog += "--- No Validity Errors ---\n";
134  _errorLog += "--- No Consistency Errors ---\n";
135  }
136  }
137  catch (Exception &ex)
138  {
139  _errorLog = "--- YACS schema has consistency errors ---\n\n";
140  _errorLog += ex.what();
141  }
143  }
144  // --- Add initial logger info
145  logger = proc->getLogger("parser");
146  if (!logger->isEmpty())
147  {
148  _errorLog += "--- Original file import log ---\n";
149  _errorLog += logger->getStr();
150  }
151  statusLog = _modifLog + _errorLog;
152  _statusLog->setText(statusLog.c_str());
153 }
void EditionProc::update ( GuiEvent  event,
int  type,
Subject son 
)
virtual

when loading a schema, creation of all edition widgets is time and memory consuming, so, widget edition creation is differed until user select an item in tree or 2D vue.

Reimplemented from YACS::HMI::EditionBloc.

Definition at line 75 of file EditionProc.cxx.

References _errorLog, _modifLog, _statusLog, DEBTRACE, YACS::HMI::EDIT, YACS::HMI::GuiObserver::eventName(), YACS::FINISHED, YACS::HMI::GuiExecutor::getErrorReport(), YACS::HMI::QtGuiContext::getGuiExecutor(), YACS::HMI::GuiContext::getProc(), YACS::HMI::QtGuiContext::getQtCurrent(), synchronize(), YACS::HMI::EditionBloc::update(), YACS::HMI::UPDATE, and YACS::HMI::UPDATEPROGRESS.

Referenced by gui.graph.MyCanvas::customEvent().

76 {
77  DEBTRACE("EditionProc::update " << GuiObserver::eventName(event));
78  EditionBloc::update(event, type, son);
79  string statusLog = "";
80  switch (event)
81  {
82  case EDIT:
83  if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
84  _modifLog = "";
85  else
86  _modifLog = "--- some elements are modified and not taken into account. Confirmation or annulation required ---\n";
87  case UPDATE:
88  synchronize();
89  break;
90  case UPDATEPROGRESS:
91  {
92  if(type != YACS::FINISHED)break;
93  if (!QtGuiContext::getQtCurrent()) break;
94  if (!QtGuiContext::getQtCurrent()->getGuiExecutor()) break;
97  _statusLog->setText(QString::fromStdString(_errorLog));
98  break;
99  }
100  default:
101  ;
102  }
103 
104 }

Member Data Documentation

std::string YACS::HMI::EditionProc::_errorLog
protected

Definition at line 52 of file EditionProc.hxx.

Referenced by EditionProc(), synchronize(), and update().

std::string YACS::HMI::EditionProc::_modifLog
protected

Definition at line 53 of file EditionProc.hxx.

Referenced by EditionProc(), synchronize(), and update().

QTextEdit* YACS::HMI::EditionProc::_statusLog
protected

Definition at line 51 of file EditionProc.hxx.

Referenced by EditionProc(), synchronize(), and update().


The documentation for this class was generated from the following files: