Skip to content
Permalink
Browse files

Deprecate QgsProject::dirty( bool ) in favor of QgsProject::setDirty

  • Loading branch information
m-kuhn committed Apr 5, 2016
1 parent 8948607 commit 9c0a291046577b8b1dc0ccb36e042891b91441b7
@@ -57,8 +57,13 @@ class QgsProject : QObject
//@{
bool isDirty() const;

// ### QGIS 3: remove in favor of setDirty(...)
void dirty( bool b );
/**
* Flag the project as dirty (modified). If this flag is set, the user will
* be asked to save changes to the project before closing the current project.
*
* @deprecated use setDirty instead
*/
void dirty( bool b ) /Deprecated/;

/** Set project as dirty (modified).
* @note added in 2.4 */
@@ -4048,7 +4048,7 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
mMapCanvas->setCanvasColor( QColor( myRed, myGreen, myBlue ) );
mOverviewCanvas->setBackgroundColor( QColor( myRed, myGreen, myBlue ) );

prj->dirty( false );
prj->setDirty( false );

setTitleBarText_( *this );

@@ -4072,7 +4072,7 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
prj->writeEntry( "SpatialRefSys", "/ProjectCRSProj4String", srs.toProj4() );
prj->writeEntry( "SpatialRefSys", "/ProjectCrs", srs.authid() );
prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", static_cast< int >( srs.srsid() ) );
prj->dirty( false );
prj->setDirty( false );
if ( srs.mapUnits() != QGis::UnknownUnit )
{
mMapCanvas->setMapUnits( srs.mapUnits() );
@@ -9577,7 +9577,7 @@ void QgisApp::showMapCanvas()
void QgisApp::markDirty()
{
// notify the project that there was a change
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgisApp::extentChanged()
@@ -963,7 +963,7 @@ void QgsRasterLayerProperties::apply()
mRasterLayer->triggerRepaint();

// notify the project we've made a change
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}//apply

void QgsRasterLayerProperties::on_mLayerOrigNameLineEd_textEdited( const QString& text )
@@ -636,7 +636,7 @@ void QgsVectorLayerProperties::apply()

layer->triggerRepaint();
// notify the project we've made a change
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsVectorLayerProperties::onCancel()
@@ -76,5 +76,5 @@ void QgsAddRemoveItemCommand::switchState()
emit itemAdded( mItem );
mState = Added;
}
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}
@@ -78,7 +78,7 @@ void QgsAddRemoveMultiFrameCommand::switchState()
mComposition->addMultiFrame( mMultiFrame );
mState = Added;
}
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}
}

@@ -118,7 +118,7 @@ void QgsComposerItemCommand::restoreState( QDomDocument& stateDoc ) const

destItem->readXML( stateDoc.documentElement().firstChild().toElement(), stateDoc );
destItem->repaint();
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

//
@@ -624,7 +624,7 @@ void QgsComposerMouseHandles::mouseReleaseEvent( QGraphicsSceneMouseEvent* event
subcommand->saveAfterState();
}
mComposition->undoStack()->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}
else if ( mCurrentMouseMoveAction != QgsComposerMouseHandles::NoAction )
{
@@ -664,7 +664,7 @@ void QgsComposerMouseHandles::mouseReleaseEvent( QGraphicsSceneMouseEvent* event
subcommand->saveAfterState();
}
mComposition->undoStack()->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

deleteAlignItems();
@@ -72,7 +72,7 @@ void QgsComposerMultiFrameCommand::restoreState( QDomDocument& stateDoc )
if ( mMultiFrame )
{
mMultiFrame->readXML( stateDoc.documentElement().firstChild().toElement(), stateDoc );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}
}

@@ -416,7 +416,7 @@ void QgsComposition::setPaperSize( const double width, const double height, bool
mPages.at( i )->setSceneRect( QRectF( 0, currentY, width, height ) );
currentY += ( height + mSpaceBetweenPages );
}
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
updateBounds();
emit paperSizeChanged();
}
@@ -542,7 +542,7 @@ void QgsComposition::setNumPages( const int pages )
}
}

QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
updateBounds();

emit nPagesChanged();
@@ -604,7 +604,7 @@ void QgsComposition::setPageStyleSymbol( QgsFillSymbolV2* symbol )
{
delete mPageStyleSymbol;
mPageStyleSymbol = static_cast<QgsFillSymbolV2*>( symbol->clone() );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::createDefaultPageStyleSymbol()
@@ -848,7 +848,7 @@ void QgsComposition::setPrintResolution( const int dpi )
{
mPrintResolution = dpi;
emit printResolutionChanged();
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::setUseAdvancedEffects( const bool effectsEnabled )
@@ -1801,7 +1801,7 @@ void QgsComposition::alignSelectedItemsLeft()
subcommand->saveAfterState();
}
mUndoStack->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::alignSelectedItemsHCenter()
@@ -1831,7 +1831,7 @@ void QgsComposition::alignSelectedItemsHCenter()
subcommand->saveAfterState();
}
mUndoStack->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::alignSelectedItemsRight()
@@ -1861,7 +1861,7 @@ void QgsComposition::alignSelectedItemsRight()
subcommand->saveAfterState();
}
mUndoStack->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::alignSelectedItemsTop()
@@ -1890,7 +1890,7 @@ void QgsComposition::alignSelectedItemsTop()
subcommand->saveAfterState();
}
mUndoStack->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::alignSelectedItemsVCenter()
@@ -1918,7 +1918,7 @@ void QgsComposition::alignSelectedItemsVCenter()
subcommand->saveAfterState();
}
mUndoStack->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::alignSelectedItemsBottom()
@@ -1946,7 +1946,7 @@ void QgsComposition::alignSelectedItemsBottom()
subcommand->saveAfterState();
}
mUndoStack->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::lockSelectedItems()
@@ -1964,7 +1964,7 @@ void QgsComposition::lockSelectedItems()

