30 return QObject::tr(
"Encoding is not correctly set. A non 'System' encoding is required" );
32 return QObject::tr(
"Layer short name is not valid. It must start with an unaccented alphabetical letter, followed by any alphanumeric letters, dot, dash or underscore" );
34 return QObject::tr(
"One or more layers or groups have the same name or short name. Both the 'name' and 'short name' for layers and groups must be unique" );
36 return QObject::tr(
"The project root name (either the project short name or project title) is not valid. It must start with an unaccented alphabetical letter, followed by any alphanumeric letters, dot, dash or underscore" );
38 return QObject::tr(
"The project root name (either the project short name or project title) is already used by a layer or a group" );
43 void QgsProjectServerValidator::browseLayerTree(
QgsLayerTreeGroup *treeGroup, QStringList &owsNames, QStringList &encodingMessages )
45 QList< QgsLayerTreeNode * > treeGroupChildren = treeGroup->
children();
46 for (
int i = 0; i < treeGroupChildren.size(); ++i )
52 QString shortName = treeGroupChild->
customProperty( QStringLiteral(
"wmsShortName" ) ).toString();
53 if ( shortName.isEmpty() )
54 owsNames << treeGroupChild->
name();
56 owsNames << shortName;
57 browseLayerTree( treeGroupChild, owsNames, encodingMessages );
66 if ( shortName.isEmpty() )
67 owsNames << layer->
name();
69 owsNames << shortName;
75 encodingMessages << layer->
name();
93 QStringList owsNames, encodingMessages;
94 browseLayerTree( project->
layerTreeRoot(), owsNames, encodingMessages );
96 QStringList duplicateNames, regExpMessages;
98 const auto constOwsNames = owsNames;
99 for (
const QString &name : constOwsNames )
101 if ( !snRegExp.exactMatch( name ) )
103 regExpMessages << name;
106 if ( duplicateNames.contains( name ) )
111 if ( owsNames.count( name ) > 1 )
113 duplicateNames << name;
117 if ( !duplicateNames.empty() )
123 if ( !regExpMessages.empty() )
129 if ( !encodingMessages.empty() )
136 QString rootLayerName = project->
readEntry( QStringLiteral(
"WMSRootName" ), QStringLiteral(
"/" ),
"" );
137 if ( rootLayerName.isEmpty() && !project->
title().isEmpty() )
139 rootLayerName = project->
title();
141 if ( !rootLayerName.isEmpty() )
143 if ( owsNames.count( rootLayerName ) >= 1 )
149 if ( !snRegExp.exactMatch( rootLayerName ) )