Skip to content
Permalink
Browse files

Identation

  • Loading branch information
nyalldawson committed Mar 20, 2021
1 parent 764d802 commit 22aa7332400b8acb05b470a3d21364a41e5fabef
@@ -220,8 +220,8 @@ bool QgsGeoPackageProviderConnection::spatialIndexExists( const QString &schema,
{
QgsMessageLog::logMessage( QStringLiteral( "Schema is not supported by GPKG, ignoring" ), QStringLiteral( "OGR" ), Qgis::Info );
}
const auto res { executeGdalSqlPrivate( QStringLiteral( "SELECT HasSpatialIndex(%1, %2)" ).arg( QgsSqliteUtils::quotedString( name ),
QgsSqliteUtils::quotedString( geometryColumn ) ) ).rows() };
const QList<QList<QVariant> > res = executeGdalSqlPrivate( QStringLiteral( "SELECT HasSpatialIndex(%1, %2)" ).arg( QgsSqliteUtils::quotedString( name ),
QgsSqliteUtils::quotedString( geometryColumn ) ) ).rows();
return !res.isEmpty() && !res.at( 0 ).isEmpty() && res.at( 0 ).at( 0 ).toBool();
}

@@ -255,9 +255,9 @@ QList<QgsGeoPackageProviderConnection::TableProperty> QgsGeoPackageProviderConne

