Skip to content

Commit

Permalink
automatic indentation update (r9220-r9281)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@9282 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Sep 8, 2008
1 parent 911038b commit 17d69a1
Show file tree
Hide file tree
Showing 36 changed files with 509 additions and 504 deletions.
46 changes: 23 additions & 23 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -888,7 +888,7 @@ void QgsComposer::on_mActionExportAsImage_activated( void )
//find out the last used filter
QSettings myQSettings; // where we keep last used filter in persistant state
QString myLastUsedFormat = myQSettings.value( "/UI/lastSaveAsImageFormat", "png" ).toString();
QString myLastUsedFile = myQSettings.value( "/UI/lastSaveAsImageFile", "qgis.png").toString();
QString myLastUsedFile = myQSettings.value( "/UI/lastSaveAsImageFile", "qgis.png" ).toString();
QFileInfo file( myLastUsedFile );

// get a list of supported output image types
Expand Down Expand Up @@ -944,9 +944,9 @@ void QgsComposer::on_mActionExportAsImage_activated( void )
//raise();

if ( result != QDialog::Accepted )
{
return;
}
{
return;
}

myOutputFileNameQString = myQFileDialog->selectedFiles().first();
QString myFilterString = myQFileDialog->selectedFilter();
Expand All @@ -959,21 +959,21 @@ void QgsComposer::on_mActionExportAsImage_activated( void )
if ( myOutputFileNameQString == "" ) return;

mComposition->setPlotStyle( QgsComposition::Print );
mView->setScene(0);
mView->setScene( 0 );

QImage image( QSize(width, height), QImage::Format_ARGB32 );
image.setDotsPerMeterX(mComposition->printoutResolution() / 25.4 * 1000);
image.setDotsPerMeterY(mComposition->printoutResolution() / 25.4 * 1000);
image.fill(0);
QImage image( QSize( width, height ), QImage::Format_ARGB32 );
image.setDotsPerMeterX( mComposition->printoutResolution() / 25.4 * 1000 );
image.setDotsPerMeterY( mComposition->printoutResolution() / 25.4 * 1000 );
image.fill( 0 );
QPainter p( &image );
QRectF sourceArea( 0, 0, mComposition->paperWidth(), mComposition->paperHeight());
QRectF targetArea(0, 0, width, height);
mComposition->render( &p, targetArea, sourceArea);
QRectF sourceArea( 0, 0, mComposition->paperWidth(), mComposition->paperHeight() );
QRectF targetArea( 0, 0, width, height );
mComposition->render( &p, targetArea, sourceArea );
p.end();

mComposition->setPlotStyle( QgsComposition::Preview );
image.save( myOutputFileNameQString, myFilterMap[myFilterString].toLocal8Bit().data() );
mView->setScene(mComposition);
mView->setScene( mComposition );
}


Expand Down Expand Up @@ -1420,8 +1420,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newLabel );
mComposition->update();
mComposition->clearSelection();
newLabel->setSelected(true);
showItemOptions(newLabel);
newLabel->setSelected( true );
showItemOptions( newLabel );
}

//composer maps
Expand All @@ -1435,8 +1435,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newMap );
mComposition->update();
mComposition->clearSelection();
newMap->setSelected(true);
showItemOptions(newMap);
newMap->setSelected( true );
showItemOptions( newMap );
}

//composer scalebars
Expand All @@ -1450,8 +1450,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newScaleBar );
mComposition->update();
mComposition->clearSelection();
newScaleBar->setSelected(true);
showItemOptions(newScaleBar);
newScaleBar->setSelected( true );
showItemOptions( newScaleBar );
}

//composer legends
Expand All @@ -1465,8 +1465,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newLegend );
mComposition->update();
mComposition->clearSelection();
newLegend->setSelected(true);
showItemOptions(newLegend);
newLegend->setSelected( true );
showItemOptions( newLegend );
}

//composer pictures
Expand All @@ -1480,8 +1480,8 @@ void QgsComposer::readXML( const QDomDocument& doc )
mComposition->addItem( newPicture );
mComposition->update();
mComposition->clearSelection();
newPicture->setSelected(true);
showItemOptions(newPicture);
newPicture->setSelected( true );
showItemOptions( newPicture );
}

