GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/gui/osgwidget.hh Lines: 0 1 0.0 %
Date: 2020-05-14 11:23:33 Branches: 0 0 - %

Line Branch Exec Source
1
// Copyright (c) 2015-2018, LAAS-CNRS
2
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3
//
4
// This file is part of gepetto-viewer.
5
// gepetto-viewer is free software: you can redistribute it
6
// and/or modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation, either version
8
// 3 of the License, or (at your option) any later version.
9
//
10
// gepetto-viewer is distributed in the hope that it will be
11
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// General Lesser Public License for more details. You should have
14
// received a copy of the GNU Lesser General Public License along with
15
// gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16
17
#ifndef GEPETTO_GUI_OSGWIDGET_HH
18
#define GEPETTO_GUI_OSGWIDGET_HH
19
20
#include <gepetto/gui/fwd.hh>
21
#include <gepetto/viewer/config-osg.h>
22
23
#include <QString>
24
#include <QThread>
25
#include <QLabel>
26
#include <QTimer>
27
28
#include <osg/ref_ptr>
29
#include <osgViewer/ViewerBase>
30
#include <osgViewer/ViewerEventHandlers>
31
32
#include <osgQt/GraphicsWindowQt>
33
34
class QToolBar;
35
class QProcess;
36
class QTextBrowser;
37
38
namespace gepetto {
39
  namespace gui {
40
    typedef viewer::WindowManagerPtr_t WindowManagerPtr_t;
41
    typedef viewer::WindowID WindowID;
42
43
    /// Widget that displays scenes.
44
    class OSGWidget : public QWidget
45
    {
46
      Q_OBJECT
47
      public:
48
        OSGWidget( WindowsManagerPtr_t wm,
49
                  const std::string & name,
50
                  MainWindow* parent,
51
                  Qt::WindowFlags f = 0,
52
                  osgViewer::ViewerBase::ThreadingModel threadingModel=osgViewer::Viewer::ThreadPerContext );
53
54
        virtual ~OSGWidget();
55
56
        WindowID windowID () const;
57
58
        WindowManagerPtr_t window () const;
59
60
        WindowsManagerPtr_t osg () const;
61
62
        public slots:
63
        /// Replace the camera at her home position.
64
        void onHome();
65
66
        void addFloor();
67
68
        void toggleCapture (bool active);
69
70
        void captureFrame ();
71
        void captureFrame (const std::string& filename);
72
        bool startCapture (const std::string& filename, const std::string& extension);
73
        bool stopCapture ();
74
75
      protected:
76
        virtual void paintEvent(QPaintEvent* event);
77
78
        bool isFixedSize () const;
79
80
        void setFixedSize (bool fixedSize);
81
82
        void setWindowDimension (const osgVector2& size);
83
84
      private slots:
85
        void readyReadProcessOutput ();
86
        void toggleFullscreenMode (bool fullscreenOn);
87
88
      private:
89
        void initToolBar ();
90
        void initGraphicsWindowsAndViewer (MainWindow* parent, const std::string& name);
91
92
        osg::ref_ptr<osgQt::GraphicsWindowQt> graphicsWindow_;
93
        WindowsManagerPtr_t wsm_;
94
        osg::ref_ptr<PickHandler> pickHandler_;
95
        WindowID wid_;
96
        WindowManagerPtr_t wm_;
97
        QTimer timer_;
98
        osgViewer::ViewerRefPtr viewer_;
99
        osg::ref_ptr <osgViewer::ScreenCaptureHandler> screenCapture_;
100
101
        QToolBar* toolBar_;
102
103
        // To record movies.
104
        QProcess* process_;
105
        QDialog* showPOutput_;
106
        QTextBrowser* pOutput_;
107
108
        QWidget* fullscreen_, *normal_;
109
110
        friend class PickHandler;
111
    };
112
  } // namespace gui
113
} // namespace gepetto
114
115
#endif // GEPETTO_GUI_OSGWIDGET_HH