mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 10:55:37 +00:00
Added a new experimental 'Reviews' widget to the toolbox. This shows
all the reviews on the document (pretty unuseful now, but that will change ;-). Another step to good kpdf annotations. Part: Added Reviews toolbox pane. Added (commented out while doing it right) searchline for toc; just works. Misc: Observer: added id for Reviews pane (as document observer it monitors document/annotations changes). Page: added 2 temporary accessors for annotations (will change soon). Makefile: added side_reviews.cpp to compilation. Searchwidget: slight better spacing to look consistant with the review panel. svn path=/branches/kpdf_annotations/kdegraphics/kpdf/; revision=400307
This commit is contained in:
parent
a7c62b4a98
commit
4d0a1ed6e1
|
@ -21,6 +21,7 @@
|
|||
#define THUMBNAILS_ID 4
|
||||
#define TOC_ID 5
|
||||
#define MINIBAR_ID 6
|
||||
#define REVIEWS_ID 7
|
||||
|
||||
/** PRIORITIES for requests. Globally defined here. **/
|
||||
#define PAGEVIEW_PRIO 1
|
||||
|
|
19
core/page.h
19
core/page.h
|
@ -39,15 +39,15 @@ class Annotation;
|
|||
class KPDFPage
|
||||
{
|
||||
public:
|
||||
KPDFPage( uint number, float width, float height, int rotation );
|
||||
KPDFPage( uint number, double width, double height, int rotation );
|
||||
~KPDFPage();
|
||||
|
||||
// query properties (const read-only methods)
|
||||
inline int number() const { return m_number; }
|
||||
inline int rotation() const { return m_rotation; }
|
||||
inline float width() const { return m_width; }
|
||||
inline float height() const { return m_height; }
|
||||
inline float ratio() const { return m_height / m_width; }
|
||||
inline double width() const { return m_width; }
|
||||
inline double height() const { return m_height; }
|
||||
inline double ratio() const { return m_height / m_width; }
|
||||
bool hasPixmap( int p_id, int width = -1, int height = -1 ) const;
|
||||
bool hasSearchPage() const;
|
||||
bool hasBookmark() const;
|
||||
|
@ -61,8 +61,11 @@ class KPDFPage
|
|||
const ObjectRect * getObjectRect( double x, double y ) const;
|
||||
//const Annotation * getAnnotation( double x, double y ) const;
|
||||
const KPDFPageTransition * getTransition() const;
|
||||
//FIXME TEMP:
|
||||
bool hasAnnotations() const { return !m_annotations.isEmpty(); }
|
||||
const QValueList< Annotation * > getAnnotations() const { return m_annotations; }
|
||||
|
||||
// operations: set/delete contents (by KPDFDocument)
|
||||
// operations: set contents (by KPDFDocument)
|
||||
void setPixmap( int p_id, QPixmap * pixmap );
|
||||
void setSearchPage( TextPage * text );
|
||||
void setBookmark( bool state );
|
||||
|
@ -70,6 +73,7 @@ class KPDFPage
|
|||
void setHighlight( int s_id, NormalizedRect * &r, const QColor & color );
|
||||
void addAnnotation( Annotation * annotation );
|
||||
void setTransition( KPDFPageTransition * transition );
|
||||
// operations: delete contents (by KPDFDocument)
|
||||
void deletePixmap( int p_id );
|
||||
void deletePixmapsAndRects();
|
||||
void deleteHighlights( int s_id = -1 );
|
||||
|
@ -81,8 +85,9 @@ class KPDFPage
|
|||
|
||||
private:
|
||||
friend class PagePainter;
|
||||
int m_number, m_rotation;
|
||||
float m_width, m_height;
|
||||
int m_number;
|
||||
int m_rotation;
|
||||
double m_width, m_height;
|
||||
bool m_bookmarked;
|
||||
|
||||
QMap< int, QPixmap * > m_pixmaps;
|
||||
|
|
41
part.cpp
41
part.cpp
|
@ -32,6 +32,7 @@
|
|||
#include <dcopobject.h>
|
||||
#include <dcopclient.h>
|
||||
#include <kapplication.h>
|
||||
#include <klistviewsearchline.h>
|
||||
#include <kaction.h>
|
||||
#include <kdirwatch.h>
|
||||
#include <kinstance.h>
|
||||
|
@ -55,9 +56,10 @@
|
|||
#include "xpdf/GlobalParams.h"
|
||||
#include "part.h"
|
||||
#include "ui/pageview.h"
|
||||
#include "ui/thumbnaillist.h"
|
||||
#include "ui/searchwidget.h"
|
||||
#include "ui/toc.h"
|
||||
#include "ui/searchwidget.h"
|
||||
#include "ui/thumbnaillist.h"
|
||||
#include "ui/side_reviews.h"
|
||||
#include "ui/minibar.h"
|
||||
#include "ui/propertiesdialog.h"
|
||||
#include "ui/presentationwidget.h"
|
||||
|
@ -104,14 +106,6 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
connect( m_document, SIGNAL( linkGoToPage() ), this, SLOT( slotGoToPage() ) );
|
||||
connect( m_document, SIGNAL( openURL(const KURL &) ), this, SLOT( openURL(const KURL &) ) );
|
||||
|
||||
// widgets: ^searchbar (toolbar containing label and SearchWidget)
|
||||
// m_searchToolBar = new KToolBar( parentWidget, "searchBar" );
|
||||
// m_searchToolBar->boxLayout()->setSpacing( KDialog::spacingHint() );
|
||||
// QLabel * sLabel = new QLabel( i18n( "&Search:" ), m_searchToolBar, "kde toolbar widget" );
|
||||
// m_searchWidget = new SearchWidget( m_searchToolBar, m_document );
|
||||
// sLabel->setBuddy( m_searchWidget );
|
||||
// m_searchToolBar->setStretchableWidget( m_searchWidget );
|
||||
|
||||
// widgets: [] splitter []
|
||||
m_splitter = new QSplitter( parentWidget, widgetName );
|
||||
m_splitter->setOpaqueResize( true );
|
||||
|
@ -128,13 +122,19 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
leftPanelLayout->addWidget( m_toolBox );
|
||||
|
||||
// [left toolbox: Table of Contents] | []
|
||||
TOC * tocFrame = new TOC( m_toolBox, m_document );
|
||||
connect(tocFrame, SIGNAL(hasTOC(bool)), this, SLOT(enableTOC(bool)));
|
||||
m_toolBox->addItem( tocFrame, QIconSet(SmallIcon("text_left")), i18n("Contents") );
|
||||
//QFrame * tocFrame = new QFrame( m_toolBox );
|
||||
//QVBoxLayout * tocFrameLayout = new QVBoxLayout( tocFrame );
|
||||
TOC * toc = new TOC( m_toolBox/*tocFrame*/, m_document );
|
||||
connect( toc, SIGNAL( hasTOC( bool ) ), this, SLOT( enableTOC( bool ) ) );
|
||||
//KListViewSearchLine * tocSearchLine = new KListViewSearchLine( tocFrame, toc );
|
||||
//tocFrameLayout->addWidget( tocSearchLine );
|
||||
//tocFrameLayout->addWidget( toc );
|
||||
m_toolBox->addItem( toc/*tocFrame*/, QIconSet(SmallIcon("text_left")), i18n("Contents") );
|
||||
enableTOC( false );
|
||||
|
||||
// [left toolbox: Thumbnails and Bookmarks] | []
|
||||
QVBox * thumbsBox = new ThumbnailsBox( m_toolBox );
|
||||
thumbsBox->setSpacing( 4 );
|
||||
m_searchWidget = new SearchWidget( thumbsBox, m_document );
|
||||
m_thumbnailList = new ThumbnailList( thumbsBox, m_document );
|
||||
// ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList );
|
||||
|
@ -147,10 +147,9 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
m_toolBox->addItem( thumbsBox, QIconSet(SmallIcon("thumbnail")), i18n("Thumbnails") );
|
||||
m_toolBox->setCurrentItem( thumbsBox );
|
||||
|
||||
/* // [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 );*/
|
||||
// [left toolbox: Reviews] | []
|
||||
Reviews * reviewsWidget = new Reviews( m_toolBox, m_document );
|
||||
m_toolBox->addItem( reviewsWidget, QIconSet(SmallIcon("pencil")), i18n("Reviews") );
|
||||
|
||||
// widgets: [../miniBarContainer] | []
|
||||
QWidget * miniBarContainer = new QWidget( m_leftPanel );
|
||||
|
@ -165,17 +164,23 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
|
|||
miniBarLayout->addWidget( miniBar );
|
||||
|
||||
// widgets: [] | [right 'pageView']
|
||||
// QWidget * rightContainer = new QWidget( m_splitter );
|
||||
// QVBoxLayout * rightLayout = new QVBoxLayout( rightContainer );
|
||||
// KToolBar * rtb = new KToolBar( rightContainer, "mainToolBarSS" );
|
||||
// rightLayout->addWidget( rtb );
|
||||
m_pageView = new PageView( m_splitter, m_document );
|
||||
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 &) ) );
|
||||
// rightLayout->addWidget( m_pageView );
|
||||
|
||||
// add document observers
|
||||
m_document->addObserver( this );
|
||||
m_document->addObserver( m_thumbnailList );
|
||||
m_document->addObserver( m_pageView );
|
||||
m_document->addObserver( tocFrame );
|
||||
m_document->addObserver( toc );
|
||||
m_document->addObserver( miniBar );
|
||||
m_document->addObserver( reviewsWidget );
|
||||
|
||||
// ACTIONS
|
||||
KActionCollection * ac = actionCollection();
|
||||
|
|
|
@ -8,7 +8,7 @@ noinst_LTLIBRARIES = libkpdfui.la
|
|||
libkpdfui_la_SOURCES = pagepainter.cpp pageview.cpp pageviewutils.cpp \
|
||||
pageviewannotator.cpp minibar.cpp thumbnaillist.cpp \
|
||||
searchwidget.cpp toc.cpp propertiesdialog.cpp \
|
||||
presentationwidget.cpp
|
||||
presentationwidget.cpp side_reviews.cpp
|
||||
|
||||
pageview.lo: ../conf/settings.h
|
||||
pageviewutils.lo: ../conf/settings.h
|
||||
|
|
|
@ -33,8 +33,6 @@ SearchWidget::SearchWidget( QWidget * parent, KPDFDocument * document )
|
|||
m_searchType( 0 ), m_caseSensitive( false )
|
||||
{
|
||||
// change toolbar appearance
|
||||
setMargin( 3 );
|
||||
setFlat( true );
|
||||
setIconSize( 16 );
|
||||
setMovingEnabled( false );
|
||||
|
||||
|
|
281
ui/side_reviews.cpp
Normal file
281
ui/side_reviews.cpp
Normal file
|
@ -0,0 +1,281 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> *
|
||||
* *
|
||||
* 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 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
// qt/kde includes
|
||||
#include <qheader.h>
|
||||
#include <qlayout.h>
|
||||
#include <qtimer.h>
|
||||
#include <ktoolbar.h>
|
||||
#include <klistview.h>
|
||||
#include <klistviewsearchline.h>
|
||||
#include <kaction.h>
|
||||
#include <kactionclasses.h>
|
||||
#include <klocale.h>
|
||||
#include <kapplication.h>
|
||||
#include <kiconloader.h>
|
||||
|
||||
// local includes
|
||||
#include "core/annotations.h"
|
||||
#include "core/document.h"
|
||||
#include "core/page.h"
|
||||
#include "conf/settings.h"
|
||||
#include "side_reviews.h"
|
||||
|
||||
|
||||
Reviews::Reviews( QWidget * parent, KPDFDocument * document )
|
||||
: QWidget( parent ), m_document( document ), m_delayTimer( 0 ), m_currentPage( -1 )
|
||||
{
|
||||
// create widgets and layout them vertically
|
||||
QVBoxLayout * vLayout = new QVBoxLayout( this, 0, 4 );
|
||||
m_toolBar1 = new KToolBar( this, "reviewSearchBar" );
|
||||
vLayout->addWidget( m_toolBar1 );
|
||||
m_listView = new KListView( this );
|
||||
vLayout->addWidget( m_listView );
|
||||
m_toolBar2 = new KToolBar( this, "reviewOptsBar" );
|
||||
vLayout->addWidget( m_toolBar2 );
|
||||
|
||||
// setup 1-UPPER toolbar and searchLine
|
||||
m_searchLine = new KListViewSearchLine( m_toolBar1, m_listView );
|
||||
m_toolBar1->setIconSize( 16 );
|
||||
m_toolBar1->setMovingEnabled( false );
|
||||
// - add Clear button
|
||||
QString clearIconName = KApplication::reverseLayout() ? "clear_left" : "locationbar_erase";
|
||||
m_toolBar1->insertButton( clearIconName, 1, SIGNAL( clicked() ),
|
||||
m_searchLine, SLOT( clear() ), true, i18n( "Clear Filter" ) );
|
||||
// - add Search line
|
||||
m_toolBar1->insertWidget( 2, 0, m_searchLine );
|
||||
m_toolBar1->setItemAutoSized( 2 );
|
||||
m_toolBar1->getWidget( 2 )->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored );
|
||||
|
||||
// setup 2-LOWER toolbar
|
||||
m_toolBar2->setIconSize( 16 );
|
||||
m_toolBar2->setMovingEnabled( false );
|
||||
// - add Page button
|
||||
m_toolBar2->insertButton( "txt", 1, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( slotPageEnabled( bool ) ), true, i18n( "Group by Page" ) );
|
||||
m_toolBar2->setToggle( 1 );
|
||||
m_toolBar2->setButton( 1, Settings::groupByPage() );
|
||||
// - add Author button
|
||||
m_toolBar2->insertButton( "personal", 2, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( slotAuthorEnabled( bool ) ), true, i18n( "Group by Author" ) );
|
||||
m_toolBar2->setToggle( 2 );
|
||||
m_toolBar2->setButton( 2, Settings::groupByAuthor() );
|
||||
// - add separator
|
||||
m_toolBar2->insertLineSeparator();
|
||||
// - add Current Page Only button
|
||||
m_toolBar2->insertButton( "1downarrow", 3, SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( slotCurrentPageOnly( bool ) ), true, i18n( "Show reviews for current page only" ) );
|
||||
m_toolBar2->setToggle( 3 );
|
||||
m_toolBar2->setButton( 3, Settings::currentPageOnly() );
|
||||
|
||||
// customize listview appearance
|
||||
m_listView->addColumn( i18n("Annotation") );
|
||||
m_listView->header()->hide();
|
||||
m_listView->setTreeStepSize( 16 );
|
||||
m_listView->setResizeMode( KListView::AllColumns );
|
||||
}
|
||||
|
||||
//BEGIN DocumentObserver Notifies -> requestListViewUpdate
|
||||
void Reviews::notifySetup( const QValueVector< KPDFPage * > & pages, bool documentChanged )
|
||||
{
|
||||
// grab the page array when document changes
|
||||
if ( documentChanged )
|
||||
{
|
||||
m_currentPage = -1;
|
||||
m_pages = pages;
|
||||
|
||||
// request an update to the listview
|
||||
m_listView->clear();
|
||||
requestListViewUpdate( 1000 );
|
||||
}
|
||||
}
|
||||
|
||||
void Reviews::notifyViewportChanged( bool /*smoothMove*/ )
|
||||
{
|
||||
// sync current page and update listview on change if filtering-on-page
|
||||
int page = m_document->currentPage();
|
||||
if ( page != m_currentPage )
|
||||
{
|
||||
m_currentPage = page;
|
||||
if ( Settings::currentPageOnly() )
|
||||
requestListViewUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void Reviews::notifyPageChanged( int pageNumber, int changedFlags )
|
||||
{
|
||||
// only check if there are changes to annotations
|
||||
if ( changedFlags & DocumentObserver::Annotations )
|
||||
{
|
||||
// if filtering-on-page and the page is not the active one, return
|
||||
if ( Settings::currentPageOnly() && pageNumber != m_currentPage )
|
||||
return;
|
||||
// request an update to the listview
|
||||
// TODO selective update on modified page only
|
||||
// nice trick: listview is cleared but screen not updated. zero flicker.
|
||||
m_listView->setUpdatesEnabled( false );
|
||||
m_listView->clear();
|
||||
m_listView->setUpdatesEnabled( true );
|
||||
requestListViewUpdate();
|
||||
}
|
||||
}
|
||||
//END DocumentObserver Notifies
|
||||
|
||||
//BEGIN GUI Slots -> requestListViewUpdate
|
||||
void Reviews::slotPageEnabled( bool on )
|
||||
{
|
||||
// store toggle state in Settings and update the listview
|
||||
Settings::setGroupByPage( on );
|
||||
requestListViewUpdate();
|
||||
}
|
||||
|
||||
void Reviews::slotAuthorEnabled( bool on )
|
||||
{
|
||||
// store toggle state in Settings and update the listview
|
||||
Settings::setGroupByAuthor( on );
|
||||
requestListViewUpdate();
|
||||
}
|
||||
|
||||
void Reviews::slotCurrentPageOnly( bool on )
|
||||
{
|
||||
// store toggle state in Settings and update the listview
|
||||
Settings::setCurrentPageOnly( on );
|
||||
requestListViewUpdate();
|
||||
}
|
||||
//END GUI Slots
|
||||
|
||||
|
||||
class ReviewItem : public QListViewItem
|
||||
{
|
||||
public:
|
||||
ReviewItem( QListView * parent, const QString & text )
|
||||
: QListViewItem( parent, text ) {}
|
||||
|
||||
void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align )
|
||||
{
|
||||
QColorGroup myCg = cg;
|
||||
myCg.setColor( QColorGroup::Text, Qt::red );
|
||||
QListViewItem::paintCell( p, myCg, column, width, align );
|
||||
}
|
||||
void paintFocus( QPainter *, const QColorGroup &, const QRect & )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
void Reviews::slotUpdateListView()
|
||||
{
|
||||
// reset listview to default
|
||||
m_listView->clear();
|
||||
m_listView->setRootIsDecorated( true );
|
||||
m_listView->setSelectionMode( QListView::Single );
|
||||
|
||||
if ( Settings::currentPageOnly() )
|
||||
{
|
||||
// handle the 'filter on current page'
|
||||
if ( m_currentPage >= 0 && m_currentPage < (int)m_pages.count() )
|
||||
{
|
||||
const KPDFPage * page = m_pages[ m_currentPage ];
|
||||
if ( page->hasAnnotations() )
|
||||
addContents( page );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// grab all annotations from pages
|
||||
QValueVector< KPDFPage * >::iterator it = m_pages.begin(), end = m_pages.end();
|
||||
for ( ; it != end; ++it )
|
||||
{
|
||||
const KPDFPage * page = *it;
|
||||
if ( page->hasAnnotations() )
|
||||
addContents( page );
|
||||
}
|
||||
}
|
||||
|
||||
// display an info message if no annotations present
|
||||
if ( !m_listView->firstChild() )
|
||||
{
|
||||
m_listView->setRootIsDecorated( false );
|
||||
m_listView->setSelectionMode( QListView::NoSelection );
|
||||
new ReviewItem( m_listView, i18n("<No Items>") );
|
||||
}
|
||||
}
|
||||
|
||||
void Reviews::addContents( const KPDFPage * page )
|
||||
{
|
||||
// if page-grouping -> create Page subnode
|
||||
QListViewItem * pageItem = 0;
|
||||
if ( Settings::groupByPage() )
|
||||
{
|
||||
QString pageText = i18n( "page %1" ).arg( page->number() + 1 );
|
||||
pageItem = new QListViewItem( m_listView, pageText );
|
||||
pageItem->setPixmap( 0, SmallIcon( "txt" ) );
|
||||
pageItem->setOpen( Settings::groupByAuthor() );
|
||||
}
|
||||
|
||||
// iterate over all annotations in this page
|
||||
const QValueList< Annotation * > & annots = page->getAnnotations();
|
||||
QValueList< Annotation * >::const_iterator aIt = annots.begin(), aEnd = annots.end();
|
||||
for ( ; aIt != aEnd; ++aIt )
|
||||
{
|
||||
// get annotation
|
||||
Annotation * annotation = *aIt;
|
||||
|
||||
// if page-grouping -> create Author subnode
|
||||
QListViewItem * authorItem = pageItem;
|
||||
if ( Settings::groupByAuthor() )
|
||||
{
|
||||
// get author's name
|
||||
QString author = annotation->author;
|
||||
if ( author.isEmpty() )
|
||||
author = i18n( "Unknown" );
|
||||
|
||||
// find out a previous entry by author
|
||||
authorItem = pageItem ? pageItem->firstChild() : m_listView->firstChild();
|
||||
while ( authorItem && authorItem->text(0) != author )
|
||||
authorItem = authorItem->nextSibling();
|
||||
|
||||
// if item not found, create one
|
||||
if ( !authorItem )
|
||||
{
|
||||
if ( pageItem )
|
||||
authorItem = new QListViewItem( pageItem, author );
|
||||
else
|
||||
authorItem = new QListViewItem( m_listView, author );
|
||||
QString icon = author != i18n( "Unknown" ) ? "personal" : "presence_away";
|
||||
authorItem->setPixmap( 0, SmallIcon( icon ) );
|
||||
}
|
||||
}
|
||||
|
||||
// create Annotation subnode
|
||||
QListViewItem * singleItem = authorItem ?
|
||||
new QListViewItem( authorItem, annotation->contents ) :
|
||||
new QListViewItem( m_listView, annotation->contents );
|
||||
singleItem->setPixmap( 0, SmallIcon( "kpdf" ) );
|
||||
}
|
||||
}
|
||||
|
||||
void Reviews::requestListViewUpdate( int delayms )
|
||||
{
|
||||
// only schedule an update if have any pages
|
||||
if ( m_pages.isEmpty() )
|
||||
return;
|
||||
|
||||
// create timer if not present
|
||||
if ( !m_delayTimer )
|
||||
{
|
||||
m_delayTimer = new QTimer( this );
|
||||
connect( m_delayTimer, SIGNAL( timeout() ), this, SLOT( slotUpdateListView() ) );
|
||||
}
|
||||
|
||||
// start timer if not already running
|
||||
if ( !m_delayTimer->isActive() )
|
||||
m_delayTimer->start( delayms, true );
|
||||
}
|
||||
|
||||
#include "side_reviews.moc"
|
63
ui/side_reviews.h
Normal file
63
ui/side_reviews.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> *
|
||||
* *
|
||||
* 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 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _KPDF_SIDE_REVIEWS_H_
|
||||
#define _KPDF_SIDE_REVIEWS_H_
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qvaluevector.h>
|
||||
#include "core/observer.h"
|
||||
|
||||
class KPDFDocument;
|
||||
class KPDFPage;
|
||||
class KToolBar;
|
||||
class KListView;
|
||||
class KListViewSearchLine;
|
||||
class QTimer;
|
||||
|
||||
/**
|
||||
* @short ...
|
||||
*/
|
||||
class Reviews : public QWidget, public DocumentObserver
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Reviews( QWidget * parent, KPDFDocument * document );
|
||||
|
||||
// [INHERITED] from DocumentObserver
|
||||
uint observerId() const { return REVIEWS_ID; }
|
||||
void notifySetup( const QValueVector< KPDFPage * > & pages, bool );
|
||||
void notifyViewportChanged( bool smoothMove );
|
||||
void notifyPageChanged( int pageNumber, int changedFlags );
|
||||
|
||||
public slots:
|
||||
void slotPageEnabled( bool );
|
||||
void slotAuthorEnabled( bool );
|
||||
void slotCurrentPageOnly( bool );
|
||||
void slotUpdateListView();
|
||||
|
||||
private:
|
||||
// add all annotations of a page to the listView taking care of grouping
|
||||
void addContents( const KPDFPage * page );
|
||||
// delay an update to the listView
|
||||
void requestListViewUpdate( int delayms = 200 );
|
||||
|
||||
// data fields (GUI)
|
||||
KToolBar * m_toolBar1;
|
||||
KToolBar * m_toolBar2;
|
||||
KListView * m_listView;
|
||||
KListViewSearchLine * m_searchLine;
|
||||
// internal storage
|
||||
KPDFDocument * m_document;
|
||||
QValueVector< KPDFPage * > m_pages;
|
||||
QTimer * m_delayTimer;
|
||||
int m_currentPage;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue