NorMIT-nav  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 
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
cx::ScreenVideoProvider
Definition: cxScreenVideoProvider.h:51
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
cx::SecondaryViewLayoutWindow::showEvent
virtual void showEvent(QShowEvent *event)
Definition: cxSecondaryViewLayoutWindow.cpp:90
cx::VisServicesPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
cx::SecondaryViewLayoutWindow
Experimental class for IPad usage.
Definition: cxSecondaryViewLayoutWindow.h:34
cx::ScreenVideoProvider::saveScreenShot
void saveScreenShot(QImage image, QString id)
Definition: cxScreenVideoProvider.cpp:77
cx::ScreenVideoProvider::getSecondaryLayoutWidget
class ViewCollectionWidget * getSecondaryLayoutWidget()
Definition: cxScreenVideoProvider.cpp:179
cx::SecondaryViewLayoutWindow::closeEvent
virtual void closeEvent(QCloseEvent *event)
Definition: cxSecondaryViewLayoutWindow.cpp:102
vtkWindowToImageFilterPtr
vtkSmartPointer< class vtkWindowToImageFilter > vtkWindowToImageFilterPtr
Definition: cxScreenVideoProvider.h:22
cx::ScreenVideoProvider::ScreenVideoProvider
ScreenVideoProvider(VisServicesPtr services)
Definition: cxScreenVideoProvider.cpp:69
cx::ViewServicePtr
boost::shared_ptr< class ViewService > ViewServicePtr
Definition: cxLogicManager.h:28
cx::SecondaryViewLayoutWindow::mSecondaryLayoutId
int mSecondaryLayoutId
Definition: cxScreenVideoProvider.h:38
cx::SecondaryViewLayoutWindow::~SecondaryViewLayoutWindow
~SecondaryViewLayoutWindow()
Definition: cxScreenVideoProvider.h:35
cx::ScreenVideoProvider::grabSecondaryLayout
QImage grabSecondaryLayout()
Definition: cxScreenVideoProvider.cpp:169
cxScreenShotImageWriter.h
cx::ScreenVideoProvider::closeSecondaryLayout
void closeSecondaryLayout()
Definition: cxScreenVideoProvider.cpp:163
cx::ScreenVideoProvider::generatePNGEncoding
QByteArray generatePNGEncoding(QImage image)
Definition: cxScreenVideoProvider.cpp:82
vtkUnsignedCharArrayPtr
vtkSmartPointer< class vtkUnsignedCharArray > vtkUnsignedCharArrayPtr
Definition: cxScreenVideoProvider.h:24
cx::ScreenVideoProvider::grabScreen
QPixmap grabScreen(unsigned screenid)
Definition: cxScreenVideoProvider.cpp:91
cx::ScreenVideoProvider::showSecondaryLayout
void showSecondaryLayout(QSize size, QString layout)
Definition: cxScreenVideoProvider.cpp:98
cx::ScreenShotImageWriter
Definition: cxScreenShotImageWriter.h:28
cx::SecondaryViewLayoutWindow::hideEvent
virtual void hideEvent(QCloseEvent *event)
Definition: cxSecondaryViewLayoutWindow.cpp:97
vtkPNGWriterPtr
vtkSmartPointer< class vtkPNGWriter > vtkPNGWriterPtr
Definition: cxScreenVideoProvider.h:23
cx::SecondaryViewLayoutWindow::tryShowOnSecondaryScreen
void tryShowOnSecondaryScreen()
Definition: cxSecondaryViewLayoutWindow.cpp:45
cx::SecondaryViewLayoutWindow::SecondaryViewLayoutWindow
SecondaryViewLayoutWindow(QWidget *parent)
Definition: cxSecondaryViewLayoutWindow.cpp:25
cxVisServices.h
cx::ViewCollectionWidget
Definition: cxViewCollectionWidget.h:39