4 changes: 2 additions & 2 deletions scripts/astyle-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export elcr="$(tput el)$(tput cr)"

find src -type f -print | while read f; do
case "$f" in
src/app/gps/qwtpolar-*|src/core/spatialite/*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/pyspatialite/*|src/providers/sqlanywhere/sqlanyconnection/*)
src/app/gps/qwtpolar-*|src/app/qtmain_android.cpp|src/core/spatialite/*|src/core/spatialindex/src/*|src/core/gps/qextserialport/*|src/plugins/grass/qtermwidget/*|src/astyle/*|python/pyspatialite/*|src/providers/sqlanywhere/sqlanyconnection/*)
echo $f skipped
continue
;;
Expand All @@ -22,7 +22,7 @@ find src -type f -print | while read f; do
;;

*)
echo $f skipped
echo -ne "$f skipped $elcr"
continue
;;
esac
Expand Down
15 changes: 9 additions & 6 deletions src/analysis/raster/qgshillshadefilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@
#include "qgshillshadefilter.h"

QgsHillshadeFilter::QgsHillshadeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, double lightAzimuth,
double lightAngle): \
QgsDerivativeFilter( inputFile, outputFile, outputFormat ), mLightAzimuth( lightAzimuth ), mLightAngle( lightAngle )
double lightAngle )
: QgsDerivativeFilter( inputFile, outputFile, outputFormat )
, mLightAzimuth( lightAzimuth )
, mLightAngle( lightAngle )
{
}

QgsHillshadeFilter::~QgsHillshadeFilter()
{
}

float QgsHillshadeFilter::processNineCellWindow( float* x11, float* x21, float* x31, \
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 )
float QgsHillshadeFilter::processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 )
{
float derX = calcFirstDerX( x11, x21, x31, x12, x22, x32, x13, x23, x33 );
float derY = calcFirstDerY( x11, x21, x31, x12, x22, x32, x13, x23, x33 );
Expand All @@ -42,13 +45,13 @@ float QgsHillshadeFilter::processNineCellWindow( float* x11, float* x21, float*
float slope_rad = atan( sqrt( derX * derX + derY * derY ) );
float azimuth_rad = mLightAzimuth * M_PI / 180.0;
float aspect_rad = 0;
if( derX == 0 && derY == 0 ) //aspect undefined, take a neutral value. Better solutions?
if ( derX == 0 && derY == 0 ) //aspect undefined, take a neutral value. Better solutions?
{
aspect_rad = azimuth_rad / 2.0;
}
else
{
aspect_rad = M_PI + atan2( derX, derY );
}
return qMax( 0.0, 255.0 * ( ( cos( zenith_rad ) * cos( slope_rad ) ) + ( sin( zenith_rad ) * sin( slope_rad ) * cos( azimuth_rad - aspect_rad ) ) ) );
return qMax( 0.0, 255.0 * (( cos( zenith_rad ) * cos( slope_rad ) ) + ( sin( zenith_rad ) * sin( slope_rad ) * cos( azimuth_rad - aspect_rad ) ) ) );
}
13 changes: 7 additions & 6 deletions src/analysis/raster/qgshillshadefilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@ class ANALYSIS_EXPORT QgsHillshadeFilter: public QgsDerivativeFilter
{
public:
QgsHillshadeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat, double lightAzimuth = 300,
double lightAngle = 40 );
double lightAngle = 40 );
~QgsHillshadeFilter();

/**Calculates output value from nine input values. The input values and the output value can be equal to the \
/**Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31, \
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 );
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 );

float lightAzimuth() const { return mLightAzimuth; }
void setLightAzimuth( float azimuth ){ mLightAzimuth = azimuth; }
void setLightAzimuth( float azimuth ) { mLightAzimuth = azimuth; }
float lightAngle() const { return mLightAngle; }
void setLightAngle( float angle ){ mLightAngle = angle; }
void setLightAngle( float angle ) { mLightAngle = angle; }

private:
float mLightAzimuth;
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsrelief.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
qgsrelief.cpp - description
---------------------------
begin : November 2011
copyright : (C) 20011 by Marco Hugentobler
copyright : (C) 2011 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************/

