Commit b787abb5 authored by Sebastian Trueg's avatar Sebastian Trueg

Nobody reacted on my email to the devel mailing list, so I suspect that noone...

Nobody reacted on my email to the devel mailing list, so I suspect that noone has any objections to my patches.
Anyway, this is what happens:
* I replaced the zoom combobox in the toolbar with the fit to width/page buttons. For one they look much cleaner and
  also most users would never use the freezooming anyway.
* Removed the frame from the sidebar, making for a cleaner overall look. After all, nothing else has a frame.
* Let the statusbar stretch over the full width of the window. This again makes the app look cleaner.
* Used the same trick as in Gwenview: let the background shine through -> clean++
* Use QToolButton instead of QPushButton for the minibar buttons to fit the other buttons in all apps.

svn path=/trunk/KDE/kdegraphics/okular/; revision=887160
parent 5d94111c
......@@ -224,8 +224,14 @@ m_cliPresentation(false), m_generatorGuiClient(0), m_keeper( 0 )
GuiUtils::setIconLoader( iconLoader() );
m_sidebar = new Sidebar( parentWidget );
setWidget( m_sidebar );
QWidget* mainWidget = new QWidget( parentWidget );
QVBoxLayout* mainWidgetLayout = new QVBoxLayout( mainWidget );
mainWidgetLayout->setMargin( 0 );
mainWidgetLayout->setSpacing( 0 );
m_sidebar = new Sidebar( mainWidget );
mainWidgetLayout->addWidget( m_sidebar );
setWidget( mainWidget );
// build the document
m_document = new Okular::Document(widget());
......@@ -322,7 +328,8 @@ m_cliPresentation(false), m_generatorGuiClient(0), m_keeper( 0 )
rightLayout->addWidget( m_pageView );
m_findBar = new FindBar( m_document, rightContainer );
rightLayout->addWidget( m_findBar );
QWidget * bottomBar = new QWidget( rightContainer );
QWidget * bottomBar = new QWidget( mainWidget );
mainWidgetLayout->addWidget( bottomBar );
QHBoxLayout * bottomBarLayout = new QHBoxLayout( bottomBar );
m_pageSizeLabel = new PageSizeLabel( bottomBar, m_document );
bottomBarLayout->setMargin( 0 );
......@@ -333,7 +340,6 @@ m_cliPresentation(false), m_generatorGuiClient(0), m_keeper( 0 )
bottomBarLayout->addWidget( m_miniBar );
bottomBarLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
bottomBarLayout->addWidget( m_pageSizeLabel );
rightLayout->addWidget( bottomBar );
connect( m_reviewsWidget, SIGNAL( setAnnotationWindow( Okular::Annotation* ) ),
m_pageView, SLOT( setAnnotationWindow( Okular::Annotation* ) ) );
......@@ -898,7 +904,7 @@ bool Part::openFile()
// update viewing actions
updateViewActions();
m_fileWasRemoved = false;
if ( !ok )
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="okular_part" version="26">
<kpartgui name="okular_part" version="27">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Action name="get_new_stuff" group="file_open"/>
......@@ -87,7 +87,8 @@
<Action name="go_previous"/>
<Action name="go_next"/>
<Separator/>
<Action name="zoom_to" />
<Action name="view_fit_to_width"/>
<Action name="view_fit_to_page"/>
<Action name="view_zoom_out"/>
<Action name="view_zoom_in"/>
<Separator/>
......
......@@ -19,6 +19,7 @@
#include <qlayout.h>
#include <QStyleOptionButton>
#include <QStylePainter>
#include <QtGui/QToolButton>
#include <qvalidator.h>
#include <qpainter.h>
#include <kicon.h>
......@@ -52,24 +53,10 @@ class PagesEdit : public KLineEdit
};
// [private widget] a flat qpushbutton that enlights on hover
class HoverButton : public QPushButton
class HoverButton : public QToolButton
{
public:
HoverButton( QWidget * parent );
void setWidthScaleFactor(double widthScale)
{
m_widthScale = widthScale;
}
protected:
QSize sizeHint() const;
QSize minimumSizeHint() const;
void paintEvent( QPaintEvent * e );
private:
double m_widthScale;
};
......@@ -82,7 +69,7 @@ MiniBar::MiniBar( QWidget * parent, Okular::Document * document )
setObjectName( "miniBar" );
QHBoxLayout * horLayout = new QHBoxLayout( this );
horLayout->setMargin( 0 );
horLayout->setSpacing( 3 );
......@@ -100,14 +87,13 @@ MiniBar::MiniBar( QWidget * parent, Okular::Document * document )
horLayout->addWidget( new QLabel( i18nc( "Layouted like: '5 [pages] of 10'", "of" ), this ) );
// bottom: right button
m_pagesButton = new HoverButton( this );
m_pagesButton->setWidthScaleFactor(1.0);
horLayout->addWidget( m_pagesButton );
// bottom: right next_page button
m_nextButton = new HoverButton( this );
m_nextButton->setIcon( KIcon( layoutDirection() == Qt::RightToLeft ? "arrow-left" : "arrow-right" ) );
m_nextButton->setIconSize( buttonSize );
horLayout->addWidget( m_nextButton );
QSizePolicy sp = sizePolicy();
sp.setHorizontalPolicy( QSizePolicy::Fixed );
sp.setVerticalPolicy( QSizePolicy::Fixed );
......@@ -401,43 +387,12 @@ void PagesEdit::wheelEvent( QWheelEvent * e )
/** HoverButton **/
HoverButton::HoverButton( QWidget * parent )
: QPushButton( parent )
, m_widthScale( 1.5 )
: QToolButton( parent )
{
setMouseTracking( true );
setAttribute( Qt::WA_Hover );
KAcceleratorManager::setNoAccel( this );
setAutoRaise(true);
setFocusPolicy(Qt::NoFocus);
}
QSize HoverButton::sizeHint() const
{
QSize base = QPushButton::sizeHint();
base.setWidth( (int)(base.width() * m_widthScale) );
return base;
}
QSize HoverButton::minimumSizeHint() const
{
QSize base = QPushButton::minimumSizeHint();
base.setWidth( (int)(base.width() * m_widthScale) );
return base;
}
void HoverButton::paintEvent( QPaintEvent * e )
{
if ( testAttribute( Qt::WA_UnderMouse ) && isEnabled() )
{
QPushButton::paintEvent( e );
}
else
{
QStylePainter p( this );
QStyleOptionButton opt;
initStyleOption( &opt );
opt.features |= QStyleOptionButton::Flat;
p.drawControl( QStyle::CE_PushButton, opt );
}
setToolButtonStyle(Qt::ToolButtonIconOnly);
KAcceleratorManager::setNoAccel( this );
}
#include "minibar.moc"
......@@ -744,7 +744,7 @@ void PageView::notifySetup( const QVector< Okular::Page * > & pageSet, int setup
if ( !documentChanged )
return;
}
// delete all widgets (one for each page in pageSet)
QVector< PageViewItem * >::const_iterator dIt = d->items.constBegin(), dEnd = d->items.constEnd();
for ( ; dIt != dEnd; ++dIt )
......@@ -1643,11 +1643,11 @@ void PageView::contentsMousePressEvent( QMouseEvent * e )
// handle mode dependant mouse press actions
bool leftButton = e->button() == Qt::LeftButton,
rightButton = e->button() == Qt::RightButton;
// Not sure we should erase the selection when clicking with left.
if ( d->mouseMode != MouseTextSelect )
textSelectionClear();
switch ( d->mouseMode )
{
case MouseNormal: // drag start / click / link following
......@@ -1946,7 +1946,7 @@ void PageView::contentsMouseReleaseEvent( QMouseEvent * e )
break;
}
// if we support text generation
// if we support text generation
QString selectedText;
if (d->document->supportsSearching())
{
......
......@@ -203,6 +203,7 @@ class SidebarListWidget : public QListWidget
SidebarListWidget::SidebarListWidget( QWidget *parent )
: QListWidget( parent )
{
setFrameStyle( NoFrame );
}
SidebarListWidget::~SidebarListWidget()
......@@ -379,9 +380,7 @@ Sidebar::Sidebar( QWidget *parent )
d->list->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
d->list->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
d->list->setContextMenuPolicy( Qt::CustomContextMenu );
QPalette pal = d->list->palette();
pal.setBrush( QPalette::Base, pal.brush( QPalette::Window ) );
d->list->setPalette( pal );
d->list->viewport()->setAutoFillBackground( false );
d->splitter = new QSplitter( this );
mainlay->addWidget( d->splitter );
......
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