Skip to content

Commit

Permalink
Add accessors for all menus, toolbars and actions to plugin interface…
Browse files Browse the repository at this point in the history
… so that plugins can insert actions at any position in any menu or toolbar.

git-svn-id: http://svn.osgeo.org/qgis/trunk@9258 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Sep 5, 2008
1 parent 95858f5 commit 0a6dbb7
Show file tree
Hide file tree
Showing 4 changed files with 501 additions and 16 deletions.
131 changes: 127 additions & 4 deletions python/gui/qgisinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ class QgisInterface : QObject
virtual void removeToolBarIcon(QAction *qAction) = 0;
//! Add toolbar with specified name
virtual QToolBar* addToolBar(QString name)=0 /Factory/;
/** Get the file toolbar - intended for use with plugins which
* add a new file type handler.
*/
virtual QToolBar * fileToolBar()=0;

// TODO: is this deprecated in favour of QgsContextHelp?
/** Open a url in the users browser. By default the QGIS doc directory is used
Expand Down Expand Up @@ -88,6 +84,133 @@ class QgisInterface : QObject
/** refresh legend of a layer */
virtual void refreshLegend( QgsMapLayer * layer )=0;

/** Add window to Window menu. The action title is the window title
* and the action should raise, unminimize and activate the window. */
virtual void addWindow( QAction *action ) = 0;
/** Remove window from Window menu. Calling this is necessary only for
* windows which are hidden rather than deleted when closed. */
virtual void removeWindow( QAction *action ) = 0;

/** Accessors for inserting items into menus and toolbars.
* An item can be inserted before any existing action.
*/

//! Menus
virtual QMenu *fileMenu() = 0;
virtual QMenu *editMenu() = 0;
virtual QMenu *viewMenu() = 0;
virtual QMenu *layerMenu() = 0;
virtual QMenu *settingsMenu() = 0;
virtual QMenu *pluginMenu() = 0;
virtual QMenu *firstRightStandardMenu() = 0;
virtual QMenu *windowMenu() = 0;
virtual QMenu *helpMenu() = 0;

//! ToolBars
virtual QToolBar *fileToolBar() = 0;
virtual QToolBar *layerToolBar() = 0;
virtual QToolBar *mapNavToolToolBar() = 0;
virtual QToolBar *digitizeToolBar() = 0;
virtual QToolBar *attributesToolBar() = 0;
virtual QToolBar *pluginToolBar() = 0;
virtual QToolBar *helpToolBar() = 0;

//! File menu actions
virtual QAction *actionNewProject() = 0;
virtual QAction *actionOpenProject() = 0;
virtual QAction *actionFileSeparator1() = 0;
virtual QAction *actionSaveProject() = 0;
virtual QAction *actionSaveProjectAs() = 0;
virtual QAction *actionSaveMapAsImage() = 0;
virtual QAction *actionFileSeparator2() = 0;
virtual QAction *actionProjectProperties() = 0;
virtual QAction *actionFileSeparator3() = 0;
virtual QAction *actionPrintComposer() = 0;
virtual QAction *actionFileSeparator4() = 0;
virtual QAction *actionExit() = 0;

//! Edit menu actions
virtual QAction *actionCutFeatures() = 0;
virtual QAction *actionCopyFeatures() = 0;
virtual QAction *actionPasteFeatures() = 0;
virtual QAction *actionEditSeparator1() = 0;
virtual QAction *actionCapturePoint() = 0;
virtual QAction *actionCaptureLine() = 0;
virtual QAction *actionCapturePologon() = 0;
virtual QAction *actionDeleteSelected() = 0;
virtual QAction *actionMoveFeature() = 0;
virtual QAction *actionSplitFeatures() = 0;
virtual QAction *actionAddVertex() = 0;
virtual QAction *actionDelerteVertex() = 0;
virtual QAction *actioMoveVertex() = 0;
virtual QAction *actionAddRing() = 0;
virtual QAction *actionAddIsland() = 0;
virtual QAction *actionEditSeparator2() = 0;

//! View menu actions
virtual QAction *actionPan() = 0;
virtual QAction *actionZoomIn() = 0;
virtual QAction *actionZoomOut() = 0;
virtual QAction *actionSelect() = 0;
virtual QAction *actionIdentify() = 0;
virtual QAction *actionMeasure() = 0;
virtual QAction *actionMeasureArea() = 0;
virtual QAction *actionViewSeparator1() = 0;
virtual QAction *actionZoomFullExtent() = 0;
virtual QAction *actionZoomToLayer() = 0;
virtual QAction *actionZoomToSelected() = 0;
virtual QAction *actionZoomLast() = 0;
virtual QAction *actionZoomActualSize() = 0;
virtual QAction *actionViewSeparator2() = 0;
virtual QAction *actionMapTips() = 0;
virtual QAction *actionNewBookmark() = 0;
virtual QAction *actionShowBookmarks() = 0;
virtual QAction *actionDraw() = 0;
virtual QAction *actionViewSeparator3() = 0;