setAllUnselected();
mUndoStack->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::unlockAllItems()
@@ -1993,7 +1993,7 @@ void QgsComposition::unlockAllItems()
}
}
mUndoStack->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

QgsComposerItemGroup *QgsComposition::groupItems( QList<QgsComposerItem *> items )
@@ -2073,7 +2073,7 @@ void QgsComposition::updateZValues( const bool addUndoCommands )
if ( addUndoCommands )
{
mUndoStack->push( parentCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}
}

@@ -2422,7 +2422,7 @@ void QgsComposition::endCommand()
if ( mActiveItemCommand->containsChange() ) //protect against empty commands
{
mUndoStack->push( mActiveItemCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}
else
{
@@ -2467,7 +2467,7 @@ void QgsComposition::endMultiFrameCommand()
if ( mActiveMultiFrameCommand->containsChange() )
{
mUndoStack->push( mActiveMultiFrameCommand );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}
else
{
@@ -2708,7 +2708,7 @@ void QgsComposition::pushAddRemoveCommand( QgsComposerItem* item, const QString&
QgsAddRemoveItemCommand* c = new QgsAddRemoveItemCommand( state, item, this, text );
connectAddRemoveCommandSignals( c );
undoStack()->push( c );
QgsProject::instance()->dirty( true );
QgsProject::instance()->setDirty( true );
}

void QgsComposition::connectAddRemoveCommandSignals( QgsAddRemoveItemCommand* c )
@@ -391,7 +391,7 @@ void QgsProject::setTitle( const QString &title )
{
imp_->title = title;

dirty( true );
setDirty( true );
}


@@ -406,15 +406,9 @@ bool QgsProject::isDirty() const
return imp_->dirty;
} // bool QgsProject::isDirty()


void QgsProject::dirty( bool b )
{
imp_->dirty = b;
} // bool QgsProject::isDirty()

void QgsProject::setDirty( bool b )
{
dirty( b );
imp_->dirty = b;
}


@@ -423,7 +417,7 @@ void QgsProject::setFileName( QString const &name )
{
imp_->file.setFileName( name );

dirty( true );
setDirty( true );
} // void QgsProject::setFileName( QString const &name )


@@ -941,12 +935,13 @@ bool QgsProject::read()
mVisibilityPresetCollection.reset( new QgsVisibilityPresetCollection() );
mVisibilityPresetCollection->readXML( *doc );


// read the project: used by map canvas and legend
emit readProject( *doc );

// if all went well, we're allegedly in pristine state
if ( clean )
dirty( false );
setDirty( false );

emit nonIdentifiableLayersChanged( nonIdentifiableLayers() );

@@ -1194,7 +1189,7 @@ bool QgsProject::write()
return false;
}

dirty( false ); // reset to pristine state
setDirty( false ); // reset to pristine state

emit projectSaved();

@@ -1207,15 +1202,15 @@ void QgsProject::clearProperties()
{
clear();

dirty( true );
setDirty( true );
} // QgsProject::clearProperties()



bool
QgsProject::writeEntry( QString const &scope, const QString &key, bool value )
{
dirty( true );
setDirty( true );

return addKey_( scope, key, &imp_->properties_, value );
} // QgsProject::writeEntry ( ..., bool value )
@@ -1225,7 +1220,7 @@ bool
QgsProject::writeEntry( QString const &scope, const QString &key,
double value )
{
dirty( true );
setDirty( true );

return addKey_( scope, key, &imp_->properties_, value );
} // QgsProject::writeEntry ( ..., double value )
@@ -1234,7 +1229,7 @@ QgsProject::writeEntry( QString const &scope, const QString &key,
bool
QgsProject::writeEntry( QString const &scope, const QString &key, int value )
{
dirty( true );
setDirty( true );

return addKey_( scope, key, &imp_->properties_, value );
} // QgsProject::writeEntry ( ..., int value )
@@ -1244,7 +1239,7 @@ bool
QgsProject::writeEntry( QString const &scope, const QString &key,
const QString &value )
{
dirty( true );
setDirty( true );

return addKey_( scope, key, &imp_->properties_, value );
} // QgsProject::writeEntry ( ..., const QString &value )
@@ -1254,7 +1249,7 @@ bool
QgsProject::writeEntry( QString const &scope, const QString &key,
const QStringList &value )
{
dirty( true );
setDirty( true );

return addKey_( scope, key, &imp_->properties_, value );
} // QgsProject::writeEntry ( ..., const QStringList &value )
@@ -1390,7 +1385,7 @@ bool QgsProject::removeEntry( QString const &scope, const QString &key )
{
removeKey_( scope, key, imp_->properties_ );

dirty( true );
setDirty( true );

return !findKey_( scope, key, imp_->properties_ );
} // QgsProject::removeEntry

0 comments on commit 9c0a291

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