From a41a727e214eef60054b1b264fad6eb5c3c76598 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Thu, 27 Sep 2012 14:14:03 +0200 Subject: [PATCH] Extend GuiUtils with helper function for ScreenAnnotations REVIEW: 106607 --- ui/guiutils.cpp | 15 +++++++++++++++ ui/guiutils.h | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/ui/guiutils.cpp b/ui/guiutils.cpp index 30be525ce..1d67d3ad7 100644 --- a/ui/guiutils.cpp +++ b/ui/guiutils.cpp @@ -21,6 +21,7 @@ #include // local includes +#include "core/action.h" #include "core/annotations.h" #include "core/document.h" @@ -225,4 +226,18 @@ void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent ) f.close(); } +Okular::Movie* renditionMovieFromScreenAnnotation( const Okular::ScreenAnnotation *annotation ) +{ + if ( !annotation ) + return 0; + + if ( annotation->action() && annotation->action()->actionType() == Okular::Action::Rendition ) + { + Okular::RenditionAction *renditionAction = static_cast< Okular::RenditionAction * >( annotation->action() ); + return renditionAction->movie(); + } + + return 0; +} + } diff --git a/ui/guiutils.h b/ui/guiutils.h index b68e21196..2ae4ab3d3 100644 --- a/ui/guiutils.h +++ b/ui/guiutils.h @@ -20,6 +20,8 @@ class KIconLoader; namespace Okular { class Annotation; class EmbeddedFile; +class Movie; +class ScreenAnnotation; } namespace GuiUtils @@ -42,6 +44,13 @@ namespace GuiUtils KIconLoader* iconLoader(); void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent ); + + /** + * Returns the movie object that is referenced by a rendition action of the passed screen @p annotation + * or @c 0 if the screen annotation has no rendition action set or the rendition action does not contain + * a media rendition. + */ + Okular::Movie* renditionMovieFromScreenAnnotation( const Okular::ScreenAnnotation * annotation ); }