//! Layer menu actions
virtual QAction *actionNewVectorLayer() = 0;
virtual QAction *actionAddOgrLayer() = 0;
virtual QAction *actionAddRasterLayer() = 0;
virtual QAction *actionAddPgLayer() = 0;
virtual QAction *actionAddWmsLayer() = 0;
virtual QAction *actionLayerSeparator1() = 0;
virtual QAction *actionOpenTable() = 0;
virtual QAction *actionToggleEditing() = 0;
virtual QAction *actionLayerSaveAs() = 0;
virtual QAction *actionLayerSelectionSaveAs() = 0;
virtual QAction *actionRemoveLayer() = 0;
virtual QAction *actionLayerProperties() = 0;
virtual QAction *actionLayerSeparator2() = 0;
virtual QAction *actionAddToOverview() = 0;
virtual QAction *actionAddAllToOverview() = 0;
virtual QAction *actionRemoveAllFromOverview() = 0;
virtual QAction *actionLayerSeparator3() = 0;
virtual QAction *actionHideAllLayers() = 0;
virtual QAction *actionShowAllLayers() = 0;

//! Plugin menu actions
virtual QAction *actionManagePlugins() = 0;
virtual QAction *actionPluginSeparator1() = 0;
virtual QAction *actionPluginListSeparator() = 0;
virtual QAction *actionPluginSeparator2() = 0;
virtual QAction *actionPluginPythonSeparator() = 0;
virtual QAction *actionShowPythonDialog() = 0;

//! Settings menu actions
virtual QAction *actionToggleFullScreen() = 0;
virtual QAction *actionSettingsSeparator1() = 0;
virtual QAction *actionOptions() = 0;
virtual QAction *actionCustomProjection() = 0;

//! Help menu actions
virtual QAction *actionHelpContents() = 0;
virtual QAction *actionHelpSeparator1() = 0;
virtual QAction *actionQgisHomePage() = 0;
virtual QAction *actionCheckQgisVersion() = 0;
virtual QAction *actionHelpSeparator2() = 0;
virtual QAction *actionAbout() = 0;

