Bug 47282

Summary: Added media rendition support for Qt4
Product: poppler Reporter: Guillermo A. Amaral <g>
Component: qt4 frontendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch
Patch (rebased)
Patch (rebased)
Patch (rebased)
Patch (working)
Okular patch (for reference)
Patch (cleaned 1)
Patch (cleaned 2)
Patch (cleaned 3)

Description Guillermo A. Amaral 2012-03-13 07:54:49 UTC
Created attachment 58375 [details] [review]
Patch

Added media rendition support for Qt4 front-end, also includes a nifty QIODevice Stream wrapper (StreamDevice).
Comment 1 Guillermo A. Amaral 2012-03-13 08:06:41 UTC
Created attachment 58376 [details] [review]
Patch (rebased)
Comment 2 Guillermo A. Amaral 2012-03-13 08:07:49 UTC
Created attachment 58377 [details] [review]
Patch (rebased)
Comment 3 Guillermo A. Amaral 2012-03-13 08:13:13 UTC
Created attachment 58380 [details] [review]
Patch (rebased)
Comment 4 Guillermo A. Amaral 2012-03-13 14:18:03 UTC
Created attachment 58395 [details] [review]
Patch (working)

Working and tested with okular
Comment 5 Guillermo A. Amaral 2012-03-13 14:18:36 UTC
Created attachment 58396 [details] [review]
Okular patch (for reference)
Comment 6 Albert Astals Cid 2012-03-13 15:06:44 UTC
What does the loop in ScreenAnnotation::ScreenAnnotation( const QDomNode & node ) do?

What's the point in creating an empty screen elment in ScreenAnnotation::store?

 \since 0.10 needs to be  \since 0.20

Please pass the MediaRendition to LinkRenditionPrivate

poppler-media.h: qt interface to poppler in poppler-media.cc

MediaRendition has no documentation at all

MediaRendition misses some const in the getters (isValid, contentType, etc)

MediaRenditionPrivate *d_ptr; is duplicating what Q_DECLARE_PRIVATE( MediaRendition ) does?

Please use UnicodeParsedString instead of QString::fromLatin1

Please d-pointify ScreenObject

poppler-screen.cc says poppler-sound.cc: qt interface to poppler

What's the use of passing AnnotScreen *ann to ScreenObject::ScreenObject

What's the use of ScreenObject itself if only holds a LinkRendition ?

Q_DISABLE_COPY to StreamDevice ?

StreamDevice seems like it could to more to implement QIODevice functions like reset, etc, i understand you decided to say its isSequential to simplify the job, maybe you should rename StreamDevice to StreamSequentialDevice?
Comment 7 Albert Astals Cid 2012-03-13 15:09:36 UTC
All the public new functions also need \since as well as enums and classes
Comment 8 Guillermo A. Amaral 2012-03-13 17:39:25 UTC
(In reply to comment #6)

I would like to point out that I tried to stick as close as possible to current implementations, though I did also add a few of my usual blunders to keep things fresh. Enjoy!

> What does the loop in ScreenAnnotation::ScreenAnnotation( const QDomNode & node
> ) do?
> 
> What's the point in creating an empty screen elment in ScreenAnnotation::store?

  *Removed* (appeared in MovieAnnotation, left it in as a place holder)

>  \since 0.10 needs to be  \since 0.20

  *Replaced* (woops)

> Please pass the MediaRendition to LinkRenditionPrivate

  *Passed* (though it appeared as assignment in other existing implementations)

> poppler-media.h: qt interface to poppler in poppler-media.cc

  *Fixed*

> MediaRendition has no documentation at all

  *Documented*

> MediaRendition misses some const in the getters (isValid, contentType, etc)

  Sadly the original (wrapped) class didn't declare it's functions as constant, and I was a bit reluctant to change the original rendition class. Anyway, it's been done.

  *Constant-ed*
 
> MediaRenditionPrivate *d_ptr; is duplicating what Q_DECLARE_PRIVATE(
> MediaRendition ) does?

  Again, noticed that some already existing implementation where using Q_DECLARE_PRIVATE in order to use Q_D in member functions.
  As you know, d_ptr is not declared by the macro, so I had to add it manually.

#define Q_DECLARE_PRIVATE(Class) \                                                                                                
inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr)); } \
inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); } \
friend class Class##Private;

#define Q_D(Class) Class##Private * const d = d_func()

  *Answered*

> Please use UnicodeParsedString instead of QString::fromLatin1

  *Replaced* (remnant from MovieAnnotation's current implementation)

> Please d-pointify ScreenObject

  *PIMPL'd*

> poppler-screen.cc says poppler-sound.cc: qt interface to poppler

  *Replaced*

> What's the use of passing AnnotScreen *ann to ScreenObject::ScreenObject

  *Removed* (sorry, left over from a previous attempt)

> What's the use of ScreenObject itself if only holds a LinkRendition ?

  For consistency, anyway the class is (was) no more heavy than a private class, not to mention it might come in handy later.

  * Consistency*

> Q_DISABLE_COPY to StreamDevice ?

  *Added*

> StreamDevice seems like it could to more to implement QIODevice functions like
> reset, etc, i understand you decided to say its isSequential to simplify the
> job, maybe you should rename StreamDevice to StreamSequentialDevice?

  Well, not quite, I first implemented it as a full blown non-sequential stream, but then I noticed that the Stream object getting sent to the wrapper was a FilterStream, so seeking was out of the question.

  *Renamed* (also added close for kicks)
StreamSequentialDevice
Comment 9 Guillermo A. Amaral 2012-03-13 17:40:08 UTC
Created attachment 58408 [details] [review]
Patch (cleaned 1)
Comment 10 Guillermo A. Amaral 2012-03-13 17:47:24 UTC
(In reply to comment #7)
> All the public new functions also need \since as well as enums and classes

*Sinced*
Comment 11 Guillermo A. Amaral 2012-03-13 17:47:44 UTC
Created attachment 58409 [details] [review]
Patch (cleaned 2)
Comment 12 Guillermo A. Amaral 2012-03-14 16:14:35 UTC
Created attachment 58460 [details] [review]
Patch (cleaned 3)
Comment 13 Albert Astals Cid 2012-03-14 16:35:55 UTC
Pushed

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.