Skip to content

Commit a990adf

Browse files
committedMay 18, 2020
Use translated strings while logging profiles
1 parent a913a6a commit a990adf

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
832832
sInstance = this;
833833
QgsRuntimeProfiler *profiler = QgsApplication::profiler();
834834

835-
startProfile( QStringLiteral( "User profile manager" ) );
835+
startProfile( tr( "User profile manager" ) );
836836
mUserProfileManager = new QgsUserProfileManager( QString(), this );
837837
mUserProfileManager->setRootLocation( rootProfileLocation );
838838
mUserProfileManager->setActiveUserProfile( activeProfile );
@@ -841,14 +841,13 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
841841
endProfile();
842842

843843
// start the network logger early, we want all requests logged!
844-
startProfile( QStringLiteral( "Network logger" ) );
844+
startProfile( tr( "Network logger" ) );
845845
mNetworkLogger = new QgsNetworkLogger( QgsNetworkAccessManager::instance(), this );
846846
endProfile();
847847

848848
// load GUI: actions, menus, toolbars
849-
profiler->beginGroup( QStringLiteral( "qgisapp" ) );
850-
profiler->beginGroup( QStringLiteral( "startup" ) );
851-
startProfile( QStringLiteral( "Setting up UI" ) );
849+
profiler->start( tr( "Application startup" ) );
850+
startProfile( tr( "Setting up UI" ) );
852851
setupUi( this );
853852
// because mActionToggleMapOnly can hide the menu (thereby disabling menu actions),
854853
// we attach the following actions to the MainWindow too (to be able to come back)
@@ -861,7 +860,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
861860

862861
//////////
863862

864-
startProfile( QStringLiteral( "Checking database" ) );
863+
startProfile( tr( "Checking database" ) );
865864
mSplash->showMessage( tr( "Checking database" ), Qt::AlignHCenter | Qt::AlignBottom );
866865
qApp->processEvents();
867866
// Do this early on before anyone else opens it and prevents us copying it
@@ -873,7 +872,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
873872
endProfile();
874873

875874
// Create the themes folder for the user
876-
startProfile( QStringLiteral( "Creating theme folder" ) );
875+
startProfile( tr( "Creating theme folder" ) );
877876
QgsApplication::createThemeFolder();
878877
endProfile();
879878

@@ -893,7 +892,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
893892
QgsSettings settings;
894893

895894

