Skip to content

Commit

Permalink
do not transform project if current_version > transform.to (#7807)
Browse files Browse the repository at this point in the history
* do nottransform project if current_version > transform.to
* use >=
  • Loading branch information
3nids committed Sep 6, 2018
1 parent 1839daa commit d6b2537
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/core/qgsprojectfiletransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ QgsProjectFileTransform::TransformItem QgsProjectFileTransform::sTransformers[]
// A transformer with a NULL from version means that it should be run when upgrading
// from any version and will take care that it's not going to cause trouble if it's
// run several times on the same file.
{PFV(), PFV( 2, 99, 0 ), &QgsProjectFileTransform::transform2990},
{PFV(), PFV( 3, 0, 0 ), &QgsProjectFileTransform::transform3000},
};

bool QgsProjectFileTransform::updateRevision( const QgsProjectVersion &newVersion )
Expand All @@ -78,7 +78,7 @@ bool QgsProjectFileTransform::updateRevision( const QgsProjectVersion &newVersio
for ( std::size_t i = 0; i < sizeof( sTransformers ) / sizeof( TransformItem ); i++ )
{
const TransformItem &transformer = sTransformers[i];
if ( transformer.from == mCurrentVersion || transformer.from.isNull() )
if ( transformer.to >= mCurrentVersion && ( transformer.from == mCurrentVersion || transformer.from.isNull() ) )
{
// Run the transformer, and update the revision in every case
( this->*( transformer.transformFunc ) )();
Expand Down Expand Up @@ -621,7 +621,7 @@ void QgsProjectFileTransform::transform2200to2300()
}
}

void QgsProjectFileTransform::transform2990()
void QgsProjectFileTransform::transform3000()
{
// transform OTF off to "no projection" for project
QDomElement propsElem = mDom.firstChildElement( QStringLiteral( "qgis" ) ).toElement().firstChildElement( QStringLiteral( "properties" ) );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsprojectfiletransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class CORE_EXPORT QgsProjectFileTransform
void transform1400to1500();
void transform1800to1900();
void transform2200to2300();
void transform2990();
void transform3000();

//helper functions
static int rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName, QgsRasterLayer *rlayer );
Expand Down

0 comments on commit d6b2537

Please sign in to comment.