Salome HOME
b61583f7563b591f21db0d9652ceb24996bbfcc4
[modules/yacs.git] / src / genericgui / SchemaProcItem.cxx
1 //  Copyright (C) 2006-2008  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.
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 #include "SchemaProcItem.hxx"
20 #include "Menus.hxx"
21 #include "QtGuiContext.hxx"
22
23 //#define _DEVDEBUG_
24 #include "YacsTrace.hxx"
25
26 using namespace std;
27 using namespace YACS::ENGINE;
28 using namespace YACS::HMI;
29
30
31 SchemaProcItem::SchemaProcItem(SchemaItem *parent, QString label, Subject* subject)
32   : SchemaComposedNodeItem(parent, label, subject)
33 {
34   DEBTRACE("SchemaProcItem::SchemaProcItem");
35 }
36
37 SchemaProcItem::~SchemaProcItem()
38 {
39   DEBTRACE("SchemaProcItem::~SchemaProcItem");
40 }
41
42 void SchemaProcItem::popupMenu(QWidget *caller, const QPoint &globalPos)
43 {
44   ProcMenu m;
45   m.popupMenu(caller, globalPos);
46 }
47
48 void SchemaProcItem::setExecState(int execState)
49 {
50   DEBTRACE("SchemaProcItem::setExecState " << execState);
51   _execState = execState;
52   QString stateDef;
53   QColor sc;
54   switch (_execState)
55     {
56     case YACS::NOTYETINITIALIZED: sc.setHsv( 45, 50, 255); stateDef = "Not Yet Initialized"; break;
57     case YACS::INITIALISED:       sc.setHsv( 90, 50, 255); stateDef = "Initialized";         break;
58     case YACS::RUNNING:           sc.setHsv(135, 50, 255); stateDef = "Running";             break;
59     case YACS::WAITINGTASKS:      sc.setHsv(180, 50, 255); stateDef = "Waiting Tasks";       break;
60     case YACS::PAUSED:            sc.setHsv(225, 50, 255); stateDef = "Paused";              break;
61     case YACS::FINISHED:          sc.setHsv(270, 50, 255); stateDef = "Finished";            break;
62     case YACS::STOPPED:           sc.setHsv(315, 50, 255); stateDef = "Stopped";             break;
63     default:                      sc.setHsv(360, 50, 255); stateDef = "Unknown Status";
64    }
65   _itemData.replace(YState, stateDef);
66   _itemForeground.replace(YState, Qt::darkBlue);
67   _itemBackground.replace(YState, sc);
68 }