Skip to content
Permalink
Browse files

better naming for messageEmitted/Discarded in maptools, followup 5bc5fdb

  • Loading branch information
3nids committed Mar 21, 2014
1 parent dd4975f commit 4342b73eeac44528c99bb7139ca2a25895532290
@@ -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:

@@ -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* ) ) );
@@ -378,7 +378,7 @@ void QgsMapToolNodeTool::canvasPressEvent( QMouseEvent * e )
else
{
// remove previous warning
emit discardMessage();
emit messageDiscarded();

QgsVectorLayer *vlayer = mSelectedFeature->vlayer();
Q_ASSERT( vlayer );
@@ -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() ) );
@@ -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() )
@@ -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 )
@@ -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() ) );
}
}

@@ -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;
}
@@ -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;
}

@@ -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 );
@@ -195,6 +195,6 @@ void QgsMapToolAddPart::canvasReleaseEvent( QMouseEvent * e )
break;
}

emit emitMessage( errorMessage , QgsMessageBar::WARNING );
emit messageEmitted( errorMessage , QgsMessageBar::WARNING );
vlayer->destroyEditCommand();
}
@@ -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;

@@ -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." ) );
}
}

@@ -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;

@@ -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." ) );
}
}

@@ -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" ) );
}
@@ -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:

0 comments on commit 4342b73

Please sign in to comment.
You can’t perform that action at this time.