Commit 25e194b4 authored by Pino Toscano's avatar Pino Toscano

less qt3_support

svn path=/branches/work/kde4/playground/graphics/okular/; revision=524069
parent a536c798
......@@ -258,7 +258,7 @@ RegularArea<NormalizedShape, Shape>::geometry( int xScale, int yScale, int dx, i
foreach(const NormalizedShape ns, *this)
{
t=ns->geometry(xScale,yScale);
t.moveBy(dx,dy);
t.translate(dx,dy);
ret->append(t);
}
......
......@@ -415,7 +415,7 @@ void KPDFDocument::removeObserver( DocumentObserver * pObserver )
AllocatedPixmap * p = *aIt;
if ( p->id == observerId )
{
aIt = d->allocatedPixmapsFifo.remove( aIt );
aIt = d->allocatedPixmapsFifo.erase( aIt );
delete p;
}
else
......@@ -572,7 +572,7 @@ void KPDFDocument::requestPixmaps( const QLinkedList< PixmapRequest * > & reques
{
// delete request and remove it from stack
delete *sIt;
sIt = d->pixmapRequestsStack.remove( sIt );
sIt = d->pixmapRequestsStack.erase( sIt );
}
else
++sIt;
......@@ -718,7 +718,7 @@ void KPDFDocument::setViewport( const DocumentViewport & viewport, int excludeId
if ( (*aIt)->page == page )
{
viewportPixmaps.append( *aIt );
aIt = d->allocatedPixmapsFifo.remove( aIt );
aIt = d->allocatedPixmapsFifo.erase( aIt );
continue;
}
++aIt;
......@@ -927,7 +927,7 @@ bool KPDFDocument::searchText( int searchID, const QString & text, bool fromStar
{
// search and highlight every word in 'text' on all pages
bool matchAll = type == GoogleAll;
QStringList words = QStringList::split( " ", text );
QStringList words = text.split( " ", QString::SkipEmptyParts );
int wordsCount = words.count(),
hueStep = (wordsCount > 1) ? (60 / (wordsCount - 1)) : 60,
baseHue, baseSat, baseVal;
......@@ -1189,7 +1189,7 @@ void KPDFDocument::processLink( const KPDFLink * link )
case KPDFLink::Browse: {
const KPDFLinkBrowse * browse = static_cast< const KPDFLinkBrowse * >( link );
// if the url is a mailto one, invoke mailer
if ( browse->url().startsWith( "mailto:", false ) )
if ( browse->url().startsWith( "mailto:", Qt::CaseInsensitive ) )
KToolInvocation::invokeMailer( browse->url() );
else
{
......@@ -1236,7 +1236,7 @@ void KPDFDocument::requestDone( PixmapRequest * req )
if ( (*aIt)->page == req->pageNumber && (*aIt)->id == req->id )
{
AllocatedPixmap * p = *aIt;
d->allocatedPixmapsFifo.remove( aIt );
d->allocatedPixmapsFifo.erase( aIt );
d->allocatedPixmapsTotalMemory -= p->memory;
delete p;
break;
......@@ -1349,7 +1349,7 @@ void KPDFDocument::cleanupPixmapMemory( int /*sure? bytesOffset*/ )
if ( d->observers[ p->id ]->canUnloadPixmap( p->page ) )
{
// update internal variables
pIt = d->allocatedPixmapsFifo.remove( pIt );
pIt = d->allocatedPixmapsFifo.erase( pIt );
d->allocatedPixmapsTotalMemory -= p->memory;
memoryToFree -= p->memory;
pagesFreed++;
......
......@@ -266,7 +266,7 @@ void KPDFPage::deleteHighlights( int s_id )
HighlightAreaRect* highlight = *it;
if ( s_id == -1 || highlight->s_id == s_id )
{
it = m_highlights.remove( it );
it = m_highlights.erase( it );
delete highlight;
}
else
......
......@@ -617,9 +617,9 @@ void Part::slotShowLeftPanel()
KpdfSettings::setShowLeftPanel( showLeft );
KpdfSettings::writeConfig();
// show/hide left panel
m_leftPanel->setShown( showLeft );
m_leftPanel->setVisible( showLeft );
// this needs to be hidden explicitly to disable thumbnails gen
m_thumbnailList->setShown( showLeft );
m_thumbnailList->setVisible( showLeft );
}
void Part::saveSplitterSize()
......@@ -711,12 +711,15 @@ public:
QWidget *w = new QWidget(this);
setMainWidget(w);
QVBoxLayout *topLayout = new QVBoxLayout( w, 0, spacingHint() );
QVBoxLayout *topLayout = new QVBoxLayout(w);
topLayout->setMargin(0);
topLayout->setSpacing(spacingHint());
e1 = new KIntNumInput(current, w);
e1->setRange(1, max);
e1->setEditFocus(true);
QLabel *label = new QLabel( e1,i18n("&Page:"), w );
QLabel *label = new QLabel(i18n("&Page:"), w);
label->setBuddy(e1);
topLayout->addWidget(label);
topLayout->addWidget(e1);
topLayout->addSpacing(spacingHint()); // A little bit extra space
......
......@@ -79,9 +79,10 @@ class HoverButton : public QPushButton
/** MiniBar **/
MiniBar::MiniBar( QWidget * parent, KPDFDocument * document )
: QFrame( parent, "miniBar" ), m_document( document ),
: QFrame( parent ), m_document( document ),
m_currentPage( -1 )
{
setObjectName( "miniBar" );
// left spacer
QHBoxLayout * horLayout = new QHBoxLayout( this );
QSpacerItem * spacerL = new QSpacerItem( 20, 10, QSizePolicy::Expanding );
......
......@@ -244,8 +244,8 @@ class ItemsView : public KHTMLPart
QString emailString = authorString.section( '(', 1, 1 );
if ( emailString.contains( '@' ) && emailString.contains( ')' ) )
{
emailString = emailString.remove( ')' ).stripWhiteSpace();
authorString = authorString.section( '(', 0, 0 ).stripWhiteSpace();
emailString = emailString.remove( ')' ).trimmed();
authorString = authorString.section( '(', 0, 0 ).trimmed();
authorString = "<a href='mailto:" + emailString + "'>" + authorString + "</a>";
}
......@@ -416,8 +416,9 @@ struct NewStuffDialogPrivate
};
NewStuffDialog::NewStuffDialog( QWidget * parentWidget )
: QDialog( parentWidget, "kpdfNewStuff" ), d( new NewStuffDialogPrivate )
: QDialog( parentWidget ), d( new NewStuffDialogPrivate )
{
setObjectName( "kpdfNewStuff" );
// initialize the private classes
d->providersListJob.job = 0;
......@@ -432,7 +433,8 @@ NewStuffDialog::NewStuffDialog( QWidget * parentWidget )
this, SLOT( slotNetworkTimeout() ) );
// popuplate dialog with stuff
QBoxLayout * horLay = new QHBoxLayout( this, 11 );
QBoxLayout * horLay = new QHBoxLayout( this );
horLay->setMargin( 11 );
// create left picture widget (if picture found)
QPixmap p( locate( "data", "kpdf/pics/ghns.png" ) );
......
......@@ -227,7 +227,7 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p
NormalizedRect * r = (*hIt).second;
// find out the rect to highlight on pixmap
QRect highlightRect = r->geometry( scaledWidth, scaledHeight ).intersect( limits );
highlightRect.moveBy( -limits.left(), -limits.top() );
highlightRect.translate( -limits.left(), -limits.top() );
// highlight composition (product: highlight color * destcolor)
unsigned int * data = (unsigned int *)backImage.bits();
......@@ -484,7 +484,7 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p
QColor lightColor = normalColor.light( 140 );
// enlarging limits for intersection is like growing the 'rectGeometry' below
QRect limitsEnlarged = limits;
limitsEnlarged.addCoords( -2, -2, 2, 2 );
limitsEnlarged.adjust( -2, -2, 2, 2 );
// draw rects that are inside the 'limits' paint region as opaque rects
QLinkedList< ObjectRect * >::const_iterator lIt = page->m_rects.begin(), lEnd = page->m_rects.end();
for ( ; lIt != lEnd; ++lIt )
......@@ -497,11 +497,11 @@ void PagePainter::paintPageOnPainter( QPainter * destPainter, const KPDFPage * p
if ( rectGeometry.intersects( limitsEnlarged ) )
{
// expand rect and draw inner border
rectGeometry.addCoords( -1,-1,1,1 );
rectGeometry.adjust( -1,-1,1,1 );
mixedPainter->setPen( lightColor );
mixedPainter->drawRect( rectGeometry );
// expand rect to draw outer border
rectGeometry.addCoords( -1,-1,1,1 );
rectGeometry.adjust( -1,-1,1,1 );
mixedPainter->setPen( normalColor );
mixedPainter->drawRect( rectGeometry );
}
......
......@@ -496,7 +496,7 @@ void PageView::notifyPageChanged( int pageNumber, int changedFlags )
{
// update item's rectangle plus the little outline
QRect expandedRect = (*iIt)->geometry();
expandedRect.addCoords( -1, -1, 3, 3 );
expandedRect.adjust( -1, -1, 3, 3 );
updateContents( expandedRect );
// if we were "zoom-dragging" do not overwrite the "zoom-drag" cursor
......@@ -537,7 +537,7 @@ if ( d->document->handleEvent( pe ) )
// create the rect into contents from the clipped screen rect
QRect viewportRect = viewport()->rect();
QRect contentsRect = pe->rect().intersect( viewportRect );
contentsRect.moveBy( contentsX(), contentsY() );
contentsRect.translate( contentsX(), contentsY() );
if ( !contentsRect.isValid() )
return;
......@@ -549,10 +549,10 @@ if ( d->document->handleEvent( pe ) )
// selectionRect is the normalized mouse selection rect
QRect selectionRect = d->mouseSelectionRect;
if ( !selectionRect.isNull() )
selectionRect = selectionRect.normalize();
selectionRect = selectionRect.normalized();
// selectionRectInternal without the border
QRect selectionRectInternal = selectionRect;
selectionRectInternal.addCoords( 1, 1, -1, -1 );
selectionRectInternal.adjust( 1, 1, -1, -1 );
// color for blending
QColor selBlendColor = (selectionRect.width() > 8 || selectionRect.height() > 8) ?
d->mouseSelectionColor : Qt::red;
......@@ -579,8 +579,8 @@ if ( d->document->handleEvent( pe ) )
if ( useSubdivision )
{
// set 'contentsRect' to a part of the sub-divided region
contentsRect = allRects[i].normalize().intersect( viewportRect );
contentsRect.moveBy( contentsX(), contentsY() );
contentsRect = allRects[i].normalized().intersect( viewportRect );
contentsRect.translate( contentsX(), contentsY() );
if ( !contentsRect.isValid() )
continue;
}
......@@ -1233,7 +1233,7 @@ if (d->document->handleEvent( e ) )
// if a selection rect has been defined, zoom into it
if ( leftButton && d->mouseSelecting )
{
QRect selRect = d->mouseSelectionRect.normalize();
QRect selRect = d->mouseSelectionRect.normalized();
if ( selRect.width() <= 8 && selRect.height() <= 8 )
{
selectionClear();
......@@ -1241,7 +1241,7 @@ if (d->document->handleEvent( e ) )
}
// find out new zoom ratio and normalized view center (relative to the contentsRect)
double zoom = QMIN( (double)visibleWidth() / (double)selRect.width(), (double)visibleHeight() / (double)selRect.height() );
double zoom = qMin( (double)visibleWidth() / (double)selRect.width(), (double)visibleHeight() / (double)selRect.height() );
double nX = (double)(selRect.left() + selRect.right()) / (2.0 * (double)contentsWidth());
double nY = (double)(selRect.top() + selRect.bottom()) / (2.0 * (double)contentsHeight());
......@@ -1277,7 +1277,7 @@ if (d->document->handleEvent( e ) )
!d->mouseSelecting )
break;
QRect selectionRect = d->mouseSelectionRect.normalize();
QRect selectionRect = d->mouseSelectionRect.normalized();
if ( selectionRect.width() <= 8 && selectionRect.height() <= 8 )
{
selectionClear();
......@@ -1311,7 +1311,7 @@ if (d->document->handleEvent( e ) )
d->document->requestTextPage( kpdfPage->number() );
// grab text in the rect that intersects itemRect
QRect relativeRect = selectionRect.intersect( itemRect );
relativeRect.moveBy( -itemRect.left(), -itemRect.top() );
relativeRect.translate( -itemRect.left(), -itemRect.top() );
rects->append(new NormalizedRect( relativeRect, item->width(), item->height() ));
}
}
......@@ -1520,7 +1520,7 @@ void PageView::drawDocumentOnPainter( const QRect & contentsRect, QPainter * p )
// growing PageViewItems rects (for keeping outline into account), we
// grow the contentsRect
QRect checkRect = contentsRect;
checkRect.addCoords( -3, -3, 1, 1 );
checkRect.adjust( -3, -3, 1, 1 );
// create a region from wich we'll subtract painted rects
QRegion remainingArea( contentsRect );
......@@ -1537,7 +1537,7 @@ void PageView::drawDocumentOnPainter( const QRect & contentsRect, QPainter * p )
PageViewItem * item = *iIt;
QRect itemGeometry = item->geometry(),
outlineGeometry = itemGeometry;
outlineGeometry.addCoords( -1, -1, 3, 3 );
outlineGeometry.adjust( -1, -1, 3, 3 );
// move the painter to the top-left corner of the page
p->save();
......@@ -1571,7 +1571,7 @@ void PageView::drawDocumentOnPainter( const QRect & contentsRect, QPainter * p )
if ( contentsRect.intersects( itemGeometry ) )
{
QRect pixmapRect = contentsRect.intersect( itemGeometry );
pixmapRect.moveBy( -itemGeometry.left(), -itemGeometry.top() );
pixmapRect.translate( -itemGeometry.left(), -itemGeometry.top() );
int flags = PagePainter::Accessibility | PagePainter::EnhanceLinks |
PagePainter::EnhanceImages | PagePainter::Highlights |
PagePainter::Annotations;
......@@ -1711,16 +1711,16 @@ void PageView::selectionEndPoint( int x, int y )
if ( d->mouseSelectionRect.right() != x || d->mouseSelectionRect.bottom() != y )
{
// send incremental paint events
QRect oldRect = d->mouseSelectionRect.normalize();
QRect oldRect = d->mouseSelectionRect.normalized();
d->mouseSelectionRect.setRight( x );
d->mouseSelectionRect.setBottom( y );
QRect newRect = d->mouseSelectionRect.normalize();
QRect newRect = d->mouseSelectionRect.normalized();
// generate diff region: [ OLD.unite(NEW) - OLD.intersect(NEW) ]
QRegion compoundRegion = QRegion( oldRect ).unite( newRect );
if ( oldRect.intersects( newRect ) )
{
QRect intersection = oldRect.intersect( newRect );
intersection.addCoords( 1, 1, -1, -1 );
intersection.adjust( 1, 1, -1, -1 );
if ( intersection.width() > 20 && intersection.height() > 20 )
compoundRegion -= intersection;
}
......@@ -1733,7 +1733,7 @@ void PageView::selectionEndPoint( int x, int y )
void PageView::selectionClear()
{
QRect updatedRect = d->mouseSelectionRect.normalize();
QRect updatedRect = d->mouseSelectionRect.normalized();
d->mouseSelecting = false;
d->mouseSelectionRect.setCoords( 0, 0, -1, -1 );
updateContents( updatedRect );
......
......@@ -503,7 +503,7 @@ if ( !item ) return; //STRAPAAAATCH !!! FIXME
// 3.1. unite old and new painting regions
QRegion compoundRegion( m_lastDrawnRect );
m_lastDrawnRect = paintRect;
m_lastDrawnRect.moveBy( itemRect.left(), itemRect.top() );
m_lastDrawnRect.translate( itemRect.left(), itemRect.top() );
// 3.2. decompose paint region in rects and send paint events
QVector<QRect> rects = compoundRegion.unite( m_lastDrawnRect ).rects();
for ( int i = 0; i < rects.count(); i++ )
......@@ -543,7 +543,7 @@ void PageViewAnnotator::routePaint( QPainter * painter, const QRect & paintRect
// transform cliprect from absolute to item relative coords
QRect annotRect = paintRect.intersect( m_lastDrawnRect );
annotRect.moveBy( itemGeometry.left(), itemGeometry.top() );
annotRect.translate( itemGeometry.left(), itemGeometry.top() );
// use current engine for painting
m_engine->paint( painter, m_lockedItem->width(), m_lockedItem->height(), annotRect );
......
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