CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxStringPropertyActiveVideoSource.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 
13 #include "cxVideoService.h"
14 #include "cxVideoSource.h"
15 
16 namespace cx
17 {
18 
20  mService(service)
21 {
22  connect(mService.get(), &VideoService::activeVideoSourceChanged, this, &Property::changed);
23 }
24 
26 {
27  return "Stream";
28 }
29 
31 {
32  if (value == this->getValue())
33  return false;
34  mService->setActiveVideoSource(value);
35  emit changed();
36  return true;
37 }
38 
40 {
41  return mService->getActiveVideoSource()->getUid();
42 }
43 
45 {
46  std::vector<VideoSourcePtr> sources = mService->getVideoSources();
47  QStringList retval;
48  for (unsigned i=0; i<sources.size(); ++i)
49  retval << sources[i]->getUid();
50  return retval;
51 }
52 
54 {
55  return "Select the active video source.";
56 }
57 
58 
59 } // namespace cx
boost::shared_ptr< class VideoService > VideoServicePtr
virtual QString getDisplayName() const
name of data entity. Used for display to user.
virtual bool setValue(const QString &value)
set the data value.
void changed()
emit when the underlying data value is changed: The user interface will be updated.
virtual QString getUid() const
virtual QString getValue() const
get the data value.
virtual QString getHelp() const
return a descriptive help string for the data, used for example as a tool tip.
void activeVideoSourceChanged()
Namespace for all CustusX production code.