[QGIS Commit] r10393 - in trunk/qgis/src: app plugins/coordinate_capture

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Mar 21 18:04:51 EDT 2009


Author: timlinux
Date: 2009-03-21 18:04:51 -0400 (Sat, 21 Mar 2009)
New Revision: 10393

Modified:
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
   trunk/qgis/src/app/qgisappinterface.cpp
   trunk/qgis/src/app/qgisappinterface.h
   trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.cpp
   trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.h
Log:
Enable plugins to dynamically change their theme if it is changed in app props. Its up to each plugin to individually support this

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2009-03-21 21:53:52 UTC (rev 10392)
+++ trunk/qgis/src/app/qgisapp.cpp	2009-03-21 22:04:51 UTC (rev 10393)
@@ -1485,6 +1485,7 @@
   {
     mComposer->setupTheme();
   }
+  emit currentThemeChanged( theThemeName );
 }
 
 void QgisApp::setupConnections()

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2009-03-21 21:53:52 UTC (rev 10392)
+++ trunk/qgis/src/app/qgisapp.h	2009-03-21 22:04:51 UTC (rev 10393)
@@ -599,6 +599,12 @@
     //! emitted when a new bookmark is added
     void bookmarkAdded();
 
+    /** Signal emitted when the current theme is changed so plugins 
+     * can change there tool button icons.
+     * @note This was added in QGIS 1.1
+     */
+    void currentThemeChanged ( QString );
+
   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-03-21 21:53:52 UTC (rev 10392)
+++ trunk/qgis/src/app/qgisappinterface.cpp	2009-03-21 22:04:51 UTC (rev 10393)
@@ -36,6 +36,8 @@
   // connect signals
   connect( qgis->legend(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ),
            this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) );
+  connect( qgis, SIGNAL( currentThemeChanged( QString ) ),
+           this, SIGNAL( currentThemeChanged( QString ) ) );
 
 }
 

Modified: trunk/qgis/src/app/qgisappinterface.h
===================================================================
--- trunk/qgis/src/app/qgisappinterface.h	2009-03-21 21:53:52 UTC (rev 10392)
+++ trunk/qgis/src/app/qgisappinterface.h	2009-03-21 22:04:51 UTC (rev 10393)
@@ -234,6 +234,9 @@
     virtual QAction *actionHelpSeparator2();
     virtual QAction *actionAbout();
 
+  signals:
+    void currentThemeChanged( QString );
+
   private:
 
     /// QgisInterface aren't copied

Modified: trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.cpp
===================================================================
--- trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.cpp	2009-03-21 21:53:52 UTC (rev 10392)
+++ trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.cpp	2009-03-21 22:04:51 UTC (rev 10393)
@@ -83,6 +83,7 @@
   mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object
 
   connect( mQGisIface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) );
+  connect( mQGisIface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
 
   setSourceCrs(); //set up the source CRS
   mTransform.setDestCRS( mCrs ); // set the CRS in the transform
@@ -251,6 +252,11 @@
   delete mQActionPointer;
 }
 
+void CoordinateCapture::setCurrentTheme ( QString theThemeName )
+{
+  qDebug (" Current theme changed \n\n\n\n\n" );
+  mQActionPointer->setIcon( QIcon());
+}
 
 //////////////////////////////////////////////////////////////////////////
 //

Modified: trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.h
===================================================================
--- trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.h	2009-03-21 21:53:52 UTC (rev 10392)
+++ trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.h	2009-03-21 22:04:51 UTC (rev 10393)
@@ -103,6 +103,8 @@
     void copy();
     //! called when the project's CRS is changed
     void setSourceCrs();
+    //! update the plugins theme when the app tells us its theme is changed
+    void setCurrentTheme ( QString theThemeName );
 
   private:
     //! Container for the coordinate info



More information about the QGIS-commit mailing list