21 changes: 9 additions & 12 deletions src/app/qgsfieldsproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ QgsFieldsProperties::QgsFieldsProperties( QgsVectorLayer *layer, QWidget* parent
mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.png" ) );
mCalculateFieldButton->setIcon( QgsApplication::getThemeIcon( "/mActionCalculateField.png" ) );

connect( mToggleEditingButton, SIGNAL( clicked() ), this, SLOT( toggleEditing() ) );
connect( mToggleEditingButton, SIGNAL( clicked() ), this, SIGNAL( toggleEditing() ) );
connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( attributeAdded( int ) ) );
Expand Down Expand Up @@ -242,11 +242,6 @@ void QgsFieldsProperties::onAttributeSelectionChanged()
mAddItemButton->setEnabled( isAddPossible );
}

void QgsFieldsProperties::toggleEditing()
{
emit toggleEditing( mLayer );
}

QTreeWidgetItem *QgsFieldsProperties::loadAttributeEditorTreeItem( QgsAttributeEditorElement* const widgetDef, QTreeWidgetItem* parent )
{
QTreeWidgetItem* newWidget = 0;
Expand Down Expand Up @@ -303,7 +298,7 @@ void QgsFieldsProperties::loadAttributeEditorTree()

void QgsFieldsProperties::loadRows()
{
disconnect( mAttributesList, SIGNAL( cellChanged( int, int ) ), this, SLOT( on_mAttributesList_cellChanged( int, int ) ) );
disconnect( mAttributesList, SIGNAL( cellChanged( int, int ) ), this, SLOT( attributesListCellChanged( int, int ) ) );
const QgsFieldMap &fields = mLayer->pendingFields();

mAttributesList->clear();
Expand Down Expand Up @@ -334,7 +329,7 @@ void QgsFieldsProperties::loadRows()
setRow( row, it.key(), it.value() );

mAttributesList->resizeColumnsToContents();
connect( mAttributesList, SIGNAL( cellChanged( int, int ) ), this, SLOT( on_mAttributesList_cellChanged( int, int ) ) );
connect( mAttributesList, SIGNAL( cellChanged( int, int ) ), this, SLOT( attributesListCellChanged( int, int ) ) );
}

void QgsFieldsProperties::setRow( int row, int idx, const QgsField &field )
Expand Down Expand Up @@ -474,7 +469,7 @@ void QgsFieldsProperties::on_mMoveUpItem_clicked()
}
}

