Commit b8b36ae5 authored by Nate Graham's avatar Nate Graham 🔩
Browse files

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
parent 1a430419
Pipeline #21395 passed with stage
in 8 minutes and 56 seconds
doc/annotations.png

72.9 KB | W: | H:

doc/annotations.png

202 KB | W: | H:

doc/annotations.png
doc/annotations.png
doc/annotations.png
doc/annotations.png
  • 2-up
  • Swipe
  • Onion skin
doc/bookmark-management.png

70.1 KB | W: | H:

doc/bookmark-management.png

163 KB | W: | H:

doc/bookmark-management.png
doc/bookmark-management.png
doc/bookmark-management.png
doc/bookmark-management.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -6,9 +6,8 @@
<!ENTITY % addindex "IGNORE">
]>
<!-- TODO
add chapter about navigation panel
Show/Hide Contens/Thumbnails/Reviews/Bookmarks bar to save screen space
Use Small Icons and deselect Show Text to minimize the navigation panel
add chapter about sidebar
Show/Hide the whole thing to save screen space
Describe all actions only possible in the navigation bars:
Switching between documents using bookmarks
Context menu actions like Rename Bookmarks etc.)
......@@ -150,7 +149,7 @@ Context menu actions like Rename Bookmarks etc.)
Once you cross the border of a page, the mouse cursor appears on top or bottom of the screen again and you can just continue to drag.
</para>
<para>
The navigation panel on the left side of the screen enables two more ways of navigating
The sidebar on the left side of the screen enables two more ways of navigating
through a document:
</para>
<itemizedlist>
......@@ -497,7 +496,7 @@ Context menu actions like Rename Bookmarks etc.)
<para>Text annotations like <guilabel>Yellow Highlighter</guilabel> and <guilabel>Black Underlining</guilabel>
for files with text like &eg; &PDF;.</para>
<para>Graphic annotations like <guilabel>Pop-up Note</guilabel>, <guilabel>Inline Note</guilabel>, <guilabel>Freehand Line</guilabel>, <guilabel>Highlighter</guilabel>, <guilabel>Straight Line</guilabel>, <guilabel>Polygon</guilabel>, <guilabel>Stamp</guilabel>, <guilabel>Underline</guilabel>, <guilabel>Ellipse</guilabel>, and <guilabel>Typewriter</guilabel> for all formats supported by &okular;.</para>
<para>Using the context menu either in the <guilabel>Reviews</guilabel> view of the navigation panel or in the main window you can open a <guilabel>Pop up Note</guilabel> for any kind of annotation and add or edit comments.</para>
<para>Using the context menu either in the <guilabel>Reviews</guilabel> view of the sidebar or in the main window you can open a <guilabel>Pop up Note</guilabel> for any kind of annotation and add or edit comments.</para>
<para>Annotations are not only limited to &PDF; files, they can be used for any format &okular; supports.</para>
<para>
&okular; has the "document archiving" feature. This is an &okular;-specific format for carrying the document plus various metadata related to it (currently only annotations). You can save a "document archive" from the open document by choosing <menuchoice><guimenu>File</guimenu><guisubmenu>Save As</guisubmenu></menuchoice> and selecting <guilabel>Okular document archive</guilabel> in the <guilabel>Filter</guilabel> selector. Documents saved this way will get <filename>.okular</filename> as their filename extension. To open an &okular; document archive, just open it with &okular; as it would be &eg; a &PDF; document.
......@@ -929,13 +928,12 @@ Context menu actions like Rename Bookmarks etc.)
&okular; has a very flexible bookmark system. &okular; saves the position on the page in bookmark and allows you to define more than one bookmark per page.
</para>
<para>
To manage bookmarks in &okular; you can use <guilabel>Bookmarks</guilabel> view from <guilabel>Navigation Panel</guilabel>, <link linkend="menubookmarks">Bookmarks menu</link> or context menu of document view (click with &RMB; to open it).
To manage bookmarks in &okular; you can use <guilabel>Bookmarks</guilabel> view from <guilabel>Sidebar</guilabel>, <link linkend="menubookmarks">Bookmarks menu</link> or context menu of document view (click with &RMB; to open it).
</para>
<sect2 id="bookmarks-view">
<title>Bookmarks view</title>
<para>
To open <guilabel>Bookmarks</guilabel> view click on <guilabel>Bookmarks</guilabel> item on the <guilabel>Navigation Panel</guilabel>. If the <guilabel>Navigation Panel</guilabel> is not shown, use <menuchoice><shortcut><keycap>F7</keycap></shortcut> <guimenu>Settings</guimenu><guimenuitem>Show Navigation Panel</guimenuitem>
</menuchoice> main menu item to make it visible.
To open <guilabel>Bookmarks</guilabel> view, click on the <guilabel>Bookmarks</guilabel> tab at the top of the <guilabel>Sidebar</guilabel>. If the <guilabel>Sidebar</guilabel> is not shown, click the <guibutton>Show Sidebar</guibutton> button on the toolbar or the menu item, or the <menuchoice><shortcut><keycap>F7</keycap></shortcut> <guimenu>Settings</guimenu><guimenuitem>Show Sidebar</guimenuitem></menuchoice> menu item to make it visible.
</para>
<screenshot>
<screeninfo>Bookmark view context menu</screeninfo>
......@@ -1897,11 +1895,11 @@ Context menu actions like Rename Bookmarks etc.)
<menuchoice>
<shortcut><keycap>F7</keycap></shortcut>
<guimenu>Settings</guimenu>
<guimenuitem>Show Navigation Panel</guimenuitem>
<guimenuitem>Show Sidebar</guimenuitem>
</menuchoice>
</term>
<listitem>
<para><action>Toggle the navigation panel</action> on and off.</para>
<para><action>Shows or hides the Sidebar.</action></para>
</listitem>
</varlistentry>
<varlistentry>
......
doc/mainwindow.png

