Skip to content
Permalink
Browse files

Remove unused variables, also avoid some unnecessary string creation

when not using debug builds
  • Loading branch information
nyalldawson committed May 9, 2016
1 parent bf76049 commit d255bfb2566c6dad83af573823958c30e9913427
Showing with 86 additions and 185 deletions.
  1. +4 −3 src/app/gps/qgsgpsinformationwidget.cpp
  2. +1 −1 src/app/main.cpp
  3. +2 −22 src/app/qgisapp.cpp
  4. +0 −1 src/app/qgsbrowserdockwidget.cpp
  5. +0 −2 src/app/qgshandlebadlayers.cpp
  6. +1 −0 src/app/qgslabeldialog.cpp
  7. +0 −2 src/app/qgsoptions.cpp
  8. +0 −1 src/app/qgsvectorlayerproperties.cpp
  9. +0 −4 src/core/composer/qgscomposerlabel.cpp
  10. +0 −1 src/core/composer/qgslegendmodel.cpp
  11. +0 −1 src/core/qgsdataitem.cpp
  12. +0 −1 src/core/qgsdiagramrendererv2.cpp
  13. +3 −0 src/core/qgserror.cpp
  14. +5 −6 src/core/qgsfontutils.cpp
  15. +2 −1 src/core/qgsmaprenderercustompainterjob.cpp
  16. +0 −6 src/core/qgsogcutils.cpp
  17. +3 −1 src/core/qgspallabeling.cpp
  18. +0 −1 src/core/qgsproject.cpp
  19. +1 −3 src/core/qgsvectorlayer.cpp
  20. +2 −7 src/core/raster/qgsrasterlayer.cpp
  21. +1 −1 src/core/symbology-ng/qgscptcityarchive.cpp
  22. +0 −1 src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
  23. +0 −1 src/core/symbology-ng/qgsstylev2.cpp
  24. +0 −1 src/core/symbology-ng/qgssvgcache.cpp
  25. +1 −2 src/gui/qgsbrowsertreeview.cpp
  26. +2 −0 src/gui/qgscomposerruler.cpp
  27. +0 −4 src/gui/qgsmapcanvas.cpp
  28. +1 −1 src/gui/raster/qgsrasterhistogramwidget.cpp
  29. +1 −2 src/gui/symbology-ng/qgsstylev2managerdialog.cpp
  30. +0 −2 src/gui/symbology-ng/qgssymbolslistwidget.cpp
  31. +0 −1 src/helpviewer/main.cpp
  32. +2 −1 src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp
  33. +6 −7 src/plugins/oracle_raster/qgsselectgeoraster_ui.cpp
  34. +0 −1 src/plugins/roadgraph/roadgraphplugin.cpp
  35. +0 −1 src/plugins/spatialquery/qgsspatialquerydialog.cpp
  36. +3 −5 src/providers/db2/qgsdb2dataitems.cpp
  37. +0 −1 src/providers/db2/qgsdb2expressioncompiler.cpp
  38. +1 −2 src/providers/db2/qgsdb2featureiterator.cpp
  39. +9 −20 src/providers/db2/qgsdb2provider.cpp
  40. +2 −5 src/providers/db2/qgsdb2sourceselect.cpp
  41. +2 −4 src/providers/mssql/qgsmssqlfeatureiterator.cpp
  42. +17 −36 src/providers/mssql/qgsmssqlprovider.cpp
  43. +2 −4 src/providers/mssql/qgsmssqlsourceselect.cpp
  44. +1 −2 src/providers/ogr/qgsogrdataitems.cpp
  45. +0 −1 src/providers/spatialite/qgsspatialiteprovider.cpp
  46. +0 −2 src/providers/spatialite/qgsspatialitetablemodel.cpp
  47. +1 −1 src/providers/virtual/qgsvirtuallayersqlitemodule.cpp
  48. +3 −3 src/providers/wcs/qgswcsprovider.cpp
  49. +1 −2 src/providers/wfs/qgswfsrequest.cpp
  50. +3 −1 src/providers/wms/qgswmscapabilities.cpp
  51. +3 −2 src/providers/wms/qgswmsprovider.cpp
  52. +0 −2 src/server/qgssldconfigparser.cpp
  53. +0 −1 src/server/qgswfsserver.cpp
  54. +0 −1 src/server/qgswmsconfigparser.cpp
