Fraxinus  18.10
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 "cxEnumConverter.h"
19 #include "cxXmlOptionItem.h"
20 
21 #include "cxDataLocations.h"
22 #include "cxWorkflowStateMachine.h"
24 #include "cxDataLocations.h"
25 #include "cxConfig.h"
26 
27 #include "cxTrackingServiceProxy.h"
29 #include "cxSpaceProviderImpl.h"
30 #include "cxVideoServiceProxy.h"
31 #include "cxApplicationsParser.h"
32 #include "cxProfile.h"
33 #include "cxLogger.h"
34 #include "cxVisServices.h"
35 
36 namespace cx
37 {
38 
39 StateServiceImpl::StateServiceImpl(ctkPluginContext* context)
40 {
41 
42  mServices = VisServices::create(context);
43  this->initialize();
44 }
45 
47 {
48 }
49 
51 {
52  return false;
53 }
54 
55 void StateServiceImpl::initialize()
56 {
57  this->fillDefaultSettings();
58 
60 
61  mWorkflowStateMachine.reset(new CustusXWorkflowStateMachine(mServices));
62  mWorkflowStateMachine->start();
63 
64  connect(mWorkflowStateMachine.get(), &WorkflowStateMachine::activeStateChanged, this, &StateServiceImpl::workflowStateChanged);
66 
68 }
69 
71 {
72  return ProfileManager::getInstance()->activeProfile()->getUid();
73 }
74 
76 {
78 }
79 
81 {
82  return QString("%1").arg(CustusX_VERSION_STRING);
83 }
84 
86 {
87  return mWorkflowStateMachine->getActionGroup();
88 }
89 
90 WorkflowStateMachinePtr StateServiceImpl::getWorkflow()
91 {
92  return mWorkflowStateMachine;
93 }
94 
96 {
97  mWorkflowStateMachine->setActiveState(uid);
98 }
99 
101 {
102  ApplicationsParser parser;
103  return parser.getDesktop(mWorkflowStateMachine->getActiveUidState());
104 }
105 
107 {
108  ApplicationsParser parser;
109  parser.setDesktop(mWorkflowStateMachine->getActiveUidState(),
110  desktop);
111 }
112 
114 {
115  ApplicationsParser parser;
116  parser.resetDesktop(mWorkflowStateMachine->getActiveUidState());
117 }
118 
119 } //namespace cx
virtual QActionGroup * getWorkflowActions()
void activeProfileChanged()
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.