CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxScreenVideoProvider.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 #ifndef CXSCREENVIDEOPROVIDER_H
12 #define CXSCREENVIDEOPROVIDER_H
13 
14 #include <QObject>
15 #include <QPointer>
16 #include <QMainWindow>
17 #include "vtkSmartPointer.h"
18 #include "cxVisServices.h"
19 #include "cxForwardDeclarations.h"
21 
22 typedef vtkSmartPointer<class vtkWindowToImageFilter> vtkWindowToImageFilterPtr;
23 typedef vtkSmartPointer<class vtkPNGWriter> vtkPNGWriterPtr;
24 typedef vtkSmartPointer<class vtkUnsignedCharArray> vtkUnsignedCharArrayPtr;
25 
26 namespace cx
27 {
28 
29 class SecondaryViewLayoutWindow: public QWidget
30 {
31 Q_OBJECT
32 
33 public:
34  SecondaryViewLayoutWindow(QWidget* parent, ViewServicePtr viewService);
36 
39 
40 protected:
41  virtual void showEvent(QShowEvent* event);
42  virtual void hideEvent(QCloseEvent* event);
43  virtual void closeEvent(QCloseEvent *event);
44 private:
45  QString toString(QRect r) const;
46  int findSmallestSecondaryScreen();
47 
48  ViewServicePtr mViewService;
49 };
50 
51 class ScreenVideoProvider : public QObject
52 {
53  Q_OBJECT
54 public:
56 
57  class ViewCollectionWidget* getSecondaryLayoutWidget();
58  void saveScreenShot(QImage image, QString id);
59  QByteArray generatePNGEncoding(QImage image);
60  QPixmap grabScreen(unsigned screenid);
61  void showSecondaryLayout(QSize size, QString layout);
62  QImage grabSecondaryLayout();
63  void closeSecondaryLayout();
64 private:
65  VisServicesPtr mServices;
66  SecondaryViewLayoutWindow* mSecondaryViewLayoutWindow;
67  QPointer<class QWidget> mTopWindow;
68  ScreenShotImageWriter mWriter;
69  void setWidgetToNiceSizeInLowerRightCorner(QSize size);
70 };
71 
72 } // namespace cx
73 
74 
75 #endif // CXSCREENVIDEOPROVIDER_H
vtkSmartPointer< class vtkPNGWriter > vtkPNGWriterPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
boost::shared_ptr< class ViewService > ViewServicePtr
virtual void closeEvent(QCloseEvent *event)
vtkSmartPointer< class vtkUnsignedCharArray > vtkUnsignedCharArrayPtr
Experimental class for IPad usage.
vtkSmartPointer< class vtkWindowToImageFilter > vtkWindowToImageFilterPtr
virtual void showEvent(QShowEvent *event)
virtual void hideEvent(QCloseEvent *event)
Namespace for all CustusX production code.