Version: 8.3.0
SchemaProcItem.cxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
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 "SchemaProcItem.hxx"
21 #include "Menus.hxx"
22 #include "QtGuiContext.hxx"
23 #include "Resource.hxx"
24 
25 //#define _DEVDEBUG_
26 #include "YacsTrace.hxx"
27 
28 using namespace std;
29 using namespace YACS::ENGINE;
30 using namespace YACS::HMI;
31 
32 
33 SchemaProcItem::SchemaProcItem(SchemaItem *parent, QString label, Subject* subject)
34  : SchemaComposedNodeItem(parent, label, subject)
35 {
36  DEBTRACE("SchemaProcItem::SchemaProcItem");
37 }
38 
40 {
41  DEBTRACE("SchemaProcItem::~SchemaProcItem");
42 }
43 
44 void SchemaProcItem::popupMenu(QWidget *caller, const QPoint &globalPos)
45 {
46  ProcMenu m;
47  m.popupMenu(caller, globalPos);
48 }
49 
50 void SchemaProcItem::setExecState(int execState)
51 {
52  DEBTRACE("SchemaProcItem::setExecState " << execState);
53  _execState = execState;
54  QString stateDef;
55  QColor sc;
56  switch (_execState)
57  {
58  case YACS::NOTYETINITIALIZED: sc = YACS::HMI::Resource::NOTYETINITIALIZED; stateDef = "Not Yet Initialized"; break;
59  case YACS::INITIALISED: sc = YACS::HMI::Resource::INITIALISED ; stateDef = "Initialized"; break;
60  case YACS::RUNNING: sc = YACS::HMI::Resource::RUNNING ; stateDef = "Running"; break;
61  case YACS::WAITINGTASKS: sc = YACS::HMI::Resource::WAITINGTASKS ; stateDef = "Waiting Tasks"; break;
62  case YACS::PAUSED: sc = YACS::HMI::Resource::PAUSED ; stateDef = "Paused"; break;
63  case YACS::FINISHED: sc = YACS::HMI::Resource::FINISHED ; stateDef = "Finished"; break;
64  case YACS::STOPPED: sc = YACS::HMI::Resource::STOPPED ; stateDef = "Stopped"; break;
65  default: sc = YACS::HMI::Resource::UNKNOWN ; stateDef = "Unknown Status";
66  }
67  _itemData.replace(YState, stateDef);
68  _itemForeground.replace(YState, QColor(Qt::darkBlue));
69  _itemBackground.replace(YState, sc);
70 }
71 
72 QVariant SchemaProcItem::editionToolTip(int column) const
73 {
74  QString val = QString("Edition: ") + _itemData.value(0).toString();
75  QString val1 = _itemData.value(2).toString();
76  QString val2 = QtGuiContext::getQtCurrent()->getFileName();
77  if (!val1.isEmpty()) val += QString(" | ") + val1;
78  if (!val2.isEmpty()) val += QString(" | ") + val2;
79  return val;
80 }
81 
82 QVariant SchemaProcItem::runToolTip(int column) const
83 {
84  QString val = QString("Execution: ") + _itemData.value(0).toString();
85  QString val1 = _itemData.value(2).toString();
86  QString val2 = QtGuiContext::getQtCurrent()->getFileName();
87  if (!val1.isEmpty()) val += QString(" | ") + val1;
88  if (!val2.isEmpty()) val += QString(" | ") + val2;
89  return val;
90 }
91 
92 QVariant SchemaProcItem::editionWhatsThis(int column) const
93 {
94  return "<p>To edit the schema properties, select the schema and use the input panel. <a href=\"modification.html#property-page-for-schema\">More...</a></p>";
95 }