Skip to content

Commit 091ce7c

Browse files
committedDec 4, 2012
fix indentation and some translation strings
1 parent faf1c60 commit 091ce7c

File tree

6 files changed

+146
-145
lines changed

6 files changed

+146
-145
lines changed
 

‎python/plugins/sextante/modeler/ModelerDialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def saveModel(self):
301301
f.close()
302302
self.help = None
303303
QMessageBox.information(self,
304-
self.tr("Model saving"),
304+
self.tr("Model saved"),
305305
self.tr("Model was correctly saved.")
306306
)
307307

‎src/providers/spatialite/qgsspatialiteconnection.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,19 @@ QgsSpatiaLiteConnection::Error QgsSpatiaLiteConnection::fetchTables( bool loadGe
8787
if ( ret == LayoutCurrent && recentVersion == false )
8888
{
8989
// obsolete library version
90-
mErrorMsg = tr( "obsolete libspatialite: connecting to this DB requires using v.4.0 (or any subsequent)" );
91-
return FailedToCheckMetadata;
90+
mErrorMsg = tr( "obsolete libspatialite: connecting to this DB requires using v.4.0 (or any subsequent)" );
91+
return FailedToCheckMetadata;
9292
}
9393

9494
#ifdef SPATIALITE_RECENT_VERSION
9595
// only if libspatialite version is >= 4.0.0
96-
// using v.4.0 Abstract Interface
97-
if (!getTableInfoAbstractInterface( handle, loadGeometrylessTables ) )
98-
{
99-
return FailedToGetTables;
100-
}
101-
closeSpatiaLiteDb( handle );
102-
return NoError;
96+
// using v.4.0 Abstract Interface
97+
if ( !getTableInfoAbstractInterface( handle, loadGeometrylessTables ) )
98+
{
99+
return FailedToGetTables;
100+
}
101+
closeSpatiaLiteDb( handle );
102+
return NoError;
103103
#endif
104104

105105
// obsolete library: still using the traditional approach
@@ -129,10 +129,10 @@ bool QgsSpatiaLiteConnection::updateStatistics()
129129
// checking the library version
130130
bool recentVersion = false;
131131
const char *version = spatialite_version();
132-
if ( isdigit(*version) && *version >= '4' )
133-
recentVersion = true;
132+
if ( isdigit( *version ) && *version >= '4' )
133+
recentVersion = true;
134134

135-
bool ret = update_layer_statistics ( handle, NULL, NULL );
135+
bool ret = update_layer_statistics( handle, NULL, NULL );
136136

137137
closeSpatiaLiteDb( handle );
138138

@@ -144,7 +144,7 @@ sqlite3 *QgsSpatiaLiteConnection::openSpatiaLiteDb( QString path )
144144
sqlite3 *handle = NULL;
145145
int ret;
146146
// activating the SpatiaLite library
147-
spatialite_init(0);
147+
spatialite_init( 0 );
148148

149149
// trying to open the SQLite DB
150150
ret = sqlite3_open_v2( path.toUtf8().constData(), &handle, SQLITE_OPEN_READWRITE, NULL );
@@ -275,7 +275,7 @@ int QgsSpatiaLiteConnection::checkHasMetadataTables( sqlite3* handle )
275275
}
276276

