Skip to content
Permalink
Browse files
Improve about screen version report
- Don't show redundant compiled/running version strings if they are
  identical
- Show Proj EPSG database version
- Fix capitalisation and other formatting
  • Loading branch information
nyalldawson committed Apr 22, 2021
1 parent e29f119 commit 0f9431d5b52f0fab5176e06812c439a77b288b68
Showing with 98 additions and 36 deletions.
  1. +98 −36 src/app/qgisapp.cpp
@@ -309,6 +309,7 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
#include "qgshandlebadlayers.h"
#include "qgsprintlayout.h"
#include "qgsprocessingregistry.h"
#include "qgsprojutils.h"
#include "qgsproject.h"
#include "qgsprojectlayergroupdialog.h"
#include "qgsprojectproperties.h"
@@ -5139,7 +5140,6 @@ void QgisApp::about()
static QgsAbout *sAbt = nullptr;
if ( !sAbt )
{
QApplication::setOverrideCursor( Qt::WaitCursor );
sAbt = new QgsAbout( this );
QString versionString = QStringLiteral( "<html><body><div align='center'><table width='100%'>" );

@@ -5162,86 +5162,148 @@ void QgisApp::about()
{
versionString += QStringLiteral( "%1</td><td><a href=\"https://github.com/qgis/QGIS/commit/%2\">%2</a></td>" ).arg( tr( "QGIS code revision" ) ).arg( Qgis::devVersion() );
}

versionString += QLatin1String( "</tr><tr>" );

versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against Qt" ), QT_VERSION_STR );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against Qt" ), qVersion() );

// Qt version
const QString qtVersionCompiled{ QT_VERSION_STR };
const QString qtVersionRunning{ qVersion() };
if ( qtVersionCompiled != qtVersionRunning )
{
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against Qt" ), qtVersionCompiled );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against Qt" ), qtVersionRunning );
}
else
{
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "Qt version" ), qtVersionCompiled );
}
versionString += QLatin1String( "</tr><tr>" );

versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against GDAL/OGR" ), GDAL_RELEASE_NAME );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against GDAL/OGR" ), GDALVersionInfo( "RELEASE_NAME" ) );

// GDAL version
const QString gdalVersionCompiled { GDAL_RELEASE_NAME };
const QString gdalVersionRunning { GDALVersionInfo( "RELEASE_NAME" ) };
if ( gdalVersionCompiled != gdalVersionRunning )
{
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against GDAL/OGR" ), gdalVersionCompiled );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against GDAL/OGR" ), gdalVersionRunning );
}
else
{
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "GDAL/OGR version" ), gdalVersionCompiled );
}
versionString += QLatin1String( "</tr><tr>" );

versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against GEOS" ), GEOS_CAPI_VERSION );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against GEOS" ), GEOSversion() );
// proj
PJ_INFO info = proj_info();
const QString projVersionCompiled { QStringLiteral( "%1.%2.%3" ).arg( PROJ_VERSION_MAJOR ).arg( PROJ_VERSION_MINOR ).arg( PROJ_VERSION_PATCH ) };
const QString projVersionRunning { info.version };
if ( projVersionCompiled != projVersionRunning )
{
versionString += QStringLiteral( "<td>%1</td><td>%2.%3.%4</td>" ).arg( tr( "Compiled against PROJ" ), projVersionCompiled );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against PROJ" ), projVersionRunning );
}
else
{
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "PROJ version" ), projVersionCompiled );
}
versionString += QLatin1String( "</tr><tr>" );

// CRS database versions
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2 (%3)</td>" ).arg( tr( "EPSG Registry database version" ), QgsProjUtils::epsgRegistryVersion(), QgsProjUtils::epsgRegistryDate().toString( Qt::ISODate ) );
versionString += QLatin1String( "</tr><tr>" );

versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against SQLite" ), SQLITE_VERSION );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against SQLite" ), sqlite3_libversion() );
// GEOS version
const QString geosVersionCompiled { GEOS_CAPI_VERSION };
const QString geosVersionRunning { GEOSversion() };
if ( geosVersionCompiled != geosVersionRunning )
{
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against GEOS" ), geosVersionCompiled );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against GEOS" ), geosVersionRunning );
}
else
{
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "GEOS version" ), geosVersionCompiled );
}
versionString += QLatin1String( "</tr><tr>" );

// SQLite version
const QString sqliteVersionCompiled { SQLITE_VERSION };
const QString sqliteVersionRunning { sqlite3_libversion() };
if ( sqliteVersionCompiled != sqliteVersionRunning )
{
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against SQLite" ), sqliteVersionCompiled );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against SQLite" ), sqliteVersionRunning );
}
else
{
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "SQLite version" ), sqliteVersionCompiled );
}
versionString += QLatin1String( "</tr><tr>" );

