[vlmc-devel] [PATCH] Renderer: have quint64 as a pointer of Window Id

yikei lu luyikei.qmltu at gmail.com
Tue Apr 5 11:47:20 CEST 2016


reinterpret_cast might be needed

2016-04-05 18:46 GMT+09:00 Yikai Lu <luyikei.qmltu at gmail.com>:
> ---
>  src/Gui/preview/PreviewWidget.cpp | 2 +-
>  src/Renderer/ClipRenderer.cpp     | 4 ++--
>  src/Renderer/GenericRenderer.cpp  | 8 +++-----
>  src/Renderer/GenericRenderer.h    | 7 ++-----
>  src/Renderer/WorkflowRenderer.cpp | 5 ++---
>  5 files changed, 10 insertions(+), 16 deletions(-)
>
> diff --git a/src/Gui/preview/PreviewWidget.cpp b/src/Gui/preview/PreviewWidget.cpp
> index a50e9a9..fb080d8 100644
> --- a/src/Gui/preview/PreviewWidget.cpp
> +++ b/src/Gui/preview/PreviewWidget.cpp
> @@ -71,7 +71,7 @@ PreviewWidget::setRenderer(GenericRenderer *renderer)
>      // Give the renderer to the ruler
>      m_ui->rulerWidget->setRenderer( m_renderer );
>
> -    m_renderer->setRenderWidget( m_ui->renderWidget );
> +    m_renderer->setRenderWidget( reinterpret_cast<quint64>( static_cast<RenderWidget*>( m_ui->renderWidget )->id() ) );
>
>  #if defined ( Q_OS_MAC )
>      /* Releases the NSView in the RenderWidget*/
> diff --git a/src/Renderer/ClipRenderer.cpp b/src/Renderer/ClipRenderer.cpp
> index 318d6bd..6e86da7 100644
> --- a/src/Renderer/ClipRenderer.cpp
> +++ b/src/Renderer/ClipRenderer.cpp
> @@ -31,7 +31,6 @@
>  #include "Library/Library.h"
>  #include "Media/Media.h"
>  #include "Workflow/MainWorkflow.h"
> -#include "Gui/preview/RenderWidget.h"
>
>  ClipRenderer::ClipRenderer() :
>      GenericRenderer(),
> @@ -89,7 +88,8 @@ ClipRenderer::startPreview()
>
>      delete m_sourceRenderer;
>      m_sourceRenderer = m_selectedClip->getMedia()->source()->createRenderer( m_eventWatcher );
> -    m_sourceRenderer->setOutputWidget( (void *) static_cast< RenderWidget* >( m_renderWidget )->id() );
> +    if ( m_renderWidgetId != 0 )
> +        m_sourceRenderer->setOutputWidget( (void *) m_renderWidgetId );
>
>      connect( m_eventWatcher, SIGNAL( stopped() ), this, SLOT( videoStopped() ) );
>      connect( m_eventWatcher, SIGNAL( paused() ),  this, SIGNAL( paused() ) );
> diff --git a/src/Renderer/GenericRenderer.cpp b/src/Renderer/GenericRenderer.cpp
> index 6ed435a..3456b3e 100644
> --- a/src/Renderer/GenericRenderer.cpp
> +++ b/src/Renderer/GenericRenderer.cpp
> @@ -21,12 +21,12 @@
>   *****************************************************************************/
>
>  #include "GenericRenderer.h"
> -#include "preview/RenderWidget.h"
>  #include <QtGlobal>
>
>  GenericRenderer::GenericRenderer()
>      : m_sourceRenderer( nullptr )
>      , m_paused( false )
> +    , m_renderWidgetId( 0 )
>  {
>      m_eventWatcher = new RendererEventWatcher;
>  }
> @@ -37,11 +37,10 @@ GenericRenderer::~GenericRenderer()
>      delete m_eventWatcher;
>  }
>
> -#ifdef WITH_GUI
>  void
> -GenericRenderer::setRenderWidget(QWidget *renderWidget)
> +GenericRenderer::setRenderWidget( quint64 id )
>  {
> -    m_renderWidget = renderWidget;
> +    m_renderWidgetId = id;
>  }
>
>  RendererEventWatcher*
> @@ -49,4 +48,3 @@ GenericRenderer::eventWatcher()
>  {
>      return m_eventWatcher;
>  }
> -#endif
> diff --git a/src/Renderer/GenericRenderer.h b/src/Renderer/GenericRenderer.h
> index 5cb34f5..cf9a670 100644
> --- a/src/Renderer/GenericRenderer.h
> +++ b/src/Renderer/GenericRenderer.h
> @@ -26,9 +26,6 @@
>  #include "config.h"
>
>  #include <QObject>
> -#ifdef WITH_GUI
> -# include <QWidget>
> -#endif
>
>  #include "EffectsEngine/EffectUser.h"
>  #include "Workflow/Types.h"
> @@ -57,7 +54,7 @@ public:
>       *  \param  renderWidget    The widget to use for render.
>       *  \sa     setPreviewLabel( QLabel* )
>       */
> -    void                setRenderWidget( QWidget* renderWidget );
> +    void                setRenderWidget( quint64 id );
>  #endif
>
>      /**
> @@ -174,7 +171,7 @@ protected:
>       */
>      bool                            m_paused;
>
> -    QWidget*                        m_renderWidget;
> +    quint64                         m_renderWidgetId;
>
>  public slots:
>      /**
> diff --git a/src/Renderer/WorkflowRenderer.cpp b/src/Renderer/WorkflowRenderer.cpp
> index f50838a..fa8066f 100644
> --- a/src/Renderer/WorkflowRenderer.cpp
> +++ b/src/Renderer/WorkflowRenderer.cpp
> @@ -37,7 +37,6 @@
>  #include "Backend/IBackend.h"
>  #include "Backend/ISource.h"
>  #include "Workflow/MainWorkflow.h"
> -#include "Gui/preview/RenderWidget.h"
>  #include "Settings/Settings.h"
>  #include "Tools/VlmcDebug.h"
>  #include "Workflow/Types.h"
> @@ -88,8 +87,8 @@ WorkflowRenderer::setupRenderer( quint32 width, quint32 height, double fps, cons
>      m_sourceRenderer = m_source->createRenderer( m_eventWatcher );
>      m_sourceRenderer->setName( "WorkflowRenderer" );
>      m_sourceRenderer->enableMemoryInput( m_esHandler, getLockCallback(), getUnlockCallback() );
> -    if ( m_renderWidget != nullptr )
> -        m_sourceRenderer->setOutputWidget( (void *) static_cast< RenderWidget* >( m_renderWidget )->id() );
> +    if ( m_renderWidgetId != 0 )
> +        m_sourceRenderer->setOutputWidget( (void *) m_renderWidgetId );
>  }
>
>  int
> --
> 1.9.1
>


More information about the Vlmc-devel mailing list