mComposition->sortZList();
Expand Down
8 changes: 4 additions & 4 deletions src/app/composer/qgscomposerlegendwidget.cpp
Expand Up @@ -363,10 +363,10 @@ void QgsComposerLegendWidget::on_mUpdatePushButton_clicked()
return;
}

if(mLegend->model())
{
mLegend->model()->updateItem(currentItem);
}
if ( mLegend->model() )
{
mLegend->model()->updateItem( currentItem );
}
mLegend->update();
mLegend->adjustBoxSize();
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/composer/qgscompositionwidget.cpp
Expand Up @@ -25,8 +25,8 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
createPaperEntries();

//unit (only mm at the moment, therefore disabled)
mPaperUnitsComboBox->addItem("mm");
mPaperUnitsComboBox->setEnabled(false);
mPaperUnitsComboBox->addItem( "mm" );
mPaperUnitsComboBox->setEnabled( false );

//orientation
mPaperOrientationComboBox->blockSignals( true );
Expand Down
26 changes: 13 additions & 13 deletions src/app/qgsattributedialog.cpp
Expand Up @@ -253,15 +253,15 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
{
QLineEdit *le = new QLineEdit( myFieldValue.toString() );

QPushButton *pb = new QPushButton( tr("...") );
connect(pb, SIGNAL(clicked()), this, SLOT(selectFileName()));
QPushButton *pb = new QPushButton( tr( "..." ) );
connect( pb, SIGNAL( clicked() ), this, SLOT( selectFileName() ) );

QHBoxLayout *hbl = new QHBoxLayout();
hbl->addWidget(le);
hbl->addWidget(pb);
hbl->addWidget( le );
hbl->addWidget( pb );

myWidget = new QWidget;
myWidget->setLayout(hbl);
myWidget->setLayout( hbl );
}
break;
}
Expand Down Expand Up @@ -296,22 +296,22 @@ QgsAttributeDialog::~QgsAttributeDialog()
void QgsAttributeDialog::selectFileName()
{
QPushButton *pb = dynamic_cast<QPushButton *>( sender() );
if(!pb)
if ( !pb )
return;

QWidget *hbox = dynamic_cast<QWidget *>( pb->parent() );
if(!hbox)
if ( !hbox )
return;

QLineEdit *le = hbox->findChild<QLineEdit *>();
if(!le)
if ( !le )
return;

QString fileName = QFileDialog::getOpenFileName(0 , tr("Select a file"));
if(fileName.isNull())
QString fileName = QFileDialog::getOpenFileName( 0 , tr( "Select a file" ) );
if ( fileName.isNull() )
return;

le->setText(fileName);
le->setText( fileName );
}

void QgsAttributeDialog::accept()
Expand Down Expand Up @@ -368,8 +368,8 @@ void QgsAttributeDialog::accept()
myFieldValue = QString::number( dsb->value() );
}

le = mpWidgets.value( myIndex )->findChild<QLineEdit *>("lineEdit");
if(le)
le = mpWidgets.value( myIndex )->findChild<QLineEdit *>( "lineEdit" );
if ( le )
{
myFieldValue = le->text();
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsattributetable.cpp
Expand Up @@ -103,7 +103,7 @@ QgsAttributeTable::~QgsAttributeTable()

void QgsAttributeTable::setReadOnly( bool b )
{
blockSignals(true);
blockSignals( true );

setEditTriggers( b ? QAbstractItemView::NoEditTriggers :
QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed );
Expand All @@ -112,7 +112,7 @@ void QgsAttributeTable::setReadOnly( bool b )
setColumnReadOnly( 0, true );
}

blockSignals(false);
blockSignals( false );
}

void QgsAttributeTable::setColumnReadOnly( int col, bool ro )
Expand Down Expand Up @@ -439,7 +439,7 @@ void QgsAttributeTable::copySelectedRows()

void QgsAttributeTable::fillTable( QgsVectorLayer *layer )
{
blockSignals(true);
blockSignals( true );

const QgsFieldMap &fields = layer->pendingFields();

Expand Down Expand Up @@ -489,7 +489,7 @@ void QgsAttributeTable::fillTable( QgsVectorLayer *layer )
for ( int i = 0; i < columnCount(); i++ )
resizeColumnToContents( i );

blockSignals(false);
blockSignals( false );
}