signals:
/** Emited whenever current (selected) layer changes.
* The pointer to layer can be null if no layer is selected
Expand Down
124 changes: 120 additions & 4 deletions src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,7 @@ QToolBar* QgisAppInterface::addToolBar( QString name )
{
return qgis->addToolBar( name );
}
QToolBar * QgisAppInterface::fileToolBar()
{
return qgis->fileToolBar();
}

void QgisAppInterface::openURL( QString url, bool useQgisDocDirectory )
{
qgis->openURL( url, useQgisDocDirectory );
Expand Down Expand Up @@ -153,3 +150,122 @@ void QgisAppInterface::refreshLegend( QgsMapLayer *l )
qgis->legend()->refreshLayerSymbology( l->getLayerID() );
}
}

void QgisAppInterface::addWindow( QAction *action ) { qgis->addWindow( action ); }
void QgisAppInterface::removeWindow( QAction *action ) { qgis->removeWindow( action ); }

//! Menus
QMenu *QgisAppInterface::fileMenu() { return qgis->fileMenu(); }
QMenu *QgisAppInterface::editMenu() { return qgis->editMenu(); }
QMenu *QgisAppInterface::viewMenu() { return qgis->viewMenu(); }
QMenu *QgisAppInterface::layerMenu() { return qgis->layerMenu(); }
QMenu *QgisAppInterface::settingsMenu() { return qgis->settingsMenu(); }
QMenu *QgisAppInterface::pluginMenu() { return qgis->pluginMenu(); }
QMenu *QgisAppInterface::firstRightStandardMenu() { return qgis->firstRightStandardMenu(); }
QMenu *QgisAppInterface::windowMenu() { return qgis->windowMenu(); }
QMenu *QgisAppInterface::helpMenu() { return qgis->helpMenu(); }

//! ToolBars
QToolBar *QgisAppInterface::fileToolBar() { return qgis->fileToolBar(); }
QToolBar *QgisAppInterface::layerToolBar() { return qgis->layerToolBar(); }
QToolBar *QgisAppInterface::mapNavToolToolBar() { return qgis->mapNavToolToolBar(); }
QToolBar *QgisAppInterface::digitizeToolBar() { return qgis->digitizeToolBar(); }
QToolBar *QgisAppInterface::attributesToolBar() { return qgis->attributesToolBar(); }
QToolBar *QgisAppInterface::pluginToolBar() { return qgis->pluginToolBar(); }
QToolBar *QgisAppInterface::helpToolBar() { return qgis->helpToolBar(); }

//! File menu actions
QAction *QgisAppInterface::actionNewProject() { return qgis->actionNewProject(); }
QAction *QgisAppInterface::actionOpenProject() { return qgis->actionOpenProject(); }
QAction *QgisAppInterface::actionFileSeparator1() { return qgis->actionFileSeparator1(); }
QAction *QgisAppInterface::actionSaveProject() { return qgis->actionSaveProject(); }
QAction *QgisAppInterface::actionSaveProjectAs() { return qgis->actionSaveProjectAs(); }
QAction *QgisAppInterface::actionSaveMapAsImage() { return qgis->actionSaveMapAsImage(); }
QAction *QgisAppInterface::actionFileSeparator2() { return qgis->actionFileSeparator2(); }
QAction *QgisAppInterface::actionProjectProperties() { return qgis->actionProjectProperties(); }
QAction *QgisAppInterface::actionFileSeparator3() { return qgis->actionFileSeparator3(); }
QAction *QgisAppInterface::actionPrintComposer() { return qgis->actionPrintComposer(); }
QAction *QgisAppInterface::actionFileSeparator4() { return qgis->actionFileSeparator4(); }
QAction *QgisAppInterface::actionExit() { return qgis->actionExit(); }

//! Edit menu actions
QAction *QgisAppInterface::actionCutFeatures() { return qgis->actionCutFeatures(); }
QAction *QgisAppInterface::actionCopyFeatures() { return qgis->actionCopyFeatures(); }
QAction *QgisAppInterface::actionPasteFeatures() { return qgis->actionPasteFeatures(); }
QAction *QgisAppInterface::actionEditSeparator1() { return qgis->actionEditSeparator1(); }
QAction *QgisAppInterface::actionCapturePoint() { return qgis->actionCapturePoint(); }
QAction *QgisAppInterface::actionCaptureLine() { return qgis->actionCaptureLine(); }
QAction *QgisAppInterface::actionCapturePologon() { return qgis->actionCapturePologon(); }
QAction *QgisAppInterface::actionDeleteSelected() { return qgis->actionDeleteSelected(); }
QAction *QgisAppInterface::actionMoveFeature() { return qgis->actionMoveFeature(); }
QAction *QgisAppInterface::actionSplitFeatures() { return qgis->actionSplitFeatures(); }
QAction *QgisAppInterface::actionAddVertex() { return qgis->actionAddVertex(); }
QAction *QgisAppInterface::actionDelerteVertex() { return qgis->actionDelerteVertex(); }
QAction *QgisAppInterface::actioMoveVertex() { return qgis->actioMoveVertex(); }
QAction *QgisAppInterface::actionAddRing() { return qgis->actionAddRing(); }
QAction *QgisAppInterface::actionAddIsland() { return qgis->actionAddIsland(); }
QAction *QgisAppInterface::actionEditSeparator2() { return qgis->actionEditSeparator2(); }

//! View menu actions
QAction *QgisAppInterface::actionPan() { return qgis->actionPan(); }
QAction *QgisAppInterface::actionZoomIn() { return qgis->actionZoomIn(); }
QAction *QgisAppInterface::actionZoomOut() { return qgis->actionZoomOut(); }
QAction *QgisAppInterface::actionSelect() { return qgis->actionSelect(); }
QAction *QgisAppInterface::actionIdentify() { return qgis->actionIdentify(); }
QAction *QgisAppInterface::actionMeasure() { return qgis->actionMeasure(); }
QAction *QgisAppInterface::actionMeasureArea() { return qgis->actionMeasureArea(); }
QAction *QgisAppInterface::actionViewSeparator1() { return qgis->actionViewSeparator1(); }
QAction *QgisAppInterface::actionZoomFullExtent() { return qgis->actionZoomFullExtent(); }
QAction *QgisAppInterface::actionZoomToLayer() { return qgis->actionZoomToLayer(); }
QAction *QgisAppInterface::actionZoomToSelected() { return qgis->actionZoomToSelected(); }
QAction *QgisAppInterface::actionZoomLast() { return qgis->actionZoomLast(); }
QAction *QgisAppInterface::actionZoomActualSize() { return qgis->actionZoomActualSize(); }
QAction *QgisAppInterface::actionViewSeparator2() { return qgis->actionViewSeparator2(); }
QAction *QgisAppInterface::actionMapTips() { return qgis->actionMapTips(); }
QAction *QgisAppInterface::actionNewBookmark() { return qgis->actionNewBookmark(); }
QAction *QgisAppInterface::actionShowBookmarks() { return qgis->actionShowBookmarks(); }
QAction *QgisAppInterface::actionDraw() { return qgis->actionDraw(); }
QAction *QgisAppInterface::actionViewSeparator3() { return qgis->actionViewSeparator3(); }

//! Layer menu actions
QAction *QgisAppInterface::actionNewVectorLayer() { return qgis->actionNewVectorLayer(); }
QAction *QgisAppInterface::actionAddOgrLayer() { return qgis->actionAddOgrLayer(); }
QAction *QgisAppInterface::actionAddRasterLayer() { return qgis->actionAddRasterLayer(); }
QAction *QgisAppInterface::actionAddPgLayer() { return qgis->actionAddPgLayer(); }
QAction *QgisAppInterface::actionAddWmsLayer() { return qgis->actionAddWmsLayer(); }
QAction *QgisAppInterface::actionLayerSeparator1() { return qgis->actionLayerSeparator1(); }
QAction *QgisAppInterface::actionOpenTable() { return qgis->actionOpenTable(); }
QAction *QgisAppInterface::actionToggleEditing() { return qgis->actionToggleEditing(); }
QAction *QgisAppInterface::actionLayerSaveAs() { return qgis->actionLayerSaveAs(); }
QAction *QgisAppInterface::actionLayerSelectionSaveAs() { return qgis->actionLayerSelectionSaveAs(); }
QAction *QgisAppInterface::actionRemoveLayer() { return qgis->actionRemoveLayer(); }
QAction *QgisAppInterface::actionLayerProperties() { return qgis->actionLayerProperties(); }
QAction *QgisAppInterface::actionLayerSeparator2() { return qgis->actionLayerSeparator2(); }
QAction *QgisAppInterface::actionAddToOverview() { return qgis->actionAddToOverview(); }
QAction *QgisAppInterface::actionAddAllToOverview() { return qgis->actionAddAllToOverview(); }
QAction *QgisAppInterface::actionRemoveAllFromOverview() { return qgis->actionRemoveAllFromOverview(); }
QAction *QgisAppInterface::actionLayerSeparator3() { return qgis->actionLayerSeparator3(); }
QAction *QgisAppInterface::actionHideAllLayers() { return qgis->actionHideAllLayers(); }
QAction *QgisAppInterface::actionShowAllLayers() { return qgis->actionShowAllLayers(); }

//! Plugin menu actions
QAction *QgisAppInterface::actionManagePlugins() { return qgis->actionManagePlugins(); }
QAction *QgisAppInterface::actionPluginSeparator1() { return qgis->actionPluginSeparator1(); }
QAction *QgisAppInterface::actionPluginListSeparator() { return qgis->actionPluginListSeparator(); }
QAction *QgisAppInterface::actionPluginSeparator2() { return qgis->actionPluginSeparator2(); }
QAction *QgisAppInterface::actionPluginPythonSeparator() { return qgis->actionPluginPythonSeparator(); }
QAction *QgisAppInterface::actionShowPythonDialog() { return qgis->actionShowPythonDialog(); }

//! Settings menu actions
QAction *QgisAppInterface::actionToggleFullScreen() { return qgis->actionToggleFullScreen(); }
QAction *QgisAppInterface::actionSettingsSeparator1() { return qgis->actionSettingsSeparator1(); }
QAction *QgisAppInterface::actionOptions() { return qgis->actionOptions(); }
QAction *QgisAppInterface::actionCustomProjection() { return qgis->actionCustomProjection(); }

//! Help menu actions
QAction *QgisAppInterface::actionHelpContents() { return qgis->actionHelpContents(); }
QAction *QgisAppInterface::actionHelpSeparator1() { return qgis->actionHelpSeparator1(); }
QAction *QgisAppInterface::actionQgisHomePage() { return qgis->actionQgisHomePage(); }
QAction *QgisAppInterface::actionCheckQgisVersion() { return qgis->actionCheckQgisVersion(); }
QAction *QgisAppInterface::actionHelpSeparator2() { return qgis->actionHelpSeparator2(); }
QAction *QgisAppInterface::actionAbout() { return qgis->actionAbout(); }

0 comments on commit 0a6dbb7

Please sign in to comment.