fw4spl
ActivityDataView.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2016-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "uiMedDataQt/config.hpp"
10 
11 #include <fwActivities/registry/Activities.hpp>
12 
13 #include <fwData/Composite.hpp>
14 
15 #include <fwMedData/ActivitySeries.hpp>
16 
17 #include <QEvent>
18 #include <QPointer>
19 #include <QTabWidget>
20 #include <QTreeWidget>
21 
22 namespace uiMedDataQt
23 {
24 namespace widget
25 {
26 
30 class UIMEDDATAQT_CLASS_API ActivityDataView : public QTabWidget
31 {
32 Q_OBJECT;
33 
34 public:
35 
36  typedef std::map< std::string, std::string > ObjectIconMapType;
37 
38  UIMEDDATAQT_API ActivityDataView(QWidget* parent = 0);
39 
40  UIMEDDATAQT_API virtual ~ActivityDataView();
41 
43  UIMEDDATAQT_API static const int s_UID_ROLE;
44 
45  enum class ColumnType : int
46  {
47  NAME,
48  TYPE,
49  DESC,
50  PATIENT,
51  STUDY
52  };
53 
55  UIMEDDATAQT_API void fillInformation(const ::fwActivities::registry::ActivityInfo& info);
56 
58  UIMEDDATAQT_API void fillInformation(const ::fwMedData::ActivitySeries::sptr& actSeries);
59 
70  UIMEDDATAQT_API bool checkAndComputeData(const ::fwMedData::ActivitySeries::sptr& actSeries,
71  std::string& errorMsg);
72 
79  UIMEDDATAQT_API ::fwData::Object::sptr checkData(size_t index, std::string& errorMsg);
80 
82  void setIOSelectorConfig(const std::string& ioSelectorSrvConfig)
83  {
84  m_ioSelectorSrvConfig = ioSelectorSrvConfig;
85  }
86 
88  void setSDBIOSelectorConfig(const std::string& ioSelectorSrvConfig)
89  {
90  m_sdbIoSelectorSrvConfig = ioSelectorSrvConfig;
91  }
92 
94  UIMEDDATAQT_API virtual void clear();
95 
97  void setObjectIconAssociation(const ObjectIconMapType& objectIcons)
98  {
99  m_objectIcons = objectIcons;
100  }
101 
102 protected:
103 
105  bool eventFilter(QObject* obj, QEvent* event) override;
106 
107 private:
108 
109  typedef std::vector< ::fwData::Object::csptr > ImportedObjectType;
110  typedef std::vector<QPointer<QTreeWidget> > TreeContainerType;
111 
113  void importObject();
114 
116  void importObjectFromSDB();
117 
119  void createNewObject();
120 
122  fwData::Object::sptr readObject(const std::string& classname, const std::string& ioSelectorSrvConfig);
123 
125  void removeSelectedObjects();
126 
128  void clearTree();
129 
134  void onTreeItemDoubleClicked(QTreeWidgetItem* item, int column);
135 
141  void addObjectItem(size_t index, const ::fwData::Object::csptr& obj);
142 
144 
145  std::string m_ioSelectorSrvConfig;
146  std::string m_sdbIoSelectorSrvConfig;
147 
148  ImportedObjectType m_importedObject;
149  TreeContainerType m_treeWidgets;
150 
151  ObjectIconMapType m_objectIcons;
152 };
153 
154 } // namespace widget
155 } // namespace uiMedDataQt
void setSDBIOSelectorConfig(const std::string &ioSelectorSrvConfig)
Set io selector configuration used to import data from a SDB.
The namespace uiMedDataQt contains editors for medical data.
Holds Activities configuration.
Definition: Activities.hpp:175
static UIMEDDATAQT_API const int s_UID_ROLE
Identifier of the role UID in the series tree item.
void setIOSelectorConfig(const std::string &ioSelectorSrvConfig)
Set io selector configuration used to import data.
void setObjectIconAssociation(const ObjectIconMapType &objectIcons)
Set the map that defines the icon associated to an object.
This class displays a tab widget allowing to select the required data to create an activity...