Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLEventLogger.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLEventLogger_h
22 #define __qMRMLEventLogger_h
23 
24 // Qt includes
25 #include <QObject>
26 
27 // CTK includes
28 #include <ctkPimpl.h>
29 
30 #include "qMRMLWidgetsExport.h"
31 
32 class qMRMLEventLoggerPrivate;
33 class vtkMRMLScene;
34 class vtkObject;
35 
36 class QMRML_WIDGETS_EXPORT qMRMLEventLogger: public QObject
37 {
38  Q_OBJECT
39 public:
40  typedef QObject Superclass;
41  explicit qMRMLEventLogger(QObject* parent = nullptr);
42  ~qMRMLEventLogger() override;
43 
46  void setMRMLScene(vtkMRMLScene* scene);
47 
50  bool listeningNodeAddedEvent();
51  bool listeningNodeRemovedEvent();
52  bool listeningNewSceneEvent();
53  bool listeningSceneClosedEvent();
54  bool listeningSceneAboutToBeClosedEvent();
55  bool listeningMetadataAddedEvent();
56  bool listeningImportProgressFeedbackEvent();
57  bool listeningSaveProgressFeedbackEvent();
58  bool listeningSceneAboutToBeImportedEvent();
59  bool listeningSceneImportedEvent();
60  bool listeningSceneRestoredEvent();
61 
62 public slots:
65  void listenNodeAddedEvent(bool listen);
66  void listenNodeRemovedEvent(bool listen);
67  void listenNewSceneEvent(bool listen);
68  void listenSceneClosedEvent(bool listen);
69  void listenSceneAboutToBeClosedEvent(bool listen);
70  void listenMetadataAddedEvent(bool listen);
71  void listenImportProgressFeedbackEvent(bool listen);
72  void listenSaveProgressFeedbackEvent(bool listen);
73  void listenSceneAboutToBeImportedEvent(bool listen);
74  void listenSceneImportedEvent(bool listen);
75  void listenSceneRestoredEvent(bool listen);
76 
77  virtual void onNodeAddedEvent(vtkObject* caller, vtkObject* call_data);
78  virtual void onNodeRemovedEvent(vtkObject* caller, vtkObject* call_data);
79  virtual void onNewSceneEvent();
80  virtual void onSceneClosedEvent();
81  virtual void onSceneAboutToBeClosedEvent();
82  virtual void onMetadataAddedEvent();
83  virtual void onImportProgressFeedbackEvent();
84  virtual void onSaveProgressFeedbackEvent();
85  virtual void onSceneAboutToBeImportedEvent();
86  virtual void onSceneImportedEvent();
87  virtual void onSceneRestoredEvent();
88 
90  void setConsoleOutputEnabled(bool enabled);
91 
92 signals:
95  void signalNodeAddedEvent(vtkObject* caller, vtkObject* call_data);
96  void signalNodeRemovedEvent(vtkObject* caller, vtkObject* call_data);
97  void signalNewSceneEvent();
98  void signalSceneClosedEvent();
99  void signalSceneAboutToBeClosedEvent();
100  void signalMetadataAddedEvent();
101  void signalImportProgressFeedbackEvent();
102  void signalSaveProgressFeedbackEvent();
103  void signalSceneAboutToBeImportedEvent();
104  void signalSceneImportedEvent();
105  void signalSceneRestoredEvent();
106 
107 protected:
108  QScopedPointer<qMRMLEventLoggerPrivate> d_ptr;
109 
110 private:
111  Q_DECLARE_PRIVATE(qMRMLEventLogger);
112  Q_DISABLE_COPY(qMRMLEventLogger);
113 };
114 
115 #endif
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
QScopedPointer< qMRMLEventLoggerPrivate > d_ptr