Skip to content

Commit

Permalink
update code layout according to the new astyle version
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasMizera committed May 13, 2024
1 parent bbae798 commit 48fc05f
Show file tree
Hide file tree
Showing 27 changed files with 95 additions and 95 deletions.
4 changes: 2 additions & 2 deletions app/activeproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ActiveProject::ActiveProject( AppSettings &appSettings
QObject::connect(
&mLocalProjectsManager,
&LocalProjectsManager::aboutToRemoveLocalProject,
this, [this]( const LocalProject & project )
this, [this]( const LocalProject &project )
{
if ( project.id() == mLocalProject.id() )
{
Expand All @@ -62,7 +62,7 @@ ActiveProject::ActiveProject( AppSettings &appSettings
QObject::connect(
&mLocalProjectsManager,
&LocalProjectsManager::localProjectDataChanged,
this, [this]( const LocalProject & project )
this, [this]( const LocalProject &project )
{
if ( project.projectDir == mLocalProject.projectDir )
{
Expand Down
6 changes: 3 additions & 3 deletions app/attributes/fieldvalidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ QString FieldValidator::constructConstraintValidationMessage( const FormItem &it
QgsFieldConstraints fldCons = field.constraints();
QStringList validationMessages;

bool hasNotNullConstraint = fldCons.constraints() & QgsFieldConstraints::ConstraintNotNull;
bool hasNotNullConstraint = fldCons.constraints() &QgsFieldConstraints::ConstraintNotNull;
bool notNullViolated = unmetConstraints.contains( QStringLiteral( "value is NULL" ) );

if ( hasNotNullConstraint && notNullViolated )
Expand All @@ -212,7 +212,7 @@ QString FieldValidator::constructConstraintValidationMessage( const FormItem &it
}
}

bool hasUniqueConstraint = fldCons.constraints() & QgsFieldConstraints::ConstraintUnique;
bool hasUniqueConstraint = fldCons.constraints() &QgsFieldConstraints::ConstraintUnique;
bool uniqueViolated = unmetConstraints.contains( QStringLiteral( "value is not unique" ) );

if ( hasUniqueConstraint && uniqueViolated )
Expand All @@ -229,7 +229,7 @@ QString FieldValidator::constructConstraintValidationMessage( const FormItem &it
}
}

bool hasExpressionConstrain = fldCons.constraints() & QgsFieldConstraints::ConstraintExpression;
bool hasExpressionConstrain = fldCons.constraints() &QgsFieldConstraints::ConstraintExpression;
bool expressionViolated = unmetConstraints.filter( QRegularExpression( "(parser error|evaluation error|check failed)" ) ).size() > 0;

if ( hasExpressionConstrain && expressionViolated )
Expand Down
8 changes: 4 additions & 4 deletions app/identifykit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ QgsFeatureList IdentifyKit::identifyVectorLayer( QgsVectorLayer *layer, const Qg
QgsRenderContext context( QgsRenderContext::fromMapSettings( mMapSettings->mapSettings() ) );
context.expressionContext() << QgsExpressionContextUtils::layerScope( layer );
QgsFeatureRenderer *renderer = layer->renderer();
if ( renderer && renderer->capabilities() & QgsFeatureRenderer::ScaleDependent )
if ( renderer && renderer->capabilities() &QgsFeatureRenderer::ScaleDependent )
{
// setup scale for scale dependent visibility (rule based)
renderer->startRender( context, layer->fields() );
filter = renderer->capabilities() & QgsFeatureRenderer::Filter;
filter = renderer->capabilities() &QgsFeatureRenderer::Filter;
}

for ( const QgsFeature &feature : featureList )
Expand All @@ -231,7 +231,7 @@ QgsFeatureList IdentifyKit::identifyVectorLayer( QgsVectorLayer *layer, const Qg
results.append( feature );
}

if ( renderer && renderer->capabilities() & QgsFeatureRenderer::ScaleDependent )
if ( renderer && renderer->capabilities() &QgsFeatureRenderer::ScaleDependent )
{
renderer->stopRender( context );
}
Expand All @@ -241,7 +241,7 @@ QgsFeatureList IdentifyKit::identifyVectorLayer( QgsVectorLayer *layer, const Qg

double IdentifyKit::searchRadiusMU( const QgsRenderContext &context ) const
{
return mSearchRadiusMm * context.scaleFactor() * context.mapToPixel().mapUnitsPerPixel();
return mSearchRadiusMm *context.scaleFactor() * context.mapToPixel().mapUnitsPerPixel();
}

double IdentifyKit::searchRadiusMU() const
Expand Down
32 changes: 16 additions & 16 deletions app/inputprojutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,50 +67,50 @@ static QStringList detailsToStr( const QgsDatumTransform::TransformDetails &deta

void InputProjUtils::initCoordinateOperationHandlers()
{
QgsCoordinateTransform::setCustomMissingRequiredGridHandler( [ = ]( const QgsCoordinateReferenceSystem & sourceCrs,
const QgsCoordinateReferenceSystem & destinationCrs,
const QgsDatumTransform::GridDetails & grid )
QgsCoordinateTransform::setCustomMissingRequiredGridHandler( [ = ]( const QgsCoordinateReferenceSystem &sourceCrs,
const QgsCoordinateReferenceSystem &destinationCrs,
const QgsDatumTransform::GridDetails &grid )
{
Q_UNUSED( destinationCrs )
Q_UNUSED( sourceCrs )
logUser( QStringLiteral( "missing required grid: %1" ).arg( grid.shortName ), mMissingRequiredGridReported );
warnUser( tr( "Missing required PROJ datum shift grid: %1. For newly downloaded project please restart Mergin Maps." ).arg( grid.shortName ) );
} );

QgsCoordinateTransform::setCustomMissingPreferredGridHandler( [ = ]( const QgsCoordinateReferenceSystem & sourceCrs,
const QgsCoordinateReferenceSystem & destinationCrs,
const QgsDatumTransform::TransformDetails & preferredOperation,
const QgsDatumTransform::TransformDetails & availableOperation )
QgsCoordinateTransform::setCustomMissingPreferredGridHandler( [ = ]( const QgsCoordinateReferenceSystem &sourceCrs,
const QgsCoordinateReferenceSystem &destinationCrs,
const QgsDatumTransform::TransformDetails &preferredOperation,
const QgsDatumTransform::TransformDetails &availableOperation )
{
Q_UNUSED( destinationCrs )
Q_UNUSED( sourceCrs )
Q_UNUSED( availableOperation )
logUser( QStringLiteral( "missing preffered grid: %1" ).arg( detailsToStr( preferredOperation ).join( ";" ) ), mMissingPreferredGridReported );
} );

QgsCoordinateTransform::setCustomCoordinateOperationCreationErrorHandler( [ = ]( const QgsCoordinateReferenceSystem & sourceCrs,
const QgsCoordinateReferenceSystem & destinationCrs,
const QString & error )
QgsCoordinateTransform::setCustomCoordinateOperationCreationErrorHandler( [ = ]( const QgsCoordinateReferenceSystem &sourceCrs,
const QgsCoordinateReferenceSystem &destinationCrs,
const QString &error )
{
Q_UNUSED( destinationCrs )
Q_UNUSED( sourceCrs )
logUser( QStringLiteral( "coordinate operation creation error: %1" ).arg( error ), mCoordinateOperationCreationErrorReported );
warnUser( tr( "Error creating custom PROJ operation. For newly downloaded project please restart Mergin Maps." ) );
} );

QgsCoordinateTransform::setCustomMissingGridUsedByContextHandler( [ = ]( const QgsCoordinateReferenceSystem & sourceCrs,
const QgsCoordinateReferenceSystem & destinationCrs,
const QgsDatumTransform::TransformDetails & desired )
QgsCoordinateTransform::setCustomMissingGridUsedByContextHandler( [ = ]( const QgsCoordinateReferenceSystem &sourceCrs,
const QgsCoordinateReferenceSystem &destinationCrs,
const QgsDatumTransform::TransformDetails &desired )
{
Q_UNUSED( destinationCrs )
Q_UNUSED( sourceCrs )
logUser( QStringLiteral( "custom missing grid used by context handler %1" ).arg( detailsToStr( desired ).join( ";" ) ), mMissingGridUsedByContextHandlerReported );
warnUser( tr( "Missing required PROJ datum shift grids: %1. For newly downloaded project please restart Mergin Maps." ).arg( detailsToStr( desired ).join( "<br>" ) ) );
} );

QgsCoordinateTransform::setFallbackOperationOccurredHandler( [ = ]( const QgsCoordinateReferenceSystem & sourceCrs,
const QgsCoordinateReferenceSystem & destinationCrs,
const QString & desired )
QgsCoordinateTransform::setFallbackOperationOccurredHandler( [ = ]( const QgsCoordinateReferenceSystem &sourceCrs,
const QgsCoordinateReferenceSystem &destinationCrs,
const QString &desired )
{
Q_UNUSED( destinationCrs )
Q_UNUSED( sourceCrs )
Expand Down
12 changes: 6 additions & 6 deletions app/inpututils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ QString InputUtils::formatDistanceInProjectUnit( const double distanceInMeters,
}

double factor = QgsUnitTypes::fromUnitToUnitFactor( Qgis::DistanceUnit::Meters, distUnit );
double distance = distanceInMeters * factor;
double distance = distanceInMeters *factor;
QString abbreviation = QgsUnitTypes::toAbbreviatedString( distUnit );

return QString( "%1 %2" ).arg( QString::number( distance, 'f', precision ), abbreviation );
Expand Down Expand Up @@ -532,7 +532,7 @@ QString InputUtils::filesToString( QList<MerginFile> files )
QString InputUtils::bytesToHumanSize( double bytes )
{
const int precision = 1;
if ( bytes < 1e-5 )
if ( bytes < 1e - 5 )
{
return "0.0";
}
Expand Down Expand Up @@ -567,7 +567,7 @@ bool InputUtils::acquireCameraPermission()
if ( Qt::PermissionStatus::Undetermined == status )
{
// TODO this is async so it should be treated as such
qApp->requestPermission( QCameraPermission{}, []( const QPermission & permission ) {} );
qApp->requestPermission( QCameraPermission{}, []( const QPermission &permission ) {} );
return false;
}

Expand Down Expand Up @@ -1355,7 +1355,7 @@ void InputUtils::formatToMetricDistance( double srcDistance,
double &destDistance,
Qgis::DistanceUnit &destUnits )
{
double dist = srcDistance * QgsUnitTypes::fromUnitToUnitFactor( srcUnits, Qgis::DistanceUnit::Millimeters );
double dist = srcDistance *QgsUnitTypes::fromUnitToUnitFactor( srcUnits, Qgis::DistanceUnit::Millimeters );
if ( dist < 0 )
{
destDistance = 0;
Expand Down Expand Up @@ -1396,7 +1396,7 @@ void InputUtils::formatToImperialDistance( double srcDistance,
double &destDistance,
Qgis::DistanceUnit &destUnits )
{
double dist = srcDistance * QgsUnitTypes::fromUnitToUnitFactor( srcUnits, Qgis::DistanceUnit::Feet );
double dist = srcDistance *QgsUnitTypes::fromUnitToUnitFactor( srcUnits, Qgis::DistanceUnit::Feet );
if ( dist < 0 )
{
destDistance = 0;
Expand Down Expand Up @@ -1430,7 +1430,7 @@ void InputUtils::formatToUSCSDistance( double srcDistance,
double &destDistance,
Qgis::DistanceUnit &destUnits )
{
double dist = srcDistance * QgsUnitTypes::fromUnitToUnitFactor( srcUnits, Qgis::DistanceUnit::Feet );
double dist = srcDistance *QgsUnitTypes::fromUnitToUnitFactor( srcUnits, Qgis::DistanceUnit::Feet );
if ( dist < 0 )
{
destDistance = 0;
Expand Down
2 changes: 1 addition & 1 deletion app/inpututils_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ qreal InputUtilsPrivate::calculateScreenDpr()
double dpiY = screen->physicalDotsPerInchY();

qreal realDpi = dpiX < dpiY ? dpiX : dpiY;
realDpi = realDpi * screen->devicePixelRatio();
realDpi = realDpi *screen->devicePixelRatio();

return realDpi / 160.;
}
Expand Down
6 changes: 3 additions & 3 deletions app/ios/iosinterface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ +( void )showImagePicker:( int )sourceType : ( IOSImagePicker * )handler
static IOSViewDelegate *delegate = nullptr;
delegate = [[IOSViewDelegate alloc] initWithHandler:handler];

[[NSNotificationCenter defaultCenter] addObserverForName:@"_UIImagePickerControllerUserDidCaptureItem" object:nil queue:nil usingBlock: ^ ( NSNotification * _Nonnull notification )
[[NSNotificationCenter defaultCenter] addObserverForName:@"_UIImagePickerControllerUserDidCaptureItem" object:nil queue:nil usingBlock: ^ ( NSNotification *_Nonnull notification )
{
Q_UNUSED( notification )
// Fetch GPS data when an image is captured
mGpsData = getGPSData( delegate->handler->positionKit(), delegate->handler->compass() );
}];

// Confirm event
delegate->imagePickerControllerDidFinishPickingMediaWithInfo = ^( UIImagePickerController * picker, NSDictionary * info )
delegate->imagePickerControllerDidFinishPickingMediaWithInfo = ^( UIImagePickerController *picker, NSDictionary *info )
{
if ( delegate->processingPicture )
{
Expand Down Expand Up @@ -253,7 +253,7 @@ +( void )showImagePicker:( int )sourceType : ( IOSImagePicker * )handler


// Cancel event
delegate->imagePickerControllerDidCancel = ^( UIImagePickerController * picker )
delegate->imagePickerControllerDidCancel = ^( UIImagePickerController *picker )
{
qWarning() << "Image Picker: Cancel event (imagePickerControllerDidCancel)";
[picker dismissViewControllerAnimated:YES completion:nil];
Expand Down
2 changes: 1 addition & 1 deletion app/ios/iosutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ IosUtils::IosUtils( QObject *parent ): QObject( parent )
setIdleTimerDisabled();
#endif
mImagePicker = new IOSImagePicker();
QObject::connect( mImagePicker, &IOSImagePicker::imageCaptured, this, [this]( const QString & absoluteImagePath )
QObject::connect( mImagePicker, &IOSImagePicker::imageCaptured, this, [this]( const QString &absoluteImagePath )
{
emit imageSelected( absoluteImagePath, mLastCode );
} );
Expand Down
4 changes: 2 additions & 2 deletions app/ios/iosviewdelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ UINavigationControllerDelegate>
IOSImagePicker *handler;
BOOL processingPicture;

void ( ^ imagePickerControllerDidFinishPickingMediaWithInfo )( UIImagePickerController * picker, NSDictionary * info );
void ( ^ imagePickerControllerDidCancel )( UIImagePickerController * picker );
void ( ^imagePickerControllerDidFinishPickingMediaWithInfo )( UIImagePickerController *picker, NSDictionary *info );
void ( ^imagePickerControllerDidCancel )( UIImagePickerController *picker );
}
- ( id ) initWithHandler:( IOSImagePicker * )handler;
@end
Expand Down
2 changes: 1 addition & 1 deletion app/layer/layerdetaildata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void LayerDetailData::setLayerTreeNode( QgsLayerTreeNode *newLayerTreeNode )
emit mapLayerChanged( nodeLayer->layer() );

// listen on visibility change
connect( mLayerTreeNode, &QgsLayerTreeNode::visibilityChanged, this, [this]( QgsLayerTreeNode * node )
connect( mLayerTreeNode, &QgsLayerTreeNode::visibilityChanged, this, [this]( QgsLayerTreeNode *node )
{
if ( node && node == mLayerTreeNode && node->isVisible() != this->isVisible() )
{
Expand Down
2 changes: 1 addition & 1 deletion app/layer/layertreeflatsortfiltermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool LayerTreeFlatSortFilterModel::filterAcceptsRow( int source_row, const QMode

if ( layer )
{
bool isPrivate = layer->flags() & QgsMapLayer::LayerFlag::Private;
bool isPrivate = layer->flags() &QgsMapLayer::LayerFlag::Private;

if ( isPrivate )
{
Expand Down
2 changes: 1 addition & 1 deletion app/layer/layertreesortfiltermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bool LayerTreeSortFilterModel::filterAcceptsRow( int source_row, const QModelInd

if ( layer )
{
bool isPrivate = layer->flags() & QgsMapLayer::LayerFlag::Private;
bool isPrivate = layer->flags() &QgsMapLayer::LayerFlag::Private;

if ( isPrivate )
{
Expand Down
2 changes: 1 addition & 1 deletion app/layersproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LayersProxyModel::LayersProxyModel( LayersModel *model, LayerModelTypes modelTyp
switch ( mModelType )
{
case ActiveLayerSelection:
filterFunction = [this]( QgsMapLayer * layer ) { return recordingAllowed( layer ); };
filterFunction = [this]( QgsMapLayer *layer ) { return recordingAllowed( layer ); };
break;
default:
filterFunction = []( QgsMapLayer * ) { return true; };
Expand Down
26 changes: 13 additions & 13 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ int main( int argc, char *argv[] )

// there seem to be issues with HTTP/2 server support (QTBUG-111417)
// so let's stick to HTTP/1 for the time being (Qt5 has HTTP/2 disabled by default)
QgsNetworkAccessManager::instance()->setRequestPreprocessor( []( QNetworkRequest * r )
QgsNetworkAccessManager::instance()->setRequestPreprocessor( []( QNetworkRequest *r )
{
r->setAttribute( QNetworkRequest::Http2AllowedAttribute, false );
} );
Expand Down Expand Up @@ -499,7 +499,7 @@ int main( int argc, char *argv[] )

// build position kit, save active provider to QSettings and load previously active provider
PositionKit pk;
QObject::connect( &pk, &PositionKit::positionProviderChanged, &as, [&as]( AbstractPositionProvider * provider )
QObject::connect( &pk, &PositionKit::positionProviderChanged, &as, [ &as]( AbstractPositionProvider *provider )
{
as.setActivePositionProviderId( provider ? provider->id() : QLatin1String() );
} );
Expand Down Expand Up @@ -527,52 +527,52 @@ int main( int argc, char *argv[] )
CoreUtils::log( QStringLiteral( "AppState" ), QStringLiteral( "Application has quit" ) );
} );

QObject::connect( &help, &InputHelp::submitReportSuccessful, &lambdaContext, [&notificationModel]()
QObject::connect( &help, &InputHelp::submitReportSuccessful, &lambdaContext, [ &notificationModel]()
{
notificationModel.addSuccess( QObject::tr( "Report submitted. Please contact us on %1" ).arg( InputHelp::helpdeskMail() ) );
} );

QObject::connect( &help, &InputHelp::submitReportFailed, &lambdaContext, [&notificationModel]()
QObject::connect( &help, &InputHelp::submitReportFailed, &lambdaContext, [ &notificationModel]()
{
notificationModel.addError( QObject::tr( "Failed to submit report. Please check your internet connection." ) );
} );

QObject::connect( &pw, &ProjectWizard::notifySuccess, &lambdaContext, [&notificationModel]( const QString & message )
QObject::connect( &pw, &ProjectWizard::notifySuccess, &lambdaContext, [ &notificationModel]( const QString &message )
{
notificationModel.addSuccess( message );
} );

QObject::connect( &iosUtils, &IosUtils::notifyError, &lambdaContext, [&notificationModel]( const QString & message )
QObject::connect( &iosUtils, &IosUtils::notifyError, &lambdaContext, [ &notificationModel]( const QString &message )
{
notificationModel.addError( message );
} );

QObject::connect( &androidUtils, &AndroidUtils::notifyInfo, &lambdaContext, [&notificationModel]( const QString & message )
QObject::connect( &androidUtils, &AndroidUtils::notifyInfo, &lambdaContext, [ &notificationModel]( const QString &message )
{
notificationModel.addInfo( message );
} );

QObject::connect( &androidUtils, &AndroidUtils::notifyError, &lambdaContext, [&notificationModel]( const QString & message )
QObject::connect( &androidUtils, &AndroidUtils::notifyError, &lambdaContext, [ &notificationModel]( const QString &message )
{
notificationModel.addError( message );
} );

QObject::connect( &activeProject, &ActiveProject::syncActiveProject, &syncManager, [&syncManager]( const LocalProject & project )
QObject::connect( &activeProject, &ActiveProject::syncActiveProject, &syncManager, [ &syncManager]( const LocalProject &project )
{
syncManager.syncProject( project, SyncOptions::Authorized, SyncOptions::Retry );
} );

QObject::connect( ma.get(), &MerginApi::notifyInfo, &lambdaContext, [&notificationModel]( const QString & message )
QObject::connect( ma.get(), &MerginApi::notifyInfo, &lambdaContext, [ &notificationModel]( const QString &message )
{
notificationModel.addInfo( message );
} );

QObject::connect( ma.get(), &MerginApi::notifySuccess, &lambdaContext, [&notificationModel]( const QString & message )
QObject::connect( ma.get(), &MerginApi::notifySuccess, &lambdaContext, [ &notificationModel]( const QString &message )
{
notificationModel.addSuccess( message );
} );

QObject::connect( ma.get(), &MerginApi::notifyError, &lambdaContext, [&notificationModel]( const QString & message )
QObject::connect( ma.get(), &MerginApi::notifyError, &lambdaContext, [ &notificationModel]( const QString &message )
{
notificationModel.addError( message );
} );
Expand All @@ -581,7 +581,7 @@ int main( int argc, char *argv[] )
QObject::connect( &pw, &ProjectWizard::projectCreated, &localProjectsManager, &LocalProjectsManager::addLocalProject );
QObject::connect( &activeProject, &ActiveProject::projectReloaded, vm.get(), &VariablesManager::merginProjectChanged );
QObject::connect( &activeProject, &ActiveProject::projectWillBeReloaded, &inputProjUtils, &InputProjUtils::resetHandlers );
QObject::connect( &syncManager, &SynchronizationManager::syncFinished, &activeProject, [&activeProject]( const QString & projectFullName, bool successfully, int version, bool reloadNeeded )
QObject::connect( &syncManager, &SynchronizationManager::syncFinished, &activeProject, [ &activeProject]( const QString &projectFullName, bool successfully, int version, bool reloadNeeded )
{
Q_UNUSED( successfully );
Q_UNUSED( version );
Expand Down
Loading

0 comments on commit 48fc05f

Please sign in to comment.