Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ActionState.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 #ifndef ACTIONSTATE_H
26 #define ACTIONSTATE_H
27 
28 // Qt stuff
29 #include <QTime>
30 #include <QState>
31 #include <QVector>
32 #include <QTextStream>
33 
34 //CamiTK stuff
35 #include <Action.h>
36 
37 // Local stuff
38 #include "ActionStateWidget.h"
39 #include "ActionTransition.h"
40 
41 using namespace camitk;
42 
43 class ActionState : public QState {
44 
45 public:
48  ActionState(QState * parent, QString name, QString description, QTextStream * logStream = NULL);
49 
50  void setAction(Action * action,
51  QMap<QString, QVariant> parameters,
52  QMap<QString, QString> inputComponentNames,
53  QMap<QString, QString> outputComponentNames);
54 
56  QString getName();
58  QString getDescription();
59 
61  void setAleternativeDesc(QString altDescText, QVector<Action::ApplyStatus> statusList);
62 
63 
64  virtual Action::ApplyStatus applyAction();
65 
67  ActionTransition * addActionTransition(QString buttonText, QAbstractState * nextState,
68 
69  bool applyAction = true, QVector<Action::ApplyStatus> disableConditions = QVector<Action::ApplyStatus>());
70 
71  ActionStateWidget * getWidget();
72 
73  void setPreviousActionStatus(Action::ApplyStatus status);
74  void setFinal();
75 
76 
77 
78 
79 protected:
82  virtual void onEntry ( QEvent * event );
83 
84  virtual void onExit ( QEvent * event );
86 
88  QString name;
91  QString description;
92 
95 
96  QMap<QString, QString> inputComponentNames;
97  QMap<QString, QString> outputComponentNames;
98 
100  QMap<Action::ApplyStatus, QVector<QPushButton * > > conditionalButtons;
101 
103  QMap<Action::ApplyStatus, QString> conditionalDescriptions;
104 
113 
115  QTextStream * logStream;
116 
118  QTime * startTime;
119 
120 
121 };
122 #endif // ACTIONSTATE_H