NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxStringPropertySelectRecordSession.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 =========================================================================*/
12 #include "cxTypeConversions.h"
13 
14 namespace cx
15 {
16 
17 
20 {
21  connect(mPluginData.get(), &AcquisitionData::recordedSessionsChanged, this, &StringPropertySelectRecordSession::setDefaultSlot);
22  this->setDefaultSlot();
23 }
25 {
26  return "Select a record session";
27 }
29 {
30  if(mRecordSession && value==mRecordSession->getUid())
31  return false;
32  RecordSessionPtr temp = mPluginData->getRecordSession(value);
33  if(!temp)
34  return false;
35 
36  mRecordSession = temp;
37  emit changed();
38  return true;
39 }
41 {
42  if(!mRecordSession)
43  return "<no session>";
44  return mRecordSession->getUid();
45 }
47 {
48  return "Select a session";
49 }
51 {
52  return mRecordSession;
53 }
54 void StringPropertySelectRecordSession::setDefaultSlot()
55 {
56  std::vector<RecordSessionPtr> sessions = mPluginData->getRecordSessions();
57  if(!sessions.empty())
58  this->setValue(sessions.at(0)->getUid());
59 }
60 
61 
62 //---------------------------------------------------------
63 //---------------------------------------------------------
64 //---------------------------------------------------------
65 
66 
67 
68 
70  mPluginData(pluginData)
71 {
73 }
75 {
76  std::vector<RecordSessionPtr> sessions = mPluginData->getRecordSessions();
77  QStringList retval;
78  retval << "";
79  for (unsigned i=0; i<sessions.size(); ++i)
80  retval << qstring_cast(sessions[i]->getUid());
81  return retval;
82 }
84 {
85  RecordSessionPtr session = mPluginData->getRecordSession(internal);
86  if(!session)
87  {
88  return "<no session>";
89  }
90  return qstring_cast(session->getDescription());
91 }
92 
93 }
qstring_cast
QString qstring_cast(const T &val)
Definition: cxTypeConversions.h:46
cx::StringPropertySelectRecordSessionBase::StringPropertySelectRecordSessionBase
StringPropertySelectRecordSessionBase(AcquisitionDataPtr pluginData)
Definition: cxStringPropertySelectRecordSession.cpp:69
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::StringPropertySelectRecordSession::getRecordSession
RecordSessionPtr getRecordSession()
Definition: cxStringPropertySelectRecordSession.cpp:50
cx::Property::changed
void changed()
emit when the underlying data value is changed: The user interface will be updated.
cx::StringPropertySelectRecordSessionBase::mPluginData
AcquisitionDataPtr mPluginData
Definition: cxStringPropertySelectRecordSession.h:45
cx::StringPropertySelectRecordSessionBase::getValueRange
virtual QStringList getValueRange() const
Definition: cxStringPropertySelectRecordSession.cpp:74
cxStringPropertySelectRecordSession.h
cxTypeConversions.h
cx::StringPropertySelectRecordSessionBase
Definition: cxStringPropertySelectRecordSession.h:31
cx::StringPropertyBase::getUid
virtual QString getUid() const
Definition: cxStringPropertyBase.h:91
cx::StringPropertySelectRecordSession::getHelp
virtual QString getHelp() const
Definition: cxStringPropertySelectRecordSession.cpp:46
cx::StringPropertySelectRecordSession::setValue
virtual bool setValue(const QString &value)
set the data value.
Definition: cxStringPropertySelectRecordSession.cpp:28
cx::StringPropertySelectRecordSession::getDisplayName
virtual QString getDisplayName() const
name of data entity. Used for display to user.
Definition: cxStringPropertySelectRecordSession.cpp:24
cx::AcquisitionData::recordedSessionsChanged
void recordedSessionsChanged()
cx::AcquisitionDataPtr
boost::shared_ptr< class AcquisitionData > AcquisitionDataPtr
Definition: cxAcquisitionImplService.h:22
cx::RecordSessionPtr
boost::shared_ptr< class RecordSession > RecordSessionPtr
Definition: cxAcquisitionService.h:28
cx::StringPropertySelectRecordSessionBase::convertInternal2Display
virtual QString convertInternal2Display(QString internal)
Definition: cxStringPropertySelectRecordSession.cpp:83
cx::StringPropertySelectRecordSession::StringPropertySelectRecordSession
StringPropertySelectRecordSession(AcquisitionDataPtr pluginData)
Definition: cxStringPropertySelectRecordSession.cpp:18
cx::StringPropertySelectRecordSession::getValue
virtual QString getValue() const
get the data value.
Definition: cxStringPropertySelectRecordSession.cpp:40