// PDAL
#ifdef HAVE_PDAL
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against PDAL" ), PDAL_VERSION );
const QString pdalVersionCompiled { PDAL_VERSION };
#if PDAL_VERSION_MAJOR_INT > 1 || (PDAL_VERSION_MAJOR_INT == 1 && PDAL_VERSION_MINOR_INT >= 7)
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against PDAL" ) ).arg( QString::fromStdString( pdal::Config::fullVersionString() ) );
const QString pdalVersionRunningRaw { QString::fromStdString( pdal::Config::fullVersionString() ) };
#else
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against PDAL" ) ).arg( QString::fromStdString( pdal::GetFullVersionString() ) );
const QString pdalVersionRunningRaw { QString::fromStdString( pdal::GetFullVersionString() ) };
#endif
const QRegularExpression pdalVersionRx { QStringLiteral( "(\\d+\\.\\d+\\.\\d+)" )};
const QRegularExpressionMatch pdalVersionMatch{ pdalVersionRx.match( pdalVersionRunningRaw ) };
const QString pdalVersionRunning{ pdalVersionMatch.hasMatch() ? pdalVersionMatch.captured( 1 ) : pdalVersionRunningRaw };
if ( pdalVersionCompiled != pdalVersionRunning )
{
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Compiled against PDAL" ), pdalVersionCompiled );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against PDAL" ), pdalVersionRunning );
}
else
{
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "PDAL version" ), pdalVersionCompiled );
}
versionString += QLatin1String( "</tr><tr>" );
#endif

versionString += QStringLiteral( "<td>%1</td><td>" ).arg( tr( "PostgreSQL Client Version" ) );
// postgres
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">" ).arg( tr( "PostgreSQL client version" ) );
#ifdef HAVE_POSTGRESQL
versionString += QStringLiteral( PG_VERSION );
#else
versionString += tr( "No support" );
#endif
versionString += QStringLiteral( "</td></tr><tr>" );

versionString += QStringLiteral( "</td><td>%1</td><td>%2</td>" ).arg( tr( "SpatiaLite Version" ), spatialite_version() );

// spatialite
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "SpatiaLite version" ), spatialite_version() );
versionString += QLatin1String( "</tr><tr>" );

versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "QWT Version" ), QWT_VERSION_STR );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "QScintilla2 Version" ), QSCINTILLA_VERSION_STR );

// QWT
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "QWT version" ), QWT_VERSION_STR );
versionString += QLatin1String( "</tr><tr>" );

PJ_INFO info = proj_info();
versionString += QStringLiteral( "<td>%1</td><td>%2.%3.%4</td>" ).arg( tr( "Compiled against PROJ" ) ).arg( PROJ_VERSION_MAJOR ).arg( PROJ_VERSION_MINOR ).arg( PROJ_VERSION_PATCH );
versionString += QStringLiteral( "<td>%1</td><td>%2</td>" ).arg( tr( "Running against PROJ" ) ).arg( info.release );

// QScintilla
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "QScintilla2 version" ), QSCINTILLA_VERSION_STR );
versionString += QLatin1String( "</tr><tr>" );

versionString += QStringLiteral( "<td>%1</td><td" ).arg( tr( "OS Version" ) );

#ifndef QGISDEBUG
versionString += QLatin1String( " colspan=3" );
#endif

versionString += QStringLiteral( ">%1</td>" ).arg( QSysInfo::prettyProductName() );
// Operating system
versionString += QStringLiteral( "<td>%1</td><td colspan=\"3\">%2</td>" ).arg( tr( "OS version" ), QSysInfo::prettyProductName() );
versionString += QLatin1String( "</tr><tr>" );

#ifdef QGISDEBUG
versionString += QStringLiteral( "<td colspan=2>%1</td>" ).arg( tr( "This copy of QGIS writes debugging output." ) );
versionString += QLatin1String( "</tr><tr>" );
versionString += QStringLiteral( "<td colspan=\"4\"><i>%1</i></td>" ).arg( tr( "This copy of QGIS writes debugging output." ) );
versionString += QLatin1String( "</tr><tr>" );
#endif

#ifdef WITH_BINDINGS
if ( mPythonUtils && mPythonUtils->isEnabled() )
{
const QStringList activePlugins = mPythonUtils->listActivePlugins();
versionString += QStringLiteral( "</tr><tr><td>%1</td><td colspan=3>%2</td>" ).arg( tr( "Active python plugins" ), activePlugins.join( "; <br>" ) );
versionString += QStringLiteral( "</tr><tr><td>%1</td><td colspan=3><ul><li>%2</li><ul></td>" ).arg( tr( "Active Python plugins" ), activePlugins.join( "</li><li>" ) );
}
#endif

versionString += QLatin1String( "</tr></table></div></body></html>" );

sAbt->setVersion( versionString );

QApplication::restoreOverrideCursor();
}
sAbt->show();
sAbt->raise();

0 comments on commit 0f9431d

Please sign in to comment.