NorMIT-nav  22.09
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
cxWorkflowStateMachine.h
cx::ProfileManager::getProfiles
QStringList getProfiles()
Definition: cxProfile.cpp:256
cxLogger.h
cx::StateServiceImpl::getApplicationStateName
virtual QString getApplicationStateName() const
Definition: cxStateServiceImpl.cpp:69
cxApplicationsParser.h
cx::StateServiceImpl::~StateServiceImpl
virtual ~StateServiceImpl()
Definition: cxStateServiceImpl.cpp:45
cx::StateService::workflowStateAboutToChange
void workflowStateAboutToChange()
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::CustusXWorkflowStateMachine
State Machine for the Workflow Steps for CustusX.
Definition: cxCustusXWorkflowStateMachine.h:32
cx::ApplicationsParser::setDesktop
void setDesktop(QString workflowName, Desktop desktop)
Definition: cxApplicationsParser.cpp:159
cxXmlOptionItem.h
cx::StateService::fillDefaultSettings
void fillDefaultSettings()
Definition: cxStateService.cpp:54
cx::ApplicationsParser::getDesktop
Desktop getDesktop(QString workflowName)
Definition: cxApplicationsParser.cpp:138
cx::WorkflowStateMachine::activeStateAboutToChange
void activeStateAboutToChange()
cx::WorkflowStateMachinePtr
boost::shared_ptr< class WorkflowStateMachine > WorkflowStateMachinePtr
Definition: cxStateServiceImpl.h:21
cx::StateServiceImpl::getWorkflow
virtual WorkflowStateMachinePtr getWorkflow()
Definition: cxStateServiceImpl.cpp:89
cxStateServiceImpl.h
cx::WorkflowStateMachine::activeStateChanged
void activeStateChanged()
cx::StateServiceImpl::resetDesktop
virtual void resetDesktop()
Definition: cxStateServiceImpl.cpp:112
cx::StateServiceImpl::isNull
virtual bool isNull()
Definition: cxStateServiceImpl.cpp:49
cx::StateService::workflowStateChanged
void workflowStateChanged()
cxProfile.h
cx::StateService::applicationStateChanged
void applicationStateChanged()
cxPatientModelServiceProxy.h
cxSpaceProviderImpl.h
cx::StateServiceImpl::getActiveDesktop
virtual Desktop getActiveDesktop()
Definition: cxStateServiceImpl.cpp:99
cx::StateServiceImpl::getWorkflowActions
virtual QActionGroup * getWorkflowActions()
Definition: cxStateServiceImpl.cpp:84
cx::StateServiceImpl::saveDesktop
virtual void saveDesktop(Desktop desktop)
Definition: cxStateServiceImpl.cpp:105
cx::StateServiceImpl::getVersionName
virtual QString getVersionName()
Definition: cxStateServiceImpl.cpp:79
cx::StateServiceImpl::getAllApplicationStateNames
virtual QStringList getAllApplicationStateNames() const
Definition: cxStateServiceImpl.cpp:74
cx::ApplicationsParser::resetDesktop
void resetDesktop(QString workflowName)
Definition: cxApplicationsParser.cpp:178
cx::VisServices::create
static VisServicesPtr create(ctkPluginContext *context)
Definition: cxVisServices.cpp:17
cx::StateServiceImpl::StateServiceImpl
StateServiceImpl(ctkPluginContext *context)
Definition: cxStateServiceImpl.cpp:38
cxDataLocations.h
cx::ProfileManager::activeProfileChanged
void activeProfileChanged()
cx::StateServiceImpl::setWorkFlowState
virtual void setWorkFlowState(QString uid)
Definition: cxStateServiceImpl.cpp:94
cxTrackingServiceProxy.h
cx::ProfileManager::getInstance
static ProfileManager * getInstance(QString defaultProfile=QString("Laboratory"))
returns the only instance of this class
Definition: cxProfile.cpp:167
cx::ProfileManager::activeProfile
ProfilePtr activeProfile()
Definition: cxProfile.cpp:285
cxVideoServiceProxy.h
cx::Desktop
Data class for CustusX desktop.
Definition: cxStateService.h:43
cx::ProfileManager::initialize
static void initialize()
Definition: cxProfile.cpp:176
cxCustusXWorkflowStateMachine.h
cx::ApplicationsParser
Definition: cxApplicationsParser.h:27
cxVisServices.h