CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxPlaybackWidget.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 CXPLAYBACKWIDGET_H_
13 #define CXPLAYBACKWIDGET_H_
14 
15 #include "cxGuiExport.h"
16 
17 #include "cxBaseWidget.h"
18 #include "cxDoubleProperty.h"
19 #include "vtkForwardDeclarations.h"
20 #include "cxForwardDeclarations.h"
21 #include "cxVector3D.h"
23 #include "cxPlaybackTime.h"
24 
25 namespace cx
26 {
27 class TimelineWidget;
28 
29 
37 class cxGui_EXPORT PlaybackWidget : public BaseWidget
38 {
39  Q_OBJECT
40 public:
41  PlaybackWidget(TrackingServicePtr trackingService, VideoServicePtr videoService, PatientModelServicePtr patientModelService, QWidget* parent);
42  virtual ~PlaybackWidget();
43 
44 private slots:
45  void timeChangedSlot();
46  void playSlot();
47 // void pauseSlot();
48  void stopSlot();
49  void forwardSlot();
50  void rewindSlot();
51 
52  void toggleOpenSlot();
53  void speedChangedSlot();
54  void timeLineWidgetValueChangedSlot();
55  void toolManagerInitializedSlot();
56  void toggleDetailsSlot();
57 
58 private:
59 // QString stripLeadingZeros(QString time);
60  std::vector<TimelineEvent> convertHistoryToEvents(ToolPtr tool);
61  std::vector<TimelineEvent> createEvents();
62  std::pair<double,double> findTimeRange(std::vector<TimelineEvent> events);
63  std::vector<TimelineEvent> convertRegistrationHistoryToEvents(RegistrationHistoryPtr reg);
64  void showDetails();
65  QColor generateRandomToolColor() const;
66  QString convertMillisecsToNiceString(qint64 ms) const;
67  bool isInterestingTool(ToolPtr tool) const;
68 
69  QLabel* mLabel;
70  QLabel* mTotalLengthLabel;
71  QLabel* mStartTimeLabel;
72  bool mOpen;
73  PlaybackTimePtr mTimer;
74  QAction* mPlayAction;
75  QAction* mOpenAction;
76  DoublePropertyPtr mSpeedAdapter;
77  TimelineWidget* mToolTimelineWidget;
78  TrackingServicePtr mTrackingService;
79  VideoServicePtr mVideoService;
80  PatientModelServicePtr mPatientModelService;
81 };
82 
83 
84 
85 
86 
87 } /* namespace cx */
88 #endif /* CXPLAYBACKWIDGET_H_ */
widget for displaying a timeline for events.
boost::shared_ptr< class VideoService > VideoServicePtr
boost::shared_ptr< class RegistrationHistory > RegistrationHistoryPtr
Definition: cxDataManager.h:37
boost::shared_ptr< class TrackingService > TrackingServicePtr
boost::shared_ptr< class PlaybackTime > PlaybackTimePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Widget interface to PlaybackTime.
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr