Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
better naming for messageEmitted/Discarded in maptools, followup 5bc5fdb
  • Loading branch information
3nids committed Mar 21, 2014
1 parent dd4975f commit 4342b73
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
6 changes: 3 additions & 3 deletions python/gui/qgsmaptool.sip
Expand Up @@ -113,11 +113,11 @@ class QgsMapTool : QObject

signals:
//! emit a message
void emitMessage( QString message );
void emitMessage( QString message, QgsMessageBar::MessageLevel );
void messageEmitted( QString message );
void messageEmitted( QString message, QgsMessageBar::MessageLevel );

//! emit signal to clear previous message
void discardMessage();
void messageDiscarded();

protected:

Expand Down
6 changes: 3 additions & 3 deletions src/app/nodetool/qgsmaptoolnodetool.cpp
Expand Up @@ -362,12 +362,12 @@ void QgsMapToolNodeTool::canvasPressEvent( QMouseEvent * e )

if ( snapResults.size() < 1 )
{
emit emitMessage( tr( "could not snap to a segment on the current layer." ) );
emit messageEmitted( tr( "could not snap to a segment on the current layer." ) );
return;
}

// remove previous warning
emit discardMessage();
emit messageDiscarded();

mSelectedFeature = new QgsSelectedFeature( snapResults[0].snappedAtGeometry, vlayer, mCanvas );
connect( QgisApp::instance()->legend(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ), this, SLOT( currentLayerChanged( QgsMapLayer* ) ) );
Expand All @@ -378,7 +378,7 @@ void QgsMapToolNodeTool::canvasPressEvent( QMouseEvent * e )
else
{
// remove previous warning
emit discardMessage();
emit messageDiscarded();

QgsVectorLayer *vlayer = mSelectedFeature->vlayer();
Q_ASSERT( vlayer );
Expand Down
16 changes: 8 additions & 8 deletions src/app/qgisapp.cpp
Expand Up @@ -1052,7 +1052,7 @@ void QgisApp::createActions()
connect( mActionNewSpatiaLiteLayer, SIGNAL( triggered() ), this, SLOT( newSpatialiteLayer() ) );
connect( mActionShowRasterCalculator, SIGNAL( triggered() ), this, SLOT( showRasterCalculator() ) );
connect( mActionEmbedLayers, SIGNAL( triggered() ) , this, SLOT( embedLayers() ) );
connect( mActionAddLayerDefinition, SIGNAL( triggered() ), this, SLOT( addLayerDefinition () ) );
connect( mActionAddLayerDefinition, SIGNAL( triggered() ), this, SLOT( addLayerDefinition() ) );
connect( mActionAddOgrLayer, SIGNAL( triggered() ), this, SLOT( addVectorLayer() ) );
connect( mActionAddRasterLayer, SIGNAL( triggered() ), this, SLOT( addRasterLayer() ) );
connect( mActionAddPgLayer, SIGNAL( triggered() ), this, SLOT( addDatabaseLayer() ) );
Expand Down Expand Up @@ -2460,7 +2460,7 @@ void QgisApp::about()
abt->activateWindow();
}

