2004-04-15 18:36:43 +00:00
|
|
|
/***************************************************************************
|
2013-03-14 22:09:07 +00:00
|
|
|
* Copyright (C) 2004 by Albert Astals Cid <aacid@kde.org> *
|
2004-04-15 18:36:43 +00:00
|
|
|
* *
|
|
|
|
* 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. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
#ifndef _OKULAR_THUMBNAILLIST_H_
|
|
|
|
#define _OKULAR_THUMBNAILLIST_H_
|
2004-04-15 18:36:43 +00:00
|
|
|
|
2016-07-21 19:53:54 +00:00
|
|
|
#include <QScrollArea>
|
|
|
|
#include <QToolBar>
|
|
|
|
#include <QVBoxLayout>
|
2006-03-24 19:35:20 +00:00
|
|
|
|
2005-01-02 14:55:14 +00:00
|
|
|
#include "core/observer.h"
|
2016-07-21 19:53:54 +00:00
|
|
|
|
2008-01-24 11:37:00 +00:00
|
|
|
class ThumbnailListPrivate;
|
2004-09-04 22:28:14 +00:00
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
namespace Okular {
|
|
|
|
class Document;
|
|
|
|
}
|
|
|
|
|
2004-09-23 17:16:04 +00:00
|
|
|
/**
|
2008-12-01 03:52:13 +00:00
|
|
|
* @short A scrollview that displays page pixmap previews (aka thumbnails).
|
2004-09-23 17:16:04 +00:00
|
|
|
*
|
|
|
|
* ...
|
|
|
|
*/
|
2006-09-21 08:45:36 +00:00
|
|
|
class ThumbnailList : public QScrollArea, public Okular::DocumentObserver
|
2004-04-15 18:36:43 +00:00
|
|
|
{
|
2004-09-07 21:29:44 +00:00
|
|
|
Q_OBJECT
|
2006-07-15 10:23:43 +00:00
|
|
|
public:
|
2006-09-21 08:45:36 +00:00
|
|
|
ThumbnailList(QWidget *parent, Okular::Document *document);
|
2006-07-15 10:23:43 +00:00
|
|
|
~ThumbnailList();
|
2004-09-08 12:41:14 +00:00
|
|
|
|
2004-12-22 18:21:36 +00:00
|
|
|
// inherited: create thumbnails ( inherited as a DocumentObserver )
|
2017-03-02 19:39:24 +00:00
|
|
|
void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags ) override;
|
2004-12-22 18:21:36 +00:00
|
|
|
// inherited: hilihght current thumbnail ( inherited as DocumentObserver )
|
2017-03-02 19:39:24 +00:00
|
|
|
void notifyCurrentPageChanged( int previous, int current ) override;
|
2004-12-22 18:21:36 +00:00
|
|
|
// inherited: redraw thumbnail ( inherited as DocumentObserver )
|
2017-03-02 19:39:24 +00:00
|
|
|
void notifyPageChanged( int pageNumber, int changedFlags ) override;
|
2018-11-14 19:12:15 +00:00
|
|
|
// inherited: request all visible pixmap (due to a global change or so..)
|
2017-03-02 19:39:24 +00:00
|
|
|
void notifyContentsCleared( int changedFlags ) override;
|
2006-06-23 21:11:52 +00:00
|
|
|
// inherited: the visible areas of the page have changed
|
2017-03-02 19:39:24 +00:00
|
|
|
void notifyVisibleRectsChanged() override;
|
2005-01-09 23:37:07 +00:00
|
|
|
// inherited: tell if pixmap is hidden and can be unloaded
|
2017-03-02 19:39:24 +00:00
|
|
|
bool canUnloadPixmap( int pageNumber ) const override;
|
2004-11-12 10:58:33 +00:00
|
|
|
|
2004-11-07 11:20:27 +00:00
|
|
|
// redraw visible widgets (useful for refreshing contents...)
|
|
|
|
void updateWidgets();
|
|
|
|
|
2016-07-11 17:30:31 +00:00
|
|
|
public Q_SLOTS:
|
2005-01-03 15:51:05 +00:00
|
|
|
// these are connected to ThumbnailController buttons
|
|
|
|
void slotFilterBookmarks( bool filterOn );
|
|
|
|
|
2006-07-15 10:23:43 +00:00
|
|
|
protected:
|
|
|
|
// scroll up/down the view
|
2017-03-02 19:39:24 +00:00
|
|
|
void keyPressEvent( QKeyEvent * e ) override;
|
2006-07-15 10:23:43 +00:00
|
|
|
|
|
|
|
// catch the viewport event and filter them if necessary
|
2017-03-02 19:39:24 +00:00
|
|
|
bool viewportEvent( QEvent * ) override;
|
2006-07-15 10:23:43 +00:00
|
|
|
|
2016-07-11 17:30:31 +00:00
|
|
|
Q_SIGNALS:
|
2006-09-21 08:45:36 +00:00
|
|
|
void rightClick( const Okular::Page *, const QPoint & );
|
2006-07-15 10:23:43 +00:00
|
|
|
|
|
|
|
private:
|
2008-01-24 11:37:00 +00:00
|
|
|
friend class ThumbnailListPrivate;
|
|
|
|
ThumbnailListPrivate *d;
|
|
|
|
|
|
|
|
Q_PRIVATE_SLOT( d, void slotRequestVisiblePixmaps( int newContentsY = -1 ) )
|
|
|
|
Q_PRIVATE_SLOT( d, void slotDelayTimeout() )
|
2004-04-15 18:36:43 +00:00
|
|
|
};
|
|
|
|
|
2004-09-23 17:16:04 +00:00
|
|
|
/**
|
2004-09-27 21:36:25 +00:00
|
|
|
* @short A vertical boxed container with zero size hint (for insertion on left toolbox)
|
2004-09-23 17:16:04 +00:00
|
|
|
*/
|
2015-03-17 22:15:20 +00:00
|
|
|
class ThumbnailsBox : public QWidget
|
2004-09-23 17:16:04 +00:00
|
|
|
{
|
2016-10-29 14:32:24 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2006-07-15 10:23:43 +00:00
|
|
|
public:
|
2019-02-27 06:50:47 +00:00
|
|
|
explicit ThumbnailsBox( QWidget * parent ) : QWidget( parent ) { QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setContentsMargins(0, 0, 0, 0); vbox->setSpacing(0);}
|
2017-03-02 19:39:24 +00:00
|
|
|
QSize sizeHint() const override { return QSize(); }
|
2004-09-23 17:16:04 +00:00
|
|
|
};
|
|
|
|
|
2005-01-03 15:51:05 +00:00
|
|
|
/**
|
2008-12-01 03:52:13 +00:00
|
|
|
* @short A toolbar that sets ThumbnailList properties when clicking on items
|
2005-01-03 15:51:05 +00:00
|
|
|
*
|
2008-12-01 03:52:13 +00:00
|
|
|
* This class is the small toolbar that resides in the bottom of the
|
2005-01-03 15:51:05 +00:00
|
|
|
* ThumbnailsBox container (below ThumbnailList and the SearchLine) and
|
|
|
|
* emits signals whenever a button is pressed. A click action results
|
|
|
|
* in invoking some method (or slot) in ThumbnailList.
|
|
|
|
*/
|
2006-04-01 00:01:07 +00:00
|
|
|
class ThumbnailController : public QToolBar
|
2005-01-03 15:51:05 +00:00
|
|
|
{
|
2016-10-29 14:32:24 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2005-01-03 15:51:05 +00:00
|
|
|
public:
|
|
|
|
ThumbnailController( QWidget * parent, ThumbnailList * thumbnailList );
|
|
|
|
};
|
|
|
|
|
2004-04-15 18:36:43 +00:00
|
|
|
#endif
|