Skip to content

Commit

Permalink
Enable plugins to dynamically change their theme if it is changed in …
Browse files Browse the repository at this point in the history
…app props. Its up to each plugin to individually support this

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10393 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Mar 21, 2009
1 parent af34446 commit d0a7eca
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,7 @@ void QgisApp::setTheme( QString theThemeName )
{
mComposer->setupTheme();
}
emit currentThemeChanged( theThemeName );
}

void QgisApp::setupConnections()
Expand Down
6 changes: 6 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,12 @@ class QgisApp : public QMainWindow
//! 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
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
// connect signals
connect( qgis->legend(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ),
this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) );
connect( qgis, SIGNAL( currentThemeChanged( QString ) ),
this, SIGNAL( currentThemeChanged( QString ) ) );

}

Expand Down
3 changes: 3 additions & 0 deletions src/app/qgisappinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ class QgisAppInterface : public QgisInterface
virtual QAction *actionHelpSeparator2();
virtual QAction *actionAbout();

signals:
void currentThemeChanged( QString );

private:

/// QgisInterface aren't copied
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/coordinate_capture/coordinatecapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ void CoordinateCapture::initGui()
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
Expand Down Expand Up @@ -251,6 +252,11 @@ void CoordinateCapture::unload()
delete mQActionPointer;
}

void CoordinateCapture::setCurrentTheme ( QString theThemeName )
{
qDebug (" Current theme changed \n\n\n\n\n" );
mQActionPointer->setIcon( QIcon());
}

//////////////////////////////////////////////////////////////////////////
//
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/coordinate_capture/coordinatecapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class CoordinateCapture: public QObject, public QgisPlugin
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
Expand Down

0 comments on commit d0a7eca

Please sign in to comment.