Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxRegistrationHistoryWidget.h
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 #ifndef CXREGISTRATIONHISTORYWIDGET_H_
13 #define CXREGISTRATIONHISTORYWIDGET_H_
14 
15 #include <vector>
16 #include <QtWidgets>
17 
19 #include "cxBaseWidget.h"
20 #include "cxRegServices.h"
21 
22 namespace cx
23 {
40 {
41  Q_OBJECT
42 
43 public:
44  RegistrationHistoryWidget(RegServicesPtr servicesPtr, QWidget* parent, bool compact = false);
46  virtual QString defaultWhatsThis() const;
47 
48 protected slots:
49  void rewindSlot();
50  void removeSlot();
51  void forwardSlot();
52  void fastForwardSlot();
53  void reconnectSlot();
54 
55  virtual void prePaintEvent();
56 protected:
57  virtual void showEvent(QShowEvent* event);
58  virtual void hideEvent(QCloseEvent* event);
59 
60 private:
62  void createControls(QHBoxLayout* layout);
63  QString debugDump();
64  template<class T>
65  QAction* createAction(QLayout* layout, QString iconName, QString text, QString tip, T slot);
66 
67  typedef std::multimap<QDateTime,QString> TimeMap;
68  typedef std::pair<QDateTime,QString> TimeMapPair;
69  typedef std::vector<RegistrationHistoryWidget::TimeMap::iterator> TimeMapIterators;
70  TimeMap generateRegistrationTimes();
71  QDateTime getActiveTime();
72  void setActiveTime(QDateTime active);
73  RegistrationHistoryWidget::TimeMapIterators findActiveRegistrations(TimeMap& times);
74 
75  QFrame* mGroup;
76  std::vector<RegistrationHistoryPtr> mHistories;
77  QAction* mRewindAction;
78  QAction* mRemoveAction;
79  QAction* mForwardAction;
80  QAction* mFastForwardAction;
81 
82  QLabel* mBehindLabel;
83  QLabel* mInFrontLabel;
84  QTextEdit* mTextEdit;
85 
86  std::vector<RegistrationHistoryPtr> getAllRegistrationHistories();
87  std::vector<RegistrationTransform> mergeHistory(const std::vector<RegistrationHistoryPtr>& allHistories);
88 
89  RegServicesPtr mServices;
90  RegistrationHistoryWidget::TimeMap::iterator findActiveRegistration(TimeMap &times);
91 };
92 
96 }//end namespace cx
97 
98 #endif /* CXREGISTRATIONHISTORYWIDGET_H_ */
virtual void hideEvent(QCloseEvent *event)
disconnects stuff
boost::shared_ptr< class RegServices > RegServicesPtr
Definition: cxRegServices.h:20
virtual void showEvent(QShowEvent *event)
updates internal info before showing the widget
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
Namespace for all CustusX production code.