try
{
const QString sql { QStringLiteral( "SELECT c.table_name, data_type, description, c.srs_id, g.geometry_type_name, g.column_name "
"FROM gpkg_contents c LEFT JOIN gpkg_geometry_columns g ON (c.table_name = g.table_name) "
"WHERE c.table_name NOT IN (%1)" ).arg( excludedTableNames.join( ',' ) ) };
const QString sql = QStringLiteral( "SELECT c.table_name, data_type, description, c.srs_id, g.geometry_type_name, g.column_name "
"FROM gpkg_contents c LEFT JOIN gpkg_geometry_columns g ON (c.table_name = g.table_name) "
"WHERE c.table_name NOT IN (%1)" ).arg( excludedTableNames.join( ',' ) );
results = executeSql( sql );

for ( const auto &row : std::as_const( results ) )
@@ -490,9 +490,9 @@ QList<QgsVectorDataProvider::NativeType> QgsGeoPackageProviderConnection::native
const QgsVectorLayer vl { uri(), QStringLiteral( "temp_layer" ), QStringLiteral( "ogr" ), options };
if ( ! vl.isValid() || ! vl.dataProvider() )
{
const QString errorCause { vl.dataProvider() &&vl.dataProvider()->hasErrors() ?
vl.dataProvider()->errors().join( '\n' ) :
QObject::tr( "unknown error" ) };
const QString errorCause = vl.dataProvider() && vl.dataProvider()->hasErrors() ?
vl.dataProvider()->errors().join( '\n' ) :
QObject::tr( "unknown error" );
throw QgsProviderConnectionException( QObject::tr( "Error retrieving native types for %1: %2" ).arg( uri(), errorCause ) );
}
return vl.dataProvider()->nativeTypes();
@@ -106,11 +106,11 @@ void QgsLayoutLabelWidget::buildInsertDynamicTextMenu( QgsLayout *layout, QMenu

QMenu *dateMenu = new QMenu( tr( "Current Date" ), menu );
for ( const std::pair< QString, QString > &expression :
{
std::make_pair( tr( "ISO Format (%1)" ).arg( QDateTime::currentDateTime().toString( QStringLiteral( "yyyy-MM-dd" ) ) ), QStringLiteral( "format_date(now(), 'yyyy-MM-dd')" ) ),
std::make_pair( tr( "Day/Month/Year (%1)" ).arg( QDateTime::currentDateTime().toString( QStringLiteral( "dd/MM/yyyy" ) ) ), QStringLiteral( "format_date(now(), 'dd/MM/yyyy')" ) ),
std::make_pair( tr( "Month/Day/Year (%1)" ).arg( QDateTime::currentDateTime().toString( QStringLiteral( "MM/dd/yyyy" ) ) ), QStringLiteral( "format_date(now(), 'MM/dd/yyyy')" ) ),
} )
{
std::make_pair( tr( "ISO Format (%1)" ).arg( QDateTime::currentDateTime().toString( QStringLiteral( "yyyy-MM-dd" ) ) ), QStringLiteral( "format_date(now(), 'yyyy-MM-dd')" ) ),
std::make_pair( tr( "Day/Month/Year (%1)" ).arg( QDateTime::currentDateTime().toString( QStringLiteral( "dd/MM/yyyy" ) ) ), QStringLiteral( "format_date(now(), 'dd/MM/yyyy')" ) ),
std::make_pair( tr( "Month/Day/Year (%1)" ).arg( QDateTime::currentDateTime().toString( QStringLiteral( "MM/dd/yyyy" ) ) ), QStringLiteral( "format_date(now(), 'MM/dd/yyyy')" ) ),
} )
{
addExpression( dateMenu, expression.first, expression.second );
}
@@ -127,21 +127,21 @@ void QgsLayoutLabelWidget::buildInsertDynamicTextMenu( QgsLayout *layout, QMenu

QMenu *mapMenu = new QMenu( map->displayName(), mapsMenu );
for ( const std::pair< QString, QString > &expression :
{
std::make_pair( tr( "Scale (%1)" ).arg( map->scale() ), QStringLiteral( "item_variables('%1')['map_scale']" ).arg( map->id() ) ),
std::make_pair( tr( "Rotation (%1)" ).arg( map->rotation() ), QStringLiteral( "item_variables('%1')['map_rotation']" ).arg( map->id() ) ),
} )
{
std::make_pair( tr( "Scale (%1)" ).arg( map->scale() ), QStringLiteral( "item_variables('%1')['map_scale']" ).arg( map->id() ) ),
std::make_pair( tr( "Rotation (%1)" ).arg( map->rotation() ), QStringLiteral( "item_variables('%1')['map_rotation']" ).arg( map->id() ) ),
} )
{
addExpression( mapMenu, expression.first, expression.second );
}
mapMenu->addSeparator();
for ( const std::pair< QString, QString > &expression :
{
std::make_pair( tr( "CRS Identifier (%1)" ).arg( map->crs().authid() ), QStringLiteral( "item_variables('%1')['map_crs']" ).arg( map->id() ) ),
std::make_pair( tr( "CRS Name (%1)" ).arg( map->crs().description() ), QStringLiteral( "item_variables('%1')['map_crs_description']" ).arg( map->id() ) ),
std::make_pair( tr( "Ellipsoid Name (%1)" ).arg( map->crs().ellipsoidAcronym() ), QStringLiteral( "item_variables('%1')['map_crs_ellipsoid']" ).arg( map->id() ) ),
std::make_pair( tr( "Units (%1)" ).arg( QgsUnitTypes::toString( map->crs().mapUnits() ) ), QStringLiteral( "item_variables('%1')['map_units']" ).arg( map->id() ) ),
} )
{
std::make_pair( tr( "CRS Identifier (%1)" ).arg( map->crs().authid() ), QStringLiteral( "item_variables('%1')['map_crs']" ).arg( map->id() ) ),
std::make_pair( tr( "CRS Name (%1)" ).arg( map->crs().description() ), QStringLiteral( "item_variables('%1')['map_crs_description']" ).arg( map->id() ) ),
std::make_pair( tr( "Ellipsoid Name (%1)" ).arg( map->crs().ellipsoidAcronym() ), QStringLiteral( "item_variables('%1')['map_crs_ellipsoid']" ).arg( map->id() ) ),
std::make_pair( tr( "Units (%1)" ).arg( QgsUnitTypes::toString( map->crs().mapUnits() ) ), QStringLiteral( "item_variables('%1')['map_units']" ).arg( map->id() ) ),
} )
{
addExpression( mapMenu, expression.first, expression.second );
}
@@ -150,22 +150,22 @@ void QgsLayoutLabelWidget::buildInsertDynamicTextMenu( QgsLayout *layout, QMenu
const QgsRectangle mapExtent = map->extent();
const QgsPointXY center = mapExtent.center();
for ( const std::pair< QString, QString > &expression :
{
std::make_pair( tr( "Center (X) (%1)" ).arg( center.x() ), QStringLiteral( "x(item_variables('%1')['map_extent_center'])" ).arg( map->id() ) ),
std::make_pair( tr( "Center (Y) (%1)" ).arg( center.y() ), QStringLiteral( "y(item_variables('%1')['map_extent_center'])" ).arg( map->id() ) ),
std::make_pair( tr( "X Minimum (%1)" ).arg( mapExtent.xMinimum() ), QStringLiteral( "x_min(item_variables('%1')['map_extent'])" ).arg( map->id() ) ),
std::make_pair( tr( "Y Minimum (%1)" ).arg( mapExtent.yMinimum() ), QStringLiteral( "y_min(item_variables('%1')['map_extent'])" ).arg( map->id() ) ),
std::make_pair( tr( "X Maximum (%1)" ).arg( mapExtent.xMaximum() ), QStringLiteral( "x_max(item_variables('%1')['map_extent'])" ).arg( map->id() ) ),
std::make_pair( tr( "Y Maximum (%1)" ).arg( mapExtent.yMaximum() ), QStringLiteral( "y_max(item_variables('%1')['map_extent'])" ).arg( map->id() ) ),
} )
{
std::make_pair( tr( "Center (X) (%1)" ).arg( center.x() ), QStringLiteral( "x(item_variables('%1')['map_extent_center'])" ).arg( map->id() ) ),
std::make_pair( tr( "Center (Y) (%1)" ).arg( center.y() ), QStringLiteral( "y(item_variables('%1')['map_extent_center'])" ).arg( map->id() ) ),
std::make_pair( tr( "X Minimum (%1)" ).arg( mapExtent.xMinimum() ), QStringLiteral( "x_min(item_variables('%1')['map_extent'])" ).arg( map->id() ) ),
std::make_pair( tr( "Y Minimum (%1)" ).arg( mapExtent.yMinimum() ), QStringLiteral( "y_min(item_variables('%1')['map_extent'])" ).arg( map->id() ) ),
std::make_pair( tr( "X Maximum (%1)" ).arg( mapExtent.xMaximum() ), QStringLiteral( "x_max(item_variables('%1')['map_extent'])" ).arg( map->id() ) ),
std::make_pair( tr( "Y Maximum (%1)" ).arg( mapExtent.yMaximum() ), QStringLiteral( "y_max(item_variables('%1')['map_extent'])" ).arg( map->id() ) ),
} )
{
addExpression( mapMenu, expression.first, expression.second );
}
mapMenu->addSeparator();
for ( const std::pair< QString, QString > &expression :
{
std::make_pair( tr( "Layer Credits" ), QStringLiteral( "array_to_string(map_credits('%1'))" ).arg( map->id() ) ),
} )
{
std::make_pair( tr( "Layer Credits" ), QStringLiteral( "array_to_string(map_credits('%1'))" ).arg( map->id() ) ),
} )
{
addExpression( mapMenu, expression.first, expression.second );
}
@@ -189,30 +189,30 @@ void QgsLayoutLabelWidget::buildInsertDynamicTextMenu( QgsLayout *layout, QMenu
}