@@ -584,9 +584,7 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
QColor bg( Qt::white ); // moved several items outside of the following if block to minimize loop time
bg.setAlpha( 200 );
QColor myColor;
QBrush symbolBrush( Qt::black );
QBrush textBgBrush( bg );
QSize markerSize( 9, 9 );

// Add a marker to the polar plot
if ( currentInfo.id > 0 ) // don't show satellite if id=0 (no satellite indication)
{
@@ -607,6 +605,9 @@ void QgsGPSInformationWidget::displayGPSInformation( const QgsGPSInformation& in
myColor = Qt::black; //strong signal
}
#ifdef WITH_QWTPOLAR
QBrush symbolBrush( Qt::black );
QSize markerSize( 9, 9 );
QBrush textBgBrush( bg );
#if (QWT_POLAR_VERSION<0x010000)
mypMarker->setSymbol( QwtSymbol( QwtSymbol::Ellipse,
symbolBrush, QPen( myColor ), markerSize ) );
@@ -936,7 +936,7 @@ int main( int argc, char *argv[] )
QString i18nPath = QgsApplication::i18nPath();
QString myUserLocale = mySettings.value( "locale/userLocale", "" ).toString();
bool myLocaleOverrideFlag = mySettings.value( "locale/overrideFlag", false ).toBool();
QString myLocale;

//
// Priority of translation is:
// - command line
@@ -10477,8 +10477,6 @@ void QgisApp::refreshActionFeatureAction()
// this is a slot for action from GUI to add raster layer
void QgisApp::addRasterLayer()
{
QString fileFilters;

QStringList selectedFiles;
QString e;//only for parameter correctness
QString title = tr( "Open a GDAL Supported Raster Data Source" );
@@ -10856,6 +10854,7 @@ void QgisApp::showBookmarks()

void QgisApp::oldProjectVersionWarning( const QString& oldVersion )
{
Q_UNUSED( oldVersion );
QSettings settings;

if ( settings.value( "/qgis/warnOldProjectVersion", QVariant( true ) ).toBool() )
@@ -10864,24 +10863,6 @@ void QgisApp::oldProjectVersionWarning( const QString& oldVersion )
" When saving this project file, QGIS will update it to the latest version, "
"possibly rendering it useless for older versions of QGIS." );

QString text = tr( "<p>This project file was saved by an older version of QGIS."
" When saving this project file, QGIS will update it to the latest version, "
"possibly rendering it useless for older versions of QGIS."
"<p>Even though QGIS developers try to maintain backwards "
"compatibility, some of the information from the old project "
"file might be lost."
" To improve the quality of QGIS, we appreciate "
"if you file a bug report at %3."
" Be sure to include the old project file, and state the version of "
"QGIS you used to discover the error."
"<p>To remove this warning when opening an older project file, "
"uncheck the box '%5' in the %4 menu."
"<p>Version of the project file: %1<br>Current version of QGIS: %2" )
.arg( oldVersion,
QGis::QGIS_VERSION,
"<a href=\"https://hub.qgis.org/projects/quantum-gis\">https://hub.qgis.org/projects/quantum-gis</a> ",
tr( "<tt>Settings:Options:General</tt>", "Menu path to setting options" ),
tr( "Warn me when opening a project file saved with an older version of QGIS" ) );
QString title = tr( "Project file is older" );

#ifdef ANDROID
@@ -11225,8 +11206,7 @@ void QgisApp::namSslErrors( QNetworkReply *reply, const QList<QSslError> &errors
timer->stop();
}

QString requesturl = reply->request().url().toString();
QgsDebugMsg( QString( "SSL errors occurred accessing URL:\n%1" ).arg( requesturl ) );
QgsDebugMsg( QString( "SSL errors occurred accessing URL:\n%1" ).arg( reply->request().url().toString() ) );

QString hostport( QString( "%1:%2" )
.arg( reply->url().host() )
@@ -122,7 +122,6 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem* item )
QgsMapLayer::LayerType type = layerItem->mapLayerType();
QString layerMetadata = tr( "Error" );
QgsCoordinateReferenceSystem layerCrs;
QString notice;

// temporarily override /Projections/defaultBehaviour to avoid dialog prompt
QSettings settings;
@@ -368,8 +368,6 @@ void QgsHandleBadLayers::apply()
int idx = mLayerList->item( i, 0 )->data( Qt::UserRole ).toInt();
QDomNode &node = const_cast<QDomNode &>( mLayers[ idx ] );

QString type = mLayerList->item( i, 1 )->text();
QString provider = mLayerList->item( i, 2 )->text();
QTableWidgetItem *item = mLayerList->item( i, 4 );
QString datasource = item->text();

@@ -279,6 +279,7 @@ void QgsLabelDialog::changeFont()
qreal fontSize = mFont.pointSizeF();
bool resultFlag;
QFont newFont = QgisGui::getFont( resultFlag, mFont );
Q_UNUSED( newFont );
if ( !resultFlag )
return;

@@ -634,7 +634,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
initContrastEnhancement( cboxContrastEnhancementAlgorithmMultiBandSingleByte, "multiBandSingleByte", "NoEnhancement" );
initContrastEnhancement( cboxContrastEnhancementAlgorithmMultiBandMultiByte, "multiBandMultiByte", "StretchToMinimumMaximum" );

QString cumulativeCutText = tr( "Cumulative pixel count cut" );
cboxContrastEnhancementLimits->addItem( tr( "Cumulative pixel count cut" ), "CumulativeCut" );
cboxContrastEnhancementLimits->addItem( tr( "Minimum / maximum" ), "MinMax" );
cboxContrastEnhancementLimits->addItem( tr( "Mean +/- standard deviation" ), "StdDev" );
@@ -807,7 +806,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )

//set elements in digitizing tab
mLineWidthSpinBox->setValue( mSettings->value( "/qgis/digitizing/line_width", 1 ).toInt() );
QColor digitizingColor;
myRed = mSettings->value( "/qgis/digitizing/line_color_red", 255 ).toInt();
myGreen = mSettings->value( "/qgis/digitizing/line_color_green", 0 ).toInt();
myBlue = mSettings->value( "/qgis/digitizing/line_color_blue", 0 ).toInt();
@@ -901,7 +901,6 @@ void QgsVectorLayerProperties::saveStyleAs( StyleType styleType )
QSettings myQSettings; // where we keep last used filter in persistent state
QString myLastUsedDir = myQSettings.value( "style/lastStyleDir", QDir::homePath() ).toString();

QString format, extension;
if ( styleType == DB )
{
QString infoWindowTitle = QObject::tr( "Save style to DB (%1)" ).arg( mLayer->providerType() );
@@ -395,8 +395,6 @@ QFont QgsComposerLabel::font() const

bool QgsComposerLabel::writeXML( QDomElement& elem, QDomDocument & doc ) const
{
QString alignment;

if ( elem.isNull() )
{
return false;
@@ -429,8 +427,6 @@ bool QgsComposerLabel::writeXML( QDomElement& elem, QDomDocument & doc ) const

bool QgsComposerLabel::readXML( const QDomElement& itemElem, const QDomDocument& doc )
{
QString alignment;

if ( itemElem.isNull() )
{
return false;
@@ -784,7 +784,6 @@ bool QgsLegendModel::removeRows( int row, int count, const QModelIndex & parent
QMimeData* QgsLegendModel::mimeData( const QModelIndexList &indexes ) const
{
QMimeData* mimeData = new QMimeData();
QByteArray encodedData;
QDomDocument xmlDoc;
QDomElement xmlRootElement = xmlDoc.createElement( "LegendModelDragData" );
xmlDoc.appendChild( xmlRootElement );
@@ -1442,7 +1442,6 @@ QgsDataItem* QgsZipItem::itemFromPath( QgsDataItem* parent, const QString& fileP
QString scanZipSetting = settings.value( "/qgis/scanZipInBrowser2", "basic" ).toString();
int zipFileCount = 0;
QStringList zipFileList;
QFileInfo fileInfo( filePath );
QString vsiPrefix = QgsZipItem::vsiPrefix( filePath );
QgsZipItem * zipItem = nullptr;
bool populated = false;
@@ -371,7 +371,6 @@ void QgsDiagramSettings::writeXML( QDomElement& rendererElem, QDomDocument& doc,
categoryElem.setAttribute( "minimumSize", QString::number( minimumSize ) );
categoryElem.setAttribute( "angleOffset", QString::number( angleOffset ) );

QString colors;
int nCats = qMin( categoryColors.size(), categoryAttributes.size() );
for ( int i = 0; i < nCats; ++i )
{
@@ -51,7 +51,10 @@ QString QgsError::message( QgsErrorMessage::Format theFormat ) const
{
QString str;

#ifdef QGISDEBUG
QString srcUrl;
#endif

#if defined(QGISDEBUG) && defined(QGS_GIT_REMOTE_URL)
// TODO: verify if we are not ahead to origin (remote hash does not exist)
// and there are no local not commited changes
@@ -239,12 +239,11 @@ bool QgsFontUtils::loadStandardTestFonts( const QStringList& loadstyles )
{
continue;
}
QString familyStyle = QString( "%1 %2" ).arg( fontFamily, fontstyle );

if ( fontFamilyHasStyle( fontFamily, fontstyle ) )
{
fontsLoaded = ( fontsLoaded || false );
QgsDebugMsg( QString( "Test font '%1' already available" ).arg( familyStyle ) );
QgsDebugMsg( QString( "Test font '%1 %2' already available" ).arg( fontFamily, fontstyle ) );
}
else
{
@@ -259,8 +258,8 @@ bool QgsFontUtils::loadStandardTestFonts( const QStringList& loadstyles )
int fontID = QFontDatabase::addApplicationFont( fontPath );
loaded = ( fontID != -1 );
fontsLoaded = ( fontsLoaded || loaded );
QgsDebugMsg( QString( "Test font '%1' %2 from filesystem [%3]" )
.arg( familyStyle, loaded ? "loaded" : "FAILED to load", fontPath ) );
QgsDebugMsg( QString( "Test font '%1 %2' %3 from filesystem [%4]" )
.arg( fontFamily, fontstyle, loaded ? "loaded" : "FAILED to load", fontPath ) );
QFontDatabase db;
QgsDebugMsg( QString( "font families in %1: %2" ).arg( fontID ).arg( db.applicationFontFamilies( fontID ).join( "," ) ) );
}
@@ -273,8 +272,8 @@ bool QgsFontUtils::loadStandardTestFonts( const QStringList& loadstyles )
loaded = ( fontID != -1 );
fontsLoaded = ( fontsLoaded || loaded );
}
QgsDebugMsg( QString( "Test font '%1' %2 from testdata.qrc" )
.arg( familyStyle, loaded ? "loaded" : "FAILED to load" ) );
QgsDebugMsg( QString( "Test font '%1' %3 from testdata.qrc" )
.arg( fontFamily, fontstyle, loaded ? "loaded" : "FAILED to load" ) );
}
}
}
@@ -71,10 +71,11 @@ void QgsMapRendererCustomPainterJob::start()

mPainter->setRenderHint( QPainter::Antialiasing, mSettings.testFlag( QgsMapSettings::Antialiasing ) );

#ifndef QT_NO_DEBUG
QPaintDevice* thePaintDevice = mPainter->device();

QString errMsg = QString( "pre-set DPI not equal to painter's DPI (%1 vs %2)" ).arg( thePaintDevice->logicalDpiX() ).arg( mSettings.outputDpi() );
Q_ASSERT_X( thePaintDevice->logicalDpiX() == mSettings.outputDpi(), "Job::startRender()", errMsg.toAscii().data() );
#endif

delete mLabelingEngine;
mLabelingEngine = nullptr;
@@ -914,12 +914,6 @@ QgsRectangle QgsOgcUtils::rectangleFromGMLBox( const QDomNode& boxNode )

bool QgsOgcUtils::readGMLPositions( QgsPolyline &coords, const QDomElement &elem )
{
//tupel and coord separator are the same
QString coordSeparator = " ";
QString tupelSeparator = " ";
//"decimal" has to be "."


coords.clear();

QStringList pos = elem.text().split( ' ', QString::SkipEmptyParts );
@@ -3015,7 +3015,9 @@ bool QgsPalLayerSettings::dataDefinedValEval( DataDefinedValueType valType,
{
if ( dataDefinedEvaluate( p, exprVal, &context, originalValue ) )
{
QString dbgStr = QString( "exprVal %1:" ).arg( mDataDefinedNames.value( p ).first ) + "%1";
#ifdef QGISDEBUG
QString dbgStr = QString( "exprVal %1:" ).arg( mDataDefinedNames.value( p ).first ) + "%1"; // clazy:exclude=unused-non-trivial-variable
#endif

switch ( valType )
{
@@ -1134,7 +1134,6 @@ bool QgsProject::write()

if ( ml )
{
QString externalProjectFile = layerIsEmbedded( ml->id() );
QHash< QString, QPair< QString, bool> >::const_iterator emIt = mEmbeddedLayers.constFind( ml->id() );
if ( emIt == mEmbeddedLayers.constEnd() )
{
@@ -882,9 +882,7 @@ QgsRectangle QgsVectorLayer::extent()
QgsRectangle mbr = mDataProvider->extent();

// show the extent
QString s = mbr.toString();

QgsDebugMsg( "Extent of layer: " + s );
QgsDebugMsg( "Extent of layer: " + mbr.toString() );
// store the extent
setExtent( mbr );

@@ -679,8 +679,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider )
QgsRectangle mbr = mDataProvider->extent();

// show the extent
QString s = mbr.toString();
QgsDebugMsgLevel( "Extent of layer: " + s, 4 );
QgsDebugMsgLevel( "Extent of layer: " + mbr.toString(), 4 );
// store the extent
setExtent( mbr );

@@ -693,15 +692,11 @@ void QgsRasterLayer::setDataProvider( QString const & provider )
// Setup source CRS
setCrs( QgsCoordinateReferenceSystem( mDataProvider->crs() ) );

QString mySourceWkt = crs().toWkt();

QgsDebugMsgLevel( "using wkt:\n" + mySourceWkt, 4 );
QgsDebugMsgLevel( "using wkt:\n" + crs().toWkt(), 4 );

//defaults - Needs to be set after the Contrast list has been build
//Try to read the default contrast enhancement from the config file

QSettings myQSettings;

//decide what type of layer this is...
//TODO Change this to look at the color interp and palette interp to decide which type of layer it is
QgsDebugMsgLevel( "bandCount = " + QString::number( mDataProvider->bandCount() ), 4 );
@@ -967,7 +967,7 @@ QMap< QString, QStringList > QgsCptCityDirectoryItem::rampsMap()
if ( ! mRampsMap.isEmpty() )
return mRampsMap;

QString curName, prevName, prevPath, curVariant, curSep, schemeName;
QString curName, prevName, curVariant, curSep, schemeName;
QStringList listVariant;
QStringList schemeNamesAll, schemeNames;
bool prevAdd, curAdd;
@@ -208,7 +208,6 @@ QgsSingleSymbolRendererV2* QgsSingleSymbolRendererV2::clone() const
void QgsSingleSymbolRendererV2::toSld( QDomDocument& doc, QDomElement &element ) const
{
QgsStringMap props;
QString errorMsg;
if ( mRotation.data() )
props[ "angle" ] = mRotation->expression();
if ( mSizeScale.data() )
@@ -1311,7 +1311,6 @@ QgsSmartConditionMap QgsStyleV2::smartgroup( int id )
}

QDomElement smartEl = doc.documentElement();
QString op = smartEl.attribute( "operator" );
QDomNodeList conditionNodes = smartEl.childNodes();

for ( int i = 0; i < conditionNodes.count(); i++ )
@@ -756,7 +756,6 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
{
continue;
}
QString key = keyValueSplit.at( 0 );
QString value = keyValueSplit.at( 1 );
valueSplit = value.split( ' ' );
if ( !hasFillParam && value.startsWith( "param(fill)" ) )
@@ -107,8 +107,7 @@ void QgsBrowserTreeView::expandTree( const QModelIndex & index )
if ( !model() )
return;

QString itemPath = model()->data( index, QgsBrowserModel::PathRole ).toString();
QgsDebugMsg( "itemPath = " + itemPath );
QgsDebugMsg( "itemPath = " + model()->data( index, QgsBrowserModel::PathRole ).toString() );

expand( index );
QModelIndex parentIndex = model()->parent( index );
@@ -361,8 +361,10 @@ int QgsComposerRuler::optimumNumberDivisions( double rulerScale, int scaleMultip

void QgsComposerRuler::setSceneTransform( const QTransform& transform )
{
#if 0
QString debug = QString::number( transform.dx() ) + ',' + QString::number( transform.dy() ) + ','
+ QString::number( transform.m11() ) + ',' + QString::number( transform.m22() );
#endif
mTransform = transform;
update();
}
@@ -1180,10 +1180,6 @@ void QgsMapCanvas::keyPressEvent( QKeyEvent * e )
return;
}

QPainter paint;
QPen pen( Qt::gray );
QgsPoint ll, ur;

if ( ! mCanvasProperties->mouseButtonDown )
{
// Don't want to interfer with mouse events
@@ -688,7 +688,7 @@ void QgsRasterHistogramWidget::on_mSaveAsImageButton_clicked()

QPair< QString, QString> myFileNameAndFilter = QgisGui::getSaveAsImageName( this, tr( "Choose a file name to save the map image as" ) );
QFileInfo myInfo( myFileNameAndFilter.first );
if ( QFileInfo( myFileNameAndFilter.first ).baseName() != "" )
if ( myInfo.baseName() != "" )
{
histoSaveAsImage( myFileNameAndFilter.first );
}
@@ -1096,8 +1096,7 @@ void QgsStyleV2ManagerDialog::removeGroup()

void QgsStyleV2ManagerDialog::groupRenamed( QStandardItem * item )
{
QString data = item->data( Qt::UserRole + 1 ).toString();
QgsDebugMsg( "Symbol group edited: data=" + data + " text=" + item->text() );
QgsDebugMsg( "Symbol group edited: data=" + item->data( Qt::UserRole + 1 ).toString() + " text=" + item->text() );
int id = item->data( Qt::UserRole + 1 ).toInt();
QString name = item->text();
if ( item->parent()->data( Qt::UserRole + 1 ) == "smartgroups" )
@@ -182,8 +182,6 @@ void QgsSymbolsListWidget::populateSymbolView()
void QgsSymbolsListWidget::populateSymbols( const QStringList& names )
{
QSize previewSize = viewSymbols->iconSize();
QPixmap p( previewSize );
QPainter painter;

QStandardItemModel* model = qobject_cast<QStandardItemModel*>( viewSymbols->model() );
if ( !model )

0 comments on commit d255bfb

Please sign in to comment.
You can’t perform that action at this time.