[QGIS Commit] r10741 - in trunk/qgis/src: app gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue May 5 14:46:21 EDT 2009


Author: wonder
Date: 2009-05-05 14:46:21 -0400 (Tue, 05 May 2009)
New Revision: 10741

Modified:
   trunk/qgis/src/app/qgisappinterface.cpp
   trunk/qgis/src/app/qgisappinterface.h
   trunk/qgis/src/gui/qgisinterface.h
Log:
Extension of QgisInterface so also actions from plugins can be set in configure shortcuts dialog.


Modified: trunk/qgis/src/app/qgisappinterface.cpp
===================================================================
--- trunk/qgis/src/app/qgisappinterface.cpp	2009-05-05 15:44:06 UTC (rev 10740)
+++ trunk/qgis/src/app/qgisappinterface.cpp	2009-05-05 18:46:21 UTC (rev 10741)
@@ -29,6 +29,7 @@
 #include "qgsmaplayerregistry.h"
 #include "qgsmapcanvas.h"
 #include "qgslegend.h"
+#include "qgsshortcutsmanager.h"
 
 QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
     : qgis( _qgis )
@@ -185,6 +186,18 @@
 void QgisAppInterface::addWindow( QAction *action ) { qgis->addWindow( action ); }
 void QgisAppInterface::removeWindow( QAction *action ) { qgis->removeWindow( action ); }
 
+
+bool QgisAppInterface::registerMainWindowAction( QAction* action, QString defaultShortcut )
+{
+  return QgsShortcutsManager::instance()->registerAction( action, defaultShortcut );
+}
+
+bool QgisAppInterface::unregisterMainWindowAction( QAction* action )
+{
+  return QgsShortcutsManager::instance()->unregisterAction( action );
+}
+
+
 //! Menus
 QMenu *QgisAppInterface::fileMenu() { return qgis->fileMenu(); }
 QMenu *QgisAppInterface::editMenu() { return qgis->editMenu(); }

Modified: trunk/qgis/src/app/qgisappinterface.h
===================================================================
--- trunk/qgis/src/app/qgisappinterface.h	2009-05-05 15:44:06 UTC (rev 10740)
+++ trunk/qgis/src/app/qgisappinterface.h	2009-05-05 18:46:21 UTC (rev 10741)
@@ -116,6 +116,14 @@
      * windows which are hidden rather than deleted when closed. */
     virtual void removeWindow( QAction *action );
 
+    /** Register action to the shortcuts manager so its shortcut can be changed in GUI.
+      @note added in version 1.2. */
+    virtual bool registerMainWindowAction( QAction* action, QString defaultShortcut );
+
+    /** Unregister a previously registered action. (e.g. when plugin is going to be unloaded.
+      @note added in version 1.2. */
+    virtual bool unregisterMainWindowAction( QAction* action );
+
     /** Accessors for inserting items into menus and toolbars.
      * An item can be inserted before any existing action.
      */

Modified: trunk/qgis/src/gui/qgisinterface.h
===================================================================
--- trunk/qgis/src/gui/qgisinterface.h	2009-05-05 15:44:06 UTC (rev 10740)
+++ trunk/qgis/src/gui/qgisinterface.h	2009-05-05 18:46:21 UTC (rev 10741)
@@ -135,6 +135,12 @@
      * windows which are hidden rather than deleted when closed. */
     virtual void removeWindow( QAction *action ) = 0;
 
+    /** Register action to the shortcuts manager so its shortcut can be changed in GUI */
+    virtual bool registerMainWindowAction( QAction* action, QString defaultShortcut ) = 0;
+
+    /** Unregister a previously registered action. (e.g. when plugin is going to be unloaded */
+    virtual bool unregisterMainWindowAction( QAction* action ) = 0;
+
     // TODO: is this deprecated in favour of QgsContextHelp?
     /** Open a url in the users browser. By default the QGIS doc directory is used
      * as the base for the URL. To open a URL that is not relative to the installed



More information about the QGIS-commit mailing list