void QgsAttributeTable::putFeatureInTable( int row, const QgsFeature& fet )
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgscustomprojectiondialog.cpp
Expand Up @@ -855,7 +855,7 @@ void QgsCustomProjectionDialog::on_pbnSave_clicked()

sqlite3_finalize( myPreparedStatement );
sqlite3_close( myDatabase );
pbnDelete->setEnabled( true );
pbnDelete->setEnabled( true );
}

void QgsCustomProjectionDialog::on_pbnCalculate_clicked()
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgspluginregistry.cpp
Expand Up @@ -89,9 +89,9 @@ void QgsPluginRegistry::removePlugin( QString name )

void QgsPluginRegistry::unloadAll()
{
for(std::map<QString, QgsPluginMetadata*>::iterator it=plugins.begin();
it!=plugins.end();
it++)
if( it->second->plugin() )
for ( std::map<QString, QgsPluginMetadata*>::iterator it = plugins.begin();
it != plugins.end();
it++ )
if ( it->second->plugin() )
it->second->plugin()->unload();
}
4 changes: 2 additions & 2 deletions src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -822,7 +822,7 @@ void QgsRasterLayerProperties::sync()
pixmapLegend->repaint();

//set the palette pixmap
pixmapPalette->setPixmap( mRasterLayer->getPaletteAsPixmap(mRasterLayer->getRasterBandNumber(mRasterLayer->getGrayBandName())));
pixmapPalette->setPixmap( mRasterLayer->getPaletteAsPixmap( mRasterLayer->getRasterBandNumber( mRasterLayer->getGrayBandName() ) ) );
pixmapPalette->setScaledContents( true );
pixmapPalette->repaint();

Expand Down Expand Up @@ -1988,7 +1988,7 @@ void QgsRasterLayerProperties::on_pbnHistRefresh_clicked()

QgsDebugMsg( QString( "myMiddle = %1" ).arg( myMiddle ) );

if ( myRasterShaderFunction->generateShadedValue(myMiddle, &c1, &c2, &c3))
if ( myRasterShaderFunction->generateShadedValue( myMiddle, &c1, &c2, &c3 ) )
{
QgsDebugMsg( "Color not found" );
c1 = c2 = c3 = 180; // grey
Expand Down
56 changes: 28 additions & 28 deletions src/core/composer/qgscomposeritem.cpp
Expand Up @@ -525,58 +525,58 @@ void QgsComposerItem::hoverMoveEvent( QGraphicsSceneHoverEvent * event )
}
}

void QgsComposerItem::drawText(QPainter* p, int x, int y, const QString& text, const QFont& font) const
void QgsComposerItem::drawText( QPainter* p, int x, int y, const QString& text, const QFont& font ) const
{
QFont textFont = scaledFontPixelSize(font);
QFont textFont = scaledFontPixelSize( font );

p->save();
p->setFont(textFont);
p->setPen(QColor(0, 0, 0)); //draw text always in black
p->setFont( textFont );
p->setPen( QColor( 0, 0, 0 ) ); //draw text always in black
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale(scaleFactor, scaleFactor);
p->drawText(x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE, text);
p->scale( scaleFactor, scaleFactor );
p->drawText( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE, text );
p->restore();
}

void QgsComposerItem::drawText(QPainter* p, const QRectF& rect, const QString& text, const QFont& font) const
void QgsComposerItem::drawText( QPainter* p, const QRectF& rect, const QString& text, const QFont& font ) const
{
QFont textFont = scaledFontPixelSize(font);
QFont textFont = scaledFontPixelSize( font );

QRectF scaledRect(rect.x() * FONT_WORKAROUND_SCALE, rect.y() * FONT_WORKAROUND_SCALE,
rect.width() * FONT_WORKAROUND_SCALE, rect.height() * FONT_WORKAROUND_SCALE);
QRectF scaledRect( rect.x() * FONT_WORKAROUND_SCALE, rect.y() * FONT_WORKAROUND_SCALE,
rect.width() * FONT_WORKAROUND_SCALE, rect.height() * FONT_WORKAROUND_SCALE );

p->save();
p->setFont(textFont);
p->setPen(QColor(0, 0, 0)); //draw text always in black
p->setFont( textFont );
p->setPen( QColor( 0, 0, 0 ) ); //draw text always in black
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale(scaleFactor, scaleFactor);
p->drawText(scaledRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, text);
p->scale( scaleFactor, scaleFactor );
p->drawText( scaledRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, text );
p->restore();
}

