Skip to content

Commit

Permalink
set objectName on QMenu/QAction in C++ core plugins, fixes partially #…
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Jan 30, 2014
1 parent eeae09c commit 0f590db
Show file tree
Hide file tree
Showing 24 changed files with 77 additions and 19 deletions.
6 changes: 5 additions & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7594,7 +7594,7 @@ QMenu* QgisApp::getPluginMenu( QString menuName )
}
// It doesn't exist, so create
QMenu *menu = new QMenu( menuName, this );
menu->setObjectName( menuName.normalized( QString::NormalizationForm_KD ).remove( QRegExp( "[^a-zA-Z]" ) ) );
menu->setObjectName( normalizedMenuName( menuName ) );
// Where to put it? - we worked that out above...
mPluginMenu->insertMenu( before, menu );

Expand Down Expand Up @@ -7656,6 +7656,7 @@ QMenu* QgisApp::getDatabaseMenu( QString menuName )
}
// It doesn't exist, so create
QMenu *menu = new QMenu( menuName, this );
menu->setObjectName( normalizedMenuName( menuName ) );
if ( before )
mDatabaseMenu->insertMenu( before, menu );
else
Expand Down Expand Up @@ -7705,6 +7706,7 @@ QMenu* QgisApp::getRasterMenu( QString menuName )

// It doesn't exist, so create
QMenu *menu = new QMenu( menuName, this );
menu->setObjectName( normalizedMenuName( menuName ) );
if ( before )
mRasterMenu->insertMenu( before, menu );
else
Expand Down Expand Up @@ -7744,6 +7746,7 @@ QMenu* QgisApp::getVectorMenu( QString menuName )
}
// It doesn't exist, so create
QMenu *menu = new QMenu( menuName, this );
menu->setObjectName( normalizedMenuName( menuName ) );
if ( before )
mVectorMenu->insertMenu( before, menu );
else
Expand Down Expand Up @@ -7783,6 +7786,7 @@ QMenu* QgisApp::getWebMenu( QString menuName )
}
// It doesn't exist, so create
QMenu *menu = new QMenu( menuName, this );
menu->setObjectName( normalizedMenuName( menuName ) );
if ( before )
mWebMenu->insertMenu( before, menu );
else
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QList<QgsDecorationItem*> decorationItems() { return mDecorationItems; }
void addDecorationItem( QgsDecorationItem* item ) { mDecorationItems.append( item ); }

/** @note added in 2.1 */
static QString normalizedMenuName( const QString & name ) { return name.normalized( QString::NormalizationForm_KD ).remove( QRegExp( "[^a-zA-Z]" ) ); }

