22
22
#include < QColor>
23
23
#include < QStringList>
24
24
#include < QTextStream>
25
+ #include < QObject>
25
26
26
27
#ifndef Q_OS_WIN
27
28
#include < netinet/in.h>
@@ -1604,7 +1605,7 @@ QgsExpression::Node* QgsOgcUtils::nodeFromOgcFilter( QDomElement &element, QStri
1604
1605
return nodeIsBetweenFromOgcFilter ( element, errorMessage );
1605
1606
}
1606
1607
1607
- errorMessage += QString ( " unable to convert '%1' element to a valid expression: it is not supported yet or it has invalid arguments" ).arg ( element.tagName () );
1608
+ errorMessage += QObject::tr ( " unable to convert '%1' element to a valid expression: it is not supported yet or it has invalid arguments" ).arg ( element.tagName () );
1608
1609
return nullptr ;
1609
1610
}
1610
1611
@@ -1619,7 +1620,7 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter(
1619
1620
if ( op < 0 )
1620
1621
{
1621
1622
if ( errorMessage.isEmpty () )
1622
- errorMessage = QString ( " '%1' binary operator not supported." ).arg ( element.tagName () );
1623
+ errorMessage = QObject::tr ( " '%1' binary operator not supported." ).arg ( element.tagName () );
1623
1624
return nullptr ;
1624
1625
}
1625
1626
@@ -1628,7 +1629,7 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter(
1628
1629
if ( !expr )
1629
1630
{
1630
1631
if ( errorMessage.isEmpty () )
1631
- errorMessage = QString ( " invalid left operand for '%1' binary operator" ).arg ( element.tagName () );
1632
+ errorMessage = QObject::tr ( " invalid left operand for '%1' binary operator" ).arg ( element.tagName () );
1632
1633
return nullptr ;
1633
1634
}
1634
1635
@@ -1638,7 +1639,7 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter(
1638
1639
if ( !opRight )
1639
1640
{
1640
1641
if ( errorMessage.isEmpty () )
1641
- errorMessage = QString ( " invalid right operand for '%1' binary operator" ).arg ( element.tagName () );
1642
+ errorMessage = QObject::tr ( " invalid right operand for '%1' binary operator" ).arg ( element.tagName () );
1642
1643
delete expr;
1643
1644
return nullptr ;
1644
1645
}
@@ -1649,7 +1650,7 @@ QgsExpression::NodeBinaryOperator* QgsOgcUtils::nodeBinaryOperatorFromOgcFilter(
1649
1650
if ( expr == leftOp )
1650
1651
{
1651
1652
if ( errorMessage.isEmpty () )
1652
- errorMessage = QString ( " only one operand for '%1' binary operator" ).arg ( element.tagName () );
1653
+ errorMessage = QObject::tr ( " only one operand for '%1' binary operator" ).arg ( element.tagName () );
1653
1654
delete expr;
1654
1655
return nullptr ;
1655
1656
}
@@ -1685,7 +1686,7 @@ QgsExpression::NodeFunction* QgsOgcUtils::nodeSpatialOperatorFromOgcFilter( QDom
1685
1686
}
1686
1687
else
1687
1688
{
1688
- errorMessage = " No OGC Geometry found" ;
1689
+ errorMessage = QObject::tr ( " No OGC Geometry found" ) ;
1689
1690
delete gml2Args;
1690
1691
return nullptr ;
1691
1692
}
@@ -1708,7 +1709,7 @@ QgsExpression::NodeUnaryOperator* QgsOgcUtils::nodeNotFromOgcFilter( QDomElement
1708
1709
if ( !operand )
1709
1710
{
1710
1711
if ( errorMessage.isEmpty () )
1711
- errorMessage = QString ( " invalid operand for '%1' unary operator" ).arg ( element.tagName () );
1712
+ errorMessage = QObject::tr ( " invalid operand for '%1' unary operator" ).arg ( element.tagName () );
1712
1713
return nullptr ;
1713
1714
}
1714
1715
@@ -1720,7 +1721,7 @@ QgsExpression::NodeFunction* QgsOgcUtils::nodeFunctionFromOgcFilter( QDomElement
1720
1721
{
1721
1722
if ( element.isNull () || element.tagName () != " Function" )
1722
1723
{
1723
- errorMessage = QString ( " ogc:Function expected, got %1" ).arg ( element.tagName () );
1724
+ errorMessage = QObject::tr ( " ogc:Function expected, got %1" ).arg ( element.tagName () );
1724
1725
return nullptr ;
1725
1726
}
1726
1727
@@ -1759,7 +1760,7 @@ QgsExpression::Node* QgsOgcUtils::nodeLiteralFromOgcFilter( QDomElement &element
1759
1760
{
1760
1761
if ( element.isNull () || element.tagName () != " Literal" )
1761
1762
{
1762
- errorMessage = QString ( " ogc:Literal expected, got %1" ).arg ( element.tagName () );
1763
+ errorMessage = QObject::tr ( " ogc:Literal expected, got %1" ).arg ( element.tagName () );
1763
1764
return nullptr ;
1764
1765
}
1765
1766
@@ -1781,7 +1782,7 @@ QgsExpression::Node* QgsOgcUtils::nodeLiteralFromOgcFilter( QDomElement &element
1781
1782
if ( root )
1782
1783
delete root;
1783
1784
1784
- errorMessage = QString ( " '%1' is an invalid or not supported content for ogc:Literal" ).arg ( operandElem.tagName () );
1785
+ errorMessage = QObject::tr ( " '%1' is an invalid or not supported content for ogc:Literal" ).arg ( operandElem.tagName () );
1785
1786
return nullptr ;
1786
1787
}
1787
1788
}
@@ -1826,7 +1827,7 @@ QgsExpression::NodeColumnRef* QgsOgcUtils::nodeColumnRefFromOgcFilter( QDomEleme
1826
1827
{
1827
1828
if ( element.isNull () || element.tagName () != " PropertyName" )
1828
1829
{
1829
- errorMessage = QString ( " ogc:PropertyName expected, got %1" ).arg ( element.tagName () );
1830
+ errorMessage = QObject::tr ( " ogc:PropertyName expected, got %1" ).arg ( element.tagName () );
1830
1831
return nullptr ;
1831
1832
}
1832
1833
@@ -1879,7 +1880,7 @@ QgsExpression::Node* QgsOgcUtils::nodeIsBetweenFromOgcFilter( QDomElement& eleme
1879
1880
if ( upperBound )
1880
1881
delete upperBound;
1881
1882
1882
- errorMessage = " missing some required sub-elements in ogc:PropertyIsBetween" ;
1883
+ errorMessage = QObject::tr ( " missing some required sub-elements in ogc:PropertyIsBetween" ) ;
1883
1884
return nullptr ;
1884
1885
}
1885
1886
@@ -1947,7 +1948,7 @@ QDomElement QgsOgcUtils::expressionNodeToOgcFilter( const QgsExpression::Node* n
1947
1948
return expressionColumnRefToOgcFilter ( static_cast <const QgsExpression::NodeColumnRef*>( node ), doc, errorMessage );
1948
1949
1949
1950
default :
1950
- errorMessage = QString ( " Node type not supported: %1" ).arg ( node->nodeType () );
1951
+ errorMessage = QObject::tr ( " Node type not supported: %1" ).arg ( node->nodeType () );
1951
1952
return QDomElement ();
1952
1953
}
1953
1954
}
@@ -1974,7 +1975,7 @@ QDomElement QgsOgcUtils::expressionUnaryOperatorToOgcFilter( const QgsExpression
1974
1975
}
1975
1976
else
1976
1977
{
1977
- errorMessage = QString ( " This use of unary operator not implemented yet" );
1978
+ errorMessage = QObject::tr ( " This use of unary operator not implemented yet" );
1978
1979
return QDomElement ();
1979
1980
}
1980
1981
break ;
@@ -1984,7 +1985,7 @@ QDomElement QgsOgcUtils::expressionUnaryOperatorToOgcFilter( const QgsExpression
1984
1985
break ;
1985
1986
1986
1987
default :
1987
- errorMessage = QString ( " Unary operator %1 not implemented yet" ).arg ( QgsExpression::UnaryOperatorText[node->op ()] );
1988
+ errorMessage = QObject::tr ( " Unary operator %1 not implemented yet" ).arg ( QgsExpression::UnaryOperatorText[node->op ()] );
1988
1989
return QDomElement ();
1989
1990
}
1990
1991
@@ -2038,7 +2039,7 @@ QDomElement QgsOgcUtils::expressionBinaryOperatorToOgcFilter( const QgsExpressio
2038
2039
{
2039
2040
// not implemented binary operators
2040
2041
// TODO: regex, % (mod), ^ (pow) are not supported yet
2041
- errorMessage = QString ( " Binary operator %1 not implemented yet" ).arg ( QgsExpression::BinaryOperatorText[op] );
2042
+ errorMessage = QObject::tr ( " Binary operator %1 not implemented yet" ).arg ( QgsExpression::BinaryOperatorText[op] );
2042
2043
return QDomElement ();
2043
2044
}
2044
2045
@@ -2077,7 +2078,7 @@ QDomElement QgsOgcUtils::expressionLiteralToOgcFilter( const QgsExpression::Node
2077
2078
break ;
2078
2079
2079
2080
default :
2080
- errorMessage = QString ( " Literal type not supported: %1" ).arg ( node->value ().type () );
2081
+ errorMessage = QObject::tr ( " Literal type not supported: %1" ).arg ( node->value ().type () );
2081
2082
return QDomElement ();
2082
2083
}
2083
2084
@@ -2207,7 +2208,7 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
2207
2208
{
2208
2209
delete geom;
2209
2210
2210
- errorMessage = QString ( " <BBOX> is currently supported only in form: bbox($geometry, geomFromWKT('...'))" );
2211
+ errorMessage = QObject::tr ( " <BBOX> is currently supported only in form: bbox($geometry, geomFromWKT('...'))" );
2211
2212
return QDomElement ();
2212
2213
}
2213
2214
}
@@ -2224,7 +2225,7 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
2224
2225
otherNode = argNodes[0 ];
2225
2226
else
2226
2227
{
2227
- errorMessage = QString ( " Unable to translate spatial operator: at least one must refer to geometry." );
2228
+ errorMessage = QObject::tr ( " Unable to translate spatial operator: at least one must refer to geometry." );
2228
2229
return QDomElement ();
2229
2230
}
2230
2231
@@ -2233,7 +2234,7 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
2233
2234
// the other node must be a geometry constructor
2234
2235
if ( otherNode->nodeType () != QgsExpression::ntFunction )
2235
2236
{
2236
- errorMessage = " spatial operator: the other operator must be a geometry constructor function" ;
2237
+ errorMessage = QObject::tr ( " spatial operator: the other operator must be a geometry constructor function" ) ;
2237
2238
return QDomElement ();
2238
2239
}
2239
2240
@@ -2244,7 +2245,7 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
2244
2245
QgsExpression::Node* firstFnArg = otherFn->args ()->list ()[0 ];
2245
2246
if ( firstFnArg->nodeType () != QgsExpression::ntLiteral )
2246
2247
{
2247
- errorMessage = " geom_from_wkt: argument must be string literal" ;
2248
+ errorMessage = QObject::tr ( " geom_from_wkt: argument must be string literal" ) ;
2248
2249
return QDomElement ();
2249
2250
}
2250
2251
QString wkt = static_cast <const QgsExpression::NodeLiteral*>( firstFnArg )->value ().toString ();
@@ -2257,15 +2258,15 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
2257
2258
QgsExpression::Node* firstFnArg = otherFn->args ()->list ()[0 ];
2258
2259
if ( firstFnArg->nodeType () != QgsExpression::ntLiteral )
2259
2260
{
2260
- errorMessage = " geom_from_gml: argument must be string literal" ;
2261
+ errorMessage = QObject::tr ( " geom_from_gml: argument must be string literal" ) ;
2261
2262
return QDomElement ();
2262
2263
}
2263
2264
2264
2265
QDomDocument geomDoc;
2265
2266
QString gml = static_cast <const QgsExpression::NodeLiteral*>( firstFnArg )->value ().toString ();
2266
2267
if ( !geomDoc.setContent ( gml, true ) )
2267
2268
{
2268
- errorMessage = " geom_from_gml: unable to parse XML" ;
2269
+ errorMessage = QObject::tr ( " geom_from_gml: unable to parse XML" ) ;
2269
2270
return QDomElement ();
2270
2271
}
2271
2272
@@ -2274,7 +2275,7 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
2274
2275
}
2275
2276
else
2276
2277
{
2277
- errorMessage = " spatial operator: unknown geometry constructor function" ;
2278
+ errorMessage = QObject::tr ( " spatial operator: unknown geometry constructor function" ) ;
2278
2279
return QDomElement ();
2279
2280
}
2280
2281
@@ -2288,7 +2289,7 @@ QDomElement QgsOgcUtils::expressionFunctionToOgcFilter( const QgsExpression::Nod
2288
2289
2289
2290
if ( fd->params () == 0 )
2290
2291
{
2291
- errorMessage = QString ( " Special columns / constants are not supported." );
2292
+ errorMessage = QObject::tr ( " Special columns/ constants are not supported." );
2292
2293
return QDomElement ();
2293
2294
}
2294
2295
0 commit comments