Skip to content

Commit

Permalink
[processing] Add operators for parameter type flags, push warning
Browse files Browse the repository at this point in the history
to message log for duplicate parameter registration
  • Loading branch information
nyalldawson committed Mar 6, 2018
1 parent 74d14ae commit 227f706
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/core/processing/qgsprocessingparametertype.sip.in
Expand Up @@ -69,6 +69,9 @@ The default implementation returns an empty map.
%End
};

QFlags<QgsProcessingParameterType::ParameterFlag> operator|(QgsProcessingParameterType::ParameterFlag f1, QFlags<QgsProcessingParameterType::ParameterFlag> f2);


/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
2 changes: 2 additions & 0 deletions src/core/processing/qgsprocessingparametertype.h
Expand Up @@ -86,4 +86,6 @@ class CORE_EXPORT QgsProcessingParameterType
virtual QVariantMap metadata() const;
};

Q_DECLARE_OPERATORS_FOR_FLAGS( QgsProcessingParameterType::ParameterFlags )

#endif // QGSPROCESSINGPARAMETERTYPE_H
3 changes: 3 additions & 0 deletions src/core/processing/qgsprocessingregistry.cpp
Expand Up @@ -163,8 +163,11 @@ bool QgsProcessingRegistry::addParameterType( QgsProcessingParameterType *type )
}
else
{
QgsLogger::warning( QStringLiteral( "Duplicate parameter type %1 (\"%2\") registered" ).arg( type->id(), type->name() ) );

if ( mParameterTypes.value( type->id() ) != type )
delete type;

return false;
}
}
Expand Down

5 comments on commit 227f706

@3nids
Copy link
Member

@3nids 3nids commented on 227f706 Mar 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyalldawson ProcessingQgisAlgorithmsTest is broken, could it be this one?

@nyalldawson
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@3nids it's not this - has there been a gdal update on the docker image? I suspect that's what's happened and the new hash needs to be added to the acceptable list.

@nirvn
Copy link
Contributor

@nirvn nirvn commented on 227f706 Mar 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyalldawson , is there a way to look at the raster story on Travis to make sure it rendered okay prior to adding the hash?

@nyalldawson
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirvn nope - all you get is that hash. You make the call whether it's acceptable! (you CAN visual a raster just from a hash, right?)

@alexbruy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, for me on Ubuntu 1.6.04 build failed with

/home/alex/devel/qgis/src/core/processing/qgsprocessingparametertypeimpl.h: In member function ‘virtual QgsProcessingParameterType::ParameterFlags QgsProcessingParameterTypeVectorDestination::flags() const’:
/home/alex/devel/qgis/src/core/processing/qgsprocessingparametertypeimpl.h:396:13: error: ‘QgsProcessingParameterType::ParameterFlags {aka class QFlags<QgsProcessingParameterType::ParameterFlag>}’ has no member named ‘setFlag’
       flags.setFlag( ParameterFlag::ExposeToModeler, false );

Please sign in to comment.