void QgsFieldsProperties::attributeTypeDialog( )
void QgsFieldsProperties::attributeTypeDialog()
{
QPushButton *pb = qobject_cast<QPushButton *>( sender() );
if ( !pb )
Expand Down Expand Up @@ -657,9 +652,12 @@ void QgsFieldsProperties::on_mDeleteAttributeButton_clicked()

void QgsFieldsProperties::updateButtons()
{
int cap = mLayer->dataProvider()->capabilities();

mToggleEditingButton->setEnabled(( cap & QgsVectorDataProvider::ChangeAttributeValues ) && !mLayer->isReadOnly() );

if ( mLayer->isEditable() )
{
int cap = mLayer->dataProvider()->capabilities();
mAddAttributeButton->setEnabled( cap & QgsVectorDataProvider::AddAttributes );
mDeleteAttributeButton->setEnabled( cap & QgsVectorDataProvider::DeleteAttributes );
mCalculateFieldButton->setEnabled( cap & ( QgsVectorDataProvider::ChangeAttributeValues | QgsVectorDataProvider::AddAttributes ) );
Expand All @@ -670,13 +668,12 @@ void QgsFieldsProperties::updateButtons()
mAddAttributeButton->setEnabled( false );
mDeleteAttributeButton->setEnabled( false );
mToggleEditingButton->setChecked( false );
mToggleEditingButton->setEnabled( false );
mCalculateFieldButton->setEnabled( false );
}
}


void QgsFieldsProperties::on_mAttributesList_cellChanged( int row, int column )
void QgsFieldsProperties::attributesListCellChanged( int row, int column )
{
if ( column == attrAliasCol && mLayer ) //only consider attribute aliases in this function
{
Expand Down
8 changes: 3 additions & 5 deletions src/app/qgsfieldsproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,13 @@ class QgsFieldsProperties : public QWidget, private Ui_QgsFieldsPropertiesBase
QTreeWidgetItem *loadAttributeEditorTreeItem( QgsAttributeEditorElement* const widgetDef, QTreeWidgetItem* parent );

signals:
void toggleEditing( QgsMapLayer * );
void toggleEditing();

public slots:
void on_mAddAttributeButton_clicked();
void on_mDeleteAttributeButton_clicked();
void on_mCalculateFieldButton_clicked();
void onAttributeSelectionChanged();
void on_mAttributesList_cellChanged( int row, int column );
void on_pbnSelectEditForm_clicked();
void on_mEditorLayoutComboBox_currentIndexChanged( int index );

Expand All @@ -113,10 +112,9 @@ class QgsFieldsProperties : public QWidget, private Ui_QgsFieldsPropertiesBase
void on_mMoveDownItem_clicked();
void on_mMoveUpItem_clicked();

protected slots:
/** toggle editing of layer */
void toggleEditing();
void attributesListCellChanged( int row, int column );

protected slots:
/** editing of layer was toggled */
void editingToggled();

Expand Down
10 changes: 5 additions & 5 deletions src/app/qgsmaptoolsvgannotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ QgsMapToolSvgAnnotation::~QgsMapToolSvgAnnotation()

QgsAnnotationItem* QgsMapToolSvgAnnotation::createItem( QMouseEvent* e )
{
QgsSvgAnnotationItem* svgItem = new QgsSvgAnnotationItem( mCanvas );
svgItem->setMapPosition( toMapCoordinates( e->pos() ) );
svgItem->setSelected( true );
svgItem->setFrameSize( QSizeF( 200, 100 ) );
return svgItem;
QgsSvgAnnotationItem* svgItem = new QgsSvgAnnotationItem( mCanvas );
svgItem->setMapPosition( toMapCoordinates( e->pos() ) );
svgItem->setSelected( true );
svgItem->setFrameSize( QSizeF( 200, 100 ) );
return svgItem;
}
10 changes: 5 additions & 5 deletions src/app/qgsmaptoolsvgannotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

class QgsMapToolSvgAnnotation: public QgsMapToolAnnotation
{
public:
QgsMapToolSvgAnnotation( QgsMapCanvas* canvas );
~QgsMapToolSvgAnnotation();
protected:
QgsAnnotationItem* createItem( QMouseEvent* e );
public:
QgsMapToolSvgAnnotation( QgsMapCanvas* canvas );
~QgsMapToolSvgAnnotation();
protected:
QgsAnnotationItem* createItem( QMouseEvent* e );
};

#endif // QGSMAPTOOLSVGANNOTATION_H
22 changes: 11 additions & 11 deletions src/app/qgssvgannotationdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ class QgsAnnotationWidget;
class QgsSvgAnnotationDialog: public QDialog, private Ui::QgsFormAnnotationDialogBase
{
Q_OBJECT
public:
QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0);
~QgsSvgAnnotationDialog();
public:
QgsSvgAnnotationDialog( QgsSvgAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 );
~QgsSvgAnnotationDialog();

private slots:
void on_mBrowseToolButton_clicked();
void applySettingsToItem();
void deleteItem();
private slots:
void on_mBrowseToolButton_clicked();
void applySettingsToItem();
void deleteItem();

private:
QgsSvgAnnotationDialog(); //forbidden
private:
QgsSvgAnnotationDialog(); //forbidden

QgsSvgAnnotationItem* mItem;
QgsAnnotationWidget* mEmbeddedWidget;
QgsSvgAnnotationItem* mItem;
QgsAnnotationWidget* mEmbeddedWidget;
};

#endif // QGSSVGANNOTATIONDIALOG_H
5 changes: 4 additions & 1 deletion src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,15 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
mFieldsFrame->setLayout( new QVBoxLayout( mFieldsFrame ) );
mFieldsFrame->layout()->addWidget( mFieldsPropertiesDialog );

connect( mFieldsPropertiesDialog, SIGNAL( toggleEditing() ), this, SLOT( toggleEditing() ) );
connect( this, SIGNAL( toggleEditing( QgsMapLayer* ) ), QgisApp::instance(), SLOT( toggleEditing( QgsMapLayer* ) ) );

reset();

if ( layer->dataProvider() )//enable spatial index button group if supported by provider
{
int capabilities = layer->dataProvider()->capabilities();
if ( !( capabilities&QgsVectorDataProvider::CreateSpatialIndex ) )
if ( !( capabilities & QgsVectorDataProvider::CreateSpatialIndex ) )
{
pbnIndex->setEnabled( false );
}
Expand Down
21 changes: 11 additions & 10 deletions src/core/qgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ static QgsExpression::Interval getInterval( const QVariant& value, QgsExpression

return QgsExpression::Interval::invalidInterVal();
}
static QgsGeometry getGeometry( const QVariant& value, QgsExpression* parent)
static QgsGeometry getGeometry( const QVariant& value, QgsExpression* parent )
{
if ( value.canConvert<QgsGeometry>() )
return value.value<QgsGeometry>();
Expand Down Expand Up @@ -775,7 +775,7 @@ static QVariant fcnGeometry( const QVariantList& , QgsFeature* f, QgsExpression*
}
static QVariant fcnGeomFromWKT( const QVariantList& values, QgsFeature*, QgsExpression* parent )
{
QString wkt = getStringValue( values.at( 0 ), parent );
QString wkt = getStringValue( values.at( 0 ), parent );
QgsGeometry* geom = QgsGeometry::fromWkt( wkt );
if ( geom )
return QVariant::fromValue( *geom );
Expand All @@ -786,7 +786,7 @@ static QVariant fcnGeomFromGML2( const QVariantList& values, QgsFeature*, QgsExp
{
QDomDocument doc;
QString errorMsg;
QString gml = getStringValue( values.at( 0 ), parent );
QString gml = getStringValue( values.at( 0 ), parent );
if ( !doc.setContent( gml, true, &errorMsg ) )
return QVariant();

Expand Down Expand Up @@ -879,7 +879,7 @@ static QVariant fcnBuffer( const QVariantList& values, QgsFeature*, QgsExpressio
return QVariant();

QgsGeometry fGeom = getGeometry( values.at( 0 ), parent );
double dist = getDoubleValue( values.at( 1 ), parent );
double dist = getDoubleValue( values.at( 1 ), parent );
int seg = 8;
if ( values.length() == 3 )
seg = getIntValue( values.at( 2 ), parent );
Expand Down Expand Up @@ -1033,7 +1033,7 @@ const QStringList &QgsExpression::BuiltinFunctions()
{
gmBuiltinFunctions << "sqrt"
<< "sqrt" << "cos" << "sin" << "tan"
<< "asin" << "acos" << "atan" << "atan2"
<< "asin" << "acos" << "atan" << "atan2"
<< "exp" << "ln" << "log10" << "log"
<< "round" << "toint" << "toreal" << "tostring"
<< "todatetime" << "todate" << "totime" << "tointerval"
Expand Down Expand Up @@ -2254,7 +2254,7 @@ void QgsExpression::NodeFunction::toOgcFilter( QDomDocument &doc, QDomElement &e
if ( fd->name() == ogcOperatorName.toLower() )
{
isSpatial = true;
QDomElement funcElem = doc.createElement( "ogc:"+ogcOperatorName );
QDomElement funcElem = doc.createElement( "ogc:" + ogcOperatorName );
QDomElement geomProperty = doc.createElement( "ogc:PropertyName" );
geomProperty.appendChild( doc.createTextNode( "geometry" ) );
funcElem.appendChild( geomProperty );
Expand All @@ -2279,14 +2279,14 @@ void QgsExpression::NodeFunction::toOgcFilter( QDomDocument &doc, QDomElement &e
{
QDomDocument geomDoc;
QString errorMsg;
QString gml = childElem.firstChildElement().text();
QString gml = childElem.firstChildElement().text();
if ( geomDoc.setContent( gml, true, &errorMsg ) )
funcElem.appendChild( doc.documentElement() );
}
}
childElem = childElem.nextSiblingElement();
}

element.appendChild( funcElem );
}
}
Expand Down Expand Up @@ -2329,7 +2329,7 @@ QgsExpression::Node* QgsExpression::NodeFunction::createFromOgcFilter( QDomEleme
opeIdx = j;
}

if (geomIdx == 0 || gml2Idx == 0 || opeIdx == 0 )
if ( geomIdx == 0 || gml2Idx == 0 || opeIdx == 0 )
{
errorMessage = QString( "spatial functions not find %1, got %2, %3, %4" ).arg( ogcOperatorName ).arg( geomIdx ).arg( gml2Idx ).arg( opeIdx );
return NULL;
Expand All @@ -2338,7 +2338,8 @@ QgsExpression::Node* QgsExpression::NodeFunction::createFromOgcFilter( QDomEleme
QgsExpression::NodeList *gml2Args = new QgsExpression::NodeList();
QDomElement childElem = element.firstChildElement();
QString gml2Str = "";
while ( !childElem.isNull() && gml2Str == "" ) {
while ( !childElem.isNull() && gml2Str == "" )
{
if ( childElem.tagName() != "PropertyName" )
{
QTextStream gml2Stream( &gml2Str );
Expand Down
76 changes: 38 additions & 38 deletions src/core/qgsexpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,61 +227,61 @@ class CORE_EXPORT QgsExpression
class CORE_EXPORT Function
{
public:
Function( QString fnname, int params, QString group, QString helpText = QString(), bool usesGeometry = false )
: mName( fnname ), mParams( params ), mUsesGeometry( usesGeometry ), mGroup( group ), mHelpText( helpText ) {}
/** The name of the function. */
QString name() { return mName; }
/** The number of parameters this function takes. */
int params() { return mParams; }
/** Does this function use a geometry object. */
bool usesgeometry() { return mUsesGeometry; }
/** The group the function belongs to. */
QString group() { return mGroup; }
/** The help text for the function. */
QString helptext() { return mHelpText; }

virtual QVariant func(const QVariantList& values, QgsFeature* f, QgsExpression* parent) = 0;

bool operator==(const Function& other) const
{
if ( QString::compare( mName, other.mName, Qt::CaseInsensitive ) == 0 )
return true;

return false;
}

private:
QString mName;
int mParams;
bool mUsesGeometry;
QString mGroup;
QString mHelpText;
Function( QString fnname, int params, QString group, QString helpText = QString(), bool usesGeometry = false )
: mName( fnname ), mParams( params ), mUsesGeometry( usesGeometry ), mGroup( group ), mHelpText( helpText ) {}
/** The name of the function. */
QString name() { return mName; }
/** The number of parameters this function takes. */
int params() { return mParams; }
/** Does this function use a geometry object. */
bool usesgeometry() { return mUsesGeometry; }
/** The group the function belongs to. */
QString group() { return mGroup; }
/** The help text for the function. */
QString helptext() { return mHelpText; }

virtual QVariant func( const QVariantList& values, QgsFeature* f, QgsExpression* parent ) = 0;

bool operator==( const Function& other ) const
{
if ( QString::compare( mName, other.mName, Qt::CaseInsensitive ) == 0 )
return true;

return false;
}

private:
QString mName;
int mParams;
bool mUsesGeometry;
QString mGroup;
QString mHelpText;
};

class StaticFunction : public Function
{
public:
StaticFunction( QString fnname, int params, FcnEval fcn, QString group, QString helpText = QString(), bool usesGeometry = false )
: Function( fnname, params, group, helpText, usesGeometry), mFnc( fcn ) {}
: Function( fnname, params, group, helpText, usesGeometry ), mFnc( fcn ) {}

virtual QVariant func(const QVariantList& values, QgsFeature* f, QgsExpression* parent)
{
return mFnc(values,f, parent);
}
virtual QVariant func( const QVariantList& values, QgsFeature* f, QgsExpression* parent )
{
return mFnc( values, f, parent );
}

private:
FcnEval mFnc;
};

const static QList<Function*> &Functions();
static QList<Function*> gmFunctions;

static QStringList gmBuiltinFunctions;
const static QStringList &BuiltinFunctions();

static bool registerFunction(Function* function);
static bool unregisterFunction(QString name);
static bool registerFunction( Function* function );
static bool unregisterFunction( QString name );

// tells whether the identifier is a name of existing function
static bool isFunctionName( QString name );

Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2985,7 +2985,7 @@ double QgsGeometry::closestVertexWithContext( const QgsPoint& point, int& atVert

if ( !mGeos )
{
return -1;
return -1;
}

const GEOSGeometry *g = GEOSGetExteriorRing( mGeos );
Expand Down Expand Up @@ -3290,7 +3290,7 @@ int QgsGeometry::addRing( const QList<QgsPoint>& ring )

if ( !mGeos )
{
return 6;
return 6;
}

int type = GEOSGeomTypeId( mGeos );
Expand Down
Loading