CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxWorkflowStateMachine.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXWORKFLOWSTATEMACHINE_H_
13 #define CXWORKFLOWSTATEMACHINE_H_
14 
15 #include "cxResourceExport.h"
16 
17 #include <QStateMachine>
18 #include <QActionGroup>
19 #include "cxForwardDeclarations.h"
20 
21 class QToolBar;
22 class QMenu;
23 
24 namespace cx
25 {
26 
27 class WorkflowState;
28 
37 class cxResource_EXPORT WorkflowStateMachine: public QStateMachine
38 {
39 Q_OBJECT
40 public:
42  virtual ~WorkflowStateMachine();
43 
44  QActionGroup* getActionGroup();
45 
46  QString getActiveUidState();
47  void setActiveState(QString uid);
48 
49 signals:
50  void activeStateChanged();
51  void activeStateAboutToChange();
52 
53 private slots:
54  void startedSlot();
55  void clinicalApplicationChangedSlot();
56 
57 protected:
58  virtual WorkflowState* newState(WorkflowState* state);
59 
62 
63 private:
64  void fillActionGroup(WorkflowState* current, QActionGroup* group);
65  QAction* addAction(QString stateUid, QActionGroup* group);
66 
67  typedef std::map<QString, WorkflowState*> WorkflowStateMap;
68  WorkflowStateMap mStates;
69  QActionGroup* mActionGroup;
70  bool mStarted;
71 };
72 
73 typedef boost::shared_ptr<WorkflowStateMachine> WorkflowStateMachinePtr;
74 }
75 
76 #endif /* CXWORKFLOWSTATEMACHINE_H_ */
boost::shared_ptr< class WorkflowStateMachine > WorkflowStateMachinePtr
State in a WorkflowStateMachine.
boost::shared_ptr< class CoreServices > CoreServicesPtr
Definition: cxCameraStyle.h:37
State Machine for the Workflow Steps.
Namespace for all CustusX production code.