double QgsComposerItem::textWidthMM(const QFont& font, const QString& text) const
double QgsComposerItem::textWidthMM( const QFont& font, const QString& text ) const
{
QFont metricsFont = scaledFontPixelSize(font);
QFontMetrics fontMetrics(metricsFont);
return (fontMetrics.width(text) / FONT_WORKAROUND_SCALE);
QFont metricsFont = scaledFontPixelSize( font );
QFontMetrics fontMetrics( metricsFont );
return ( fontMetrics.width( text ) / FONT_WORKAROUND_SCALE );
}

double QgsComposerItem::fontAscentMM(const QFont& font) const
double QgsComposerItem::fontAscentMM( const QFont& font ) const
{
QFont metricsFont = scaledFontPixelSize(font);
QFontMetrics fontMetrics(metricsFont);
return (fontMetrics.ascent() / FONT_WORKAROUND_SCALE);
QFont metricsFont = scaledFontPixelSize( font );
QFontMetrics fontMetrics( metricsFont );
return ( fontMetrics.ascent() / FONT_WORKAROUND_SCALE );
}

double QgsComposerItem::pixelFontSize(double pointSize) const
double QgsComposerItem::pixelFontSize( double pointSize ) const
{
return (pointSize * 0.3527);
return ( pointSize * 0.3527 );
}

QFont QgsComposerItem::scaledFontPixelSize(const QFont& font) const
QFont QgsComposerItem::scaledFontPixelSize( const QFont& font ) const
{
QFont scaledFont = font;
double pixelSize = pixelFontSize(font.pointSizeF()) * FONT_WORKAROUND_SCALE + 0.5;
scaledFont.setPixelSize(pixelSize);
double pixelSize = pixelFontSize( font.pointSizeF() ) * FONT_WORKAROUND_SCALE + 0.5;
scaledFont.setPixelSize( pixelSize );
return scaledFont;
}
14 changes: 7 additions & 7 deletions src/core/composer/qgscomposeritem.h
Expand Up @@ -105,27 +105,27 @@ class CORE_EXPORT QgsComposerItem: public QGraphicsRectItem

const QgsComposition* composition() const {return mComposition;}

//functions that encapsulate the workaround for the Qt font bug (that is to scale the font size up and then scale the
//functions that encapsulate the workaround for the Qt font bug (that is to scale the font size up and then scale the
//painter down by the same factor for drawing

/**Draws Text. Takes care about all the composer specific issues (calculation to pixel, scaling of font and painter
to work arount the Qt font bug)*/
void drawText(QPainter* p, int x, int y, const QString& text, const QFont& font) const;
void drawText( QPainter* p, int x, int y, const QString& text, const QFont& font ) const;

/**Like the above, but with a rectangle for multiline text*/
void drawText(QPainter* p, const QRectF& rect, const QString& text, const QFont& font) const;
void drawText( QPainter* p, const QRectF& rect, const QString& text, const QFont& font ) const;

/**Returns the font width in MM (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
double textWidthMM(const QFont& font, const QString& text) const;
double textWidthMM( const QFont& font, const QString& text ) const;

/**Returns the font ascent in MM (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
double fontAscentMM(const QFont& font) const;
double fontAscentMM( const QFont& font ) const;

/**Calculates font to from point size to pixel size*/
double pixelFontSize(double pointSize) const;
double pixelFontSize( double pointSize ) const;

/**Returns a font where size is in pixel and font size is upscaled with FONT_WORKAROUND_SCALE*/
QFont scaledFontPixelSize(const QFont& font) const;
QFont scaledFontPixelSize( const QFont& font ) const;

protected:

Expand Down

0 comments on commit 17d69a1

Please sign in to comment.