From 10af2d6caa03fd2d7bb4bf82a7395352c641bbdd Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Mon, 10 Jan 2005 15:58:01 +0000 Subject: [PATCH] Added option to unlink thumbnailslist from pageview (oneliner). Fixuifiles. Use palette->active->hilight color for wheel in presentation mode, since black over black was hard to recognize. Fixes. svn path=/trunk/kdegraphics/kpdf/; revision=377198 --- conf/dlggeneral.ui | 37 +++++++++++++++++++++++++++---------- conf/dlgpresentation.ui | 3 --- conf/kpdf.kcfg | 5 +++++ ui/presentationwidget.cpp | 13 ++++++++++--- ui/thumbnaillist.cpp | 15 +++++++++++---- 5 files changed, 53 insertions(+), 20 deletions(-) diff --git a/conf/dlggeneral.ui b/conf/dlggeneral.ui index ae117bfa3..9bcc63225 100644 --- a/conf/dlggeneral.ui +++ b/conf/dlggeneral.ui @@ -9,7 +9,7 @@ 0 0 320 - 143 + 169 @@ -32,7 +32,7 @@ - layout9 + layout6 @@ -48,13 +48,24 @@ - layout1 + layout5 - + unnamed - + + + kcfg_ShowSearchBar + + + false + + + Show &search bar in thumbnails list + + + spacer2 @@ -67,22 +78,22 @@ 16 - 20 + 30 - + - kcfg_ShowSearchBar + kcfg_SyncThumbnailsViewport false - Show &search bar in thumbnails list + Link &thumbnails list with the page - + @@ -173,6 +184,12 @@ kcfg_ShowSearchBar setEnabled(bool) + + kcfg_ShowLeftPanel + toggled(bool) + kcfg_SyncThumbnailsViewport + setEnabled(bool) + kdialog.h diff --git a/conf/dlgpresentation.ui b/conf/dlgpresentation.ui index 3edca6699..1811691d7 100644 --- a/conf/dlgpresentation.ui +++ b/conf/dlgpresentation.ui @@ -12,9 +12,6 @@ 261 - - DlgPresentation - unnamed diff --git a/conf/kpdf.kcfg b/conf/kpdf.kcfg index 68ee5ea54..cdbbc19a4 100644 --- a/conf/kpdf.kcfg +++ b/conf/kpdf.kcfg @@ -75,6 +75,11 @@ 8 + + + true + + Normal diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp index bcc303bd8..2a889a145 100644 --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -496,11 +496,18 @@ void PresentationWidget::generateOverlay() QImage image( doublePixmap.convertToImage().smoothScale( side, side ) ); image.setAlphaBuffer( true ); - // generate a monochrome pixmap using grey level as alpha channel - int pixels = image.width() * image.height(); + // generate a monochrome pixmap using grey level as alpha channel and + // a saturated hilight color as base color + int hue, sat, val; + palette().active().highlight().getHsv( &hue, &sat, &val ); + sat = (sat + 255) / 2; + const QColor & color = QColor( hue, sat, val, QColor::Hsv ); + int red = color.red(), green = color.green(), blue = color.blue(), + pixels = image.width() * image.height(); unsigned int * data = (unsigned int *)image.bits(); + unsigned char alpha; for( int i = 0; i < pixels; ++i ) - data[i] = qRgba( 0, 0, 0, data[i] & 0xFF ); // base color can be changed here + data[i] = qRgba( red, green, blue, data[i] & 0xFF ); m_lastRenderedOverlay.convertFromImage( image ); // start the autohide timer diff --git a/ui/thumbnaillist.cpp b/ui/thumbnaillist.cpp index 188dd97d6..213388292 100644 --- a/ui/thumbnaillist.cpp +++ b/ui/thumbnaillist.cpp @@ -134,23 +134,30 @@ void ThumbnailList::notifySetup( const QValueVector< KPDFPage * > & pages, bool void ThumbnailList::notifyViewportChanged() { + // skip notifies for the current page (already selected) + int newPage = m_document->viewport().pageNumber; + if ( m_selected && m_selected->pageNumber() == newPage ) + return; + // deselect previous thumbnail if ( m_selected ) m_selected->setSelected( false ); m_selected = 0; // select the page with viewport and ensure it's centered in the view - int pageNumber = m_document->viewport().pageNumber; m_vectorIndex = 0; QValueVector::iterator tIt = m_thumbnails.begin(), tEnd = m_thumbnails.end(); for ( ; tIt != tEnd; ++tIt ) { - if ( (*tIt)->pageNumber() == pageNumber ) + if ( (*tIt)->pageNumber() == newPage ) { m_selected = *tIt; m_selected->setSelected( true ); - ensureVisible( 0, childY( m_selected ) + m_selected->height()/2, 0, visibleHeight()/2 ); - //non-centered version: ensureVisible( 0, itemTop + itemHeight/2, 0, itemHeight/2 ); + if ( Settings::syncThumbnailsViewport() ) + { + int yOffset = QMAX( visibleHeight() / 4, m_selected->height() / 2 ); + ensureVisible( 0, childY( m_selected ) + m_selected->height()/2, 0, yOffset ); + } break; } m_vectorIndex++;