void QgisApp::addLayerDefinition ()
void QgisApp::addLayerDefinition()
{
QString path = QFileDialog::getOpenFileName( this, "Add Layer Definition File", QDir::home().path(), "*.qlr" );
if ( path.isEmpty() )
Expand Down Expand Up @@ -8026,9 +8026,9 @@ void QgisApp::mapToolChanged( QgsMapTool *newTool, QgsMapTool *oldTool )
{
if ( oldTool )
{
disconnect( oldTool, SIGNAL( emitMessage( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) );
disconnect( oldTool, SIGNAL( emitMessage( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) );
disconnect( oldTool, SIGNAL( discardMessage() ), this, SLOT( removeMapToolMessage() ) );
disconnect( oldTool, SIGNAL( messageEmitted( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) );
disconnect( oldTool, SIGNAL( messageEmitted( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) );
disconnect( oldTool, SIGNAL( messageDiscarded() ), this, SLOT( removeMapToolMessage() ) );
}

if ( newTool )
Expand All @@ -8038,9 +8038,9 @@ void QgisApp::mapToolChanged( QgsMapTool *newTool, QgsMapTool *oldTool )
mNonEditMapTool = newTool;
}

connect( newTool, SIGNAL( emitMessage( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) );
connect( newTool, SIGNAL( emitMessage( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) );
connect( newTool, SIGNAL( discardMessage() ), this, SLOT( removeMapToolMessage() ) );
connect( newTool, SIGNAL( messageEmitted( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) );
connect( newTool, SIGNAL( messageEmitted( QString, QgsMessageBar::MessageLevel ) ), this, SLOT( displayMapToolMessage( QString, QgsMessageBar::MessageLevel ) ) );
connect( newTool, SIGNAL( messageDiscarded() ), this, SLOT( removeMapToolMessage() ) );
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsmaptooladdpart.cpp
Expand Up @@ -62,7 +62,7 @@ void QgsMapToolAddPart::canvasReleaseEvent( QMouseEvent * e )

if ( !selectionErrorMsg.isEmpty() )
{
emit emitMessage( tr( "Could not add part. %1" ).arg( selectionErrorMsg ) , QgsMessageBar::WARNING );
emit messageEmitted( tr( "Could not add part. %1" ).arg( selectionErrorMsg ) , QgsMessageBar::WARNING );
stopCapturing();
return;
}
Expand Down Expand Up @@ -101,7 +101,7 @@ void QgsMapToolAddPart::canvasReleaseEvent( QMouseEvent * e )
else if ( error == 2 )
{
//problem with coordinate transformation
emit emitMessage( tr( "Coordinate transform error. Cannot transform the point to the layers coordinate system" ) , QgsMessageBar::WARNING );
emit messageEmitted( tr( "Coordinate transform error. Cannot transform the point to the layers coordinate system" ) , QgsMessageBar::WARNING );
return;
}

Expand Down Expand Up @@ -155,7 +155,7 @@ void QgsMapToolAddPart::canvasReleaseEvent( QMouseEvent * e )
case 0:
{
// remove previous message
emit discardMessage();
emit messageDiscarded();

//add points to other features to keep topology up-to-date
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
Expand Down Expand Up @@ -195,6 +195,6 @@ void QgsMapToolAddPart::canvasReleaseEvent( QMouseEvent * e )
break;
}

emit emitMessage( errorMessage , QgsMessageBar::WARNING );
emit messageEmitted( errorMessage , QgsMessageBar::WARNING );
vlayer->destroyEditCommand();
}
4 changes: 2 additions & 2 deletions src/app/qgsmaptooldeletepart.cpp
Expand Up @@ -53,7 +53,7 @@ void QgsMapToolDeletePart::canvasPressEvent( QMouseEvent *e )
if ( mRecentSnappingResults.size() > 0 )
{
// remove previous warning
emit discardMessage();
emit messageDiscarded();

QgsPoint markerPoint = mRecentSnappingResults.begin()->snappedVertex;

Expand All @@ -64,7 +64,7 @@ void QgsMapToolDeletePart::canvasPressEvent( QMouseEvent *e )
}
else
{
emit emitMessage( tr( "could not snap to a part on the current layer." ) );
emit messageEmitted( tr( "could not snap to a part on the current layer." ) );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptooldeletering.cpp
Expand Up @@ -55,7 +55,7 @@ void QgsMapToolDeleteRing::canvasPressEvent( QMouseEvent *e )
if ( mRecentSnappingResults.size() > 0 )
{
// remove previous warning
emit discardMessage();
emit messageDiscarded();

QgsPoint markerPoint = mRecentSnappingResults.begin()->snappedVertex;

Expand All @@ -66,7 +66,7 @@ void QgsMapToolDeleteRing::canvasPressEvent( QMouseEvent *e )
}
else
{
emit emitMessage( tr( "could not snap to a ring on the current layer." ) );
emit messageEmitted( tr( "could not snap to a ring on the current layer." ) );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptooledit.cpp
Expand Up @@ -133,10 +133,10 @@ int QgsMapToolEdit::addTopologicalPoints( const QList<QgsPoint>& geom )

void QgsMapToolEdit::notifyNotVectorLayer()
{
emit emitMessage( tr( "No active vector layer" ) );
emit messageEmitted( tr( "No active vector layer" ) );
}

void QgsMapToolEdit::notifyNotEditableLayer()
{
emit emitMessage( tr( "Layer not editable" ) );
emit messageEmitted( tr( "Layer not editable" ) );
}
6 changes: 3 additions & 3 deletions src/gui/qgsmaptool.h
Expand Up @@ -131,11 +131,11 @@ class GUI_EXPORT QgsMapTool : public QObject

signals:
//! emit a message
void emitMessage( QString message );
void emitMessage( QString message, QgsMessageBar::MessageLevel );
void messageEmitted( QString message );
void messageEmitted( QString message, QgsMessageBar::MessageLevel );

//! emit signal to clear previous message
void discardMessage();
void messageDiscarded();

protected:

Expand Down

0 comments on commit 4342b73

Please sign in to comment.