Expand Down
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsrelief.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
qgsrelief.h - description
---------------------------
begin : November 2011
copyright : (C) 20011 by Marco Hugentobler
copyright : (C) 2011 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************/

Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsmaptoolcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ QgsMapToolCapture::~QgsMapToolCapture()

stopCapturing();

if( mValidator )
if ( mValidator )
{
mValidator->deleteLater();
mValidator = 0;
Expand Down Expand Up @@ -283,7 +283,7 @@ void QgsMapToolCapture::validateGeometry()
if ( settings.value( "/qgis/digitizing/validate_geometries", 1 ).toInt() == 0 )
return;

if( mValidator )
if ( mValidator )
{
mValidator->deleteLater();
mValidator = 0;
Expand Down Expand Up @@ -311,7 +311,7 @@ void QgsMapToolCapture::validateGeometry()
case CapturePolygon:
if ( mCaptureList.size() < 3 )
return;
g = QgsGeometry::fromPolygon( QgsPolygon() << ( QgsPolyline () << mCaptureList.toVector() << mCaptureList[0] ) );
g = QgsGeometry::fromPolygon( QgsPolygon() << ( QgsPolyline() << mCaptureList.toVector() << mCaptureList[0] ) );
break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsattributeaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ QString QgsAttributeAction::expandAction( QString action, QgsFeature &feat, cons
int start = index;
index = pos + rx.matchedLength();

QString to_replace = rx.cap(1).trimmed();
QString to_replace = rx.cap( 1 ).trimmed();
QgsDebugMsg( "Found expression:" + to_replace );

if ( substitutionMap && substitutionMap->contains( to_replace ) )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsattributeaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class CORE_EXPORT QgsAttributeAction
static void ( *smPythonExecute )( const QString & );

void runAction( const QgsAction &action,
void ( *executePython )( const QString & ) = 0 );
void ( *executePython )( const QString & ) = 0 );

int mDefaultAction;
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static double getDoubleValue( const QVariant& value, QgsExpression* parent )
static int getIntValue( const QVariant& value, QgsExpression* parent )
{
bool ok;
qint64 x = value.toLongLong(&ok);
qint64 x = value.toLongLong( &ok );
if ( ok && x >= std::numeric_limits<int>::min() && x <= std::numeric_limits<int>::max() )
{
return x;
Expand Down
12 changes: 11 additions & 1 deletion src/core/qgsvectordataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "qgsfeature.h"
#include "qgsfield.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"

QgsVectorDataProvider::QgsVectorDataProvider( QString uri )
: QgsDataProvider( uri )
Expand Down Expand Up @@ -157,7 +158,9 @@ void QgsVectorDataProvider::setEncoding( const QString& e )
}
else
{
QgsDebugMsg( "error finding QTextCodec for " + e );
QgsMessageLog::logMessage( tr( "Codec %1 not found. Falling back to system locale" ).arg( e ) );
mEncoding = QTextCodec::codecForName( "System" );
Q_ASSERT( mEncoding );
}
}

Expand Down Expand Up @@ -457,6 +460,12 @@ const QStringList &QgsVectorDataProvider::availableEncodings()
{
if ( smEncodings.isEmpty() )
{
foreach( QString codec, QTextCodec::availableCodecs() )
{
smEncodings << codec;
}
qSort( smEncodings );
#if 0
smEncodings << "BIG5";
smEncodings << "BIG5-HKSCS";
smEncodings << "EUCJP";
Expand Down Expand Up @@ -502,6 +511,7 @@ const QStringList &QgsVectorDataProvider::availableEncodings()
smEncodings << "Apple Roman";
smEncodings << "TIS-620";
smEncodings << "System";
#endif
}

return smEncodings;
Expand Down
12 changes: 6 additions & 6 deletions src/core/qgsvectorlayerimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ typedef QgsVectorLayerImport::ImportError createEmptyLayer_t(


QgsVectorLayerImport::QgsVectorLayerImport( const QString &uri,
const QString &providerKey,
const QgsFieldMap& fields,
QGis::WkbType geometryType,
const QgsCoordinateReferenceSystem* crs,
bool overwrite,
const QMap<QString, QVariant> *options )
const QString &providerKey,
const QgsFieldMap& fields,
QGis::WkbType geometryType,
const QgsCoordinateReferenceSystem* crs,
bool overwrite,
const QMap<QString, QVariant> *options )
: mErrorCount( 0 )
{
mProvider = NULL;
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsexpressionbuilderwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )
expressionTree->setContextMenuPolicy( Qt::CustomContextMenu );
connect( expressionTree, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showContextMenu( const QPoint & ) ) );

foreach (QPushButton* button, this->mOperatorsGroupBox->findChildren<QPushButton *>())
foreach( QPushButton* button, this->mOperatorsGroupBox->findChildren<QPushButton *>() )
{
connect( button, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
connect( button, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
}

// TODO Can we move this stuff to QgsExpression, like the functions?
Expand Down Expand Up @@ -155,7 +155,7 @@ void QgsExpressionBuilderWidget::loadFieldNames()
void QgsExpressionBuilderWidget::loadFieldNames( QgsFieldMap fields )
{
if ( fields.isEmpty() )
return;
return;

QStringList fieldNames;
foreach( QgsField field, fields )
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsprojectionselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,10 +857,10 @@ void QgsProjectionSelector::on_cbxHideDeprecated_stateChanged()
hideDeprecated( lstCoordinateSystems->topLevelItem( i ) );
}

void QgsProjectionSelector::on_lstRecent_itemClicked(QTreeWidgetItem * item)
void QgsProjectionSelector::on_lstRecent_itemClicked( QTreeWidgetItem * item )
{
setSelectedCrsId( item->text( QGIS_CRS_ID_COLUMN ).toLong() );
item->setSelected(true);
item->setSelected( true );
}

void QgsProjectionSelector::on_leSearch_textChanged( const QString & theFilterTxt )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsprojectionselector.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
* \warning This function's behaviour is undefined if it is called after the widget is shown.
*/
void setOgcWmsCrsFilter( QSet<QString> crsFilter );
void on_lstRecent_itemClicked(QTreeWidgetItem * );
void on_lstRecent_itemClicked( QTreeWidgetItem * );
void on_cbxHideDeprecated_stateChanged();
void on_leSearch_textChanged( const QString & );

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsscalecombobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void QgsScaleComboBox::showPopup()
parts = itemText( i ).split( ':' );
nextScale = parts.at( 1 ).toLong( &ok );
delta = qAbs( currScale - nextScale );
if( delta < min )
if ( delta < min )
{
min = delta;
idx = i;
Expand Down
14 changes: 9 additions & 5 deletions src/plugins/gps_importer/qgsgpsplugingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ void QgsGPSPluginGui::on_buttonBox_accepted()
// what should we do?
switch ( tabWidget->currentIndex() )
{
// add a GPX layer?
case 0:
// add a GPX layer?
emit loadGPXFile( leGPXFile->text(), cbGPXWaypoints->isChecked(),
cbGPXRoutes->isChecked(), cbGPXTracks->isChecked() );
break;
// or import other file?

case 1:
{
// or import other file?
const QString& typeString( cmbIMPFeature->currentText() );
emit importGPSFile( leIMPInput->text(),
mImporters.find( mImpFormat )->second,
Expand All @@ -107,9 +108,10 @@ void QgsGPSPluginGui::on_buttonBox_accepted()
leIMPLayer->text() );
break;
}
// or download GPS data from a device?

case 2:
{
// or download GPS data from a device?
int featureType = cmbDLFeatureType->currentIndex();

QString fileName = leDLOutput->text();
Expand All @@ -124,17 +126,19 @@ void QgsGPSPluginGui::on_buttonBox_accepted()
fileName, leDLBasename->text() );
break;
}
// or upload GPS data to a device?

case 3:
{
// or upload GPS data to a device?
emit uploadToGPS( mGPXLayers[cmbULLayer->currentIndex()],
cmbULDevice->currentText(),
cmbULPort->itemData( cmbULPort->currentIndex() ).toString() );
break;
}
// or convert between waypoints/tracks=

case 4:
{
// or convert between waypoints/tracks=
int convertType = cmbCONVType->itemData( cmbCONVType->currentIndex() ).toInt();

emit convertGPSFile( leCONVInput->text(),
Expand Down