24 QString QgsSetLayerEncodingAlgorithm::name()
const
26 return QStringLiteral(
"setlayerencoding" );
29 QString QgsSetLayerEncodingAlgorithm::displayName()
const
31 return QObject::tr(
"Set layer encoding" );
34 QStringList QgsSetLayerEncodingAlgorithm::tags()
const
36 return QObject::tr(
"change,alter,attribute,codepage" ).split(
',' );
39 QString QgsSetLayerEncodingAlgorithm::group()
const
41 return QObject::tr(
"Vector general" );
44 QString QgsSetLayerEncodingAlgorithm::groupId()
const
46 return QStringLiteral(
"vectorgeneral" );
49 QString QgsSetLayerEncodingAlgorithm::shortHelpString()
const
51 return QObject::tr(
"This algorithm sets the encoding used for reading a layer's attributes. No permanent changes "
52 "are made to the layer, rather it affects only how the layer is read during the current session.\n\n"
53 "Changing the encoding is only supported for some vector layer data sources." );
56 QString QgsSetLayerEncodingAlgorithm::shortDescription()
const
58 return QObject::tr(
"Sets the encoding used for reading a layer's attributes" );
61 QgsSetLayerEncodingAlgorithm *QgsSetLayerEncodingAlgorithm::createInstance()
const
63 return new QgsSetLayerEncodingAlgorithm();
66 void QgsSetLayerEncodingAlgorithm::initAlgorithm(
const QVariantMap & )
76 QgsVectorLayer *layer = parameterAsVectorLayer( parameters, QStringLiteral(
"INPUT" ), context );
79 throw QgsProcessingException( QObject::tr(
"Could not load source layer for %1." ).arg( QStringLiteral(
"INPUT" ) ) );
81 const QString encoding = parameterAsString( parameters, QStringLiteral(
"ENCODING" ), context );
83 mOutputId = layer->
id();
92 feedback->
pushInfo( QObject::tr(
"Layer's data provider does not support changing the attribute encoding" ) );
102 outputs.insert( QStringLiteral(
"OUTPUT" ), mOutputId );