#ifdef Q_OS_WIN
//! ugly hack
void skipNextContextMenuEvent();
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgscustomization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ QgsCustomizationDialog::QgsCustomizationDialog( QWidget *parent, QSettings* sett
mSettings = settings;
setupUi( this );

QSettings appSettings;
restoreGeometry( appSettings.value( "/Windows/Customization/geometry" ).toByteArray() );

init();
QStringList myHeaders;
myHeaders << tr( "Object name" ) << tr( "Label" ) << tr( "Description" );
Expand All @@ -63,6 +66,8 @@ QgsCustomizationDialog::QgsCustomizationDialog( QWidget *parent, QSettings* sett

QgsCustomizationDialog::~QgsCustomizationDialog()
{
QSettings settings;
settings.setValue( "/Windows/Customization/geometry", saveGeometry() );
}

QTreeWidgetItem * QgsCustomizationDialog::item( QString thePath, QTreeWidgetItem *theItem )
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/compass/qgscompassplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ void QgsCompassPlugin::initGui()

// Create the action for tool
mActionRunCompass = new QAction( QIcon(), tr( "Show compass" ), this );
mActionRunCompass->setObjectName( "mActionRunCompass" );
connect( mActionRunCompass, SIGNAL( triggered() ), this, SLOT( run() ) );

mActionAboutCompass = new QAction( QIcon(), tr( "&About" ), this );
mActionAboutCompass->setObjectName( "mActionAboutCompass" );
connect( mActionAboutCompass, SIGNAL( triggered() ), this, SLOT( about() ) );

setCurrentTheme( "" );
Expand Down
1 change: 1 addition & 0 deletions src/plugins/coordinate_capture/coordinatecapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ void CoordinateCapture::initGui()

// Create the action for tool
mQActionPointer = new QAction( QIcon(), tr( "Coordinate Capture" ), this );
mQActionPointer->setObjectName( "mQActionPointer" );
mQActionPointer->setCheckable( true );
mQActionPointer->setChecked( mpDockWidget->isVisible() );
// Set the what's this text
Expand Down
1 change: 1 addition & 0 deletions src/plugins/dxf2shp_converter/dxf2shpconverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void dxf2shpConverter::initGui()
// Create the action for tool
delete mQActionPointer;
mQActionPointer = new QAction( QIcon(), "Dxf2Shp Converter", this );
mQActionPointer->setObjectName( "mQActionPointer" );

// Set the icon
setCurrentTheme( "" );
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/evis/evis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ void eVis::initGui()

// Create the action for tool
mDatabaseConnectionActionPointer = new QAction( QIcon( ":/evis/eVisDatabaseConnection.png" ), tr( "eVis Database Connection" ), this );
mDatabaseConnectionActionPointer->setObjectName( "mDatabaseConnectionActionPointer" );
mEventIdToolActionPointer = new QAction( QIcon( ":/evis/eVisEventIdTool.png" ), tr( "eVis Event Id Tool" ), this );
mEventIdToolActionPointer->setObjectName( "mEventIdToolActionPointer" );
mEventBrowserActionPointer = new QAction( QIcon( ":/evis/eVisEventBrowser.png" ), tr( "eVis Event Browser" ), this );
mEventBrowserActionPointer->setObjectName( "mEventBrowserActionPointer" );

// Set the what's this text
mDatabaseConnectionActionPointer->setWhatsThis( tr( "Create layer from a database query" ) );
Expand Down
1 change: 1 addition & 0 deletions src/plugins/georeferencer/qgsgeorefplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ void QgsGeorefPlugin::initGui()

// Create the action for tool
mActionRunGeoref = new QAction( QIcon(), tr( "&Georeferencer" ), this );
mActionRunGeoref->setObjectName( "mActionRunGeoref" );

// Connect the action to the run
connect( mActionRunGeoref, SIGNAL( triggered() ), this, SLOT( run() ) );
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/georeferencer/qgsgeorefplugingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,10 +968,12 @@ void QgsGeorefPluginGui::createMenus()
QDialogButtonBox::ButtonLayout( style()->styleHint( QStyle::SH_DialogButtonLayout, 0, this ) );

mPanelMenu = new QMenu( tr( "Panels" ) );
mPanelMenu->setObjectName( "mPanelMenu" );
mPanelMenu->addAction( dockWidgetGCPpoints->toggleViewAction() );
// mPanelMenu->addAction(dockWidgetLogView->toggleViewAction());

mToolbarMenu = new QMenu( tr( "Toolbars" ) );
mToolbarMenu->setObjectName( "mToolbarMenu" );
mToolbarMenu->addAction( toolBarFile->toggleViewAction() );
mToolbarMenu->addAction( toolBarEdit->toggleViewAction() );
mToolbarMenu->addAction( toolBarView->toggleViewAction() );
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/globe/globe_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,11 @@ void GlobePlugin::initGui()

// Create the action for tool
mQActionPointer = new QAction( QIcon( ":/globe/globe.png" ), tr( "Launch Globe" ), this );
mQActionPointer->setObjectName( "mQActionPointer" );
mQActionSettingsPointer = new QAction( QIcon( ":/globe/globe.png" ), tr( "Globe Settings" ), this );
mQActionSettingsPointer->setObjectName( "mQActionSettingsPointer" );
mQActionUnload = new QAction( tr( "Unload Globe" ), this );
mQActionUnload->setObjectName( "mQActionUnload" );

// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Overlay data on a 3D globe" ) );
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/gps_importer/qgsgpsplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ void QgsGPSPlugin::initGui()

// add an action to the toolbar
mQActionPointer = new QAction( QIcon(), tr( "&GPS Tools" ), this );
mQActionPointer->setObjectName( "mQActionPointer" );
mCreateGPXAction = new QAction( QIcon(), tr( "&Create new GPX layer" ), this );
mCreateGPXAction->setObjectName( "mCreateGPXAction" );
setCurrentTheme( "" );

mQActionPointer->setWhatsThis( tr( "Creates a new GPX layer and displays it on the map canvas" ) );
Expand Down
35 changes: 22 additions & 13 deletions src/plugins/grass/qgsgrassplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,27 +134,36 @@ void QgsGrassPlugin::initGui()
mRegionBand->setZValue( 20 );

// Create the action for tool (the icons are set later by calling setCurrentTheme)
mOpenMapsetAction = new QAction( QIcon(), tr( "Open mapset" ), this );
mNewMapsetAction = new QAction( QIcon(), tr( "New mapset" ), this );
mCloseMapsetAction = new QAction( QIcon(), tr( "Close mapset" ), this );

mAddVectorAction = new QAction( QIcon(), tr( "Add GRASS vector layer" ), this );
mOpenMapsetAction = new QAction( QIcon(), tr( "Open Mapset" ), this );
mOpenMapsetAction->setObjectName( "mOpenMapsetAction" );
mNewMapsetAction = new QAction( QIcon(), tr( "New Mapset" ), this );
mNewMapsetAction->setObjectName( "mNewMapsetAction" );
mCloseMapsetAction = new QAction( QIcon(), tr( "Close Mapset" ), this );
mCloseMapsetAction->setObjectName( "mCloseMapsetAction" );

mAddVectorAction = new QAction( QIcon(), tr( "Add GRASS Vector Layer" ), this );
mAddVectorAction->setObjectName( "mAddVectorAction" );
mAddVectorAction->setWhatsThis( tr( "Adds a GRASS vector layer to the map canvas" ) );
mAddRasterAction = new QAction( QIcon(), tr( "Add GRASS raster layer" ), this );
mOpenToolsAction = new QAction( QIcon(), tr( "Open GRASS tools" ), this );
mAddRasterAction->setObjectName( "mAddRasterAction" );
mAddRasterAction->setWhatsThis( tr( "Adds a GRASS raster layer to the map canvas" ) );
mOpenToolsAction = new QAction( QIcon(), tr( "Open GRASS Tools" ), this );
mOpenToolsAction->setObjectName( "mOpenToolsAction" );
mOpenToolsAction->setWhatsThis( tr( "Open GRASS tools" ) );

mRegionAction = new QAction( QIcon(), tr( "Display Current Grass Region" ), this );
mRegionAction->setObjectName( "mRegionAction" );
mRegionAction->setWhatsThis( tr( "Displays the current GRASS region as a rectangle on the map canvas" ) );
mRegionAction->setCheckable( true );

mEditRegionAction = new QAction( QIcon(), tr( "Edit Current Grass Region" ), this );
mEditAction = new QAction( QIcon(), tr( "Edit Grass Vector layer" ), this );
mNewVectorAction = new QAction( QIcon(), tr( "Create new Grass Vector" ), this );

mAddVectorAction->setWhatsThis( tr( "Adds a GRASS vector layer to the map canvas" ) );
mAddRasterAction->setWhatsThis( tr( "Adds a GRASS raster layer to the map canvas" ) );
mOpenToolsAction->setWhatsThis( tr( "Open GRASS tools" ) );
mRegionAction->setWhatsThis( tr( "Displays the current GRASS region as a rectangle on the map canvas" ) );
mEditRegionAction->setObjectName( "mEditRegionAction" );
mEditRegionAction->setWhatsThis( tr( "Edit the current GRASS region" ) );
mEditAction = new QAction( QIcon(), tr( "Edit Grass Vector layer" ), this );
mEditAction->setObjectName( "mEditAction" );
mEditAction->setWhatsThis( tr( "Edit the currently selected GRASS vector layer." ) );
mNewVectorAction = new QAction( QIcon(), tr( "Create New Grass Vector" ), this );
mNewVectorAction->setObjectName( "mNewVectorAction" );

// Connect the action
connect( mAddVectorAction, SIGNAL( triggered() ), this, SLOT( addVector() ) );
Expand Down
1 change: 1 addition & 0 deletions src/plugins/heatmap/heatmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void Heatmap::initGui()

// Create the action for tool
mQActionPointer = new QAction( QIcon( ":/heatmap/heatmap.png" ), tr( "Heatmap" ), this );
mQActionPointer->setObjectName( "mQActionPointer" );
// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Creates a heatmap raster for the input point vector." ) );
// Connect the action to the run
Expand Down
1 change: 1 addition & 0 deletions src/plugins/interpolation/qgsinterpolationplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void QgsInterpolationPlugin::initGui()
if ( mIface )
{
mInterpolationAction = new QAction( QIcon( ":/raster-interpolate.png" ), tr( "&Interpolation" ), 0 );
mInterpolationAction->setObjectName( "mInterpolationAction" );
QObject::connect( mInterpolationAction, SIGNAL( triggered() ), this, SLOT( showInterpolationDialog() ) );
mIface->addRasterToolBarIcon( mInterpolationAction );
mIface->addPluginToRasterMenu( tr( "&Interpolation" ), mInterpolationAction );
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/offline_editing/offline_editing_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void QgsOfflineEditingPlugin::initGui()

// Create the action for tool
mActionConvertProject = new QAction( QIcon( ":/offline_editing/offline_editing_copy.png" ), tr( "Convert to offline project" ), this );
mActionConvertProject->setObjectName( "mActionConvertProject" );
// Set the what's this text
mActionConvertProject->setWhatsThis( tr( "Create offline copies of selected layers and save as offline project" ) );
// Connect the action to the run
Expand All @@ -65,6 +66,7 @@ void QgsOfflineEditingPlugin::initGui()
mActionConvertProject->setEnabled( false );

mActionSynchronize = new QAction( QIcon( ":/offline_editing/offline_editing_sync.png" ), tr( "Synchronize" ), this );
mActionSynchronize->setObjectName( "mActionSynchronize" );
mActionSynchronize->setWhatsThis( tr( "Synchronize offline project with remote layers" ) );
connect( mActionSynchronize, SIGNAL( triggered() ), this, SLOT( synchronize() ) );
mQGisIface->addDatabaseToolBarIcon( mActionSynchronize );
Expand Down
1 change: 1 addition & 0 deletions src/plugins/oracle_raster/qgsoracle_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void QgsOraclePlugin::initGui()
{
// Create the action for tool
mQActionPointer = new QAction( QIcon( ":/oracleplugin/oracleraster.svg" ), tr( "Add Oracle GeoRaster Layer..." ), this );
mQActionPointer->setObjectName( "mQActionPointer" );
// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Add a Oracle Spatial GeoRaster..." ) );
// Connect the action to the run
Expand Down
1 change: 1 addition & 0 deletions src/plugins/plugin_template/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void [pluginname]::initGui()

// Create the action for tool
mQActionPointer = new QAction( QIcon( ":/[pluginlcasename]/[pluginlcasename].png" ), tr( "[menuitemname]" ), this );
mQActionPointer->setObjectName( "mQActionPointer" );
// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Replace this with a short description of what the plugin does" ) );
// Connect the action to the run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,23 @@ void QgsRasterTerrainAnalysisPlugin::initGui()
}

mTerrainAnalysisMenu = new QMenu( tr( "Terrain analysis" ), rasterMenu );
mTerrainAnalysisMenu->setObjectName( "mTerrainAnalysisMenu" );
mTerrainAnalysisMenu->setIcon( QIcon( ":/raster/dem.png" ) );
mTerrainAnalysisMenu->addAction( tr( "Slope" ), this, SLOT( slope() ) );
mTerrainAnalysisMenu->addAction( tr( "Aspect" ), this, SLOT( aspect() ) );
mTerrainAnalysisMenu->addAction( tr( "Hillshade" ), this, SLOT( hillshade() ) );
mTerrainAnalysisMenu->addAction( tr( "Relief" ), this, SLOT( relief() ) );
mTerrainAnalysisMenu->addAction( tr( "Ruggedness index" ), this, SLOT( ruggedness() ) );
QAction *slopeAction = mTerrainAnalysisMenu->addAction( tr( "Slope" ), this, SLOT( slope() ) );
slopeAction->setObjectName( "slopeAction" );

QAction *aspectAction = mTerrainAnalysisMenu->addAction( tr( "Aspect" ), this, SLOT( aspect() ) );
aspectAction->setObjectName( "aspectAction" );
QAction *hilshadeAction = mTerrainAnalysisMenu->addAction( tr( "Hillshade" ), this, SLOT( hillshade() ) );
hilshadeAction->setObjectName( "hilshadeAction" );
QAction *reliefAction = mTerrainAnalysisMenu->addAction( tr( "Relief" ), this, SLOT( relief() ) );
reliefAction->setObjectName( "reliefAction" );
QAction *ruggednesIndex = mTerrainAnalysisMenu->addAction( tr( "Ruggedness index" ), this, SLOT( ruggedness() ) );
ruggednesIndex->setObjectName( "ruggednesIndex" );

rasterMenu->addMenu( mTerrainAnalysisMenu );


}
}

Expand Down
1 change: 1 addition & 0 deletions src/plugins/roadgraph/roadgraphplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void RoadGraphPlugin::initGui()

// Create the action for tool
mQSettingsAction = new QAction( QIcon( ":/roadgraph/road.png" ), tr( "Settings" ), this );
mQSettingsAction->setObjectName( "mQSettingsAction" );

// Set the what's this text
mQSettingsAction->setWhatsThis( tr( "Road graph plugin settings" ) );
Expand Down
1 change: 1 addition & 0 deletions src/plugins/spatialquery/qgsspatialqueryplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ void QgsSpatialQueryPlugin::initGui()

// Create the action for tool
mSpatialQueryAction = new QAction( QIcon(), tr( "&Spatial Query" ), this );
mSpatialQueryAction->setObjectName( "mSpatialQueryAction" );

// Connect the action to the spatialQuery slot
connect( mSpatialQueryAction, SIGNAL( triggered() ), this, SLOT( run() ) );
Expand Down
1 change: 1 addition & 0 deletions src/plugins/spit/qgsspitplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void QgsSpitPlugin::initGui()

// Create the action for tool
spitAction = new QAction( QIcon(), tr( "&Import Shapefiles to PostgreSQL" ), this );
spitAction->setObjectName( "spitAction" );
setCurrentTheme( "" );
spitAction->setWhatsThis( tr( "Import shapefiles into a PostGIS-enabled PostgreSQL database. "
"The schema and field names can be customized on import" ) );
Expand Down
1 change: 1 addition & 0 deletions src/plugins/sqlanywhere/sqlanywhere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ void SqlAnywhere::initGui()

// Create the action for tool
mActionAddSqlAnywhereLayer = new QAction( QIcon( ":/sqlanywhere/sqlanywhere.svg" ), tr( "Add SQL Anywhere Layer..." ), this );
mActionAddSqlAnywhereLayer->setObjectName( "mActionAddSqlAnywhereLayer" );
mActionAddSqlAnywhereLayer->setWhatsThis( tr( "Store vector layers within a SQL Anywhere database" ) );
connect( mActionAddSqlAnywhereLayer, SIGNAL( triggered() ), this, SLOT( addSqlAnywhereLayer() ) );

Expand Down
1 change: 1 addition & 0 deletions src/plugins/topology/topol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void Topol::initGui()
delete mQActionPointer;

mQActionPointer = new QAction( QIcon( ":/topology/topol.png" ), tr( "TopologyChecker" ), this );
mQActionPointer->setObjectName( "mQActionPointer" );
//mQActionPointer = new QAction( QIcon(), tr( "Topology Checker" ), this );
mQActionPointer->setCheckable( true );

Expand Down
1 change: 1 addition & 0 deletions src/plugins/zonal_statistics/qgszonalstatisticsplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void QgsZonalStatisticsPlugin::initGui()
delete mAction;

mAction = new QAction( QIcon( ":/zonal_statistics/raster-stats.png" ), tr( "&Zonal statistics" ), 0 );
mAction->setObjectName( "ZonalStatistics" );
QObject::connect( mAction, SIGNAL( triggered() ), this, SLOT( run() ) );
mIface->addRasterToolBarIcon( mAction );
mIface->addPluginToRasterMenu( tr( "&Zonal statistics" ), mAction );
Expand Down

0 comments on commit 0f590db

Please sign in to comment.