diff --git a/src/analysis/processing/qgsalgorithmpointstopaths.cpp b/src/analysis/processing/qgsalgorithmpointstopaths.cpp index 8a0c4aa4fab8..298e9d11bce0 100644 --- a/src/analysis/processing/qgsalgorithmpointstopaths.cpp +++ b/src/analysis/processing/qgsalgorithmpointstopaths.cpp @@ -62,27 +62,29 @@ QString QgsPointsToPathsAlgorithm::groupId() const void QgsPointsToPathsAlgorithm::initAlgorithm( const QVariantMap & ) { - addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) ); - addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "CLOSE_PATH" ), QObject::tr( "Create closed paths" ), false, true ) ); - addParameter( new QgsProcessingParameterExpression( QStringLiteral( "ORDER_EXPRESSION" ), QObject::tr( "Order expression" ), QVariant(), QStringLiteral( "INPUT" ), true ) ); - addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "NATURAL_SORT" ), QObject::tr( "Sort text containing numbers naturally" ), false, true ) ); - addParameter( new QgsProcessingParameterExpression( QStringLiteral( "GROUP_EXPRESSION" ), QObject::tr( "Path group expression" ), QVariant(), QStringLiteral( "INPUT" ), true ) ); - addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Paths" ), Qgis::ProcessingSourceType::VectorLine ) ); + addParameter( std::make_unique( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), QList() << static_cast( Qgis::ProcessingSourceType::VectorPoint ) ) ); + addParameter( std::make_unique( QStringLiteral( "CLOSE_PATH" ), QObject::tr( "Create closed paths" ), false, true ) ); + addParameter( std::make_unique( QStringLiteral( "ORDER_EXPRESSION" ), QObject::tr( "Order expression" ), QVariant(), QStringLiteral( "INPUT" ), true ) ); + addParameter( std::make_unique( QStringLiteral( "NATURAL_SORT" ), QObject::tr( "Sort text containing numbers naturally" ), false, true ) ); + addParameter( std::make_unique( QStringLiteral( "GROUP_EXPRESSION" ), QObject::tr( "Path group expression" ), QVariant(), QStringLiteral( "INPUT" ), true ) ); + addParameter( std::make_unique( QStringLiteral( "OUTPUT" ), QObject::tr( "Paths" ), Qgis::ProcessingSourceType::VectorLine ) ); // TODO QGIS 4: remove parameter. move logic to separate algorithm if needed. - addParameter( new QgsProcessingParameterFolderDestination( QStringLiteral( "OUTPUT_TEXT_DIR" ), QObject::tr( "Directory for text output" ), QVariant(), true, false ) ); - addOutput( new QgsProcessingOutputNumber( QStringLiteral( "NUM_PATHS" ), QObject::tr( "Number of paths" ) ) ); + addParameter( std::make_unique( QStringLiteral( "OUTPUT_TEXT_DIR" ), QObject::tr( "Directory for text output" ), QVariant(), true, false ) ); + addOutput( std::make_unique( QStringLiteral( "NUM_PATHS" ), QObject::tr( "Number of paths" ) ) ); // backwards compatibility parameters // TODO QGIS 4: remove compatibility parameters and their logic - QgsProcessingParameterField *orderField = new QgsProcessingParameterField( QStringLiteral( "ORDER_FIELD" ), QObject::tr( "Order field" ), QVariant(), QString(), Qgis::ProcessingFieldParameterDataType::Any, false, true ); + auto orderField = std::make_unique( QStringLiteral( "ORDER_FIELD" ), QObject::tr( "Order field" ), QVariant(), QString(), Qgis::ProcessingFieldParameterDataType::Any, false, true ); orderField->setFlags( orderField->flags() | Qgis::ProcessingParameterFlag::Hidden ); - addParameter( orderField ); - QgsProcessingParameterField *groupField = new QgsProcessingParameterField( QStringLiteral( "GROUP_FIELD" ), QObject::tr( "Group field" ), QVariant(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Any, false, true ); + addParameter( std::move( orderField ) ); + + auto groupField = std::make_unique( QStringLiteral( "GROUP_FIELD" ), QObject::tr( "Group field" ), QVariant(), QStringLiteral( "INPUT" ), Qgis::ProcessingFieldParameterDataType::Any, false, true ); groupField->setFlags( groupField->flags() | Qgis::ProcessingParameterFlag::Hidden ); - addParameter( groupField ); - QgsProcessingParameterString *dateFormat = new QgsProcessingParameterString( QStringLiteral( "DATE_FORMAT" ), QObject::tr( "Date format (if order field is DateTime)" ), QVariant(), false, true ); + addParameter( std::move( groupField ) ); + + auto dateFormat = std::make_unique( QStringLiteral( "DATE_FORMAT" ), QObject::tr( "Date format (if order field is DateTime)" ), QVariant(), false, true ); dateFormat->setFlags( dateFormat->flags() | Qgis::ProcessingParameterFlag::Hidden ); - addParameter( dateFormat ); + addParameter( std::move( dateFormat ) ); } QgsPointsToPathsAlgorithm *QgsPointsToPathsAlgorithm::createInstance() const