Fraxinus  22.04-rc3
An IGT application
cxStateServiceImpl.cpp
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 #include "cxStateServiceImpl.h"
13 
14 #include <iostream>
15 #include <QApplication>
16 #include <QByteArray>
17 #include <QDir>
18 #include "cxXmlOptionItem.h"
19 
20 #include "cxDataLocations.h"
21 #include "cxWorkflowStateMachine.h"
23 #include "cxDataLocations.h"
24 #include "cxConfig.h"
25 
26 #include "cxTrackingServiceProxy.h"
28 #include "cxSpaceProviderImpl.h"
29 #include "cxVideoServiceProxy.h"
30 #include "cxApplicationsParser.h"
31 #include "cxProfile.h"
32 #include "cxLogger.h"
33 #include "cxVisServices.h"
34 
35 namespace cx
36 {
37 
38 StateServiceImpl::StateServiceImpl(ctkPluginContext* context)
39 {
40 
41  mServices = VisServices::create(context);
42  this->initialize();
43 }
44 
46 {
47 }
48 
50 {
51  return false;
52 }
53 
54 void StateServiceImpl::initialize()
55 {
56  this->fillDefaultSettings();
57 
59 
60  mWorkflowStateMachine.reset(new CustusXWorkflowStateMachine(mServices));
61  mWorkflowStateMachine->start();
62 
63  connect(mWorkflowStateMachine.get(), &WorkflowStateMachine::activeStateChanged, this, &StateServiceImpl::workflowStateChanged);
65 
67 }
68 
70 {
71  return ProfileManager::getInstance()->activeProfile()->getUid();
72 }
73 
75 {
77 }
78 
80 {
81  return QString("%1").arg(CustusX_VERSION_STRING);
82 }
83 
85 {
86  return mWorkflowStateMachine->getActionGroup();
87 }
88 
90 {
91  return mWorkflowStateMachine;
92 }
93 
95 {
96  mWorkflowStateMachine->setActiveState(uid);
97 }
98 
100 {
101  ApplicationsParser parser;
102  return parser.getDesktop(mWorkflowStateMachine->getActiveUidState());
103 }
104 
106 {
107  ApplicationsParser parser;
108  parser.setDesktop(mWorkflowStateMachine->getActiveUidState(),
109  desktop);
110 }
111 
113 {
114  ApplicationsParser parser;
115  parser.resetDesktop(mWorkflowStateMachine->getActiveUidState());
116 }
117 
118 } //namespace cx
virtual QActionGroup * getWorkflowActions()
void activeProfileChanged()
virtual WorkflowStateMachinePtr getWorkflow()
virtual void setWorkFlowState(QString uid)
ProfilePtr activeProfile()
Definition: cxProfile.cpp:285
virtual void saveDesktop(Desktop desktop)
void applicationStateChanged()
void setDesktop(QString workflowName, Desktop desktop)
static void initialize()
Definition: cxProfile.cpp:176
static VisServicesPtr create(ctkPluginContext *context)
virtual Desktop getActiveDesktop()
static ProfileManager * getInstance(QString defaultProfile=QString("Laboratory"))
returns the only instance of this class
Definition: cxProfile.cpp:167
QStringList getProfiles()
Definition: cxProfile.cpp:256
virtual QString getVersionName()
State Machine for the Workflow Steps for CustusX.
virtual QStringList getAllApplicationStateNames() const
void resetDesktop(QString workflowName)
StateServiceImpl(ctkPluginContext *context)
void workflowStateAboutToChange()
virtual QString getApplicationStateName() const
boost::shared_ptr< class WorkflowStateMachine > WorkflowStateMachinePtr
void workflowStateChanged()
Data class for CustusX desktop.
Desktop getDesktop(QString workflowName)
Namespace for all CustusX production code.