Skip to content
Permalink
Browse files

Expand size of recent CRS history to 30 items

Because I'm sure I'm not the only one who regularly works with
more than 10 CRSes...
  • Loading branch information
nyalldawson committed Sep 23, 2020
1 parent 6b0fc7b commit 1c3347af9778e28242c04f3b1c1d4f0f38dcb49f
@@ -3603,8 +3603,8 @@ void QgsCoordinateReferenceSystem::pushRecentCoordinateReferenceSystem( const Qg
recent.removeAll( crs );
recent.insert( 0, crs );

// trim to max 10 items
recent = recent.mid( 0, 10 );
// trim to max 30 items
recent = recent.mid( 0, 30 );
QStringList authids;
authids.reserve( recent.size() );
QStringList proj;
@@ -1564,13 +1564,13 @@ void TestQgsCoordinateReferenceSystem::recentProjections()
QCOMPARE( recent.at( 1 ).authid(), QStringLiteral( "EPSG:3111" ) );
QCOMPARE( recent.at( 2 ).authid(), QStringLiteral( "EPSG:4326" ) );

// list should be truncated after 10 entries
// list should be truncated after 30 entries
for ( int i = 32510; i < 32550; ++i )
{
QgsCoordinateReferenceSystem::pushRecentCoordinateReferenceSystem( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:%1" ).arg( i ) ) );
}
recent = QgsCoordinateReferenceSystem::recentCoordinateReferenceSystems();
QCOMPARE( recent.size(), 10 );
QCOMPARE( recent.size(), 30 );
QCOMPARE( recent.at( 0 ).authid(), QStringLiteral( "EPSG:32549" ) );
QCOMPARE( recent.at( 1 ).authid(), QStringLiteral( "EPSG:32548" ) );
QCOMPARE( recent.at( 2 ).authid(), QStringLiteral( "EPSG:32547" ) );
@@ -1581,6 +1581,7 @@ void TestQgsCoordinateReferenceSystem::recentProjections()
QCOMPARE( recent.at( 7 ).authid(), QStringLiteral( "EPSG:32542" ) );
QCOMPARE( recent.at( 8 ).authid(), QStringLiteral( "EPSG:32541" ) );
QCOMPARE( recent.at( 9 ).authid(), QStringLiteral( "EPSG:32540" ) );
QCOMPARE( recent.constLast().authid(), QStringLiteral( "EPSG:32520" ) );
}

void TestQgsCoordinateReferenceSystem::displayIdentifier()

0 comments on commit 1c3347a

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