CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxStatusBar.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 CXSTATUSBAR_H_
13 #define CXSTATUSBAR_H_
14 
15 #include "cxGuiExport.h"
16 
17 #include <QStatusBar>
18 #include <map>
19 
20 #include "cxForwardDeclarations.h"
21 #include "cxReporter.h"
22 #include "cxLogMessageFilter.h"
23 
24 class QLabel;
25 class QPixmap;
26 class QAction;
27 class QToolButton;
28 
29 namespace cx
30 {
31 
32 typedef boost::shared_ptr<class ActiveToolProxy> ActiveToolProxyPtr;
33 typedef boost::shared_ptr<class MessageFilterStatusBar> MessageFilterStatusBarPtr;
34 
38 {
39 public:
40  static MessageFilterStatusBarPtr create()
41  {
43  }
44  virtual bool operator()(const Message& msg) const
45  {
46  LOG_SEVERITY severity = level2severity(msg.getMessageLevel());
47 
48  if (severity <= msWARNING)
49  return true;
50  if (msg.getMessageLevel()==mlVOLATILE)
51  return true;
52  return false;
53  }
55  {
56  return MessageFilterPtr(new MessageFilterStatusBar(*this));
57  }
58 };
59 
60 
70 class cxGui_EXPORT StatusBar: public QStatusBar
71 {
72  Q_OBJECT
73 
74 public:
75  StatusBar(TrackingServicePtr trackingService, ViewServicePtr viewService, VideoServicePtr videoService);
76  virtual ~StatusBar();
77 
78 private slots:
79  void connectToToolSignals();
80  void disconnectFromToolSignals();
81  void renderingFpsSlot(int numFps);
82  void grabbingFpsSlot(int numFps);
83  void grabberConnectedSlot(bool connected);
84  void tpsSlot(int numTps);
85  void showMessageSlot(Message message);
86  void updateToolButtons();
87  void resetToolManagerConnection();
88  void onRecordFullscreenChanged();
89 
90 private:
91  void fixFlickeringBar();
92  void activateTool(QString uid);
93  QString getToolStyle(bool visible, bool initialized, bool active);
94 
95  QLabel* mRenderingFpsLabel;
96  QLabel* mGrabbingInfoLabel;
97  QLabel* mRecordFullscreenLabel;
98  QLabel* mTpsLabel;
99 // QLabel* mMessageLevelLabel;
100  QToolButton* mMessageLevelLabel;
101  ActiveToolProxyPtr mActiveTool;
102  MessageListenerPtr mMessageListener;
103  TrackingServicePtr mTrackingService;
104 
105  struct ToolData
106  {
107  boost::shared_ptr<QAction> mAction;
108  boost::shared_ptr<QToolButton> mButton;
109  ToolPtr mTool;
110  };
111  std::vector<ToolData> mToolData;
112 };
113 }
114 
115 #endif /* CXSTATUSBAR_H_ */
mlVOLATILE
Definition: cxDefinitions.h:67
boost::shared_ptr< class VideoService > VideoServicePtr
Statusbar with extended functionality.
Definition: cxStatusBar.h:70
boost::shared_ptr< class TrackingService > TrackingServicePtr
boost::shared_ptr< class MessageFilterStatusBar > MessageFilterStatusBarPtr
Definition: cxStatusBar.h:33
boost::shared_ptr< class ViewService > ViewServicePtr
static MessageFilterStatusBarPtr create()
Definition: cxStatusBar.h:40
virtual MessageFilterPtr clone()
Definition: cxStatusBar.h:54
boost::shared_ptr< class MessageFilter > MessageFilterPtr
boost::shared_ptr< class ActiveToolProxy > ActiveToolProxyPtr
Definition: cxStatusBar.h:32
msWARNING
Definition: cxDefinitions.h:81
virtual bool operator()(const Message &msg) const
Definition: cxStatusBar.h:44
MESSAGE_LEVEL getMessageLevel() const
The category of the message.
boost::shared_ptr< class MessageListener > MessageListenerPtr
Definition: cxLog.h:45
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr