From cdc1b0c78dd9ccc3a66cfd550f5b35ed06b3bcba Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Mon, 26 Dec 2011 00:47:31 +0100 Subject: [PATCH] Several variables aren't 'const' in PageView::slotRelayoutPages when they probably should be REVIEW: 103486 --- ui/pageview.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/ui/pageview.cpp b/ui/pageview.cpp index e6eb771e4..b3c09824b 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -3614,7 +3614,7 @@ void PageView::slotRelayoutPages() // called by: notifySetup, viewportResizeEvent, slotViewMode, slotContinuousToggled, updateZoom { // set an empty container if we have no pages - int pageCount = d->items.count(); + const int pageCount = d->items.count(); if ( pageCount < 1 ) { return; @@ -3646,18 +3646,15 @@ void PageView::slotRelayoutPages() const bool facingPages = facing || centerFirstPage; const bool centerLastPage = centerFirstPage && pageCount % 2 == 0; const bool continuousView = Okular::Settings::viewContinuous(); - int nCols = overrideCentering ? 1 : viewColumns(); + const int nCols = overrideCentering ? 1 : viewColumns(); // set all items geometry and resize contents. handle 'continuous' and 'single' modes separately PageViewItem * currentItem = d->items[ qMax( 0, (int)d->document->currentPage() ) ]; - // handle the 'centering on first row' stuff - if ( centerFirstPage ) - pageCount += nCols - 1; // Here we find out column's width and row's height to compute a table // so we can place widgets 'centered in virtual cells'. - int nRows = (int)ceil( (float)pageCount / (float)nCols ); + const int nRows = (int)ceil( (float)(centerFirstPage ? (pageCount + nCols - 1) : pageCount) / (float)nCols ); int * colWidth = new int[ nCols ], * rowHeight = new int[ nRows ], @@ -3669,10 +3666,7 @@ void PageView::slotRelayoutPages() rowHeight[ i ] = 0; // handle the 'centering on first row' stuff if ( centerFirstPage ) - { - pageCount -= nCols - 1; cIdx += nCols - 1; - } // 1) find the maximum columns width and rows height for a grid in // which each page must well-fit inside a cell