for ( const std::pair< QString, QString > &expression :
{
std::make_pair( tr( "Layout Name" ), QStringLiteral( "@layout_name" ) ),
std::make_pair( tr( "Layout Page Number" ), QStringLiteral( "@layout_page" ) ),
std::make_pair( tr( "Layout Page Count" ), QStringLiteral( "@layout_numpages" ) )
} )
{
std::make_pair( tr( "Layout Name" ), QStringLiteral( "@layout_name" ) ),
std::make_pair( tr( "Layout Page Number" ), QStringLiteral( "@layout_page" ) ),
std::make_pair( tr( "Layout Page Count" ), QStringLiteral( "@layout_numpages" ) )
} )
{
addExpression( menu, expression.first, expression.second );
}
menu->addSeparator();
for ( const std::pair< QString, QString > &expression :
{
std::make_pair( tr( "Project Author" ), QStringLiteral( "@project_author" ) ),
std::make_pair( tr( "Project Title" ), QStringLiteral( "@project_title" ) ),
std::make_pair( tr( "Project Path" ), QStringLiteral( "@project_path" ) )
} )
{
std::make_pair( tr( "Project Author" ), QStringLiteral( "@project_author" ) ),
std::make_pair( tr( "Project Title" ), QStringLiteral( "@project_title" ) ),
std::make_pair( tr( "Project Path" ), QStringLiteral( "@project_path" ) )
} )
{
addExpression( menu, expression.first, expression.second );
}
menu->addSeparator();
for ( const std::pair< QString, QString > &expression :
{
std::make_pair( tr( "Current User Name" ), QStringLiteral( "@user_full_name" ) ),
std::make_pair( tr( "Current User Account" ), QStringLiteral( "@user_account_name" ) )
} )
{
std::make_pair( tr( "Current User Name" ), QStringLiteral( "@user_full_name" ) ),
std::make_pair( tr( "Current User Account" ), QStringLiteral( "@user_account_name" ) )
} )
{
addExpression( menu, expression.first, expression.second );
}
@@ -59,13 +59,13 @@ QWidget *QgsPgSourceSelectDelegate::createEditor( QWidget *parent, const QStyleO
if ( index.column() == QgsPgTableModel::DbtmType && index.data( Qt::UserRole + 1 ).toBool() )
{
QComboBox *cb = new QComboBox( parent );
static const QList<QgsWkbTypes::Type> types { QgsWkbTypes::Point
, QgsWkbTypes::LineString
, QgsWkbTypes::Polygon
, QgsWkbTypes::MultiPoint
, QgsWkbTypes::MultiLineString
, QgsWkbTypes::MultiPolygon
, QgsWkbTypes::NoGeometry };
static const QList<QgsWkbTypes::Type> types { QgsWkbTypes::Point,
QgsWkbTypes::LineString,
QgsWkbTypes::Polygon,
QgsWkbTypes::MultiPoint,
QgsWkbTypes::MultiLineString,
QgsWkbTypes::MultiPolygon,
QgsWkbTypes::NoGeometry };
for ( QgsWkbTypes::Type type : types )
{
cb->addItem( QgsLayerItem::iconForWkbType( type ), QgsPostgresConn::displayStringForWkbType( type ), type );

0 comments on commit 22aa733

Please sign in to comment.