64.9 KB | W: | H:

doc/mainwindow.png

80.6 KB | W: | H:

doc/mainwindow.png
doc/mainwindow.png
doc/mainwindow.png
doc/mainwindow.png
  • 2-up
  • Swipe
  • Onion skin
doc/signatures-panel.png

6.92 KB | W: | H:

doc/signatures-panel.png

74.6 KB | W: | H:

doc/signatures-panel.png
doc/signatures-panel.png
doc/signatures-panel.png
doc/signatures-panel.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -418,18 +418,14 @@ m_cliPresentation(false), m_cliPrint(false), m_cliPrintAndExit(false), m_embedMo
// sLabel->setBuddy( m_searchWidget );
// m_searchToolBar->setStretchableWidget( m_searchWidget );
// [left toolbox: Table of Contents] | []
// [left toolbox optional item: Table of Contents] | []
m_toc = new TOC( nullptr, m_document );
connect( m_toc.data(), &TOC::hasTOC, this, &Part::enableTOC );
connect( m_toc.data(), &TOC::rightClick, this, &Part::slotShowTOCMenu );
m_sidebar->addItem( m_toc, QIcon::fromTheme(QApplication::isLeftToRight() ? QStringLiteral("format-justify-left") : QStringLiteral("format-justify-right")), i18n("Contents") );
enableTOC( false );
// [left toolbox: Layers] | []
// [left toolbox optional item: Layers] | []
m_layers = new Layers( nullptr, m_document );
connect( m_layers.data(), &Layers::hasLayers, this, &Part::enableLayers );
m_sidebar->addItem( m_layers, QIcon::fromTheme( QStringLiteral("format-list-unordered") ), i18n( "Layers" ) );
enableLayers( false );
// [left toolbox: Thumbnails and Bookmarks] | []
QWidget * thumbsBox = new ThumbnailsBox( nullptr );
......@@ -447,18 +443,14 @@ m_cliPresentation(false), m_cliPrint(false), m_cliPrintAndExit(false), m_embedMo
// [left toolbox: Reviews] | []
m_reviewsWidget = new Reviews( nullptr, m_document );
m_sidebar->addItem( m_reviewsWidget, QIcon::fromTheme(QStringLiteral("draw-freehand")), i18n("Reviews") );
m_sidebar->setItemEnabled( m_reviewsWidget, false );
// [left toolbox: Bookmarks] | []
m_bookmarkList = new BookmarkList( m_document, nullptr );
m_sidebar->addItem( m_bookmarkList, QIcon::fromTheme(QStringLiteral("bookmarks")), i18n("Bookmarks") );
m_sidebar->setItemEnabled( m_bookmarkList, false );
// [left toolbox: Signature Panel] | []
// [left toolbox optional item: Signature Panel] | []
m_signaturePanel = new SignaturePanel( m_document, nullptr );
connect( m_signaturePanel.data(), &SignaturePanel::documentHasSignatures, this, &Part::showSidebarSignaturesItem );
m_sidebar->addItem( m_signaturePanel, QIcon::fromTheme(QStringLiteral("application-pkcs7-signature")), i18n("Signatures") );
showSidebarSignaturesItem( false );
connect( m_signaturePanel.data(), &SignaturePanel::documentHasSignatures, this, &Part::enableSidebarSignaturesItem );
// widgets: [../miniBarContainer] | []
#ifdef OKULAR_ENABLE_MINIBAR
......@@ -865,7 +857,7 @@ void Part::setupActions()
m_migrationMessage->addAction( m_saveAs );
m_showLeftPanel = ac->add<KToggleAction>(QStringLiteral("show_leftpanel"));
m_showLeftPanel->setText(i18n( "Show &Navigation Panel"));
m_showLeftPanel->setText(i18n( "Show S&idebar"));
m_showLeftPanel->setIcon(QIcon::fromTheme( QStringLiteral("view-sidetree") ));
connect( m_showLeftPanel, &QAction::toggled, this, &Part::slotShowLeftPanel );
ac->setDefaultShortcut(m_showLeftPanel, QKeySequence(Qt::Key_F7));
......@@ -1695,9 +1687,9 @@ bool Part::openFile()
setFileToWatch( localFilePath() );
// if the 'OpenTOC' flag is set, open the TOC
if ( m_document->metaData( QStringLiteral("OpenTOC") ).toBool() && m_sidebar->isItemEnabled( m_toc ) && !m_sidebar->isCollapsed() && m_sidebar->currentItem() != m_toc )
if ( m_document->metaData( QStringLiteral("OpenTOC") ).toBool() && m_tocEnabled && m_sidebar->currentItem() != m_toc )
{
m_sidebar->setCurrentItem( m_toc, Sidebar::DoNotUncollapseIfCollapsed );
m_sidebar->setCurrentItem( m_toc );
}
// if the 'StartFullScreen' flag is set and we're not in viewer widget mode, or the command line flag was
// specified, start presentation
......@@ -2043,7 +2035,6 @@ bool Part::slotAttemptReload( bool oneShot, const QUrl &newUrl )
// store the current toolbox pane
m_dirtyToolboxItem = m_sidebar->currentItem();
m_wasSidebarVisible = m_sidebar->isSidebarVisible();
m_wasSidebarCollapsed = m_sidebar->isCollapsed();
// store if presentation view was open
m_wasPresentationOpen = ((PresentationWidget*)m_presentationWidget != nullptr);
......@@ -2089,8 +2080,7 @@ bool Part::slotAttemptReload( bool oneShot, const QUrl &newUrl )
m_oldUrl = QUrl();
m_viewportDirty.pageNumber = -1;
m_document->setRotation( m_dirtyPageRotation );
if ( m_sidebar->currentItem() != m_dirtyToolboxItem && m_sidebar->isItemEnabled( m_dirtyToolboxItem )
&& !m_sidebar->isCollapsed() )
if ( m_sidebar->currentItem() != m_dirtyToolboxItem )
{
m_sidebar->setCurrentItem( m_dirtyToolboxItem );
}
......@@ -2098,10 +2088,6 @@ bool Part::slotAttemptReload( bool oneShot, const QUrl &newUrl )
{
m_sidebar->setSidebarVisibility( m_wasSidebarVisible );
}
if ( m_sidebar->isCollapsed() != m_wasSidebarCollapsed )
{
m_sidebar->setCollapsed( m_wasSidebarCollapsed );
}
if (m_wasPresentationOpen) slotShowPresentation();
emit enablePrintAction(true && m_document->printingSupport() != Okular::Document::NoPrinting);
......@@ -2236,12 +2222,18 @@ void Part::updateBookmarksActions()
void Part::enableTOC(bool enable)
{
m_sidebar->setItemEnabled(m_toc, enable);
if ( !enable ) {
m_tocEnabled = false;
return;
}
m_sidebar->addItem( m_toc, QIcon::fromTheme(QApplication::isLeftToRight() ? QStringLiteral("format-justify-left") : QStringLiteral("format-justify-right")), i18n("Contents") );
m_tocEnabled = true;
// If present, show the TOC when a document is opened
if ( enable && m_sidebar->currentItem() != m_toc )
if ( m_sidebar->currentItem() != m_toc )
{
m_sidebar->setCurrentItem( m_toc, Sidebar::DoNotUncollapseIfCollapsed );
m_sidebar->setCurrentItem( m_toc );
}
}
......@@ -2252,12 +2244,24 @@ void Part::slotRebuildBookmarkMenu()
void Part::enableLayers(bool enable)
{
m_sidebar->setItemVisible( m_layers, enable );
if ( !enable ) {
m_layersEnabled = false;
return;
}
m_sidebar->addItem( m_layers, QIcon::fromTheme( QStringLiteral("format-list-unordered") ), i18n( "Layers" ) );
m_layersEnabled = true;
}
void Part::showSidebarSignaturesItem( bool show )
void Part::enableSidebarSignaturesItem( bool enable )
{
m_sidebar->setItemVisible( m_signaturePanel, show );
if ( !enable ) {
m_signaturePanelEnabled = false;
return;
}
m_sidebar->addItem( m_signaturePanel, QIcon::fromTheme(QStringLiteral("application-pkcs7-signature")), i18n("Signatures") );
m_signaturePanelEnabled = true;
}
void Part::slotShowFindBar()
......@@ -2993,7 +2997,7 @@ void Part::slotNewConfig()
m_document->reparseConfig();
// update TOC settings
if ( m_sidebar->isItemEnabled(m_toc) )
if ( m_tocEnabled )
m_toc->reparseConfig();
// update ThumbnailList contents
......@@ -3001,8 +3005,7 @@ void Part::slotNewConfig()
m_thumbnailList->updateWidgets();
// update Reviews settings
if ( m_sidebar->isItemEnabled(m_reviewsWidget) )
m_reviewsWidget->reparseConfig();
m_reviewsWidget->reparseConfig();
setWindowTitleFromDocument ();
......@@ -3509,9 +3512,6 @@ void Part::unsetDummyMode()
if ( m_embedMode == PrintPreviewMode )
return;
m_sidebar->setItemEnabled( m_reviewsWidget, true );
m_sidebar->setItemEnabled( m_bookmarkList, true );
m_sidebar->setItemEnabled( m_signaturePanel, true );
m_sidebar->setSidebarVisibility( Okular::Settings::showLeftPanel() );
// add back and next in history
......
......@@ -237,7 +237,7 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
void enableTOC(bool enable);
void slotRebuildBookmarkMenu();
void enableLayers( bool enable );
void showSidebarSignaturesItem( bool show );
void enableSidebarSignaturesItem( bool enable );
public Q_SLOTS:
bool saveFile() override;
......@@ -316,6 +316,7 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
QPointer<ThumbnailList> m_thumbnailList;
QPointer<PageView> m_pageView;
QPointer<TOC> m_toc;
bool m_tocEnabled;
QPointer<MiniBarLogic> m_miniBarLogic;
QPointer<MiniBar> m_miniBar;
QPointer<MiniBar> m_pageNumberTool;
......@@ -326,7 +327,9 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
QPointer<Reviews> m_reviewsWidget;
QPointer<BookmarkList> m_bookmarkList;
QPointer<Layers> m_layers;
bool m_layersEnabled;
QPointer<SignaturePanel> m_signaturePanel;
bool m_signaturePanelEnabled;
// document watcher (and reloader) variables
KDirWatch *m_watcher;
......@@ -338,7 +341,6 @@ class OKULARPART_EXPORT Part : public KParts::ReadWritePart, public Okular::Docu
bool m_wasPresentationOpen;
QWidget *m_dirtyToolboxItem;
bool m_wasSidebarVisible;
bool m_wasSidebarCollapsed;
bool m_fileWasRemoved;
Rotation m_dirtyPageRotation;
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="okular_part" version="44">
<kpartgui name="okular_part" version="45">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Action name="get_new_stuff" group="file_open"/>
......@@ -95,8 +95,7 @@
</Menu>
</MenuBar>
<ToolBar name="mainToolBar"><text>Main Toolbar</text>
<Action name="go_previous"/>
<Action name="go_next"/>
<Action name="show_leftpanel"/>
<Separator/>
<Action name="zoom_to" />
<Action name="view_zoom_out"/>
......
......@@ -21,8 +21,11 @@
#include <QIcon>
#include <KLocalizedString>
#include <KTitleWidget>
#include <KTreeWidgetSearchLine>
#include <kwidgetsaddons_version.h>
#include "pageitemdelegate.h"
#include "core/action.h"
#include "core/bookmarkmanager.h"
......@@ -125,9 +128,15 @@ BookmarkList::BookmarkList( Okular::Document *document, QWidget *parent )
: QWidget( parent ), m_document( document ), m_currentDocumentItem( nullptr )
{
QVBoxLayout *mainlay = new QVBoxLayout( this );
mainlay->setContentsMargins( 0, 0, 0, 0 );
mainlay->setSpacing( 6 );
KTitleWidget *titleWidget = new KTitleWidget( this );
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 53, 0)
titleWidget->setLevel( 2 );
#endif
titleWidget->setText( i18n( "Bookmarks" ) );
mainlay->addWidget( titleWidget );
mainlay->setAlignment( titleWidget, Qt::AlignHCenter );
m_searchLine = new KTreeWidgetSearchLine( this );
mainlay->addWidget( m_searchLine );
m_searchLine->setPlaceholderText(i18n( "Search..." ));
......
......@@ -11,10 +11,14 @@
#include "settings.h"
// qt/kde includes
#include <ktitlewidget.h>
#include <klocalizedstring.h>
#include <QVBoxLayout>
#include <QTreeView>
#include <qheaderview.h>
#include <kwidgetsaddons_version.h>
// local includes
#include "core/document.h"
#include "ktreeviewsearchline.h"
......@@ -23,11 +27,17 @@
Layers::Layers(QWidget *parent, Okular::Document *document) : QWidget(parent), m_document(document)
{
QVBoxLayout * const mainlay = new QVBoxLayout( this );
mainlay->setContentsMargins( 0, 0, 0, 0 );
mainlay->setSpacing( 6 );
m_document->addObserver( this );
KTitleWidget *titleWidget = new KTitleWidget( this );
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 53, 0)
titleWidget->setLevel( 2 );
#endif
titleWidget->setText( i18n( "Layers" ) );
mainlay->addWidget( titleWidget );
mainlay->setAlignment( titleWidget, Qt::AlignHCenter );
m_searchLine = new KTreeViewSearchLine( this );
mainlay->addWidget( m_searchLine );
m_searchLine->setCaseSensitivity( Okular::Settings::self()->layersSearchCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive );
......
......@@ -23,8 +23,11 @@
#include <qaction.h>
#include <KLocalizedString>
#include <kiconloader.h>
#include <KTitleWidget>
#include <QIcon>
#include <kwidgetsaddons_version.h>
// local includes
#include "core/annotations.h"
#include "core/document.h"
......@@ -89,9 +92,14 @@ Reviews::Reviews( QWidget * parent, Okular::Document * document )
{
// create widgets and layout them vertically
QVBoxLayout * vLayout = new QVBoxLayout( this );
vLayout->setContentsMargins( 0, 0, 0, 0 );
vLayout->setSpacing( 6 );
KTitleWidget *titleWidget = new KTitleWidget( this );
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 53, 0)
titleWidget->setLevel( 2 );
#endif
titleWidget->setText( i18n("Reviews") );
m_view = new TreeView( m_document, this );
m_view->setAlternatingRowColors( true );
m_view->setSelectionMode( QAbstractItemView::ExtendedSelection );
......@@ -121,6 +129,8 @@ Reviews::Reviews( QWidget * parent, Okular::Document * document )
m_searchLine->setCaseSensitivity( Okular::Settings::self()->reviewsSearchCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive );
m_searchLine->setRegularExpression( Okular::Settings::self()->reviewsSearchRegularExpression() );
connect(m_searchLine, &KTreeViewSearchLine::searchOptionsChanged, this, &Reviews::saveSearchOptions);
vLayout->addWidget( titleWidget );
vLayout->setAlignment( titleWidget, Qt::AlignHCenter );
vLayout->addWidget( m_searchLine );
vLayout->addWidget( m_view );
vLayout->addWidget( toolBar );
......
This diff is collapsed.
......@@ -28,22 +28,12 @@ class OKULARPART_EXPORT Sidebar : public QWidget
void setMainWidget( QWidget *widget );
void setBottomWidget( QWidget *widget );
void setItemEnabled( QWidget *widget, bool enabled );
bool isItemEnabled( QWidget *widget ) const;
void setItemVisible( QWidget *widget, bool visible );
enum SetCurrentItemBehaviour { UncollapseIfCollapsed, DoNotUncollapseIfCollapsed };
void setCurrentItem( QWidget *widget, SetCurrentItemBehaviour b = UncollapseIfCollapsed );
void setCurrentItem( QWidget *widget );
QWidget *currentItem() const;
void setSidebarVisibility( bool visible );
bool isSidebarVisible() const;
void setCollapsed( bool collapsed );
bool isCollapsed() const;
void moveSplitter( int sideWidgetSize );
Q_SIGNALS:
......@@ -54,17 +44,9 @@ class OKULARPART_EXPORT Sidebar : public QWidget
void dropEvent( QDropEvent* event ) override;
private Q_SLOTS:
void itemClicked( QListWidgetItem *item );
void splitterMoved( int pos, int index );
void listContextMenu( const QPoint );
void showTextToggled( bool );
void iconSizeChanged( QAction *action );
private:
void setIndexEnabled( int index, bool enabled );
void setCurrentIndex( int index, SetCurrentItemBehaviour b = UncollapseIfCollapsed );
bool isIndexEnabled( int index ) const;
void itemClicked( QListWidgetItem *item, SetCurrentItemBehaviour b );
void saveSplitterSize() const;
// private storage
......
......@@ -15,6 +15,9 @@
#include "revisionviewer.h"
#include "signaturepropertiesdialog.h"
#include <kwidgetsaddons_version.h>
#include <KTitleWidget>
#include <KLocalizedString>
#include <QMenu>
......@@ -40,6 +43,14 @@ SignaturePanel::SignaturePanel( Okular::Document *document, QWidget *parent )
: QWidget( parent ), d_ptr( new SignaturePanelPrivate )
{
Q_D( SignaturePanel );
KTitleWidget *titleWidget = new KTitleWidget( this );
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 53, 0)
titleWidget->setLevel( 2 );
#endif
titleWidget->setText( i18n( "Signatures" ) );
d->m_view = new QTreeView( this );
d->m_view->setAlternatingRowColors( true );
d->m_view->setSelectionMode( QAbstractItemView::SingleSelection );
......@@ -54,8 +65,10 @@ SignaturePanel::SignaturePanel( Okular::Document *document, QWidget *parent )
connect( d->m_view, &QTreeView::customContextMenuRequested, this, &SignaturePanel::slotShowContextMenu );
auto vLayout = new QVBoxLayout( this );
vLayout->setContentsMargins( 0, 0, 0, 0 );
vLayout->setSpacing( 6 );
vLayout->addWidget( titleWidget );
vLayout->setAlignment( titleWidget, Qt::AlignHCenter );
vLayout->addWidget( d->m_view );
}
......
......@@ -20,9 +20,13 @@
#include <QSizePolicy>
#include <QStyle>
#include <QTimer>
#include <QVBoxLayout>
#include <KLocalizedString>
#include <KActionCollection>
#include <KTitleWidget>
#include <kwidgetsaddons_version.h>
// local includes
#include "pagepainter.h"
......@@ -36,6 +40,25 @@
class ThumbnailWidget;
ThumbnailsBox::ThumbnailsBox( QWidget * parent ) : QWidget( parent ) {
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setSpacing(0);
KTitleWidget *titleWidget = new KTitleWidget( this );
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 53, 0)
titleWidget->setLevel( 2 );
#endif
titleWidget->setText( i18n( "Thumbnails" ) );
vbox->addWidget( titleWidget );
vbox->setAlignment( titleWidget, Qt::AlignHCenter );
}
QSize ThumbnailsBox::sizeHint() const
{
return QSize();
}
class ThumbnailListPrivate : public QWidget
{
Q_OBJECT
......
......@@ -12,7 +12,6 @@
#include <QScrollArea>
#include <QToolBar>
#include <QVBoxLayout>
#include "core/observer.h"
......@@ -77,8 +76,8 @@ class ThumbnailsBox : public QWidget
Q_OBJECT
public:
explicit ThumbnailsBox( QWidget * parent ) : QWidget( parent ) { QVBoxLayout *vbox = new QVBoxLayout(this); vbox->setContentsMargins(0, 0, 0, 0); vbox->setSpacing(0);}
QSize sizeHint() const override { return QSize(); }
explicit ThumbnailsBox( QWidget * parent );
QSize sizeHint() const override;
};
/**
......
......@@ -18,6 +18,9 @@
#include <klineedit.h>
#include <KLocalizedString>
#include <KTitleWidget>
#include <kwidgetsaddons_version.h>
// local includes
#include "ktreeviewsearchline.h"
......@@ -30,9 +33,15 @@
TOC::TOC(QWidget *parent, Okular::Document *document) : QWidget(parent), m_document(document)
{
QVBoxLayout *mainlay = new QVBoxLayout( this );
mainlay->setContentsMargins( 0, 0, 0, 0 );
mainlay->setSpacing( 6 );
KTitleWidget *titleWidget = new KTitleWidget( this );
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 53, 0)
titleWidget->setLevel( 2 );
#endif
titleWidget->setText( i18n( "Contents" ) );
mainlay->addWidget( titleWidget );
mainlay->setAlignment( titleWidget, Qt::AlignHCenter );
m_searchLine = new KTreeViewSearchLine( this );
mainlay->addWidget( m_searchLine );
m_searchLine->setPlaceholderText(i18n( "Search..." ));
......
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