Commit fe9ef1d7 authored by Albert Astals Cid's avatar Albert Astals Cid

Link following in presentation mode.

Cookie goes to Enrico for implementing kpdf's second most voted wish
BUGS: 98388

svn path=/trunk/KDE/kdegraphics/kpdf/; revision=436026
parent d785f136
......@@ -59,7 +59,6 @@ More items (first items will enter 'In progress list' first):
-> presentation: implement missing transitions (6/11 done)
-> 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)
-> presentation: wheel not visible on black. gradient appreciated on lighter backgrounds.
-> 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)
......@@ -73,6 +72,7 @@ More items (first items will enter 'In progress list' first):
Done (newest features come first):
-- merging from kdpf_annotations branch --
-> ADD: presentation: link following (BR98388)
-> ADD: Save zoom setting on exit
-> ADD: Put fonts used by the document on the properties dialog
-> ADD: partial implementation of XYZ links
......
......@@ -1027,6 +1027,12 @@ void KPDFDocument::processLink( const KPDFLink * link )
case KPDFLinkAction::Quit:
emit quit();
break;
case KPDFLinkAction::Presentation:
emit linkPresentation();
break;
case KPDFLinkAction::EndPresentation:
emit linkEndPresentation();
break;
case KPDFLinkAction::Find:
emit linkFind();
break;
......
......@@ -102,11 +102,13 @@ class KPDFDocument : public QObject
void requestDone( PixmapRequest * request );
signals:
void close();
void quit();
void close();
void quit();
void linkFind();
void linkGoToPage();
void openURL(const KURL &url);
void linkPresentation();
void linkEndPresentation();
private:
void sendGeneratorRequest();
......
......@@ -304,7 +304,7 @@ void PDFGenerator::generatePixmap( PixmapRequest * request )
bool genTextPage = !page->hasSearchPage() && (request->width == page->width()) &&
(request->height == page->height());
// generate links and image rects if rendering pages on pageview
bool genObjectRects = request->id == PAGEVIEW_ID;
bool genObjectRects = request->id & (PAGEVIEW_ID | PRESENTATION_ID);
// 0. LOCK [waits for the thread end]
docLock.lock();
......@@ -1080,7 +1080,7 @@ void PDFPixmapGeneratorThread::run()
( height == page->height() );
// generate links and image rects if rendering pages on pageview
bool genObjectRects = d->currentRequest->id == PAGEVIEW_ID;
bool genObjectRects = d->currentRequest->id & (PAGEVIEW_ID | PRESENTATION_ID);
// 0. LOCK s[tart locking XPDF thread unsafe classes]
d->generator->docLock.lock();
......
......@@ -88,7 +88,7 @@ class KPDFLinkAction : public KPDFLink
{
public:
// define types of actions
enum ActionType { PageFirst, PagePrev, PageNext, PageLast, HistoryBack, HistoryForward, Quit, Find, GoToPage, Close };
enum ActionType { PageFirst, PagePrev, PageNext, PageLast, HistoryBack, HistoryForward, Quit, Presentation, EndPresentation, Find, GoToPage, Close };
// query for action type
ActionType actionType() const { return m_type; }
......
......@@ -105,6 +105,8 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
m_document = new KPDFDocument();
connect( m_document, SIGNAL( linkFind() ), this, SLOT( slotFind() ) );
connect( m_document, SIGNAL( linkGoToPage() ), this, SLOT( slotGoToPage() ) );
connect( m_document, SIGNAL( linkPresentation() ), this, SLOT( slotShowPresentation() ) );
connect( m_document, SIGNAL( linkEndPresentation() ), this, SLOT( slotHidePresentation() ) );
connect( m_document, SIGNAL( openURL(const KURL &) ), this, SLOT( openURL(const KURL &) ) );
connect( m_document, SIGNAL( close() ), this, SLOT( close() ) );
......@@ -431,6 +433,7 @@ bool Part::closeURL()
m_temporaryLocalFile = QString::null;
}
slotHidePresentation();
m_find->setEnabled( false );
m_findNext->setEnabled( false );
m_saveAs->setEnabled( false );
......@@ -832,6 +835,12 @@ void Part::slotShowPresentation()
m_presentationWidget = new PresentationWidget( widget(), m_document );
}
void Part::slotHidePresentation()
{
if ( m_presentationWidget )
delete (PresentationWidget*) m_presentationWidget;
}
void Part::slotPrint()
{
if (m_document->pages() == 0) return;
......
......@@ -106,6 +106,7 @@ protected slots:
void slotShowProperties();
void slotShowLeftPanel();
void slotShowPresentation();
void slotHidePresentation();
void close();
// can be connected to widget elements
void updateViewActions();
......
This diff is collapsed.
......@@ -22,6 +22,7 @@ class QTimer;
class KPDFDocument;
class KPDFPage;
class KPDFLink;
class PresentationFrame;
/**
......@@ -49,10 +50,13 @@ class PresentationWidget : public QDialog, public DocumentObserver
void keyPressEvent( QKeyEvent * e );
void wheelEvent( QWheelEvent * e );
void mousePressEvent( QMouseEvent * e );
void mouseReleaseEvent( QMouseEvent * e );
void mouseMoveEvent( QMouseEvent * e );
void paintEvent( QPaintEvent * e );
private:
const KPDFLink * getLink( int x, int y, QRect * geometry = 0 ) const;
void testCursorOnLink( int x, int y );
void overlayClick( const QPoint & position );
void changePage( int newPage );
void generatePage();
......@@ -69,6 +73,8 @@ class PresentationWidget : public QDialog, public DocumentObserver
QPixmap m_lastRenderedPixmap;
QPixmap m_lastRenderedOverlay;
QRect m_overlayGeometry;
const KPDFLink * m_pressedLink;
bool m_handCursor;
// transition related
QTimer * m_transitionTimer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment