Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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