okular/part/thumbnaillist.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 lines
2.7 KiB
C
Raw Normal View History

2021-05-24 07:25:56 +00:00
/*
SPDX-FileCopyrightText: 2004 Albert Astals Cid <aacid@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef _OKULAR_THUMBNAILLIST_H_
#define _OKULAR_THUMBNAILLIST_H_
2016-07-21 19:53:54 +00:00
#include <QScrollArea>
#include <QToolBar>
#include "core/observer.h"
2016-07-21 19:53:54 +00:00
class ThumbnailListPrivate;
namespace Okular
{
class Document;
}
/**
* @short A scrollview that displays page pixmap previews (aka thumbnails).
*
* ...
*/
class ThumbnailList : public QScrollArea, public Okular::DocumentObserver
{
Q_OBJECT
public:
ThumbnailList(QWidget *parent, Okular::Document *document);
~ThumbnailList() override;
// 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;
// inherited: hilihght current thumbnail ( inherited as DocumentObserver )
2017-03-02 19:39:24 +00:00
void notifyCurrentPageChanged(int previous, int current) override;
// 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;
// inherited: the visible areas of the page have changed
2017-03-02 19:39:24 +00:00
void notifyVisibleRectsChanged() override;
// inherited: tell if pixmap is hidden and can be unloaded
2017-03-02 19:39:24 +00:00
bool canUnloadPixmap(int pageNumber) const override;
// redraw visible widgets (useful for refreshing contents...)
void updateWidgets();
// show current page in Thumbnails view
void syncThumbnail();
public Q_SLOTS:
// these are connected to ThumbnailController buttons
void slotFilterBookmarks(bool filterOn);
protected:
// scroll up/down the view
void keyPressEvent(QKeyEvent *keyEvent) override;
// catch the viewport event and filter them if necessary
2017-03-02 19:39:24 +00:00
bool viewportEvent(QEvent *) override;
Q_SIGNALS:
2020-02-20 17:45:46 +00:00
void rightClick(const Okular::Page *, const QPoint);
private:
friend class ThumbnailListPrivate;
ThumbnailListPrivate *d;
};
/**
* @short A vertical boxed container with zero size hint (for insertion on left toolbox)
*/
2015-03-17 22:15:20 +00:00
class ThumbnailsBox : public QWidget
{
2016-10-29 14:32:24 +00:00
Q_OBJECT
public:
Improve the sidebar's navigation and UX Okular's sidebar vertical view chooser toolbar suffers from a few issues: * It's a nonstandard UI not used for category choosers in other pieces of KDE software, and not used in other FOSS document readers * What is shown and what is hidden is simultaneously too configurable while still not offering the desirable UI common to other programs (i.e. no visible category chooser, but a sidebar capable of displaying thumbnails, table of contents, search results, etc.) * With labels on it takes up quite a bit of horizontal space, while with labels off, the categories are less than clear * UX is kind of clunky with nonstandard behaviors (e.g. clicking on the current category to hide that category's view while keeping the view chooser visible, showing mostly disabled items) * It's made with custom painting code, which reduces maintainability and introduces bugs (e.g. https://bugs.kde.org/show_bug.cgi?id=408190) This patch removes the vertical category chooser entirely and replaces it with a tabbed view on the top of the sidebar itself. The tabs are icons-only and have large icons. A button is added on the left side of the default toolbar to quickly hide or show the sidebar. In order to make room for the new button, the Previous and Next buttons on the toolbar are removed, as previous/next buttons are already present on the Page Bar on the bottom of the window so there's no need to duplicate this functionality. This improves the UX, fixes a variety of bugs, and deletes a lot of custom code of dubious long-term maintainability. ![vokoscreenNG-2020-04-16_13-29-24](https://invent.kde.org/graphics/okular/uploads/a1f96a315b69282df51de9993b1befaf/vokoscreenNG-2020-04-16_13-29-24.webm) BUG: 213508 BUG: 334441 BUG: 344599 BUG: 408190 CCBUG: 335189 FIXED-IN: 1.11.0 CHANGELOG: The sidebar can now be easily shown or hidden with a toolbar button, and the category chooser no longer takes up so much space
2020-05-27 13:37:42 +00:00
explicit ThumbnailsBox(QWidget *parent);
QSize sizeHint() const override;
};
/**
* @short A toolbar that sets ThumbnailList properties when clicking on items
*
* This class is the small toolbar that resides in the bottom of the
* 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.
*/
class ThumbnailController : public QToolBar
{
2016-10-29 14:32:24 +00:00
Q_OBJECT
public:
ThumbnailController(QWidget *parent, ThumbnailList *thumbnailList);
};
#endif