CustusX  22.04-rc5
An IGT application
cxTimedAlgorithmProgressBar.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 CXTIMEDALGORITHMPROGRESSBAR_H_
13 #define CXTIMEDALGORITHMPROGRESSBAR_H_
14 
15 #include "cxResourceWidgetsExport.h"
16 
17 #include <boost/shared_ptr.hpp>
18 #include <set>
19 #include <QWidget>
20 class QProgressBar;
21 class QLabel;
22 
23 namespace cx
24 {
25 typedef boost::shared_ptr<class TimedBaseAlgorithm> TimedAlgorithmPtr;
26 class DisplayTimerWidget;
27 
51 class cxResourceWidgets_EXPORT TimedAlgorithmProgressBar : public QWidget
52 {
53  Q_OBJECT
54 public:
55  TimedAlgorithmProgressBar(QWidget* parent=NULL);
57  void setShowTextLabel(bool on);
58 
59  void attach(TimedAlgorithmPtr algorithm);
60  void attach(std::set<cx::TimedAlgorithmPtr> threads);
61 
62  void detach(TimedAlgorithmPtr algorithm);
63  void detach(std::set<cx::TimedAlgorithmPtr> threads);
64 
65 
66 private slots:
67  void algorithmStartedSlot(int maxSteps);
68  void algorithmFinishedSlot();
69  void productChangedSlot();
70 
71 private:
72  void algorithmFinished(TimedBaseAlgorithm* algo);
73  std::set<TimedAlgorithmPtr> mAlgorithm;
74  QProgressBar* mProgressBar;
75  QLabel* mLabel;
76  std::set<TimedBaseAlgorithm*> mStartedAlgos;
77  DisplayTimerWidget* mTimerWidget;
78  bool mShowTextLabel;
79 };
80 
84 }
85 #endif /* CXTIMEDALGORITHMPROGRESSBAR_H_ */
Base class for algorithms that wants to time their execution.
Show progress for a TimedBaseAlgorithm.
boost::shared_ptr< class TimedBaseAlgorithm > TimedAlgorithmPtr
A second counter widget.
Namespace for all CustusX production code.