Skip to content

Commit

Permalink
Standardise names for static variables
Browse files Browse the repository at this point in the history
All non-const variables are prefixed with "s", all const
statics are ALL_CAPS
  • Loading branch information
nyalldawson committed Jan 14, 2017
1 parent 231f6af commit b548063
Show file tree
Hide file tree
Showing 187 changed files with 1,307 additions and 1,304 deletions.
30 changes: 30 additions & 0 deletions doc/api_break.dox
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@ QgsColorBrewerColorRampDialog {#qgis_api_break_3_0_QgsColorBrewerColorRam
and the new ramp can be retrieved after executing the dialog by calling ramp().
- Some internal methods which were previously public or protected were made private.

QgsColorBrewerPalette {#qgis_api_break_3_0_QgsColorBrewerPalette}
---------------------

- brewerString was renamed to BREWER_STRING

QgsColorButton {#qgis_api_break_3_0_QgsColorButton}
--------------

Expand Down Expand Up @@ -902,6 +907,11 @@ QgsExpression::Function {#qgis_api_break_3_0_QgsExpression_Function}
- `QStringList QgsExpression::Function::referencedColumns()` has been changed to `QSet<QString> QgsExpression::Function::referencedColumns( const NodeFunction* node )`
- `QgsExpression::Function::helptext()` has been renamed to `helpText()`

QgsExpressionItem {#qgis_api_break_3_0_QgsExpressionItem}
-----------------

- CustomSortRole was renamed to CUSTOM_SORT_ROLE
- ItemTypeRole was renamed to ITEM_TYPE_ROLE

QgsExpressionContextUtils {#qgis_api_break_3_0_QgsExpressionContextUtils}
-------------------------
Expand All @@ -924,6 +934,11 @@ None will need to be modified, as the method will return an empty geometry if th
- fields() no longer returns a pointer, but instead a QgsFields value.
- The duplicate method setFeatureId() was removed. Use setId() instead.

QgsFeatureListViewDelegate {#qgis_api_break_3_0_QgsFeatureListViewDelegate}
--------------------------

- sIconSize was rename to ICON_SIZE


QgsFeatureRendererV2 {#qgis_api_break_3_0_QgsFeatureRendererV2}
--------------------
Expand All @@ -940,6 +955,10 @@ QgsFeatureRendererV2 {#qgis_api_break_3_0_QgsFeatureRendererV2}
- originalSymbolsForFeature( QgsFeature& feat ) has been removed. The originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) method should be used instead (previously available as originalSymbolsForFeature2 in PyQGIS bindings).
- copyPaintEffect() was removed. copyRendererData() should be used instead.

QgsFeatureRequest {#qgis_api_break_3_0_QgsFeatureRequest}
-----------------

- AllAttributes was renamed to ALL_ATTRIBUTES

QgsFieldCombobox {#qgis_api_break_3_0_QgsFieldCombobox}
----------------
Expand Down Expand Up @@ -1512,6 +1531,12 @@ QgsRenderContext {#qgis_api_break_3_0_QgsRenderContext}
be returned instead of a null pointer if no transformation is required.
- setCoordinateTransform() now takes a QgsCoordinateTransform reference, not a pointer. An invalid QgsCoordinateTransform should be used instead of a null pointer if no transformation is required.

QgsRendererRangeLabelFormat {#qgis_api_break_3_0_QgsRendererRangeLabelFormat}
---------------------------

- MaxPrecision was renamed to MAX_PRECISION
- MinPrecision was renamed to MIN_PRECISION


QgsRendererRegistry {#qgis_api_break_3_0_QgsRendererRegistry}
----------------------
Expand Down Expand Up @@ -1830,6 +1855,11 @@ QgsWMSLegendNode {#qgis_api_break_3_0_QgsWMSLegendNode}

- QgsWMSLegendNode has been renamed to QgsWmsLegendNode

QgsZipItem {#qgis_api_break_3_0_QgsZipItem}
----------

- mProviderNames was rename to sProviderNames


QgsRenderer {#qgis_api_break_3_0_QgsRenderer}
-----------
Expand Down
4 changes: 2 additions & 2 deletions python/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _geometryNonZero(self):
QgsGeometry.__bool__ = _geometryNonZero


def register_function(function, arg_count, group, usesgeometry=False, referenced_columns=[QgsFeatureRequest.AllAttributes], **kwargs):
def register_function(function, arg_count, group, usesgeometry=False, referenced_columns=[QgsFeatureRequest.ALL_ATTRIBUTES], **kwargs):
"""
Register a Python function to be used as a expression function.
Expand Down Expand Up @@ -71,7 +71,7 @@ def myfunc(values, *args):
"""
class QgsExpressionFunction(QgsExpression.Function):

def __init__(self, func, name, args, group, helptext='', usesGeometry=True, referencedColumns=QgsFeatureRequest.AllAttributes, expandargs=False):
def __init__(self, func, name, args, group, helptext='', usesGeometry=True, referencedColumns=QgsFeatureRequest.ALL_ATTRIBUTES, expandargs=False):
QgsExpression.Function.__init__(self, name, args, group, helptext)
self.function = func
self.expandargs = expandargs
Expand Down
10 changes: 5 additions & 5 deletions python/core/qgis.sip
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class Qgis
// Version constants
//
// Version string
static QString QGIS_VERSION;
static const QString QGIS_VERSION;
// Version number used for comparing versions using the "Check QGIS Version" function
static const int QGIS_VERSION_INT;
// Release name
static QString QGIS_RELEASE_NAME;
static const QString QGIS_RELEASE_NAME;
// The development version
static const char* QGIS_DEV_VERSION;

Expand Down Expand Up @@ -91,17 +91,17 @@ class Qgis

/** Default highlight buffer in mm.
* @note added in 2.3 */
static double DEFAULT_HIGHLIGHT_BUFFER_MM;
static const double DEFAULT_HIGHLIGHT_BUFFER_MM;

/** Default highlight line/outline minimum width in mm.
* @note added in 2.3 */
static double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM;
static const double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM;

/** Fudge factor used to compare two scales. The code is often going from scale to scale
* denominator. So it looses precision and, when a limit is inclusive, can lead to errors.
* To avoid that, use this factor instead of using <= or >=.
* @note added in 2.15*/
static double SCALE_PRECISION;
static const double SCALE_PRECISION;
};

/** Converts a string to a double in a permissive way, e.g., allowing for incorrect
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsdataitem.sip
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ class QgsZipItem : QgsDataCollectionItem

//! @note not available via python bindings
// static QVector<dataItem_t *> mDataItemPtr;
static QStringList mProviderNames;
static QStringList sProviderNames;

static QString vsiPrefix( const QString& uri );

Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsfeaturerequest.sip
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class QgsFeatureRequest
/**
* A special attribute that if set matches all attributes
*/
static const QString AllAttributes;
static const QString ALL_ATTRIBUTES;

//! construct a default request: for all features get attributes and geometries
QgsFeatureRequest();
Expand Down
2 changes: 1 addition & 1 deletion python/core/symbology-ng/qgscolorbrewerpalette.sip
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ class QgsColorBrewerPalette
static QList<int> listSchemeVariants( const QString& schemeName );

// extracted ColorBrewer data
static const char *brewerString;
static const char * BREWER_STRING;
};
4 changes: 2 additions & 2 deletions python/core/symbology-ng/qgsgraduatedsymbolrenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class QgsRendererRangeLabelFormat
void setFromDomElement( QDomElement &element );
void saveToDomElement( QDomElement &element );

static const int MaxPrecision;
static const int MinPrecision;
static const int MAX_PRECISION;
static const int MIN_PRECISION;

};

Expand Down
2 changes: 1 addition & 1 deletion python/gui/attributetable/qgsfeaturelistviewdelegate.sip
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class QgsFeatureListViewDelegate : QItemDelegate
#include <qgsfeaturelistviewdelegate.h>
%End
public:
static const int sIconSize;
static const int ICON_SIZE;

enum Element
{
Expand Down
4 changes: 2 additions & 2 deletions python/gui/qgsexpressionbuilderwidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class QgsExpressionItem : QStandardItem
QgsExpressionItem::ItemType getItemType() const;

//! Custom sort order role
static const int CustomSortRole;
static const int CUSTOM_SORT_ROLE;
//! Item type role
static const int ItemTypeRole;
static const int ITEM_TYPE_ROLE;
};

/** Search proxy used to filter the QgsExpressionBuilderWidget tree.
Expand Down
8 changes: 4 additions & 4 deletions python/sip_helpers/qgissiphelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

bool null_from_qvariant_converter( const QVariant *varp, PyObject **objp )
{
static bool watchdog = false;
static bool sWatchDog = false;

if ( watchdog )
if ( sWatchDog )
return false;

// If we deal with a NULL QVariant (and it's not a QByteArray which properly
Expand All @@ -35,10 +35,10 @@ bool null_from_qvariant_converter( const QVariant *varp, PyObject **objp )
// instead of a blacklist.
if ( varp->isNull() && varp->type() != QVariant::ByteArray )
{
watchdog = true;
sWatchDog = true;
PyObject* vartype = sipConvertFromEnum( varp->type(), sipType_QVariant_Type );
*objp = PyObject_Call(( PyObject * )sipTypeAsPyTypeObject( sipType_QVariant ), PyTuple_Pack( 1, vartype ), nullptr );
watchdog = false;
sWatchDog = false;
return true;
}
else
Expand Down
6 changes: 3 additions & 3 deletions scripts/process_contexthelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
cpp.write(
"#include \"qgscontexthelp.h\"\n"
"#include <QCoreApplication>\n\n"
"QHash<QString, QString> QgsContextHelp::gContextHelpTexts;\n"
"QHash<QString, QString> QgsContextHelp::sContextHelpTexts;\n"
"\n"
"void QgsContextHelp::init()\n"
"{\n"
" if( !gContextHelpTexts.isEmpty() )\n"
" if( !sContextHelpTexts.isEmpty() )\n"
" return;\n"
)

Expand All @@ -20,7 +20,7 @@
# Protect from IOError: [Errno 21] Is a directory
continue