Commit 208b6a5c authored by Enrico Ros's avatar Enrico Ros

Added a bottom toolbar to the thumbnailsList to enable/disable thumbnails

filtering and similar options (toolbar is not created now). Changed
Document::openDocument(..) functions order. Restore last active page when
opening an already viewed pdf. Fix margins around pages in all modes.
Presentation: page change by clicking on the round 'wheel' indicator too.
Updated TODO.

svn path=/trunk/kdegraphics/kpdf/; revision=375229
parent 451134e5
......@@ -7,14 +7,15 @@ Legend:
(*) - Some parts of this item are already done
In progress:
-> Fix threaded generation. It's.. crashy..
-> Fix threaded generation. (seems more stable since 2005-Jan-03). Waiting4backtraces.
Urgent fixes and items to get ready before 3.4 (special high-priority list):
-> FIX 1/2: sync Memory Management (in Document) with the Generator (exp. undoing requests) (may Segfault!)
-> FIX 2/2: check for removing 'canUnloadPixmap' from observers in place of requesting
a list of visible pixmaps
-> FIX: priorities for requests (pageview regular over thumbnails regular over pv preloading ...)
-> FIX: linearize memory pages map iterators in respect to time
-> FIX: linearize memory pages map iterators in respect to time = FIX:iterate
from older pages to newest ones when freeing memory (not randomly)
-> ADD: preloading (very easy, but change request a little)
-> FIX: check for removing 'canUnloadPixmap' from observers in place of a requested
'visiblity list'
......@@ -28,8 +29,7 @@ More items (first items will enter 'In progress list' first):
-> usability: layout 2PPV [1 2,3 4,5 6] -> [1,2 3,4 5]. add option for 'ebook' style alignment. (by Mikolaj)
-> usability: trigger redraw on 'filter text' on current page (by Mikolaj)
-> watch out for FIXMEs in code
-> fix: requestPixmaps not triggered when exiting fullscreen mode (to verify..I can't reproduce)
-> fix: iterate from older pages to newest ones when freeing memory (not randomly)
-> fix: requestPixmaps not triggered when exiting fullscreen mode (to verify..I can't reproduce-enrico)
-> fix: On continous view mode, if you click to a link that moves you to another
page, then scroll up and click again on the same link it does not work. (by Albert)
-> display current page / total pages (with analog indicator too (progressbar/...))
......@@ -39,11 +39,14 @@ More items (first items will enter 'In progress list' first):
insert some actions that aren't so useful in the main (and bigger) toolbar
-> abstract TextPage generation (the last xpdf dependant class!). then go dancing in the
streets.
-> better boomark rendering (tested a 'clip overlay' but looks bad actually)
maybe gray out other pages?
-> Dom framework to cache document metadata. It should archive those types of data:
(NOTE: already Dom'ed object is marked with 'X')
- <X> Synopsis will go there after 1st generation (so we can edit it too)
- <X> Document info (after the 1st gen)
- <X - in progress> Bookmarked pages
- <X> Bookmarked pages
- <X - only for pagenumber> General info (like viewport state)
- Edited pages (rotated/with_data for example)
- Overlay editing (hilighting/notations/etc..)
- Presentation related overrides (FS mode, individual / global transitions)
......@@ -56,12 +59,9 @@ More items (first items will enter 'In progress list' first):
this visually explains basic usage, mouse buttons functions & more..
-> take care of TODOs in code
-> find: scroll page if the the searched string is not visible [after 'viewport changes']
-> ADD: click over image allows "save image" [60% done]
-> ADD: click over image allows "save image" [60% done (activerect of type image)]
-> screen editing (annotations): framework (BR67300,BR62793)
-> screen editing (annotations): tools (BR67300)
-> ADD: bookmark support, with clip overlays or something.. and the bookmark
widget. or maybe they should modify the thumbnail. note: bookmark property
is already in place. Saving bookmars for a document will be cool too.
-> session support: restoring page location (BR82589)
-> export all text in plain_text/html
-> extract(export?) images (have a look at ImageOutputDev.cc and pdfimages.cc from xpdf (not in our xpdf sources))
......@@ -74,22 +74,23 @@ More items (first items will enter 'In progress list' first):
-> kttsd alternative (1): autodetect "/dev/speech" (speechd/festival) and provide reading
-> automatic online dictionaries / translators (BR80338)
-> add OCR for building TextPages out of pure graphical (aka scanned) pages
-> merge head copyright headers (by albert)
-> wrong zoom buttons order (BR74248) (check consistancy with kdvi/kghostview/.. (not konq))
-> wrong zoom buttons order (BR74248) (check consistancy with kdvi/kviewshell/kghostview/.. (not konq))
-> rotate the whole document / individual pages
-> fullscreen pdf view (presentations-like) with some gfx tools
-> incremental zoom with fast-refresh (tested but flickering!) or contour tracing
-> presentation: implement transitions
-> presentation: add some gfx tools (like a red pencil)
-> presentation: save a flag (to the xml) to open a pdf in presentation mode
-> presentation: link following (difficult due to pagerects related to pageview pixmap only)
-> investigate 'Splash' lack of smoothness at low resolutions (see lines in thumbnails)
-> add search on the toc widget (a prune on type lineedit like in thumbnails widget)
-> goto 'logical' page (usually differs from pdf's page) (req. by Luca Burrelli)
-> use wallet for storing passwords of encrypted files
-> use shortcuts for next and prev page even in presenatation mode (by Tobias Koenig)
-> set a marker on the pdf file to immediately start presentation when opening it (by Tobias Koenig)
-> move some document related features from part to the document (see find, goto dialog, ...)
-> link following when in presentation mode
-> FIX: single page mode: add a little margin on pageview (top-bottom edges)
Done (newest features come first):
-> CHG: presentation: the round wheel indicator can be clicked to change page
-> FIX: layout margins on pageView
-> ADD: restore the last active page when a file is opened again
-> ADD: Save bookmarks into a file so you they get recovered when opening the same file again (Albert)
-> FIX: searchline back to work
-> CHG: DocumentInfo is now a DomTree and the properties dialog is dynamically generated (Tobias)
......
......@@ -58,7 +58,6 @@
<entry key="ShowSearchBar" type="Bool" >
<default>true</default>
</entry>
<entry key="SplitterSizes" type="IntList" />
</group>
<group name="PageView" >
<entry key="ShowScrollBars" type="Bool" >
......@@ -91,9 +90,6 @@
</entry>
</group>
<group name="Presentation" >
<entry key="SlidesGlitterTrans" type="Bool" >
<default>true</default>
</entry>
<entry key="SlidesShowProgress" type="Bool" >
<default>true</default>
</entry>
......@@ -104,6 +100,12 @@
<default>false</default>
</entry>
</group>
<group name="Internal Status" >
<entry key="SplitterSizes" type="IntList" />
<entry key="FilterBookmarks" type="Bool" >
<default>false</default>
</entry>
</group>
<group name="Debugging Options" >
<entry key="DebugDrawBoundaries" type="Bool" >
<default>false</default>
......
......@@ -119,21 +119,23 @@ bool KPDFDocument::openDocument( const QString & docFile )
connect( generator, SIGNAL( contentsChanged( int, int ) ),
this, SLOT( slotGeneratedContents( int, int ) ) );
// ask generator to open the document and return if unsuccessfull
// 1. load Document
documentFileName = docFile;
bool openOk = generator->loadDocument( docFile, pages_vector );
if ( !openOk )
return false;
// filter pages, setup observers and set the first page as current
if ( pages_vector.size() > 0 )
{
processPageList( true );
setCurrentPage( 0 );
}
if ( !openOk || pages_vector.size() <= 0 )
return openOk;
// 2. load Additional Data (our bookmarks and metadata) about the document
loadDocumentInfo();
// 3. setup observers inernal lists and data
processPageList( true );
// 4. set initial page (restoring previous page saved in xml)
int displayedPage = ( d->currentPage >= 0 ) ? d->currentPage : 0;
d->currentPage = -1;
setCurrentPage( displayedPage );
// start bookmark saver timer
d->saveBookmarksTimer->start( 5 * 60 * 1000 );
......@@ -145,7 +147,9 @@ bool KPDFDocument::openDocument( const QString & docFile )
void KPDFDocument::closeDocument()
{
saveDocumentInfo();
// save document info if a document is still opened
if ( generator && pages_vector.size() > 0 )
saveDocumentInfo();
// stop memory check timer
d->memCheckTimer->stop();
......@@ -192,13 +196,13 @@ void KPDFDocument::removeObserver( KPDFDocumentObserver * pObserver )
// remove observer from the map. it won't receive notifications anymore
if ( d->observers.contains( pObserver->observerId() ) )
{
// free observer data
// free observer's pixmap data
int observerId = pObserver->observerId();
QValueVector<KPDFPage*>::iterator it = pages_vector.begin(), end = pages_vector.end();
for ( ; it != end; ++it )
(*it)->deletePixmap( observerId );
// delete observer
// delete observer storage info
delete d->observers[ observerId ];
d->observers.remove( observerId );
}
......@@ -632,6 +636,8 @@ int KPDFDocument::mFreeMemory()
}
void KPDFDocument::loadDocumentInfo()
// note: load data and stores it internally (document or pages). observers
// are still uninitialized at this point so don't access them
{
QFile fileReadTest( documentFileName );
fileReadTest.open( IO_ReadOnly );
......@@ -644,6 +650,7 @@ void KPDFDocument::loadDocumentInfo()
QFile infoFile( localFN );
if (infoFile.exists() && infoFile.open( IO_ReadOnly ) )
{
// Load DOM from XML file
QDomDocument doc( "documentInfo" );
if ( !doc.setContent( &infoFile ) )
{
......@@ -655,26 +662,50 @@ void KPDFDocument::loadDocumentInfo()
QDomElement root = doc.documentElement();
if (root.tagName() != "documentInfo") return;
QDomNode bookMarkList = root.firstChild();
if (bookMarkList.isElement() && bookMarkList.toElement().tagName() != "bookmarkList") return;
QDomNode n = bookMarkList.firstChild();
QDomElement e;
int pageNumber;
bool ok;
while ( !n.isNull() )
// Parse the DOM tree
QDomNode topLevelNode = root.firstChild();
while ( topLevelNode.isElement() )
{
if ( n.isElement() )
{
e = n.toElement();
if (e.tagName() != "page") return;
QString catName = topLevelNode.toElement().tagName();
pageNumber = e.text().toInt(&ok);
if (ok) toggleBookmark( pageNumber );
// Get bookmarks list from DOM
if ( catName == "bookmarkList" )
{
QDomNode n = topLevelNode.firstChild();
QDomElement e;
int pageNumber;
bool ok;
while ( n.isElement() )
{
e = n.toElement();
if (e.tagName() == "page")
{
pageNumber = e.text().toInt(&ok);
if ( ok && pageNumber >= 0 && pageNumber < (int)pages_vector.count() )
pages_vector[ pageNumber ]->setAttribute( KPDFPage::Bookmark );
}
n = n.nextSibling();
}
}
n = n.nextSibling();
}
// Get 'general info' from the DOM
else if ( catName == "generalInfo" )
{
QDomNode infoNode = topLevelNode.firstChild();
while ( infoNode.isElement() )
{
QDomElement infoElement = infoNode.toElement();
if ( infoElement.tagName() == "activePage" )
{
uint page = infoElement.attribute( "number" ).toInt();
if ( page < pages_vector.size() )
d->currentPage = page;
}
infoNode = infoNode.nextSibling();
}
}
topLevelNode = topLevelNode.nextSibling();
}
}
infoFile.close();
}
......@@ -760,10 +791,12 @@ void KPDFDocument::saveDocumentInfo() const
QFile infoFile( localFN );
if (infoFile.open( IO_WriteOnly | IO_Truncate) )
{
// Create DOM
QDomDocument doc( "documentInfo" );
QDomElement root = doc.createElement( "documentInfo" );
doc.appendChild( root );
// Add bookmark list to DOM
QDomElement bookmarkList = doc.createElement( "bookmarkList" );
root.appendChild( bookmarkList );
......@@ -778,6 +811,16 @@ void KPDFDocument::saveDocumentInfo() const
}
}
// Add general info to DOM
QDomElement generalInfo = doc.createElement( "generalInfo" );
root.appendChild( generalInfo );
QDomElement activePage = doc.createElement( "activePage" );
// FIXME: use viewport (when ready)
activePage.setAttribute( "number", d->currentPage );
generalInfo.appendChild( activePage );
// Save DOM to XML file
QString xml = doc.toString();
QTextStream os( &infoFile );
os << xml;
......@@ -847,5 +890,13 @@ QString DocumentInfo::get( const QString &key ) const
return QString();
}
/** DocumentSynopsis **/
DocumentSynopsis::DocumentSynopsis()
: QDomDocument( "DocumentSynopsis" )
{
// void implementation, only subclassed for naming
}
#include "document.moc"
#include "generator.moc"
......@@ -103,6 +103,17 @@ class KPDFDocument : public QObject // only for a private slot..
void slotGeneratedContents( int id, int pageNumber );
};
/**
* @short A window on the document.
*
* TODO HACK OVER ME AND FIXME WITH A CHAINSAW
*/
struct DocumentViewport
{
int lastPage;
};
/**
* @short Metadata that describes the document.
*
......@@ -128,16 +139,6 @@ class DocumentInfo : public QDomDocument
QString get( const QString &key ) const;
};
/**
* @short A window on the document.
*
* TODO HACK OVER ME AND FIXME WITH A CHAINSAW
*/
struct DocumentViewport
{
int lastPage;
};
/**
* @short A Dom tree that describes the Table of Contents.
*
......@@ -156,8 +157,7 @@ struct DocumentViewport
class DocumentSynopsis : public QDomDocument
{
public:
// void implementation, only subclassed for naming!
DocumentSynopsis() : QDomDocument() {};
DocumentSynopsis();
};
#endif
......@@ -112,32 +112,35 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
m_toolBox->setMinimumWidth( 80 );
m_toolBox->setMaximumWidth( 300 );
// [left toolbox: Table of Contents] | []
TOC * tocFrame = new TOC( m_toolBox, m_document );
m_toolBox->addItem( tocFrame, QIconSet(SmallIcon("text_left")), i18n("Contents") );
connect(tocFrame, SIGNAL(hasTOC(bool)), this, SLOT(enableTOC(bool)));
m_toolBox->addItem( tocFrame, QIconSet(SmallIcon("text_left")), i18n("Contents") );
enableTOC( false );
// [left toolbox: Thumbnails and Bookmarks] | []
QVBox * thumbsBox = new ThumbnailsBox( m_toolBox );
m_searchWidget = new SearchWidget( thumbsBox, m_document );
m_thumbnailList = new ThumbnailList( thumbsBox, m_document );
connect( m_thumbnailList, SIGNAL( urlDropped( const KURL& ) ), SLOT( openURL( const KURL & )));
m_searchWidget = new SearchWidget( thumbsBox, m_document );
m_thumbnailList = new ThumbnailList( thumbsBox, m_document );
// ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList );
connect( m_thumbnailList, SIGNAL( urlDropped( const KURL& ) ), SLOT( openURL( const KURL & )) );
// shrink the bottom toolbar (todo: find a less hackish way)
thumbsBox->setStretchFactor( m_searchWidget, 100 );
thumbsBox->setStretchFactor( m_thumbnailList, 100 );
// thumbsBox->setStretchFactor( m_tc, 1 );
m_toolBox->addItem( thumbsBox, QIconSet(SmallIcon("thumbnail")), i18n("Thumbnails") );
m_toolBox->setCurrentItem( thumbsBox );
// commented because probably the thumbnaillist will act as the bookmark widget too
// QFrame * bookmarksFrame = new QFrame( m_toolBox );
// int iIdx = m_toolBox->addItem( bookmarksFrame, QIconSet(SmallIcon("bookmark")), i18n("Bookmarks") );
// m_toolBox->setItemEnabled( iIdx, false );
/* QFrame * editFrame = new QFrame( m_toolBox );
/* // [left toolbox: Annotations] | []
QFrame * editFrame = new QFrame( m_toolBox );
int iIdx = m_toolBox->addItem( editFrame, QIconSet(SmallIcon("pencil")), i18n("Annotations") );
m_toolBox->setItemEnabled( iIdx, false );*/
// widgets: [] | [right 'pageView']
m_pageView = new PageView( m_splitter, m_document );
m_pageView->setFocus(); //usability setting
m_pageView->setFocus(); //usability setting
connect( m_pageView, SIGNAL( urlDropped( const KURL& ) ), SLOT( openURL( const KURL & )));
connect(m_pageView, SIGNAL( rightClick(const KPDFPage *, const QPoint &) ), this, SLOT( slotShowMenu(const KPDFPage *, const QPoint &) ));
connect( m_pageView, SIGNAL( rightClick(const KPDFPage *, const QPoint &) ), this, SLOT( slotShowMenu(const KPDFPage *, const QPoint &) ) );
// add document observers
m_document->addObserver( this );
......@@ -180,8 +183,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
m_showProperties = new KAction(i18n("Properties"), "info", 0, this, SLOT(slotShowProperties()), ac, "properties");
m_showProperties->setEnabled( false );
m_showPresentation = new KAction( i18n("Presentation"), "kpresenter_kpr", 0, this, SLOT(slotShowPresentation()), ac, "presentation");
m_showPresentation->setEnabled( false );
m_showPresentation = new KAction( i18n("Presentation"), "kpresenter_kpr", 0, this, SLOT(slotShowPresentation()), ac, "presentation");
m_showPresentation->setEnabled( false );
// attach the actions of the 2 children widgets too
m_pageView->setupActions( ac );
......
......@@ -36,6 +36,7 @@ class KPrinter;
class KPDFDocument;
class ThumbnailList;
class ThumbnailController;
class PageView;
class SearchWidget;
......@@ -117,13 +118,13 @@ private:
// main widgets
QSplitter *m_splitter;
QToolBox *m_toolBox;
SearchWidget *m_searchWidget;
ThumbnailList *m_thumbnailList;
PageView *m_pageView;
SearchWidget *m_searchWidget;
// static instances counter
static unsigned int m_count;
KDirWatch *m_watcher;
QTimer *m_dirtyHandler;
......@@ -136,7 +137,7 @@ private:
KAction *m_find;
KAction *m_findNext;
KAction *m_showProperties;
KAction *m_showPresentation;
KAction *m_showPresentation;
KToggleAction* m_watchFile;
KToggleAction* m_showMenuBarAction;
KToggleAction* m_showFullScreenAction;
......
......@@ -157,8 +157,7 @@ Shell::setupActions()
m_fullScreenAction = KStdAction::fullScreen( this, SLOT( slotUpdateFullScreen() ), actionCollection(), this );
}
void
Shell::saveProperties(KConfig* config)
void Shell::saveProperties(KConfig* config)
{
// the 'config' object points to the session managed
// config file. anything you write here will be available
......@@ -166,15 +165,6 @@ Shell::saveProperties(KConfig* config)
emit saveDocumentRestoreInfo(config);
}
void Shell::slotShowMenubar()
{
if ( m_showMenuBarAction->isChecked() )
menuBar()->show();
else
menuBar()->hide();
}
void Shell::readProperties(KConfig* config)
{
// the 'config' object points to the session managed
......@@ -259,4 +249,12 @@ void Shell::slotUpdateFullScreen()
}
}
void Shell::slotShowMenubar()
{
if ( m_showMenuBarAction->isChecked() )
menuBar()->show();
else
menuBar()->hide();
}
#include "shell.moc"
......@@ -1229,10 +1229,10 @@ void PageView::slotRelayoutPages()
{
PageViewItem * item = *iIt;
// update internal page size (leaving a little margin in case of Fit* modes)
updateItemSize( item, colWidth[ cIdx ] - 10, viewportHeight - 10 );
updateItemSize( item, colWidth[ cIdx ] - 6, viewportHeight - 10 );
// find row's maximum height and column's max width
if ( item->width() > colWidth[ cIdx ] )
colWidth[ cIdx ] = item->width();
if ( item->width() + 6 > colWidth[ cIdx ] )
colWidth[ cIdx ] = item->width() + 6;
if ( item->height() > rowHeight[ rIdx ] )
rowHeight[ rIdx ] = item->height();
// update col/row indices
......@@ -1293,12 +1293,12 @@ void PageView::slotRelayoutPages()
if ( item == currentItem || (cIdx > 0 && cIdx < nCols) )
{
// update internal page size (leaving a little margin in case of Fit* modes)
updateItemSize( item, colWidth[ cIdx ] - 10, viewportHeight - 10 );
updateItemSize( item, colWidth[ cIdx ] - 4, viewportHeight - 6 );
// find row's maximum height and column's max width
if ( item->width() > colWidth[ cIdx ] )
colWidth[ cIdx ] = item->width();
if ( item->height() > fullHeight )
fullHeight = item->height();
if ( item->width() + 4 > colWidth[ cIdx ] )
colWidth[ cIdx ] = item->width() + 4;
if ( item->height() + 6 > fullHeight )
fullHeight = item->height() + 6;
cIdx++;
}
}
......
......@@ -22,6 +22,7 @@
// system includes
#include <stdlib.h>
#include <math.h>
// local includes
#include "presentationwidget.h"
......@@ -201,21 +202,33 @@ void PresentationWidget::wheelEvent( QWheelEvent * e )
void PresentationWidget::mousePressEvent( QMouseEvent * e )
{
// pressing left button
if ( e->button() == Qt::LeftButton )
slotNextPage();
{
if ( m_overlayGeometry.contains( e->pos() ) )
overlayClick( e->pos() );
else
slotNextPage();
}
// pressing right button
else if ( e->button() == Qt::RightButton )
slotPrevPage();
}
void PresentationWidget::mouseMoveEvent( QMouseEvent * e )
{
// hide a shown bar when exiting the area
if ( m_topBar->isShown() )
{
if ( e->y() > ( m_topBar->height() + 1 ) )
m_topBar->hide();
}
// show a hidden bar if mouse reaches the top of the screen
else if ( !e->y() )
m_topBar->show();
// change page if dragging the mouse over the 'wheel'
else if ( e->state() == Qt::LeftButton && m_overlayGeometry.contains( e->pos() ) )
overlayClick( e->pos() );
}
void PresentationWidget::paintEvent( QPaintEvent * pe )
......@@ -259,6 +272,45 @@ void PresentationWidget::paintEvent( QPaintEvent * pe )
// </widget events>
void PresentationWidget::overlayClick( const QPoint & position )
{
// clicking the progress indicator
int xPos = position.x() - m_overlayGeometry.x() - m_overlayGeometry.width() / 2,
yPos = m_overlayGeometry.height() / 2 - position.y();
if ( !xPos && !yPos )
return;
// compute angle relative to indicator (note coord transformation)
float angle = 0.5 + 0.5 * atan2f( -xPos, -yPos ) / M_PI;
int pageIndex = (int)roundf( angle * ( m_frames.count() - 1 ) );
// go to selected page
changePage( pageIndex );
}
void PresentationWidget::changePage( int newPage )
{
if ( m_frameIndex == newPage )
return;
// check if pixmap exists or else request it
m_frameIndex = newPage;
PresentationFrame * frame = m_frames[ m_frameIndex ];
int pixW = frame->geometry.width();
int pixH = frame->geometry.height();
// if pixmap not inside the KPDFPage we request it and wait for
// notifyPixmapChanged call or else we can proceed to pixmap generation
if ( !frame->page->hasPixmap( PRESENTATION_ID, pixW, pixH ) )
{
QValueList< PixmapRequest * > request;
request.push_back( new PixmapRequest( PRESENTATION_ID, m_frameIndex, pixW, pixH ) );
m_document->requestPixmaps( request, false );
}
else
generatePage();
}
void PresentationWidget::generatePage()
{
if ( m_lastRenderedPixmap.isNull() )
......@@ -465,7 +517,7 @@ void PresentationWidget::generateOverlay()
// start the autohide timer
repaint( m_overlayGeometry, false /*clear*/ ); // toggle with next line
//update( m_overlayGeometry );
m_overlayHideTimer->start( 1400, true );
m_overlayHideTimer->start( 2500, true );
#endif
}
......@@ -476,22 +528,7 @@ void PresentationWidget::slotNextPage()
if ( m_frameIndex < (int)m_frames.count() - 1 )
{
// go to next page
++m_frameIndex;
// check if pixmap exists or else request it
PresentationFrame * frame = m_frames[ m_frameIndex ];
int pixW = frame->geometry.width();
int pixH = frame->geometry.height();
// if pixmap not inside the KPDFPage we request it and wait for
// notifyPixmapChanged call or else we proceed to pixmap generation
if ( !frame->page->hasPixmap( PRESENTATION_ID, pixW, pixH ) )
{
QValueList< PixmapRequest * > request;
request.push_back( new PixmapRequest( PRESENTATION_ID, m_frameIndex, pixW, pixH ) );
m_document->requestPixmaps( request, false );
}
else
generatePage();
changePage( m_frameIndex + 1 );
}
else if ( m_transitionTimer->isActive() )
{
......@@ -507,22 +544,7 @@ void PresentationWidget::slotPrevPage()
if ( m_frameIndex > 0 )
{
// go to previous page
--m_frameIndex;
// check if pixmap exists or else request it
PresentationFrame * frame = m_frames[ m_frameIndex ];
int pixW = frame->geometry.width();
int pixH = frame->geometry.height();
// if pixmap not inside the KPDFPage we request it and wait for
// notifyPixmapChanged call or else we can proceed to pixmap generation
if ( !frame->page->hasPixmap( PRESENTATION_ID, pixW, pixH ) )
{
QValueList< PixmapRequest * > request;
request.push_back( new PixmapRequest( PRESENTATION_ID, m_frameIndex, pixW, pixH ) );
m_document->requestPixmaps( request, false );
}
else
generatePage();
changePage( m_frameIndex - 1 );
}
else if ( m_transitionTimer->isActive() )
{
......
......@@ -51,6 +51,8 @@ class PresentationWidget : public QWidget, public KPDFDocumentObserver
void paintEvent( QPaintEvent * e );