[poppler] 4 commits - qt4/src
Pino Toscano
pino at kemper.freedesktop.org
Fri Aug 22 17:00:52 PDT 2008
qt4/src/CMakeLists.txt | 1
qt4/src/Makefile.am | 1
qt4/src/poppler-annotation.cc | 74 ++++++++++++++++++++++++++++++++++++++++++
qt4/src/poppler-annotation.h | 26 ++++++++++++++
qt4/src/poppler-movie.cc | 73 +++++++++++++++++++++++++++++++++++++++++
qt4/src/poppler-page.cc | 18 ++++++++--
qt4/src/poppler-qt4.h | 34 +++++++++++++++++++
7 files changed, 223 insertions(+), 4 deletions(-)
New commits:
commit 63bcaf113fcb5a4a9e5c120df2c3dafb2977c90a
Author: Pino Toscano <pino at kde.org>
Date: Sat Aug 23 01:58:30 2008 +0200
[Qt4] convert the movie annotation from the core type to the Qt4 one
diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
index 29602f4..2710ab5 100644
--- a/qt4/src/poppler-page.cc
+++ b/qt4/src/poppler-page.cc
@@ -892,6 +892,20 @@ QList<Annotation*> Page::annotations() const
break;
}
+ case Annot::typeMovie:
+ {
+ AnnotMovie * movieann = static_cast< AnnotMovie * >( ann );
+ MovieAnnotation * m = new MovieAnnotation();
+ annotation = m;
+
+ // -> movie
+ QSize movieSize;
+ movieann->getMovieSize( movieSize.rwidth(), movieSize.rheight() );
+ MovieObject *movie = new MovieObject( movieann->getMovie(), movieSize, movieann->getRotationAngle() );
+ m->setMovie( movie );
+
+ break;
+ }
// special case for ignoring unknwon annotations
case Annot::typeUnknown:
continue;
@@ -904,7 +918,6 @@ QList<Annotation*> Page::annotations() const
QByteArray type;
switch ( subType )
{
- CASE_FOR_TYPE( Movie )
CASE_FOR_TYPE( Widget )
CASE_FOR_TYPE( Screen )
CASE_FOR_TYPE( PrinterMark )
@@ -913,8 +926,7 @@ QList<Annotation*> Page::annotations() const
CASE_FOR_TYPE( 3D )
default: type = QByteArray::number( subType );
}
- // MISSING: Movie, Widget,
- // Screen, PrinterMark, TrapNet, Watermark, 3D
+ // MISSING: Widget, Screen, PrinterMark, TrapNet, Watermark, 3D
qDebug() << "Annotation" << type.constData() << "not supported.";
continue;
#undef CASE_FOR_TYPE
commit 5cc490de74af12726bdeb9b5a6a0f0d1d79383b5
Author: Pino Toscano <pino at kde.org>
Date: Sat Aug 23 01:55:41 2008 +0200
[Qt4] first version of a MovieAnnotation
right mow it just holds the movie object
diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc
index 5e352e4..c30edd5 100644
--- a/qt4/src/poppler-annotation.cc
+++ b/qt4/src/poppler-annotation.cc
@@ -1944,6 +1944,80 @@ void SoundAnnotation::setSound( SoundObject *s )
d->sound = s;
}
+/** MovieAnnotation [Annotation] */
+class MovieAnnotationPrivate : public AnnotationPrivate
+{
+ public:
+ MovieAnnotationPrivate();
+ ~MovieAnnotationPrivate();
+
+ // data fields
+ MovieObject *movie;
+};
+
+MovieAnnotationPrivate::MovieAnnotationPrivate()
+ : AnnotationPrivate(), movie( 0 )
+{
+}
+
+MovieAnnotationPrivate::~MovieAnnotationPrivate()
+{
+ delete movie;
+}
+
+MovieAnnotation::MovieAnnotation()
+ : Annotation( *new MovieAnnotationPrivate() )
+{
+}
+
+MovieAnnotation::MovieAnnotation( const QDomNode & node )
+ : Annotation( *new MovieAnnotationPrivate(), node )
+{
+ // loop through the whole children looking for a 'movie' element
+ QDomNode subNode = node.firstChild();
+ while( subNode.isElement() )
+ {
+ QDomElement e = subNode.toElement();
+ subNode = subNode.nextSibling();
+ if ( e.tagName() != "movie" )
+ continue;
+
+ // loading complete
+ break;
+ }
+}
+
+MovieAnnotation::~MovieAnnotation()
+{
+}
+
+void MovieAnnotation::store( QDomNode & node, QDomDocument & document ) const
+{
+ // recurse to parent objects storing properties
+ Annotation::store( node, document );
+
+ // create [movie] element
+ QDomElement movieElement = document.createElement( "movie" );
+ node.appendChild( movieElement );
+}
+
+Annotation::SubType MovieAnnotation::subType() const
+{
+ return AMovie;
+}
+
+MovieObject* MovieAnnotation::movie() const
+{
+ Q_D( const MovieAnnotation );
+ return d->movie;
+}
+
+void MovieAnnotation::setMovie( MovieObject *movie )
+{
+ Q_D( MovieAnnotation );
+ d->movie = movie;
+}
+
//BEGIN utility annotation functions
QColor convertAnnotColor( AnnotColor *color )
{
diff --git a/qt4/src/poppler-annotation.h b/qt4/src/poppler-annotation.h
index bf0ef67..b993476 100644
--- a/qt4/src/poppler-annotation.h
+++ b/qt4/src/poppler-annotation.h
@@ -45,9 +45,11 @@ class LinkAnnotationPrivate;
class CaretAnnotationPrivate;
class FileAttachmentAnnotationPrivate;
class SoundAnnotationPrivate;
+class MovieAnnotationPrivate;
class EmbeddedFile;
class Link;
class SoundObject;
+class MovieObject;
/**
* \short Helper class for (recursive) Annotation retrieval/storage.
@@ -93,7 +95,7 @@ class POPPLER_QT4_EXPORT Annotation
// WARNING!!! oKular uses that very same values so if you change them notify the author!
enum SubType { AText = 1, ALine = 2, AGeom = 3, AHighlight = 4, AStamp = 5,
AInk = 6, ALink = 7, ACaret = 8, AFileAttachment = 9, ASound = 10,
- A_BASE = 0 };
+ AMovie = 11, A_BASE = 0 };
enum Flag { Hidden = 1, FixedSize = 2, FixedRotation = 4, DenyPrint = 8,
DenyWrite = 16, DenyDelete = 32, ToggleHidingOnMouse = 64, External = 128 };
enum LineStyle { Solid = 1, Dashed = 2, Beveled = 4, Inset = 8, Underline = 16 };
@@ -580,6 +582,28 @@ class POPPLER_QT4_EXPORT SoundAnnotation : public Annotation
Q_DISABLE_COPY( SoundAnnotation )
};
+/**
+ * \short Movie annotation.
+ *
+ * The movie annotation represents a movie to be played when activated.
+ */
+class POPPLER_QT4_EXPORT MovieAnnotation : public Annotation
+{
+ public:
+ MovieAnnotation();
+ MovieAnnotation( const QDomNode &node );
+ virtual ~MovieAnnotation();
+ virtual void store( QDomNode &parentNode, QDomDocument &document ) const;
+ virtual SubType subType() const;
+
+ MovieObject* movie() const;
+ void setMovie( MovieObject *movie );
+
+ private:
+ Q_DECLARE_PRIVATE( MovieAnnotation )
+ Q_DISABLE_COPY( MovieAnnotation )
+};
+
}
#endif
commit 3d5c2e22d790d7c139e1cd28aebb21cfe76b8b6b
Author: Pino Toscano <pino at kde.org>
Date: Sat Aug 23 01:54:30 2008 +0200
compile the new poppler-movie.cc
diff --git a/qt4/src/CMakeLists.txt b/qt4/src/CMakeLists.txt
index 1618cc2..a72f855 100644
--- a/qt4/src/CMakeLists.txt
+++ b/qt4/src/CMakeLists.txt
@@ -15,6 +15,7 @@ set(poppler_qt4_SRCS
poppler-form.cc
poppler-link.cc
poppler-link-extractor.cc
+ poppler-movie.cc
poppler-optcontent.cc
poppler-page.cc
poppler-base-converter.cc
diff --git a/qt4/src/Makefile.am b/qt4/src/Makefile.am
index de73c8a..15642b7 100644
--- a/qt4/src/Makefile.am
+++ b/qt4/src/Makefile.am
@@ -39,6 +39,7 @@ libpoppler_qt4_la_SOURCES = \
poppler-pdf-converter.cc \
poppler-qiodeviceoutstream.cc \
poppler-private.cc \
+ poppler-movie.cc \
poppler-annotation-helper.h \
poppler-page-private.h \
poppler-link-extractor-private.h \
commit 599698a9b133999f1f0bb0548489111e9d7b6f05
Author: Pino Toscano <pino at kde.org>
Date: Sat Aug 23 01:52:58 2008 +0200
[Qt4] first version of a MovieObject object for movies
slightly differs from the version in core
diff --git a/qt4/src/poppler-movie.cc b/qt4/src/poppler-movie.cc
new file mode 100644
index 0000000..c7ebb58
--- /dev/null
+++ b/qt4/src/poppler-movie.cc
@@ -0,0 +1,73 @@
+/* poppler-sound.cc: qt interface to poppler
+ * Copyright (C) 2008, Pino Toscano <pino at kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-qt4.h"
+
+#include "Movie.h"
+
+namespace Poppler
+{
+
+class MovieData
+{
+public:
+ MovieData()
+ : m_movieObj( 0 )
+ {
+ }
+
+ ~MovieData()
+ {
+ delete m_movieObj;
+ }
+
+ Movie *m_movieObj;
+ QSize m_size;
+ int m_rotation;
+};
+
+MovieObject::MovieObject( Movie *popplermovie, const QSize &size, int rotation )
+{
+ m_movieData = new MovieData();
+ m_movieData->m_movieObj = popplermovie->copy();
+ m_movieData->m_size = size;
+ m_movieData->m_rotation = rotation;
+}
+
+MovieObject::~MovieObject()
+{
+ delete m_movieData;
+}
+
+QString MovieObject::url() const
+{
+ GooString * goo = m_movieData->m_movieObj->getFileName();
+ return goo ? QString( goo->getCString() ) : QString();
+}
+
+QSize MovieObject::size() const
+{
+ return m_movieData->m_size;
+};
+
+int MovieObject::rotation() const
+{
+ return m_movieData->m_rotation;
+}
+
+}
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index 26c7fa9..a8e57a1 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -33,6 +33,7 @@
class EmbFile;
class Sound;
+class Movie;
/**
The %Poppler Qt4 binding.
@@ -1192,6 +1193,39 @@ height = dummy.height();
SoundData *m_soundData;
};
+ class MovieData;
+ /**
+ Container class for a movie object in a PDF document.
+ */
+ class POPPLER_QT4_EXPORT MovieObject {
+ public:
+ /// \cond PRIVATE
+ MovieObject( Movie *popplermovie, const QSize &size, int rotation );
+ /// \endcond
+
+ ~MovieObject();
+
+ /**
+ The URL of the movie to be played
+ */
+ QString url() const;
+
+ /**
+ The size of the movie
+ */
+ QSize size() const;
+
+ /**
+ The rotation (either 0, 90, 180, or 270 degrees clockwise) for the movie,
+ */
+ int rotation() const;
+
+ private:
+ Q_DISABLE_COPY(MovieObject)
+
+ MovieData *m_movieData;
+ };
+
}
Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
More information about the poppler
mailing list