277277
#ifdef SPATIALITE_RECENT_VERSION
278-
// only if libspatialite version is >= 4.0.0
278+
// only if libspatialite version is >= 4.0.0
279279
bool QgsSpatiaLiteConnection::getTableInfoAbstractInterface( sqlite3 * handle, bool loadGeometrylessTables )
280280
{
281281
int ret;
@@ -289,7 +289,7 @@ bool QgsSpatiaLiteConnection::getTableInfoAbstractInterface( sqlite3 * handle, b
289289
gaiaVectorLayersListPtr list;
290290

291291
const char *version = spatialite_version();
292-
if ( isdigit(*version) && *version >= '4' )
292+
if ( isdigit( *version ) && *version >= '4' )
293293
; // OK, linked against libspatialite v.4.0 (or any subsequent)
294294
else
295295
{
@@ -298,14 +298,14 @@ bool QgsSpatiaLiteConnection::getTableInfoAbstractInterface( sqlite3 * handle, b
298298
}
299299

300300
// attempting to load the VectorLayersList
301-
list = gaiaGetVectorLayersList (handle, NULL, NULL, GAIA_VECTORS_LIST_FAST);
302-
if (list != NULL)
301+
list = gaiaGetVectorLayersList( handle, NULL, NULL, GAIA_VECTORS_LIST_FAST );
302+
if ( list != NULL )
303303
{
304304
gaiaVectorLayerPtr lyr = list->First;
305305
while ( lyr != NULL )
306306
{
307307
// populating the QGIS own Layers List
308-
if (lyr->AuthInfos)
308+
if ( lyr->AuthInfos )
309309
{
310310
if ( lyr->AuthInfos->IsHidden )
311311
{
@@ -318,39 +318,39 @@ bool QgsSpatiaLiteConnection::getTableInfoAbstractInterface( sqlite3 * handle, b
318318
QString tableName = QString::fromUtf8( lyr->TableName );
319319
QString column = QString::fromUtf8( lyr->GeometryName );
320320
QString type = tr( "UNKNOWN" );
321-
switch (lyr->GeometryType)
321+
switch ( lyr->GeometryType )
322322
{
323323
case GAIA_VECTOR_GEOMETRY:
324-
type = tr( "GEOMETRY" );
325-
break;
324+
type = tr( "GEOMETRY" );
325+
break;
326326
case GAIA_VECTOR_POINT:
327-
type = tr( "POINT" );
328-
break;
327+
type = tr( "POINT" );
328+
break;
329329
case GAIA_VECTOR_LINESTRING:
330-
type = tr( "LINESTRING" );
331-
break;
330+
type = tr( "LINESTRING" );
331+
break;
332332
case GAIA_VECTOR_POLYGON:
333-
type = tr( "POLYGON" );
334-
break;
333+
type = tr( "POLYGON" );
334+
break;
335335
case GAIA_VECTOR_MULTIPOINT:
336-
type = tr( "MULTIPOINT" );
337-
break;
336+
type = tr( "MULTIPOINT" );
337+
break;
338338
case GAIA_VECTOR_MULTILINESTRING:
339-
type = tr( "MULTILINESTRING" );
340-
break;
339+
type = tr( "MULTILINESTRING" );
340+
break;
341341
case GAIA_VECTOR_MULTIPOLYGON:
342-
type = tr( "MULTIPOLYGON" );
343-
break;
342+
type = tr( "MULTIPOLYGON" );
343+
break;
344344
case GAIA_VECTOR_GEOMETRYCOLLECTION:
345-
type = tr( "GEOMETRYCOLLECTION" );
346-
break;
345+
type = tr( "GEOMETRYCOLLECTION" );
346+
break;
347347
};
348348
mTables.append( TableEntry( tableName, column, type ) );
349349
ok = true;
350350

351351
lyr = lyr->Next;
352352
}
353-
gaiaFreeVectorLayersList (list);
353+
gaiaFreeVectorLayersList( list );
354354
}
355355

356356
if ( loadGeometrylessTables )

‎src/providers/spatialite/qgsspatialiteconnection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class QgsSpatiaLiteConnection : public QObject
8686
bool getTableInfo( sqlite3 * handle, bool loadGeometrylessTables );
8787

8888
#ifdef SPATIALITE_RECENT_VERSION
89-
// only if libspatialite version is >= 4.0.0
89+
// only if libspatialite version is >= 4.0.0
9090
/**
9191
Inserts information about the spatial tables into mTables
9292
please note: this method is fully based on the Abstract Interface

‎src/providers/spatialite/qgsspatialiteprovider.cpp

Lines changed: 103 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -443,22 +443,22 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
443443
gaiaVectorLayerPtr lyr = NULL;
444444
bool specialCase = false;
445445
if ( mGeometryColumn.isNull() )
446-
specialCase = true; // non-spatial table
446+
specialCase = true; // non-spatial table
447447
if ( mQuery.startsWith( "(" ) && mQuery.endsWith( ")" ) )
448-
specialCase = true;
448+
specialCase = true;
449449

450450
if ( specialCase == false )
451451
{
452452
// using v.4.0 Abstract Interface
453453
ret = true;
454-
list = gaiaGetVectorLayersList ( handle->handle(),
455-
mTableName.toUtf8().constData(),
456-
mGeometryColumn.toUtf8().constData(),
457-
GAIA_VECTORS_LIST_OPTIMISTIC);
454+
list = gaiaGetVectorLayersList( handle->handle(),
455+
mTableName.toUtf8().constData(),
456+
mGeometryColumn.toUtf8().constData(),
457+
GAIA_VECTORS_LIST_OPTIMISTIC );
458458
if ( list != NULL )
459-
lyr = list->First;
459+
lyr = list->First;
460460
if ( lyr == NULL )
461-
ret = false;
461+
ret = false;
462462
else
463463
{
464464
ret = checkLayerTypeAbstractInterface( lyr );
@@ -501,53 +501,54 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
501501
if ( lyr != NULL )
502502
{
503503
// using the v.4.0 AbstractInterface
504-
if ( !getGeometryDetailsAbstractInterface( lyr ) ) // gets srid and geometry type
505-
{
506-
// the table is not a geometry table
507-
numberFeatures = 0;
508-
valid = false;
509-
QgsDebugMsg( "Invalid SpatiaLite layer" );
510-
closeDb();
511-
gaiaFreeVectorLayersList ( list );
512-
return;
513-
}
514-
if ( !getTableSummaryAbstractInterface( lyr ) ) // gets the extent and feature count
515-
{
516-
numberFeatures = 0;
517-
valid = false;
518-
QgsDebugMsg( "Invalid SpatiaLite layer" );
519-
closeDb();
520-
gaiaFreeVectorLayersList ( list );
521-
return;
522-
}
523-
// load the columns list
524-
loadFieldsAbstractInterface( lyr );
525-
gaiaFreeVectorLayersList ( list );
526-
alreadyDone = true;
504+
if ( !getGeometryDetailsAbstractInterface( lyr ) ) // gets srid and geometry type
505+
{
506+
// the table is not a geometry table
507+
numberFeatures = 0;
508+
valid = false;
509+
QgsDebugMsg( "Invalid SpatiaLite layer" );
510+
closeDb();
511+
gaiaFreeVectorLayersList( list );
512+
return;
513+
}
514+
if ( !getTableSummaryAbstractInterface( lyr ) ) // gets the extent and feature count
515+
{
516+
numberFeatures = 0;
517+
valid = false;
518+
QgsDebugMsg( "Invalid SpatiaLite layer" );
519+
closeDb();
520+
gaiaFreeVectorLayersList( list );
521+
return;
522+
}
523+
// load the columns list
524+
loadFieldsAbstractInterface( lyr );
525+
gaiaFreeVectorLayersList( list );
526+
alreadyDone = true;
527527
}
528528
#endif
529529

530-
if ( alreadyDone == false ) {
530+
if ( alreadyDone == false )
531+
{
531532
// using the traditional methods
532-
if ( !getGeometryDetails() ) // gets srid and geometry type
533-
{
534-
// the table is not a geometry table
535-
numberFeatures = 0;
536-
valid = false;
537-
QgsDebugMsg( "Invalid SpatiaLite layer" );
538-
closeDb();
539-
return;
540-
}
541-
if ( !getTableSummary() ) // gets the extent and feature count
542-
{
543-
numberFeatures = 0;
544-
valid = false;
545-
QgsDebugMsg( "Invalid SpatiaLite layer" );
546-
closeDb();
547-
return;
548-
}
549-
// load the columns list
550-
loadFields();
533+
if ( !getGeometryDetails() ) // gets srid and geometry type
534+
{
535+
// the table is not a geometry table
536+
numberFeatures = 0;
537+
valid = false;
538+
QgsDebugMsg( "Invalid SpatiaLite layer" );
539+
closeDb();
540+
return;
541+
}
542+
if ( !getTableSummary() ) // gets the extent and feature count
543+
{
544+
numberFeatures = 0;
545+
valid = false;
546+
QgsDebugMsg( "Invalid SpatiaLite layer" );
547+
closeDb();
548+
return;
549+
}
550+
// load the columns list
551+
loadFields();
551552
}
552553
if ( sqliteHandle == NULL )
553554
{
@@ -580,7 +581,7 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
580581
}
581582

582583
attributeFields.clear();
583-
mPrimaryKey.clear(); // cazzo cazzo cazzo
584+
mPrimaryKey.clear(); // cazzo cazzo cazzo
584585

585586
gaiaLayerAttributeFieldPtr fld = lyr->First;
586587
if ( fld == NULL )
@@ -597,7 +598,7 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
597598
if ( name != mGeometryColumn )
598599
{
599600
const char *type = "TEXT";
600-
QVariant::Type fieldType = QVariant::String; // default: SQLITE_TEXT
601+
QVariant::Type fieldType = QVariant::String; // default: SQLITE_TEXT
601602
if ( fld->IntegerValuesCount != 0 && fld->DoubleValuesCount == 0 &&
602603
fld->TextValuesCount == 0 && fld->BlobValuesCount == 0 )
603604
{
@@ -4362,7 +4363,7 @@ QString QgsSpatiaLiteProvider::quotedValue( QString value )
43624363
}
43634364

43644365
#ifdef SPATIALITE_RECENT_VERSION
4365-
// only if libspatialite version is >= 4.0.0
4366+
// only if libspatialite version is >= 4.0.0
43664367
bool QgsSpatiaLiteProvider::checkLayerTypeAbstractInterface( gaiaVectorLayerPtr lyr )
43674368
{
43684369
if ( lyr == NULL )
@@ -4379,24 +4380,24 @@ bool QgsSpatiaLiteProvider::checkLayerTypeAbstractInterface( gaiaVectorLayerPtr
43794380
switch ( lyr->LayerType )
43804381
{
43814382
case GAIA_VECTOR_TABLE:
4382-
mTableBased = true;
4383-
break;
4383+
mTableBased = true;
4384+
break;
43844385
case GAIA_VECTOR_VIEW:
4385-
mViewBased = true;
4386-
break;
4386+
mViewBased = true;
4387+
break;
43874388
case GAIA_VECTOR_VIRTUAL:
4388-
mVShapeBased = true;
4389-
break;
4389+
mVShapeBased = true;
4390+
break;
43904391
};
43914392

43924393
if ( lyr->AuthInfos )
43934394
{
43944395
if ( lyr->AuthInfos->IsReadOnly )
4395-
mReadOnly = true;
4396+
mReadOnly = true;
43964397
}
4397-
else if ( mViewBased == true)
4398+
else if ( mViewBased == true )
43984399
{
4399-
mReadOnly = !hasTriggers();
4400+
mReadOnly = !hasTriggers();
44004401
}
44014402

44024403
if ( !isQuery )
@@ -4589,7 +4590,7 @@ bool QgsSpatiaLiteProvider::checkLayerType()
45894590
}
45904591

45914592
#ifdef SPATIALITE_RECENT_VERSION
4592-
// only if libspatialite version is >= 4.0.0
4593+
// only if libspatialite version is >= 4.0.0
45934594
bool QgsSpatiaLiteProvider::getGeometryDetailsAbstractInterface( gaiaVectorLayerPtr lyr )
45944595
{
45954596
if ( lyr == NULL )
@@ -4600,29 +4601,29 @@ bool QgsSpatiaLiteProvider::getGeometryDetailsAbstractInterface( gaiaVectorLayer
46004601
mIndexTable = mTableName;
46014602
mIndexGeometry = mGeometryColumn;
46024603

4603-
switch (lyr->GeometryType)
4604+
switch ( lyr->GeometryType )
46044605
{
46054606
case GAIA_VECTOR_POINT:
4606-
geomType = QGis::WKBPoint;
4607-
break;
4607+
geomType = QGis::WKBPoint;
4608+
break;
46084609
case GAIA_VECTOR_LINESTRING:
4609-
geomType = QGis::WKBLineString;
4610-
break;
4610+
geomType = QGis::WKBLineString;
4611+
break;
46114612
case GAIA_VECTOR_POLYGON:
4612-
geomType = QGis::WKBPolygon;
4613-
break;
4613+
geomType = QGis::WKBPolygon;
4614+
break;
46144615
case GAIA_VECTOR_MULTIPOINT:
4615-
geomType = QGis::WKBMultiPoint;
4616-
break;
4616+
geomType = QGis::WKBMultiPoint;
4617+
break;
46174618
case GAIA_VECTOR_MULTILINESTRING:
4618-
geomType = QGis::WKBMultiLineString;
4619-
break;
4619+
geomType = QGis::WKBMultiLineString;
4620+
break;
46204621
case GAIA_VECTOR_MULTIPOLYGON:
4621-
geomType = QGis::WKBMultiPolygon;
4622-
break;
4622+
geomType = QGis::WKBMultiPolygon;
4623+
break;
46234624
default:
4624-
geomType = QGis::WKBUnknown;
4625-
break;
4625+
geomType = QGis::WKBUnknown;
4626+
break;
46264627
};
46274628
mSrid = lyr->Srid;
46284629
if ( lyr->SpatialIndex == GAIA_SPATIAL_INDEX_RTREE )
@@ -4636,17 +4637,17 @@ bool QgsSpatiaLiteProvider::getGeometryDetailsAbstractInterface( gaiaVectorLayer
46364637
switch ( lyr->Dimensions )
46374638
{
46384639
case GAIA_XY:
4639-
nDims = GAIA_XY;
4640-
break;
4640+
nDims = GAIA_XY;
4641+
break;
46414642
case GAIA_XY_Z:
4642-
nDims = GAIA_XY_Z;
4643-
break;
4643+
nDims = GAIA_XY_Z;
4644+
break;
46444645
case GAIA_XY_M:
4645-
nDims = GAIA_XY_M;
4646-
break;
4646+
nDims = GAIA_XY_M;
4647+
break;
46474648
case GAIA_XY_Z_M:
4648-
nDims = GAIA_XY_Z_M;
4649-
break;
4649+
nDims = GAIA_XY_Z_M;
4650+
break;
46504651
};
46514652

46524653
if ( mViewBased && spatialIndexRTree )
@@ -5125,7 +5126,7 @@ bool QgsSpatiaLiteProvider::getSridDetails()
51255126
}
51265127

51275128
#ifdef SPATIALITE_RECENT_VERSION
5128-
// only if libspatialite version is >= 4.0.0
5129+
// only if libspatialite version is >= 4.0.0
51295130
bool QgsSpatiaLiteProvider::getTableSummaryAbstractInterface( gaiaVectorLayerPtr lyr )
51305131
{
51315132
if ( lyr == NULL )
@@ -5367,21 +5368,21 @@ QGISEXTERN bool deleteLayer( const QString& dbPath, const QString& tableName, QS
53675368
{
53685369
// if libspatialite is v.4.0 (or higher) using the internal library
53695370
// method is highly recommended
5370-
if ( !gaiaDropTable( sqlite_handle, tableName.toUtf8().constData() ) )
5371-
{
5372-
// unexpected error
5373-
errCause = QObject::tr( "Unable to delete table %1\n" ).arg( tableName );
5374-
QgsSpatiaLiteProvider::SqliteHandles::closeDb( hndl );
5375-
return false;
5376-
}
5377-
// run VACUUM to free unused space and compact the database
5378-
int ret = sqlite3_exec( sqlite_handle, "VACUUM", NULL, NULL, NULL );
5379-
if ( ret != SQLITE_OK )
5380-
{
5381-
QgsDebugMsg( "Failed to run VACUUM after deleting table on database " + dbPath );
5382-
}
5371+
if ( !gaiaDropTable( sqlite_handle, tableName.toUtf8().constData() ) )
5372+
{
5373+
// unexpected error
5374+
errCause = QObject::tr( "Unable to delete table %1\n" ).arg( tableName );
53835375
QgsSpatiaLiteProvider::SqliteHandles::closeDb( hndl );
5384-
return true;
5376+
return false;
5377+
}
5378+
// run VACUUM to free unused space and compact the database
5379+
int ret = sqlite3_exec( sqlite_handle, "VACUUM", NULL, NULL, NULL );
5380+
if ( ret != SQLITE_OK )
5381+
{
5382+
QgsDebugMsg( "Failed to run VACUUM after deleting table on database " + dbPath );
5383+
}
5384+
QgsSpatiaLiteProvider::SqliteHandles::closeDb( hndl );
5385+
return true;
53855386
}
53865387
#endif
53875388

‎src/providers/spatialite/qgsspatialiteprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
410410
bool getSridDetails();
411411
bool getTableSummary();
412412
#ifdef SPATIALITE_RECENT_VERSION
413-
// only if libspatialite version is >= 4.0.0
413+
// only if libspatialite version is >= 4.0.0
414414
bool checkLayerTypeAbstractInterface( gaiaVectorLayerPtr lyr );
415415
bool getGeometryDetailsAbstractInterface( gaiaVectorLayerPtr lyr );
416416
bool getTableSummaryAbstractInterface( gaiaVectorLayerPtr lyr );

‎src/providers/spatialite/qgsspatialitesourceselect.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ void QgsSpatiaLiteSourceSelect::updateStatistics()
144144
if ( idx > 0 )
145145
subKey.truncate( idx );
146146

147-
QString msg = tr( "Do you confirm updating the Internal Statistics for DB: %1 ?\n\n"
147+
QString msg = tr( "Are you sure you want to update the internal statistics for DB: %1?\n\n"
148148
"This could take a long time (depending on the DB size),\n"
149-
"but implies better performances in the afterwhile" ).arg( subKey );
149+
"but implies better performance thereafter." ).arg( subKey );
150150
QMessageBox::StandardButton result =
151151
QMessageBox::information( this, tr( "Confirm Update Statistics" ), msg, QMessageBox::Ok | QMessageBox::Cancel );
152152
if ( result != QMessageBox::Ok )
@@ -157,12 +157,12 @@ void QgsSpatiaLiteSourceSelect::updateStatistics()
157157
if ( conn.updateStatistics() == true )
158158
{
159159
QMessageBox::information( this, tr( "Update Statistics" ),
160-
tr( "Internal Statistics succesfully updated for: %1" ).arg( subKey ) );
160+
tr( "Internal statistics successfully updated for: %1" ).arg( subKey ) );
161161
}
162162
else
163163
{
164164
QMessageBox::critical( this, tr( "Update Statistics" ),
165-
tr( "Error while updating Internal Statistics for: %1" ).arg( subKey ) );
165+
tr( "Error while updating internal statistics for: %1" ).arg( subKey ) );
166166
}
167167
}
168168

0 commit comments

Comments
 (0)
Please sign in to comment.