LCOV - code coverage report
Current view: top level - eq/qt - window.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 0 3 0.0 %
Date: 2016-07-30 05:04:55 Functions: 0 3 0.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2014-2015, Daniel Nachbaur <danielnachbaur@gmail.com>
       3             :  *                          Stefan.Eilemann@epfl.ch
       4             :  *                          Juan Hernando <jhernando@fi.upm.es>
       5             :  *
       6             :  * This library is free software; you can redistribute it and/or modify it under
       7             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       8             :  * by the Free Software Foundation.
       9             :  *
      10             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      11             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      12             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      13             :  * details.
      14             :  *
      15             :  * You should have received a copy of the GNU Lesser General Public License
      16             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      17             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      18             :  */
      19             : 
      20             : #ifndef EQ_QT_WINDOW_H
      21             : #define EQ_QT_WINDOW_H
      22             : 
      23             : #include <eq/qt/types.h>
      24             : #include <eq/glWindow.h> // base class
      25             : #include <QObject> // base class
      26             : #include <QScreen>
      27             : 
      28             : namespace eq
      29             : {
      30             : namespace qt
      31             : {
      32             : namespace detail { class Window; }
      33             : 
      34             : /** The interface defining the minimum functionality for a Qt window. */
      35             : class WindowIF : public GLWindow
      36             : {
      37             : public:
      38           0 :     WindowIF( NotifierInterface& parent,
      39           0 :               const WindowSettings& settings ) : GLWindow( parent, settings ) {}
      40           0 :     virtual ~WindowIF() {}
      41             : 
      42             : #  pragma clang diagnostic push
      43             : #  pragma clang diagnostic ignored "-Woverloaded-virtual"
      44             :     /** Process the given event. @version 1.7.3 */
      45             :     virtual bool processEvent( const WindowEvent& event ) = 0;
      46             : #  pragma clang diagnostic pop
      47             : };
      48             : 
      49             : /** Equalizer default implementation of a Qt window */
      50             : class Window : public QObject, public WindowIF
      51             : {
      52             :     Q_OBJECT
      53             : 
      54             : public:
      55             :     /**
      56             :      * Create a new window using Qt
      57             :      *
      58             :      * The actual window will be a QWindow or a QOffscreenSurface depending
      59             :      * on the window settings.
      60             :      * The window won't be realized until configInit is called.
      61             :      *
      62             :      * @param parent The eq::Window parent window interface that uses this
      63             :      *        system window.
      64             :      * @param settings The window settings. The GL context format will be
      65             :      *        derived from these.
      66             :      * @param impl The Qt implementation (created in the app thread).
      67             :      *
      68             :      * @version 1.9
      69             :      */
      70             :     EQ_API Window( NotifierInterface& parent, const WindowSettings& settings,
      71             :                    detail::Window* impl );
      72             : 
      73             :     /** Destruct this Qt window. @version 1.7.3 */
      74             :     EQ_API ~Window() final;
      75             : 
      76             :     /** @name Qt initialization */
      77             :     //@{
      78             :     /**
      79             :      * Initialize this window for the Qt window system.
      80             :      *
      81             :      * The window will be only usable by the thread that invokes this
      82             :      * functions. Otherwise Qt thread affinity constraints will be violated.
      83             :      *
      84             :      * @return true if the initialization was successful, false otherwise.
      85             :      * @version 1.7.3
      86             :      */
      87             :     EQ_API bool configInit() override;
      88             : 
      89             :     /** @version 1.7.3 */
      90             :     EQ_API void configExit() override;
      91             : 
      92             :     //@}
      93             : 
      94             :     /**
      95             :      * The context won't be ready to be used until configInit is called.
      96             :      *
      97             :      * @return the Open GL context used by this window.
      98             :      * @version 1.9
      99             :      */
     100             :     EQ_API QOpenGLContext* getContext() const;
     101             : 
     102             :     /** @name Operations. */
     103             :     //@{
     104             :     /** @version 1.7.3 */
     105             :     EQ_API void makeCurrent( const bool cache = true ) const override;
     106             : 
     107             :     /** @version 1.10 */
     108             :     EQ_API void doneCurrent() const override;
     109             : 
     110             :     /** @version 1.7.3 */
     111             :     EQ_API void swapBuffers() override;
     112             : 
     113             :     /** Implementation untested for Qt. @version 1.7.3 */
     114             :     EQ_API void joinNVSwapBarrier( const uint32_t group,
     115             :                                    const uint32_t barrier ) override;
     116             : 
     117             :     /** Implementation untested for Qt. @version 1.7.3 */
     118             :     EQ_API void leaveNVSwapBarrier();
     119             : 
     120             :     /** @version 1.7.3 */
     121             :     EQ_API bool processEvent( const WindowEvent& event ) override;
     122             :     //@}
     123             : 
     124             :     /**
     125             :      * Use this object to make Qt events reach eq::Config when using this window
     126             :      * for offscreen rendering with shared context mode (e.g. to embed Equalizer
     127             :      * output into a Qt GUI).
     128             :      *
     129             :      * Don't send events directly to the object unless you know what you're
     130             :      * doing, use QApplication::postEvent instead.
     131             :      *
     132             :      * @return the object to which forward Qt events.
     133             :      * @version 1.9
     134             :      */
     135             :     EQ_API QObject* getEventProcessor();
     136             : 
     137             :     /** Move OpenGLContext object to given thread. @version 1.10 */
     138             :     void moveContextToThread( QThread* thread );
     139             : 
     140             : signals:
     141             :     void destroyImpl( detail::Window* );
     142             : 
     143             : private:
     144             :     detail::Window* const _impl;
     145             :     static detail::Window* createImpl( const WindowSettings&,
     146             :                                        QScreen*, QThread* );
     147             :     friend class WindowFactory;
     148             : };
     149             : }
     150             : }
     151             : #endif // EQ_QT_WINDOW_H

Generated by: LCOV version 1.11