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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Dec 8 05:35:08 EST 2009


Author: mhugent
Date: 2009-12-08 05:35:07 -0500 (Tue, 08 Dec 2009)
New Revision: 12372

Modified:
   trunk/qgis/python/gui/qgisinterface.sip
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
   trunk/qgis/src/app/qgisappinterface.cpp
   trunk/qgis/src/gui/qgisinterface.h
Log:
Notify plugins if a composer has been added or removed

Modified: trunk/qgis/python/gui/qgisinterface.sip
===================================================================
--- trunk/qgis/python/gui/qgisinterface.sip	2009-12-08 04:24:06 UTC (rev 12371)
+++ trunk/qgis/python/gui/qgisinterface.sip	2009-12-08 10:35:07 UTC (rev 12372)
@@ -246,5 +246,13 @@
      */
     void currentLayerChanged ( QgsMapLayer * layer );
 
+    /**This signal is emitted when a new composer instance has been created
+       @note added in version 1.4*/
+    void composerAdded( QgsComposerView* v );
+
+    /**This signal is emitted before a new composer instance is going to be removed
+       @note added in version 1.4*/
+    void composerWillBeRemoved( QgsComposerView* v );
+
 };
 

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2009-12-08 04:24:06 UTC (rev 12371)
+++ trunk/qgis/src/app/qgisapp.cpp	2009-12-08 10:35:07 UTC (rev 12372)
@@ -3633,11 +3633,13 @@
   //and place action into print composers menu
   mPrintComposersMenu->addAction( newComposerObject->windowAction() );
   newComposerObject->open();
+  emit composerAdded(newComposerObject->view());
   return newComposerObject;
 }
 
 void QgisApp::deleteComposer( QgsComposer* c )
 {
+  emit composerWillBeRemoved(c->view());
   mPrintComposers.remove( c );
   mPrintComposersMenu->removeAction( c->windowAction() );
   delete c;

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2009-12-08 04:24:06 UTC (rev 12371)
+++ trunk/qgis/src/app/qgisapp.h	2009-12-08 10:35:07 UTC (rev 12372)
@@ -41,6 +41,7 @@
 class QgisAppInterface;
 class QgsClipboard;
 class QgsComposer;
+class QgsComposerView;
 class QgsGeometry;
 class QgsHelpViewer;
 class QgsFeature;
@@ -669,6 +670,15 @@
      */
     void currentThemeChanged( QString );
 
+    /**This signal is emitted when a new composer instance has been created
+       @note added in version 1.4*/
+    void composerAdded( QgsComposerView* v );
+
+     /**This signal is emitted before a new composer instance is going to be removed
+       @note added in version 1.4*/
+    void composerWillBeRemoved( QgsComposerView* v );
+
+
   private:
     /** This method will open a dialog so the user can select the sublayers
     * to load

Modified: trunk/qgis/src/app/qgisappinterface.cpp
===================================================================
--- trunk/qgis/src/app/qgisappinterface.cpp	2009-12-08 04:24:06 UTC (rev 12371)
+++ trunk/qgis/src/app/qgisappinterface.cpp	2009-12-08 10:35:07 UTC (rev 12372)
@@ -39,7 +39,8 @@
            this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) );
   connect( qgis, SIGNAL( currentThemeChanged( QString ) ),
            this, SIGNAL( currentThemeChanged( QString ) ) );
-
+  connect( qgis, SIGNAL(composerAdded(QgsComposerView*)), this, SIGNAL(composerAdded( QgsComposerView* )));
+  connect( qgis, SIGNAL(composerWillBeRemoved(QgsComposerView*)), this, SIGNAL(composerWillBeRemoved(QgsComposerView*)));
 }
 
 QgisAppInterface::~QgisAppInterface()
@@ -211,7 +212,6 @@
   return QgsShortcutsManager::instance()->unregisterAction( action );
 }
 
-
 //! Menus
 QMenu *QgisAppInterface::fileMenu() { return qgis->fileMenu(); }
 QMenu *QgisAppInterface::editMenu() { return qgis->editMenu(); }

Modified: trunk/qgis/src/gui/qgisinterface.h
===================================================================
--- trunk/qgis/src/gui/qgisinterface.h	2009-12-08 04:24:06 UTC (rev 12371)
+++ trunk/qgis/src/gui/qgisinterface.h	2009-12-08 10:35:07 UTC (rev 12372)
@@ -292,7 +292,12 @@
      *  The pointer to layer can be null if no layer is selected
      */
     void currentLayerChanged( QgsMapLayer * layer );
-
+    /**This signal is emitted when a new composer instance has been created
+       @note added in version 1.4*/
+    void composerAdded( QgsComposerView* v );
+    /**This signal is emitted before a new composer instance is going to be removed
+       @note added in version 1.4*/
+    void composerWillBeRemoved( QgsComposerView* v );
 };
 
 // FIXME: also in core/qgis.h



More information about the QGIS-commit mailing list