mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-12 20:51:17 +00:00
Load video widgets for the video annotations of the document in the main page view.
Add them as part of the page items, so they can be resized, moved and shown/hidden automatically according to the related pages. svn path=/trunk/KDE/kdegraphics/okular/; revision=851960
This commit is contained in:
parent
da420dbcd3
commit
6993fda364
|
@ -59,12 +59,14 @@
|
|||
#include "pageviewannotator.h"
|
||||
#include "toolaction.h"
|
||||
#include "tts.h"
|
||||
#include "videowidget.h"
|
||||
#include "core/action.h"
|
||||
#include "core/document.h"
|
||||
#include "core/form.h"
|
||||
#include "core/page.h"
|
||||
#include "core/misc.h"
|
||||
#include "core/generator.h"
|
||||
#include "core/movie.h"
|
||||
#include "settings.h"
|
||||
|
||||
static int pageflags = PagePainter::Accessibility | PagePainter::EnhanceLinks |
|
||||
|
@ -771,6 +773,19 @@ void PageView::notifySetup( const QVector< Okular::Page * > & pageSet, int setup
|
|||
hasformwidgets = true;
|
||||
}
|
||||
}
|
||||
const QLinkedList< Okular::Annotation * > annotations = (*setIt)->annotations();
|
||||
QLinkedList< Okular::Annotation * >::const_iterator aIt = annotations.begin(), aEnd = annotations.end();
|
||||
for ( ; aIt != aEnd; ++aIt )
|
||||
{
|
||||
Okular::Annotation * a = *aIt;
|
||||
if ( a->subType() == Okular::Annotation::AMovie )
|
||||
{
|
||||
Okular::MovieAnnotation * movieAnn = static_cast< Okular::MovieAnnotation * >( a );
|
||||
VideoWidget * vw = new VideoWidget( movieAnn, d->document, widget() );
|
||||
item->videoWidgets().insert( movieAnn->movie(), vw );
|
||||
vw->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// invalidate layout so relayout/repaint will happen on next viewport change
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
// local includes
|
||||
#include "formwidgets.h"
|
||||
#include "guiutils.h"
|
||||
#include "videowidget.h"
|
||||
#include "core/movie.h"
|
||||
#include "core/page.h"
|
||||
#include "settings.h"
|
||||
|
||||
|
@ -50,6 +52,7 @@ PageViewItem::~PageViewItem()
|
|||
QHash<int, FormWidgetIface*>::iterator it = m_formWidgets.begin(), itEnd = m_formWidgets.end();
|
||||
for ( ; it != itEnd; ++it )
|
||||
delete *it;
|
||||
qDeleteAll( m_videoWidgets );
|
||||
}
|
||||
|
||||
const Okular::Page * PageViewItem::page() const
|
||||
|
@ -122,6 +125,11 @@ QHash<int, FormWidgetIface*>& PageViewItem::formWidgets()
|
|||
return m_formWidgets;
|
||||
}
|
||||
|
||||
QHash< Okular::Movie *, VideoWidget* >& PageViewItem::videoWidgets()
|
||||
{
|
||||
return m_videoWidgets;
|
||||
}
|
||||
|
||||
void PageViewItem::setWHZC( int w, int h, double z, const Okular:: NormalizedRect & c )
|
||||
{
|
||||
m_croppedGeometry.setWidth( w );
|
||||
|
@ -138,6 +146,13 @@ void PageViewItem::setWHZC( int w, int h, double z, const Okular:: NormalizedRec
|
|||
qRound( fabs( r.right - r.left ) * m_uncroppedGeometry.width() ),
|
||||
qRound( fabs( r.bottom - r.top ) * m_uncroppedGeometry.height() ) );
|
||||
}
|
||||
Q_FOREACH ( VideoWidget *vw, m_videoWidgets )
|
||||
{
|
||||
const Okular::NormalizedRect r = vw->normGeometry();
|
||||
vw->resize(
|
||||
qRound( fabs( r.right - r.left ) * m_uncroppedGeometry.width() ),
|
||||
qRound( fabs( r.bottom - r.top ) * m_uncroppedGeometry.height() ) );
|
||||
}
|
||||
}
|
||||
|
||||
void PageViewItem::moveTo( int x, int y )
|
||||
|
@ -155,12 +170,23 @@ void PageViewItem::moveTo( int x, int y )
|
|||
qRound( x + m_uncroppedGeometry.width() * r.left ) + 1,
|
||||
qRound( y + m_uncroppedGeometry.height() * r.top ) + 1 );
|
||||
}
|
||||
Q_FOREACH ( VideoWidget *vw, m_videoWidgets )
|
||||
{
|
||||
const Okular::NormalizedRect r = vw->normGeometry();
|
||||
vw->move(
|
||||
qRound( x + m_uncroppedGeometry.width() * r.left ) + 1,
|
||||
qRound( y + m_uncroppedGeometry.height() * r.top ) + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
void PageViewItem::setVisible( bool visible )
|
||||
{
|
||||
setFormWidgetsVisible( visible && m_formsVisible );
|
||||
m_visible = visible;
|
||||
Q_FOREACH ( VideoWidget *vw, m_videoWidgets )
|
||||
{
|
||||
vw->setVisible( m_visible );
|
||||
}
|
||||
}
|
||||
|
||||
void PageViewItem::invalidate()
|
||||
|
|
|
@ -24,8 +24,10 @@ class QAction;
|
|||
class QLabel;
|
||||
class QTimer;
|
||||
class FormWidgetIface;
|
||||
class VideoWidget;
|
||||
|
||||
namespace Okular {
|
||||
class Movie;
|
||||
class Page;
|
||||
}
|
||||
|
||||
|
@ -46,6 +48,7 @@ class PageViewItem
|
|||
double zoomFactor() const;
|
||||
bool isVisible() const;
|
||||
QHash<int, FormWidgetIface*>& formWidgets();
|
||||
QHash< Okular::Movie *, VideoWidget * >& videoWidgets();
|
||||
|
||||
/* The page is cropped as follows: */
|
||||
const Okular::NormalizedRect & crop() const;
|
||||
|
@ -84,6 +87,7 @@ class PageViewItem
|
|||
QRect m_uncroppedGeometry;
|
||||
Okular::NormalizedRect m_crop;
|
||||
QHash<int, FormWidgetIface*> m_formWidgets;
|
||||
QHash< Okular::Movie *, VideoWidget * > m_videoWidgets;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue