Version: 9.16.0
SchemaProcItem.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
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
28using namespace std;
29using namespace YACS::ENGINE;
30using namespace YACS::HMI;
31
32
33SchemaProcItem::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
44void SchemaProcItem::popupMenu(QWidget *caller, const QPoint &globalPos)
45{
46 ProcMenu m;
47 m.popupMenu(caller, globalPos);
48}
49
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
72QVariant 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
82QVariant 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
92QVariant 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}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
static QtGuiContext * getQtCurrent()
static QColor PAUSED
Definition: Resource.hxx:231
static QColor WAITINGTASKS
Definition: Resource.hxx:230
static QColor NOTYETINITIALIZED
Definition: Resource.hxx:227
static QColor FINISHED
Definition: Resource.hxx:232
static QColor RUNNING
Definition: Resource.hxx:229
static QColor STOPPED
Definition: Resource.hxx:233
static QColor UNKNOWN
Definition: Resource.hxx:234
static QColor INITIALISED
Definition: Resource.hxx:228
QList< QVariant > _itemBackground
Definition: SchemaItem.hxx:80
QList< QVariant > _itemForeground
Definition: SchemaItem.hxx:79
QList< QVariant > _itemData
Definition: SchemaItem.hxx:77
virtual QVariant editionWhatsThis(int column) const
virtual QVariant runToolTip(int column) const
virtual void popupMenu(QWidget *caller, const QPoint &globalPos)
virtual void setExecState(int execState)
virtual QVariant editionToolTip(int column) const
@ RUNNING
Definition: define.hxx:67
@ PAUSED
Definition: define.hxx:69
@ WAITINGTASKS
Definition: define.hxx:68
@ INITIALISED
Definition: define.hxx:66
@ NOTYETINITIALIZED
Definition: define.hxx:65
@ FINISHED
Definition: define.hxx:70
@ STOPPED
Definition: define.hxx:71