896-
startProfile( QStringLiteral( "Building style sheet" ) );
895+
startProfile( tr( "Building style sheet" ) );
897896
// set up stylesheet builder and apply saved or default style options
898897
mStyleSheetBuilder = new QgisAppStyleSheet( this );
899898
connect( mStyleSheetBuilder, &QgisAppStyleSheet::appStyleSheetChanged,
@@ -906,7 +905,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
906905
centralLayout->setContentsMargins( 0, 0, 0, 0 );
907906

908907
// "theMapCanvas" used to find this canonical instance later
909-
startProfile( QStringLiteral( "Creating map canvas" ) );
908+
startProfile( tr( "Creating map canvas" ) );
910909
mMapCanvas = new QgsMapCanvas( centralWidget );
911910
mMapCanvas->setObjectName( QStringLiteral( "theMapCanvas" ) );
912911

@@ -933,13 +932,13 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
933932
mProjOpen = settings.value( QStringLiteral( "qgis/projOpenAtLaunch" ), 0 ).toInt();
934933

935934
// a bar to warn the user with non-blocking messages
936-
startProfile( QStringLiteral( "Message bar" ) );
935+
startProfile( tr( "Message bar" ) );
937936
mInfoBar = new QgsMessageBar( centralWidget );
938937
mInfoBar->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
939938
centralLayout->addWidget( mInfoBar, 0, 0, 1, 1 );
940939
endProfile();
941940

942-
startProfile( QStringLiteral( "Welcome page" ) );
941+
startProfile( tr( "Welcome page" ) );
943942
mWelcomePage = new QgsWelcomePage( skipVersionCheck );
944943
connect( mWelcomePage, &QgsWelcomePage::projectRemoved, this, [ this ]( int row )
945944
{
@@ -972,7 +971,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
972971

973972
mCentralContainer->setCurrentIndex( mProjOpen ? 0 : 1 );
974973

975-
startProfile( QStringLiteral( "User input dock" ) );
974+
startProfile( tr( "User input dock" ) );
976975
// User Input Dock Widget
977976
mUserInputDockWidget = new QgsUserInputWidget( mMapCanvas );
978977
mUserInputDockWidget->setObjectName( QStringLiteral( "UserInputDockWidget" ) );
@@ -985,13 +984,13 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
985984
//set the focus to the map canvas
986985
mMapCanvas->setFocus();
987986

988-
startProfile( QStringLiteral( "Layer tree" ) );
987+
startProfile( tr( "Layer tree" ) );
989988
mLayerTreeView = new QgsLayerTreeView( this );
990989
mLayerTreeView->setObjectName( QStringLiteral( "theLayerTreeView" ) ); // "theLayerTreeView" used to find this canonical instance later
991990
endProfile();
992991

993992
// create undo widget
994-
startProfile( QStringLiteral( "Undo dock" ) );
993+
startProfile( tr( "Undo dock" ) );
995994
mUndoDock = new QgsDockWidget( tr( "Undo/Redo" ), this );
996995
QShortcut *showUndoDock = new QShortcut( QKeySequence( tr( "Ctrl+5" ) ), this );
997996
connect( showUndoDock, &QShortcut::activated, mUndoDock, &QgsDockWidget::toggleUserVisible );
@@ -1005,7 +1004,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
10051004
endProfile();
10061005

10071006
// Advanced Digitizing dock
1008-
startProfile( QStringLiteral( "Advanced digitize panel" ) );
1007+
startProfile( tr( "Advanced digitize panel" ) );
10091008
mAdvancedDigitizingDockWidget = new QgsAdvancedDigitizingDockWidget( mMapCanvas, this );
10101009
mAdvancedDigitizingDockWidget->setWindowTitle( tr( "Advanced Digitizing" ) );
10111010
mAdvancedDigitizingDockWidget->setObjectName( QStringLiteral( "AdvancedDigitizingTools" ) );
@@ -1018,7 +1017,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
10181017
endProfile();
10191018

10201019
// Statistical Summary dock
1021-
startProfile( QStringLiteral( "Stats dock" ) );
1020+
startProfile( tr( "Statistics dock" ) );
10221021
mStatisticalSummaryDockWidget = new QgsStatisticalSummaryDockWidget( this );
10231022
mStatisticalSummaryDockWidget->setObjectName( QStringLiteral( "StatisticalSummaryDockWidget" ) );
10241023

@@ -1030,7 +1029,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
10301029
endProfile();
10311030

10321031
// Bookmarks dock
1033-
startProfile( QStringLiteral( "Bookmarks widget" ) );
1032+
startProfile( tr( "Bookmarks widget" ) );
10341033
mBookMarksDockWidget = new QgsBookmarks( this );
10351034
mBookMarksDockWidget->setObjectName( QStringLiteral( "BookmarksDockWidget" ) );
10361035

@@ -1044,7 +1043,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
10441043

10451044
endProfile();
10461045

1047-
startProfile( QStringLiteral( "Snapping utils" ) );
1046+
startProfile( tr( "Snapping utilities" ) );
10481047
mSnappingUtils = new QgsMapCanvasSnappingUtils( mMapCanvas, this );
10491048
mMapCanvas->setSnappingUtils( mSnappingUtils );
10501049
connect( QgsProject::instance(), &QgsProject::snappingConfigChanged, mSnappingUtils, &QgsSnappingUtils::setConfig );
@@ -1062,7 +1061,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
10621061

10631062
applyDefaultSettingsToCanvas( mMapCanvas );
10641063

1065-
functionProfile( &QgisApp::initLayerTreeView, this, QStringLiteral( "Init Layer tree view" ) );
1064+
functionProfile( &QgisApp::initLayerTreeView, this, QStringLiteral( "Initialize layer tree view" ) );
10661065
functionProfile( &QgisApp::createOverview, this, QStringLiteral( "Create overview" ) );
10671066
functionProfile( &QgisApp::createMapTips, this, QStringLiteral( "Create map tips" ) );
10681067
functionProfile( &QgisApp::createDecorations, this, QStringLiteral( "Create decorations" ) );
@@ -1073,7 +1072,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
10731072
functionProfile( &QgisApp::initNativeProcessing, this, QStringLiteral( "Initialize native processing" ) );
10741073
functionProfile( &QgisApp::initLayouts, this, QStringLiteral( "Initialize layouts support" ) );
10751074

1076-
startProfile( QStringLiteral( "Geometry validation" ) );
1075+
startProfile( tr( "Geometry validation" ) );
10771076

10781077
mGeometryValidationService = qgis::make_unique<QgsGeometryValidationService>( QgsProject::instance() );
10791078
mGeometryValidationService->setMessageBar( mInfoBar );
@@ -1109,14 +1108,14 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
11091108
}
11101109

11111110
// initialize the plugin manager
1112-
startProfile( QStringLiteral( "Plugin manager" ) );
1111+
startProfile( tr( "Plugin manager" ) );
11131112
mPluginManager = new QgsPluginManager( this, restorePlugins );
11141113
endProfile();
11151114

11161115
addDockWidget( Qt::LeftDockWidgetArea, mUndoDock );
11171116
mUndoDock->hide();
11181117

1119-
startProfile( QStringLiteral( "Layer Style dock" ) );
1118+
startProfile( tr( "Layer style dock" ) );
11201119
mMapStylingDock = new QgsDockWidget( this );
11211120
mMapStylingDock->setWindowTitle( tr( "Layer Styling" ) );
11221121
mMapStylingDock->setObjectName( QStringLiteral( "LayerStyling" ) );
@@ -1134,7 +1133,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
11341133
mMapStylingDock->hide();
11351134
endProfile();
11361135

1137-
startProfile( QStringLiteral( "Dev Tools dock" ) );
1136+
startProfile( tr( "Developer tools dock" ) );
11381137
mDevToolsDock = new QgsDockWidget( this );
11391138
mDevToolsDock->setWindowTitle( tr( "Debugging/Development Tools" ) );
11401139
mDevToolsDock->setObjectName( QStringLiteral( "DevTools" ) );
@@ -1151,7 +1150,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
11511150
mDevToolsDock->hide();
11521151
endProfile();
11531152

1154-
startProfile( QStringLiteral( "Snapping dialog" ) );
1153+
startProfile( tr( "Snapping dialog" ) );
11551154
mSnappingDialog = new QgsSnappingWidget( QgsProject::instance(), mMapCanvas, this );
11561155
connect( mSnappingDialog, &QgsSnappingWidget::snappingConfigChanged, QgsProject::instance(), [ = ] { QgsProject::instance()->setSnappingConfig( mSnappingDialog->config() ); } );
11571156
QString mainSnappingWidgetMode = QgsSettings().value( QStringLiteral( "/qgis/mainSnappingWidgetMode" ), "dialog" ).toString();
@@ -1381,7 +1380,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
13811380
#ifdef WITH_BINDINGS
13821381
if ( mPythonUtils && mPythonUtils->isEnabled() )
13831382
{
1384-
startProfile( QStringLiteral( "initPluginInstaller" ) );
1383+
startProfile( tr( "Plugin installer" ) );
13851384
// initialize the plugin installer to start fetching repositories in background
13861385
QgsPythonRunner::run( QStringLiteral( "import pyplugin_installer" ) );
13871386
QgsPythonRunner::run( QStringLiteral( "pyplugin_installer.initPluginInstaller()" ) );
@@ -1399,7 +1398,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
13991398
}
14001399

14011400
// Update recent project list (as possible custom project storages are now registered by plugins)
1402-
startProfile( QStringLiteral( "Update recent project paths" ) );
1401+
startProfile( tr( "Update recent project paths" ) );
14031402
updateRecentProjectPaths();
14041403
mWelcomePage->setRecentProjects( mRecentProjects );
14051404
endProfile();
@@ -1452,17 +1451,17 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
14521451
//
14531452
mSplash->showMessage( tr( "Restoring window state" ), Qt::AlignHCenter | Qt::AlignBottom );
14541453
qApp->processEvents();
1455-
startProfile( QStringLiteral( "Restore window state" ) );
1454+
startProfile( tr( "Restore window state" ) );
14561455
restoreWindowState();
14571456
endProfile();
14581457

14591458
// do main window customization - after window state has been restored, before the window is shown
1460-
startProfile( QStringLiteral( "Update customization on main window" ) );
1459+
startProfile( tr( "Update customization on main window" ) );
14611460
QgsCustomization::instance()->updateMainWindow( mToolbarMenu );
14621461
endProfile();
14631462

14641463
mSplash->showMessage( tr( "Populate saved styles" ), Qt::AlignHCenter | Qt::AlignBottom );
1465-
startProfile( QStringLiteral( "Populate saved styles" ) );
1464+
startProfile( tr( "Populate saved styles" ) );
14661465
QgsStyle::defaultStyle();
14671466
endProfile();
14681467

@@ -1486,7 +1485,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
14861485

14871486
mFullScreenMode = false;
14881487
mPrevScreenModeMaximized = false;
1489-
startProfile( QStringLiteral( "Show main window" ) );
1488+
startProfile( tr( "Show main window" ) );
14901489
show();
14911490
qApp->processEvents();
14921491
endProfile();
@@ -1617,7 +1616,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
16171616
// notify user if authentication system is disabled
16181617
( void )QgsAuthGuiUtils::isDisabled( messageBar() );
16191618

1620-
startProfile( QStringLiteral( "New project" ) );
1619+
startProfile( tr( "New project" ) );
16211620
fileNewBlank(); // prepare empty project, also skips any default templates from loading
16221621
updateCrsStatusBar();
16231622
endProfile();

0 commit comments

Comments
 (0)
Please sign in to comment.