[QGIS Commit] r10403 - in trunk/qgis/src/plugins:
coordinate_capture copyright_label delimited_text
dxf2shp_converter georeferencer gps_importer grass
interpolation north_arrow ogr_converter quick_print scale_bar
spit wfs
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun Mar 22 18:55:59 EDT 2009
Author: borysiasty
Date: 2009-03-22 18:55:59 -0400 (Sun, 22 Mar 2009)
New Revision: 10403
Added:
trunk/qgis/src/plugins/spit/spit_icon.png
trunk/qgis/src/plugins/spit/spit_image.png
trunk/qgis/src/plugins/wfs/wfs.png
Removed:
trunk/qgis/src/plugins/spit/icon_spit.xpm
trunk/qgis/src/plugins/spit/spit_icons.h
trunk/qgis/src/plugins/spit/spiticon.xpm
trunk/qgis/src/plugins/wfs/mIconAddWfsLayer.png
Modified:
trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.cpp
trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.h
trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.qrc
trunk/qgis/src/plugins/copyright_label/plugin.cpp
trunk/qgis/src/plugins/copyright_label/plugin.h
trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugin.cpp
trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugin.h
trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.cpp
trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.h
trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.qrc
trunk/qgis/src/plugins/georeferencer/plugin.cpp
trunk/qgis/src/plugins/georeferencer/plugin.h
trunk/qgis/src/plugins/georeferencer/qgsgeorefdescriptiondialogbase.ui
trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.cpp
trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.h
trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
trunk/qgis/src/plugins/grass/qgsgrassplugin.h
trunk/qgis/src/plugins/interpolation/interpolator.qrc
trunk/qgis/src/plugins/interpolation/qgsinterpolationdialogbase.ui
trunk/qgis/src/plugins/interpolation/qgsinterpolationplugin.cpp
trunk/qgis/src/plugins/interpolation/qgsinterpolationplugin.h
trunk/qgis/src/plugins/north_arrow/plugin.cpp
trunk/qgis/src/plugins/north_arrow/plugin.h
trunk/qgis/src/plugins/ogr_converter/ogrconverter.qrc
trunk/qgis/src/plugins/ogr_converter/plugin.cpp
trunk/qgis/src/plugins/ogr_converter/plugin.h
trunk/qgis/src/plugins/quick_print/quickprint.qrc
trunk/qgis/src/plugins/quick_print/quickprintplugin.cpp
trunk/qgis/src/plugins/quick_print/quickprintplugin.h
trunk/qgis/src/plugins/scale_bar/plugin.cpp
trunk/qgis/src/plugins/scale_bar/plugin.h
trunk/qgis/src/plugins/spit/CMakeLists.txt
trunk/qgis/src/plugins/spit/qgsspit.cpp
trunk/qgis/src/plugins/spit/qgsspitbase.ui
trunk/qgis/src/plugins/spit/qgsspitplugin.cpp
trunk/qgis/src/plugins/spit/qgsspitplugin.h
trunk/qgis/src/plugins/spit/spit.png
trunk/qgis/src/plugins/spit/spit.qrc
trunk/qgis/src/plugins/wfs/qgswfsplugin.cpp
trunk/qgis/src/plugins/wfs/qgswfsplugin.h
trunk/qgis/src/plugins/wfs/wfsplugin.qrc
Log:
Support for icon themes for the core plugins
Modified: trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.cpp
===================================================================
--- trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -1,6 +1,6 @@
/***************************************************************************
coordinatecapture.cpp
- Capture mouse coordinates in different CRS
+// Capture mouse coordinates in different CRS
-------------------
begin : [PluginDate]
copyright : [(C) Your Name and Date]
@@ -22,6 +22,7 @@
#include <qgisinterface.h>
#include <qgisgui.h>
+#include "qgsapplication.h"
#include <qgspoint.h>
#include <qgsmapcanvas.h>
#include <qgsmaprenderer.h>
@@ -45,6 +46,7 @@
#include <QClipboard>
#include <QPushButton>
#include <QToolButton>
+#include <QFile>
static const char * const sIdent = "$Id: plugin.cpp 8053 2008-01-26 13:59:53Z timlinux $";
static const QString sName = QObject::tr( "Coordinate Capture" );
@@ -90,7 +92,7 @@
mUserCrsDisplayPrecision = ( mCrs.mapUnits() == QGis::Degrees ) ? 3 : 5; // precision depends on CRS units
// Create the action for tool
- mQActionPointer = new QAction( QIcon( ":/coordinatecapture/coordinate_capture.png" ), tr( "Coordinate Capture" ), this );
+ mQActionPointer = new QAction( QIcon(), tr( "Coordinate Capture" ), this );
// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
// Connect the action to the run
@@ -109,13 +111,11 @@
mypLayout->setColumnMinimumWidth( 0, 36 );
mypWidget->setLayout( mypLayout );
- QToolButton * mypUserCrsToolButton = new QToolButton( mypWidget );
- mypUserCrsToolButton->setIcon( QIcon( ":/coordinatecapture/geographic.png" ) );
+ mypUserCrsToolButton = new QToolButton( mypWidget );
mypUserCrsToolButton->setToolTip( tr( "Click to select the CRS to use for coordinate display" ) );
connect( mypUserCrsToolButton, SIGNAL( clicked() ), this, SLOT( setCRS() ) );
- QLabel * mypCRSLabel = new QLabel( mypWidget );
- mypCRSLabel->setPixmap( QPixmap( ":/coordinatecapture/transformed.png" ) );
+ mypCRSLabel = new QLabel( mypWidget );
mypCRSLabel->setGeometry( mypUserCrsToolButton->geometry() );
mpUserCrsEdit = new QLineEdit( mypWidget );
@@ -134,16 +134,18 @@
mpTrackMouseButton->setCheckable( true );
mpTrackMouseButton->setToolTip( tr( "Click to enable mouse tracking. Click the canvas to stop" ) );
mpTrackMouseButton->setChecked( false );
- mpTrackMouseButton->setIcon( QIcon( ":/coordinatecapture/tracking.png" ) );
// Create the action for tool
mpCaptureButton = new QPushButton( mypWidget );
mpCaptureButton->setText( tr( "Start capture" ) );
mpCaptureButton->setToolTip( tr( "Click to enable coordinate capture" ) );
- mpCaptureButton->setIcon( QIcon( ":/coordinatecapture/coordinatecapture/coordinate_capture.png" ));
+ mpCaptureButton->setIcon( QIcon( ":/coordinate_capture/coordinate_capture.png" ));
mpCaptureButton->setWhatsThis( tr( "Click on the map to view coordinates and capture to clipboard." ) );
connect( mpCaptureButton, SIGNAL( clicked() ), this, SLOT( run() ) );
+ // Set the icons
+ setCurrentTheme( "" );
+
mypLayout->addWidget( mypUserCrsToolButton, 0, 0 );
mypLayout->addWidget( mpUserCrsEdit, 0, 1 );
mypLayout->addWidget( mypCRSLabel, 1, 0 );
@@ -259,12 +261,41 @@
delete mQActionPointer;
}
-void CoordinateCapture::setCurrentTheme ( QString theThemeName )
+// Set icons to the current theme
+void CoordinateCapture::setCurrentTheme( QString theThemeName )
{
- qDebug (" Current theme changed \n\n\n\n\n" );
- mQActionPointer->setIcon( QIcon());
+ mQActionPointer->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) );
+ mpTrackMouseButton->setIcon( QIcon( getIconPath( "tracking.png" ) ) );
+ mpCaptureButton->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) );
+ mypUserCrsToolButton->setIcon( QIcon( getIconPath( "geographic.png" ) ) );
+ mypCRSLabel->setPixmap( QPixmap( getIconPath( "transformed.png" ) ) );
}
+// Get path to the best available icon file
+QString CoordinateCapture::getIconPath( const QString theName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/coordinate_capture/" + theName;
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/coordinate_capture/" + theName;
+ QString myQrcPath = ":/coordinate_capture/" + theName;
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ return myCurThemePath;
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ return myDefThemePath;
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ return myQrcPath;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+
//////////////////////////////////////////////////////////////////////////
//
//
Modified: trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.h
===================================================================
--- trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -53,6 +53,8 @@
class QPushButton;
class QDockWidget;
class QLineEdit;
+class QIcon;
+class QLabel;
class QgisInterface;
class QgsPoint;
@@ -120,10 +122,16 @@
//!Our custom map tool to capture clicks
CoordinateCaptureMapTool * mpMapTool;
- //!A toolbutton to keep track whether mouse tracking is enabled
+ //!A two buttons to track and capture coordinates
QToolButton * mpTrackMouseButton;
QPushButton * mpCaptureButton;
+ //! A toolbutton to select crs to display the coordinates
+ QToolButton * mypUserCrsToolButton;
+
+ //! A label for coordinates in the project crs
+ QLabel * mypCRSLabel;
+
//! transform object
QgsCoordinateTransform mTransform;
@@ -136,6 +144,9 @@
//! user coordinate display precision
int mUserCrsDisplayPrecision;
+ //! Get the path to the icon from the best available theme
+ QString getIconPath( const QString theName );
+
////////////////////////////////////////////////////////////////////
//
// MANDATORY PLUGIN PROPERTY DECLARATIONS .....
Modified: trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.qrc
===================================================================
--- trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.qrc 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/coordinate_capture/coordinatecapture.qrc 2009-03-22 22:55:59 UTC (rev 10403)
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/coordinatecapture/" >
+ <qresource prefix="/coordinate_capture/" >
<file>coordinate_capture.png</file>
<file>geographic.png</file>
<file>transformed.png</file>
Modified: trunk/qgis/src/plugins/copyright_label/plugin.cpp
===================================================================
--- trunk/qgis/src/plugins/copyright_label/plugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/copyright_label/plugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -24,6 +24,7 @@
#include "qgisinterface.h"
#include "qgisgui.h"
+#include "qgsapplication.h"
#include "qgsmapcanvas.h"
#include "qgsmaplayer.h"
#include "qgsproject.h"
@@ -35,6 +36,7 @@
#include <QDate>
#include <QTextDocument>
#include <QMatrix>
+#include <QFile>
//non qt includes
#include <cmath>
@@ -74,7 +76,8 @@
void QgsCopyrightLabelPlugin::initGui()
{
// Create the action for tool
- myQActionPointer = new QAction( QIcon( ":/copyright_label.png" ), tr( "&Copyright Label" ), this );
+ myQActionPointer = new QAction( QIcon(), tr( "&Copyright Label" ), this );
+ setCurrentTheme( "" );
myQActionPointer->setWhatsThis( tr( "Creates a copyright label that is displayed on the map canvas." ) );
// Connect the action to the run
connect( myQActionPointer, SIGNAL( activated() ), this, SLOT( run() ) );
@@ -83,6 +86,9 @@
//this resets this plugin up if a project is loaded
connect( qGisInterface->mainWindow(), SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
+ // this is called when the icon theme is changed
+ connect( qGisInterface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
+
// Add the icon to the toolbar
qGisInterface->addToolBarIcon( myQActionPointer );
qGisInterface->addPluginToMenu( tr( "&Decorations" ), myQActionPointer );
@@ -251,10 +257,30 @@
refreshCanvas();
}
+//! Set icons to the current theme
+void QgsCopyrightLabelPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/copyright_label.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/copyright_label.png";
+ QString myQrcPath = ":/copyright_label.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ myQActionPointer->setIcon( QIcon() );
+ }
+}
-
-
-
/**
* Required extern functions needed for every plugin
* These functions can be called prior to creating an instance
Modified: trunk/qgis/src/plugins/copyright_label/plugin.h
===================================================================
--- trunk/qgis/src/plugins/copyright_label/plugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/copyright_label/plugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -70,6 +70,8 @@
void setPlacement( int );
//! set copyright label enabled
void setEnable( bool );
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
Modified: trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -24,12 +24,14 @@
#include "qgisinterface.h"
#include "qgisgui.h"
+#include "qgsapplication.h"
#include "qgsmaplayer.h"
#include "qgsdelimitedtextplugin.h"
#include <QMenu>
#include <QAction>
+#include <QFile>
//non qt includes
#include <iostream>
@@ -96,8 +98,8 @@
void QgsDelimitedTextPlugin::initGui()
{
// Create the action for tool
- myQActionPointer = new QAction( QIcon( ":/delimited_text.png" ), tr( "&Add Delimited Text Layer" ), this );
-
+ myQActionPointer = new QAction( QIcon(), tr( "&Add Delimited Text Layer" ), this );
+ setCurrentTheme( "" );
myQActionPointer->setWhatsThis( tr( "Add a delimited text file as a map layer. "
"The file must have a header row containing the field names. "
"X and Y fields are required and must contain coordinates in decimal units." ) );
@@ -106,6 +108,8 @@
// Add the icon to the toolbar
qGisInterface->addToolBarIcon( myQActionPointer );
qGisInterface->addPluginToMenu( tr( "&Delimited text" ), myQActionPointer );
+ // this is called when the icon theme is changed
+ connect( qGisInterface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
}
@@ -141,6 +145,31 @@
qGisInterface->removeToolBarIcon( myQActionPointer );
delete myQActionPointer;
}
+
+//! Set icons to the current theme
+void QgsDelimitedTextPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/delimited_text.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/delimited_text.png";
+ QString myQrcPath = ":/delimited_text.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ myQActionPointer->setIcon( QIcon() );
+ }
+}
+
/**
* Required extern functions needed for every plugin
* These functions can be called prior to creating an instance
Modified: trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugin.h
===================================================================
--- trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/delimited_text/qgsdelimitedtextplugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -68,6 +68,8 @@
void unload();
//! show the help document
void help();
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
private:
Modified: trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.cpp
===================================================================
--- trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -20,6 +20,7 @@
#include <qgisinterface.h>
#include <qgisgui.h>
+#include <qgsapplication.h>
#include <qgsvectorlayer.h>
#include "dxf2shpconverter.h"
@@ -30,6 +31,7 @@
//
#include <QAction>
+#include <QFile>
#include <QToolBar>
static const char *const sIdent =
@@ -66,8 +68,11 @@
void dxf2shpConverter::initGui()
{
// Create the action for tool
- mQActionPointer = new QAction( QIcon( ":/dxf2shpconverter/dxf2shp_converter.png" ), "Dxf2Shp Converter", this );
+ mQActionPointer = new QAction( QIcon(), "Dxf2Shp Converter", this );
+ // Set the icon
+ setCurrentTheme( "" );
+
// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Converts DXF files in Shapefile format" ) );
@@ -77,6 +82,9 @@
// Add the icon to the toolbar
mQGisIface->addToolBarIcon( mQActionPointer );
mQGisIface->addPluginToMenu( tr( "&Dxf2Shp" ), mQActionPointer );
+
+ // this is called when the icon theme is changed
+ connect( mQGisIface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
}
//method defined in interface
@@ -115,6 +123,30 @@
mQGisIface->addVectorLayer( myfname, mytitle, "ogr" );
}
+//! Set icons to the current theme
+void dxf2shpConverter::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/dxf2shp_converter.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/dxf2shp_converter.png";
+ QString myQrcPath = ":/dxf2shp_converter.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ mQActionPointer->setIcon( QIcon() );
+ }
+}
+
//////////////////////////////////////////////////////////////////////////
//
//
Modified: trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.h
===================================================================
--- trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -61,6 +61,8 @@
void unload();
//! show the help document
void help();
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
void addMyLayer( QString, QString );
Modified: trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.qrc
===================================================================
--- trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.qrc 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/dxf2shp_converter/dxf2shpconverter.qrc 2009-03-22 22:55:59 UTC (rev 10403)
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/dxf2shpconverter/" >
+ <qresource prefix="/" >
<file>dxf2shp_converter.png</file>
</qresource>
</RCC>
Modified: trunk/qgis/src/plugins/georeferencer/plugin.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/plugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/georeferencer/plugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -43,10 +43,13 @@
//
#include <qgisinterface.h>
+#include <qgsapplication.h>
#include <qgsmaplayer.h>
#include <qgsrasterlayer.h>
#include "plugin.h"
+#include <QFile>
+
//
//the gui subclass
//
@@ -89,11 +92,15 @@
void QgsGeorefPlugin::initGui()
{
// Create the action for tool
- mQActionPointer = new QAction( QIcon( ":/georeferencer.png" ), tr( "&Georeferencer" ), this );
+ mQActionPointer = new QAction( QIcon(), tr( "&Georeferencer" ), this );
+ setCurrentTheme( "" );
// Connect the action to the run
connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) );
+ // this is called when the icon theme is changed
+ connect( mQGisIface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
+
// Add to the toolbar & menu
mQGisIface->addToolBarIcon( mQActionPointer );
mQGisIface->addPluginToMenu( tr( "&Georeferencer" ), mQActionPointer );
@@ -156,6 +163,30 @@
delete mQActionPointer;
}
+//! Set icons to the current theme
+void QgsGeorefPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/georeferencer.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/georeferencer.png";
+ QString myQrcPath = ":/georeferencer.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ mQActionPointer->setIcon( QIcon() );
+ }
+}
+
//////////////////////////////////////////////////////////////////////
//
// END OF MANDATORY PLUGIN METHODS
Modified: trunk/qgis/src/plugins/georeferencer/plugin.h
===================================================================
--- trunk/qgis/src/plugins/georeferencer/plugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/georeferencer/plugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -86,6 +86,8 @@
void unload();
//! show the help document
void help();
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
void about( );
//////////////////////////////////////////////////////////////////////
Modified: trunk/qgis/src/plugins/georeferencer/qgsgeorefdescriptiondialogbase.ui
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsgeorefdescriptiondialogbase.ui 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/georeferencer/qgsgeorefdescriptiondialogbase.ui 2009-03-22 22:55:59 UTC (rev 10403)
@@ -13,7 +13,7 @@
<string>Description georeferencer</string>
</property>
<property name="windowIcon" >
- <iconset resource="georeferencer.qrc" >:/icon.png</iconset>
+ <iconset resource="georeferencer.qrc" >:/georeferencer.png</iconset>
</property>
<property name="modal" >
<bool>true</bool>
Modified: trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -21,6 +21,7 @@
#include "qgisinterface.h"
#include "qgisgui.h"
+#include "qgsapplication.h"
#include "qgsmaplayerregistry.h"
#include "qgsmaplayer.h"
#include "qgsvectorlayer.h"
@@ -32,6 +33,7 @@
#include <QFileDialog>
#include <QMessageBox>
#include <QAction>
+#include <QFile>
#include <QToolBar>
#include <QProcess>
#include <QProgressDialog>
@@ -85,8 +87,9 @@
void QgsGPSPlugin::initGui()
{
// add an action to the toolbar
- mQActionPointer = new QAction( QIcon( ":/gps_importer.png" ), tr( "&Gps Tools" ), this );
- mCreateGPXAction = new QAction( QIcon( ":/gps_importer.png" ), tr( "&Create new GPX layer" ), this );
+ mQActionPointer = new QAction( QIcon(), tr( "&Gps Tools" ), this );
+ mCreateGPXAction = new QAction( QIcon(), tr( "&Create new GPX layer" ), this );
+ setCurrentTheme( "" );
mQActionPointer->setWhatsThis( tr( "Creates a new GPX layer and displays it on the map canvas" ) );
mCreateGPXAction->setWhatsThis( tr( "Creates a new GPX layer and displays it on the map canvas" ) );
@@ -96,6 +99,9 @@
mQGisInterface->fileToolBar()->addAction( mQActionPointer );
mQGisInterface->addPluginToMenu( tr( "&Gps" ), mQActionPointer );
mQGisInterface->addPluginToMenu( tr( "&Gps" ), mCreateGPXAction );
+
+ // this is called when the icon theme is changed
+ connect( mQGisInterface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
}
//method defined in interface
@@ -654,9 +660,34 @@
}
}
+//! Set icons to the current theme
+void QgsGPSPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/gps_importer.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/gps_importer.png";
+ QString myQrcPath = ":/gps_importer.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myCurThemePath ) );
+ mCreateGPXAction->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myDefThemePath ) );
+ mCreateGPXAction->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myQrcPath ) );
+ mCreateGPXAction->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ mQActionPointer->setIcon( QIcon() );
+ mCreateGPXAction->setIcon( QIcon() );
+ }
+}
-
-
/**
* Required extern functions needed for every plugin
* These functions can be called prior to creating an instance
Modified: trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.h
===================================================================
--- trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/gps_importer/qgsgpsplugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -55,6 +55,8 @@
void unload();
//! show the help document
void help();
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
//! load a GPX file
void loadGPXFile( QString fileName, bool loadWaypoints, bool loadRoutes,
Modified: trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -37,7 +37,6 @@
#include "qgsvectorlayer.h"
#include <QAction>
-#include <QDir>
#include <QFileInfo>
#include <QMessageBox>
#include <QSettings>
@@ -123,21 +122,21 @@
mRegionBand = new QgsRubberBand( mCanvas, 1 );
mRegionBand->setZValue( 20 );
- // Create the action for tool
- mOpenMapsetAction = new QAction( getThemeIcon( "grass_open_mapset.png" ), tr( "Open mapset" ), this );
- mNewMapsetAction = new QAction( getThemeIcon( "grass_new_mapset.png" ), tr( "New mapset" ), this );
- mCloseMapsetAction = new QAction( getThemeIcon( "grass_close_mapset.png" ), tr( "Close mapset" ), this );
+ // Create the action for tool (the icons are set later by calling setCurrentTheme)
+ mOpenMapsetAction = new QAction( QIcon(), tr( "Open mapset" ), this );
+ mNewMapsetAction = new QAction( QIcon(), tr( "New mapset" ), this );
+ mCloseMapsetAction = new QAction( QIcon(), tr( "Close mapset" ), this );
- mAddVectorAction = new QAction( getThemeIcon( "grass_add_vector.png" ), tr( "Add GRASS vector layer" ), this );
- mAddRasterAction = new QAction( getThemeIcon( "grass_add_raster.png" ), tr( "Add GRASS raster layer" ), this );
- mOpenToolsAction = new QAction( getThemeIcon( "grass_tools.png" ), tr( "Open GRASS tools" ), this );
+ mAddVectorAction = new QAction( QIcon(), tr( "Add GRASS vector layer" ), this );
+ mAddRasterAction = new QAction( QIcon(), tr( "Add GRASS raster layer" ), this );
+ mOpenToolsAction = new QAction( QIcon(), tr( "Open GRASS tools" ), this );
- mRegionAction = new QAction( getThemeIcon( "grass_region.png" ), tr( "Display Current Grass Region" ), this );
+ mRegionAction = new QAction( QIcon(), tr( "Display Current Grass Region" ), this );
mRegionAction->setCheckable( true );
- mEditRegionAction = new QAction( getThemeIcon( "grass_region_edit.png" ), tr( "Edit Current Grass Region" ), this );
- mEditAction = new QAction( getThemeIcon( "grass_edit.png" ), tr( "Edit Grass Vector layer" ), this );
- mNewVectorAction = new QAction( getThemeIcon( "grass_new_vector_layer.png" ), tr( "Create new Grass Vector" ), this );
+ mEditRegionAction = new QAction( QIcon(), tr( "Edit Current Grass Region" ), this );
+ mEditAction = new QAction( QIcon(), tr( "Edit Grass Vector layer" ), this );
+ mNewVectorAction = new QAction( QIcon(), tr( "Create new Grass Vector" ), this );
mAddVectorAction->setWhatsThis( tr( "Adds a GRASS vector layer to the map canvas" ) );
mAddRasterAction->setWhatsThis( tr( "Adds a GRASS raster layer to the map canvas" ) );
@@ -188,6 +187,11 @@
toolBarPointer->addAction( mRegionAction );
toolBarPointer->addAction( mEditRegionAction );
+ // Set icons to current theme
+ setCurrentTheme( "" );
+ // Connect theme change signal
+ connect( qGisInterface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
+
// Connect display region
connect( mCanvas, SIGNAL( renderComplete( QPainter * ) ), this, SLOT( postRender( QPainter * ) ) );
@@ -787,23 +791,49 @@
disconnect( qgis, SIGNAL( projectRead() ), this, SLOT( projectRead() ) );
disconnect( qgis, SIGNAL( newProject() ), this, SLOT( newProject() ) );
}
+
+// Set icons to the current theme
+void QgsGrassPlugin::setCurrentTheme( QString theThemeName )
+{
+ mOpenMapsetAction->setIcon( getThemeIcon( "grass_open_mapset.png" ) );
+ mNewMapsetAction->setIcon( getThemeIcon( "grass_new_mapset.png" ) );
+ mCloseMapsetAction->setIcon( getThemeIcon( "grass_close_mapset.png" ) );
+
+ mAddVectorAction->setIcon( getThemeIcon( "grass_add_vector.png" ) );
+ mAddRasterAction->setIcon( getThemeIcon( "grass_add_raster.png" ) );
+ mOpenToolsAction->setIcon( getThemeIcon( "grass_tools.png" ) );
+
+ mRegionAction->setIcon( getThemeIcon( "grass_region.png" ) );
+
+ mEditRegionAction->setIcon( getThemeIcon( "grass_region_edit.png" ) );
+ mEditAction->setIcon( getThemeIcon( "grass_edit.png" ) );
+ mNewVectorAction->setIcon( getThemeIcon( "grass_new_vector_layer.png" ) );
+}
+
// Note this code is duplicated from qgisapp.cpp because
// I didnt want to make plugins dependent on qgsapplication
// and because it needs grass specific path into
// the GRASS plugin resource bundle [TS]
QIcon QgsGrassPlugin::getThemeIcon( const QString theName )
{
- QString myPath = QgsApplication::activeThemePath() + QDir::separator() + "grass" + QDir::separator() + theName;
- QString myDefaultPath = QgsApplication::defaultThemePath() + QDir::separator() + "grass" + QDir::separator() + theName;
- if ( QFile::exists( myPath ) )
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/grass/" + theName;
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/grass/" + theName;
+ QString myQrcPath = ":/default/grass/" + theName;
+ if ( QFile::exists( myCurThemePath ) )
{
- return QIcon( myPath );
+ return QIcon( myCurThemePath );
}
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ return QIcon( myDefThemePath );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ return QIcon( myQrcPath );
+ }
else
{
- //could still return an empty icon if it
- //doesnt exist in the default theme either!
- return QIcon( myDefaultPath );
+ return QIcon();
}
}
Modified: trunk/qgis/src/plugins/grass/qgsgrassplugin.h
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassplugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/grass/qgsgrassplugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -70,7 +70,7 @@
QPen & regionPen( void );
//! Set Region Pen
void setRegionPen( QPen & );
- //! Get a plugin icon resource using the active theme
+ //! Get an icon from the active theme if possible
static QIcon getThemeIcon( const QString theName );
public slots:
@@ -118,6 +118,8 @@
void saveMapset();
//! Set edit action
void setEditAction();
+ //! update plugin icons when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
private:
//! Name of the plugin
QString pluginNameQString;
Modified: trunk/qgis/src/plugins/interpolation/interpolator.qrc
===================================================================
--- trunk/qgis/src/plugins/interpolation/interpolator.qrc 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/interpolation/interpolator.qrc 2009-03-22 22:55:59 UTC (rev 10403)
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/interpolator" >
+ <qresource prefix="/" >
<file>options.png</file>
<file>interpolation.png</file>
</qresource>
Modified: trunk/qgis/src/plugins/interpolation/qgsinterpolationdialogbase.ui
===================================================================
--- trunk/qgis/src/plugins/interpolation/qgsinterpolationdialogbase.ui 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/interpolation/qgsinterpolationdialogbase.ui 2009-03-22 22:55:59 UTC (rev 10403)
@@ -119,7 +119,7 @@
<string>...</string>
</property>
<property name="icon" >
- <iconset resource="interpolator.qrc" >:/interpolator/options.png</iconset>
+ <iconset resource="interpolator.qrc" >:/options.png</iconset>
</property>
</widget>
</item>
Modified: trunk/qgis/src/plugins/interpolation/qgsinterpolationplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/interpolation/qgsinterpolationplugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/interpolation/qgsinterpolationplugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -15,10 +15,13 @@
* *
***************************************************************************/
+#include "qgsapplication.h"
#include "qgsinterpolationplugin.h"
#include "qgisinterface.h"
#include "qgsinterpolationdialog.h"
+#include <QFile>
+
static const QString name_ = QObject::tr( "Interpolation plugin" );
static const QString description_ = QObject::tr( "A plugin for interpolation based on vertices of a vector layer" );
static const QString version_ = QObject::tr( "Version 0.001" );
@@ -37,10 +40,13 @@
{
if ( mIface )
{
- mInterpolationAction = new QAction( QIcon( ":/interpolator/interpolation.png" ), tr( "&Interpolation" ), 0 );
+ mInterpolationAction = new QAction( QIcon(), tr( "&Interpolation" ), 0 );
+ setCurrentTheme( "" );
QObject::connect( mInterpolationAction, SIGNAL( triggered() ), this, SLOT( showInterpolationDialog() ) );
mIface->addToolBarIcon( mInterpolationAction );
mIface->addPluginToMenu( tr( "&Interpolation" ), mInterpolationAction );
+ // this is called when the icon theme is changed
+ connect( mIface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
}
}
@@ -57,6 +63,30 @@
dialog.exec();
}
+//! Set icons to the current theme
+void QgsInterpolationPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/interpolation.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/interpolation.png";
+ QString myQrcPath = ":/interpolation.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ mInterpolationAction->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ mInterpolationAction->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ mInterpolationAction->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ mInterpolationAction->setIcon( QIcon() );
+ }
+}
+
QGISEXTERN QgisPlugin * classFactory( QgisInterface * theQgisInterfacePointer )
{
return new QgsInterpolationPlugin( theQgisInterfacePointer );
Modified: trunk/qgis/src/plugins/interpolation/qgsinterpolationplugin.h
===================================================================
--- trunk/qgis/src/plugins/interpolation/qgsinterpolationplugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/interpolation/qgsinterpolationplugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -38,6 +38,10 @@
/**Unload the plugin and cleanup the GUI*/
void unload();
+ public slots:
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
+
private slots:
void showInterpolationDialog();
Modified: trunk/qgis/src/plugins/north_arrow/plugin.cpp
===================================================================
--- trunk/qgis/src/plugins/north_arrow/plugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/north_arrow/plugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -37,6 +37,7 @@
#include <QPainter>
#include <QMenu>
#include <QDir>
+#include <QFile>
//non qt includes
#include <iostream>
@@ -91,7 +92,8 @@
void QgsNorthArrowPlugin::initGui()
{
// Create the action for tool
- myQActionPointer = new QAction( QIcon( ":/north_arrow.png" ), tr( "&North Arrow" ), this );
+ myQActionPointer = new QAction( QIcon(), tr( "&North Arrow" ), this );
+ setCurrentTheme( "" );
myQActionPointer->setWhatsThis( tr( "Creates a north arrow that is displayed on the map canvas" ) );
// Connect the action to the run
connect( myQActionPointer, SIGNAL( activated() ), this, SLOT( run() ) );
@@ -102,6 +104,8 @@
// Add the icon to the toolbar & appropriate menu
qGisInterface->addToolBarIcon( myQActionPointer );
qGisInterface->addPluginToMenu( tr( "&Decorations" ), myQActionPointer );
+ // this is called when the icon theme is changed
+ connect( qGisInterface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
projectRead();
refreshCanvas();
@@ -391,10 +395,30 @@
return goodDirn;
}
+//! Set icons to the current theme
+void QgsNorthArrowPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/north_arrow.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/north_arrow.png";
+ QString myQrcPath = ":/north_arrow.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ myQActionPointer->setIcon( QIcon() );
+ }
+}
-
-
-
/**
* Required extern functions needed for every plugin
* These functions can be called prior to creating an instance
Modified: trunk/qgis/src/plugins/north_arrow/plugin.h
===================================================================
--- trunk/qgis/src/plugins/north_arrow/plugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/north_arrow/plugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -72,6 +72,8 @@
// direction, the function returns false and leaves the rotation
// variable as is.
bool calculateNorthDirection();
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
private:
Modified: trunk/qgis/src/plugins/ogr_converter/ogrconverter.qrc
===================================================================
--- trunk/qgis/src/plugins/ogr_converter/ogrconverter.qrc 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/ogr_converter/ogrconverter.qrc 2009-03-22 22:55:59 UTC (rev 10403)
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/ogrconverter/" >
+ <qresource prefix="/" >
<file>ogr_converter.png</file>
</qresource>
</RCC>
Modified: trunk/qgis/src/plugins/ogr_converter/plugin.cpp
===================================================================
--- trunk/qgis/src/plugins/ogr_converter/plugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/ogr_converter/plugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -20,9 +20,11 @@
// QGIS
#include <qgisinterface.h>
#include <qgisgui.h>
+#include <qgsapplication.h>
#include <qgslogger.h>
// Qt
#include <QAction>
+#include <QFile>
#include <QToolBar>
// std
#include <cassert>
@@ -54,8 +56,11 @@
void OgrPlugin::initGui()
{
// Create the action for tool
- mQActionPointer = new QAction( QIcon( ":/ogrconverter/ogr_converter.png" ), tr( "Run OGR Layer Converter" ), this );
+ mQActionPointer = new QAction( QIcon(), tr( "Run OGR Layer Converter" ), this );
+ // Set the icon
+ setCurrentTheme( "" );
+
// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Translates vector layers between formats supported by OGR library" ) );
@@ -65,6 +70,9 @@
// Add the icon to the toolbar
mQGisIface->addToolBarIcon( mQActionPointer );
mQGisIface->addPluginToMenu( tr( "OG&R Converter" ), mQActionPointer );
+
+ // this is called when the icon theme is changed
+ connect( mQGisIface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
}
//method defined in interface
@@ -95,6 +103,30 @@
delete mQActionPointer;
}
+//! Set icons to the current theme
+void OgrPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/ogr_converter.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/ogr_converter.png";
+ QString myQrcPath = ":/ogr_converter.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ mQActionPointer->setIcon( QIcon() );
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////
// THE FOLLOWING CODE IS AUTOGENERATED BY THE PLUGIN BUILDER SCRIPT
// YOU WOULD NORMALLY NOT NEED TO MODIFY THIS, AND YOUR PLUGIN
Modified: trunk/qgis/src/plugins/ogr_converter/plugin.h
===================================================================
--- trunk/qgis/src/plugins/ogr_converter/plugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/ogr_converter/plugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -75,6 +75,9 @@
//! show the help document
void help();
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
+
private:
//////////////////////////////////////////////////////////////////////////
Modified: trunk/qgis/src/plugins/quick_print/quickprint.qrc
===================================================================
--- trunk/qgis/src/plugins/quick_print/quickprint.qrc 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/quick_print/quickprint.qrc 2009-03-22 22:55:59 UTC (rev 10403)
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/quickprint/" >
+ <qresource prefix="/" >
<file>quick_print.png</file>
</qresource>
</RCC>
Modified: trunk/qgis/src/plugins/quick_print/quickprintplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/quick_print/quickprintplugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/quick_print/quickprintplugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -31,6 +31,7 @@
//
#include <QAction>
+#include <QFile>
#include <QToolBar>
@@ -71,7 +72,9 @@
{
// Create the action for tool
- mQActionPointer = new QAction( QIcon( ":/quickprint/quick_print.png" ), tr( "Quick Print" ), this );
+ mQActionPointer = new QAction( QIcon(), tr( "Quick Print" ), this );
+ // Set the icon
+ setCurrentTheme( "" );
// Set the what's this text
mQActionPointer->setWhatsThis( tr( "Provides a way to quickly produce a map with minimal user input." ) );
// Connect the action to the run
@@ -80,6 +83,8 @@
mQGisIface->addToolBarIcon( mQActionPointer );
mQGisIface->addPluginToMenu( tr( "&Quick Print" ), mQActionPointer );
+ // this is called when the icon theme is changed
+ connect( mQGisIface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
}
//method defined in interface
void QuickPrintPlugin::help()
@@ -111,6 +116,29 @@
delete mQActionPointer;
}
+//! Set icons to the current theme
+void QuickPrintPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/quick_print.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/quick_print.png";
+ QString myQrcPath = ":/quick_print.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ mQActionPointer->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ mQActionPointer->setIcon( QIcon() );
+ }
+}
//////////////////////////////////////////////////////////////////////////
//
Modified: trunk/qgis/src/plugins/quick_print/quickprintplugin.h
===================================================================
--- trunk/qgis/src/plugins/quick_print/quickprintplugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/quick_print/quickprintplugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -84,6 +84,8 @@
void unload();
//! show the help document
void help();
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
private:
QgsMapCanvas * mpMapCanvas;
Modified: trunk/qgis/src/plugins/scale_bar/plugin.cpp
===================================================================
--- trunk/qgis/src/plugins/scale_bar/plugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/scale_bar/plugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -24,6 +24,7 @@
#include "qgisinterface.h"
#include "qgisgui.h"
+#include "qgsapplication.h"
#include "qgsmapcanvas.h"
#include "qgsmaplayer.h"
#include "qgsmaptopixel.h"
@@ -41,6 +42,7 @@
#include <QFont>
#include <QColor>
#include <QMenu>
+#include <QFile>
//non qt includes
#include <cmath>
@@ -97,7 +99,8 @@
void QgsScaleBarPlugin::initGui()
{
// Create the action for tool
- myQActionPointer = new QAction( QIcon( ":/scale_bar.png" ), tr( "&Scale Bar" ), this );
+ myQActionPointer = new QAction( QIcon(), tr( "&Scale Bar" ), this );
+ setCurrentTheme( "" );
myQActionPointer->setWhatsThis( tr( "Creates a scale bar that is displayed on the map canvas" ) );
// Connect the action to the run
connect( myQActionPointer, SIGNAL( activated() ), this, SLOT( run() ) );
@@ -108,6 +111,8 @@
// Add the icon to the toolbar
qGisInterface->addToolBarIcon( myQActionPointer );
qGisInterface->addPluginToMenu( tr( "&Decorations" ), myQActionPointer );
+ // this is called when the icon theme is changed
+ connect( qGisInterface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
}
void QgsScaleBarPlugin::projectRead()
@@ -589,6 +594,29 @@
QgsProject::instance()->writeEntry( "ScaleBar", "/ColorBluePart", mColour.blue() );
}
+//! Set icons to the current theme
+void QgsScaleBarPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/scale_bar.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/scale_bar.png";
+ QString myQrcPath = ":/scale_bar.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ myQActionPointer->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ myQActionPointer->setIcon( QIcon() );
+ }
+}
/**
* Required extern functions needed for every plugin
Modified: trunk/qgis/src/plugins/scale_bar/plugin.h
===================================================================
--- trunk/qgis/src/plugins/scale_bar/plugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/scale_bar/plugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -76,6 +76,8 @@
void setStyle( int );
//! set the scale bar colour
void setColour( QColor );
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
private:
Modified: trunk/qgis/src/plugins/spit/CMakeLists.txt
===================================================================
--- trunk/qgis/src/plugins/spit/CMakeLists.txt 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/spit/CMakeLists.txt 2009-03-22 22:55:59 UTC (rev 10403)
@@ -46,7 +46,7 @@
QT4_WRAP_CPP (SPIT_PLUGIN_MOC_SRCS ${SPIT_PLUGIN_MOC_HDRS})
QT4_WRAP_CPP (SPIT_EXE_MOC_SRCS ${SPIT_EXE_MOC_HDRS})
-QT4_ADD_RESOURCES(DLTEXT_RCC_SRCS ${SPIT_RCCS})
+QT4_ADD_RESOURCES(SPIT_RCC_SRCS ${SPIT_RCCS})
ADD_LIBRARY (spitplugin MODULE ${SPIT_PLUGIN_SRCS} ${SPIT_PLUGIN_MOC_SRCS} ${SPIT_RCC_SRCS} ${SPIT_UIS_H})
Deleted: trunk/qgis/src/plugins/spit/icon_spit.xpm
===================================================================
(Binary files differ)
Modified: trunk/qgis/src/plugins/spit/qgsspit.cpp
===================================================================
--- trunk/qgis/src/plugins/spit/qgsspit.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/spit/qgsspit.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -39,7 +39,6 @@
#include "qgsnewconnection.h"
#include "qgsdatasourceuri.h"
#include "qgsmessageviewer.h"
-#include "spiticon.xpm"
#include "qgslogger.h"
// Qt implementation of alignment() + changed the numeric types to be shown on the left as well
@@ -60,9 +59,6 @@
QgsSpit::QgsSpit( QWidget *parent, Qt::WFlags fl ) : QDialog( parent, fl )
{
setupUi( this );
- QPixmap icon;
- icon = QPixmap( spitIcon );
- setWindowIcon( icon );
// Set up the table column headers
tblShapefiles->setColumnCount( 5 );
Modified: trunk/qgis/src/plugins/spit/qgsspitbase.ui
===================================================================
--- trunk/qgis/src/plugins/spit/qgsspitbase.ui 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/spit/qgsspitbase.ui 2009-03-22 22:55:59 UTC (rev 10403)
@@ -41,7 +41,7 @@
<item rowspan="2" row="0" column="0" >
<widget class="QLabel" name="pixmapLabel1" >
<property name="pixmap" >
- <pixmap resource="spit.qrc" >:/spit.png</pixmap>
+ <pixmap resource="spit.qrc" >:/spit_image.png</pixmap>
</property>
<property name="scaledContents" >
<bool>true</bool>
Modified: trunk/qgis/src/plugins/spit/qgsspitplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/spit/qgsspitplugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/spit/qgsspitplugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -23,13 +23,13 @@
#include <vector>
#include <QAction>
+#include <QFile>
#include <QMenu>
#include "qgisinterface.h"
+#include "qgsapplication.h"
#include "qgsspitplugin.h"
#include "qgsspit.h"
-// xpm for creating the toolbar icon
-#include "spiticon.xpm"
static const char * const ident_ = "$Id$";
@@ -65,7 +65,8 @@
void QgsSpitPlugin::initGui()
{
// Create the action for tool
- spitAction = new QAction( QIcon( spitIcon ), tr( "&Import Shapefiles to PostgreSQL" ), this );
+ spitAction = new QAction( QIcon(), tr( "&Import Shapefiles to PostgreSQL" ), this );
+ setCurrentTheme( "" );
spitAction->setWhatsThis( tr( "Import shapefiles into a PostGIS-enabled PostgreSQL database. "
"The schema and field names can be customized on import" ) );
// Connect the action to the spit slot
@@ -74,6 +75,8 @@
qI->addToolBarIcon( spitAction );
qI->addPluginToMenu( tr( "&Spit" ), spitAction );
+ // this is called when the icon theme is changed
+ connect( qI, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
}
// Slot called when the shapefile to postgres menu item is triggered
@@ -94,6 +97,30 @@
delete spitAction;
}
+//! Set icons to the current theme
+void QgsSpitPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/spit.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/spit.png";
+ QString myQrcPath = ":/spit.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ spitAction->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ spitAction->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ spitAction->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ spitAction->setIcon( QIcon() );
+ }
+}
+
/**
* Required extern functions needed for every plugin
* These functions can be called prior to creating an instance
Modified: trunk/qgis/src/plugins/spit/qgsspitplugin.h
===================================================================
--- trunk/qgis/src/plugins/spit/qgsspitplugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/spit/qgsspitplugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -52,6 +52,8 @@
void spit();
//! unload the plugin
void unload();
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
private:
//! Name of the plugin
QString pName;
Modified: trunk/qgis/src/plugins/spit/spit.png
===================================================================
(Binary files differ)
Modified: trunk/qgis/src/plugins/spit/spit.qrc
===================================================================
--- trunk/qgis/src/plugins/spit/spit.qrc 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/spit/spit.qrc 2009-03-22 22:55:59 UTC (rev 10403)
@@ -1,5 +1,7 @@
<RCC>
<qresource prefix="/" >
<file>spit.png</file>
+ <file>spit_icon.png</file>
+ <file>spit_image.png</file>
</qresource>
</RCC>
Added: trunk/qgis/src/plugins/spit/spit_icon.png
===================================================================
(Binary files differ)
Property changes on: trunk/qgis/src/plugins/spit/spit_icon.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/qgis/src/plugins/spit/spit_icons.h
===================================================================
--- trunk/qgis/src/plugins/spit/spit_icons.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/spit/spit_icons.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -1,272 +0,0 @@
-/***************************************************************************
- spit_icons.h
- --------------------------------------
- Date : Sun Sep 16 12:13:54 AKDT 2007
- Copyright : (C) 2007 by Gary E. Sherman
- Email : sherman at mrcc dot com
- ***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-/* XPM */
-static const char *icon_ok[] =
-{
- /* columns rows colors chars-per-pixel */
- "16 16 94 2",
- " c #004100",
- ". c #004200",
- "X c #004400",
- "o c #004500",
- "O c #004600",
- "+ c #004800",
- "@ c #004900",
- "# c #004B00",
- "$ c #004C00",
- "% c #004D00",
- "& c #004E00",
- "* c #005000",
- "= c #005100",
- "- c #005300",
- "; c #005400",
- ": c #005600",
- "> c #005B00",
- ", c #005C00",
- "< c #005D00",
- "1 c #005E00",
- "2 c #005F00",
- "3 c #006000",
- "4 c #006200",
- "5 c DarkGreen",
- "6 c #006700",
- "7 c #006900",
- "8 c #006B00",
- "9 c #006C00",
- "0 c #006D00",
- "q c #006E00",
- "w c #006F00",
- "e c #007300",
- "r c #007400",
- "t c #007600",
- "y c #007700",
- "u c #007800",
- "i c #007900",
- "p c #007B00",
- "a c #017B01",
- "s c #007C00",
- "d c #007D00",
- "f c #007F00",
- "g c #008000",
- "h c #008100",
- "j c #008200",
- "k c #008300",
- "l c #038203",
- "z c #008400",
- "x c #008600",
- "c c #008700",
- "v c #008B00",
- "b c #028902",
- "n c #008C00",
- "m c #008D00",
- "M c #008F00",
- "N c #058F05",
- "B c #009100",
- "V c #019100",
- "C c #009300",
- "Z c #049104",
- "A c #009C00",
- "S c #069800",
- "D c #099B00",
- "F c #089908",
- "G c #00AC00",
- "H c #00AE00",
- "J c #00B100",
- "K c #00B200",
- "L c #06B106",
- "P c #00BE00",
- "I c #0BBE0B",
- "U c #10A010",
- "Y c #19A719",
- "T c #18B918",
- "R c #1FBD1F",
- "E c #01C001",
- "W c #00CA00",
- "Q c #00CF00",
- "! c #00D300",
- "~ c #00D500",
- "^ c #00DA00",
- "/ c #00DB00",
- "( c #00DD00",
- ") c #1BCE1B",
- "_ c #00E000",
- "` c #00E900",
- "' c #00EE00",
- "] c #08ED08",
- "[ c #00F100",
- "{ c #00F300",
- "} c #00FE00",
- "| c #0AF50A",
- " . c gray100",
- ".. c None",
- /* pixels */
- "................................",
- "................................",
- "M ........................M S D ",
- "M c ..................g v M M M ",
- "c N a ............t b F Y c c ..",
- "a T F 0 ......0 t N ) R g a ....",
- "8 H ] b 6 6 6 c P | I r a ......",
- "4 c { ( a r J ` } H 4 8 ........",
- "..2 Q ' ~ ~ ' ` M 2 4 ..........",
- "..* A ( ^ ( ! g * ..............",
- "..$ 0 W Q P 0 # ................",
- "....$ J G 4 ..................",
- "....# a 2 ....................",
- "....O O O ......................",
- "................................",
- "................................"
-};
-
-/* XPM */
-static const char *icon_reserved[] =
-{
- /* columns rows colors chars-per-pixel */
- "16 16 117 2",
- " c black",
- ". c #656565",
- "X c #B33A3D",
- "o c #B43B3E",
- "O c #B63B3E",
- "+ c #B63C3F",
- "@ c #BA373B",
- "# c #BD3639",
- "$ c #BE373A",
- "% c #B83B3E",
- "& c #A63E41",
- "* c #AD3D40",
- "= c #8F4D4F",
- "- c #844F50",
- "; c #874E50",
- ": c #904849",
- "> c #C53438",
- ", c #CA3336",
- "< c #CB3236",
- "1 c #CB3437",
- "2 c #CC3235",
- "3 c #CD3236",
- "4 c #CE3235",
- "5 c #CF3236",
- "6 c #CC3437",
- "7 c #CB3538",
- "8 c #CC3538",
- "9 c #D03236",
- "0 c #D13337",
- "q c #D23337",
- "w c #D33236",
- "e c #D33337",
- "r c #D43236",
- "t c #D73236",
- "y c #E33438",
- "u c #E33539",
- "i c #E43438",
- "p c #E43538",
- "a c #E0383C",
- "s c #EB373B",
- "d c #EB373C",
- "f c #CF3E42",
- "g c #FF3B40",
- "h c #FF3C40",
- "j c #FF3C42",
- "k c #FF3D42",
- "l c #FF3E43",
- "z c #DC5B5E",
- "x c #D55F61",
- "c c #DB6568",
- "v c #DC6F72",
- "b c #E54448",
- "n c #E24A4E",
- "m c #E44A4E",
- "M c #E54A4E",
- "N c #E64A4D",
- "B c #E05154",
- "V c #E35B5E",
- "C c #E4585C",
- "Z c #FF4045",
- "A c #FB474C",
- "S c #F8494D",
- "D c #FC484C",
- "F c #FC484D",
- "G c #FC4A4E",
- "H c #F65054",
- "J c #E06C6F",
- "K c #EC6568",
- "L c #EE666A",
- "P c #E86E72",
- "I c #E57A7C",
- "U c #E97478",
- "Y c #EA7A7E",
- "T c #F26669",
- "R c #FF6D71",
- "E c #FC7477",
- "W c #FC777A",
- "Q c #F87B7E",
- "! c #E68082",
- "~ c #E58D8F",
- "^ c #E78D90",
- "/ c #E88E90",
- "( c #E69092",
- ") c #E69294",
- "_ c #E4989A",
- "` c #EC9093",
- "' c #F28C8F",
- "] c #F29395",
- "[ c #EC9FA1",
- "{ c #E9A1A3",
- "} c #EAA4A6",
- "| c #ECB0B1",
- " . c #EEB8BA",
- ".. c #EFBABC",
- "X. c #F5A8AA",
- "o. c #F0B9BB",
- "O. c #F1C4C6",
- "+. c #F2C9CA",
- "@. c #F2C9CB",
- "#. c #F3CCCC",
- "$. c #F4CECE",
- "%. c #FFCECF",
- "&. c #F4D5D6",
- "*. c #F6DADA",
- "=. c #F6DDDE",
- "-. c #FED0D1",
- ";. c #FAD8D9",
- ":. c #F8E2E2",
- ">. c #F8E3E4",
- ",. c #F8E4E5",
- "<. c #F9E8E8",
- "1. c #FAEBEC",
- "2. c #FAEDED",
- "3. c #FBF2F2",
- "4. c #FCF2F2",
- "5. c gray100",
- "6. c None",
- /* pixels */
- "6.6.6.6.6.q 2 2 2 2 > 6.6.6.6.6.",
- "6.6.6.0 r r p B x p r 2 @ 6.6.6.",
- "6.6.0 0 M X.>.3.4.1.o.C 2 O 6.6.",
- "6.0 0 K &.:.:.:.:.:.:.=.I 2 & 6.",
- "6.0 n O.*.3.$.$.$.$.*.4.$.V > . ",
- "2 r ` .2.5.2. . . at .5.5.@._ r : ",
- "2 u { } } <.5.<...5.5.| G j i O ",
- "2 n ^ ( ) ) >.5.5.5.] H j d s O ",
- "2 b P U Y T Q 5.5.%.j j j j s + ",
- "< p A A A E 5.5.%.5.%.j Z Z u X ",
- "# r G G W 5.5.R j -.5.-.D G q - ",
- "6.< M K ;.5.' K K K ;.5.' m @ . ",
- "6.@ 6 v ! { ! ! ! ! ! _ v 8 ; . ",
- "6.6.O 2 c ~ / / ~ ^ ^ c 6 : . 6.",
- "6.6.6.& > f x v v c b X ; . 6.6.",
- "6.6.6.6.. : X + X X - . . 6.6.6."
-};
Added: trunk/qgis/src/plugins/spit/spit_image.png
===================================================================
(Binary files differ)
Property changes on: trunk/qgis/src/plugins/spit/spit_image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/qgis/src/plugins/spit/spiticon.xpm
===================================================================
(Binary files differ)
Deleted: trunk/qgis/src/plugins/wfs/mIconAddWfsLayer.png
===================================================================
(Binary files differ)
Modified: trunk/qgis/src/plugins/wfs/qgswfsplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/wfs/qgswfsplugin.cpp 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/wfs/qgswfsplugin.cpp 2009-03-22 22:55:59 UTC (rev 10403)
@@ -16,12 +16,14 @@
***************************************************************************/
#include "qgisinterface.h"
+#include "qgsapplication.h"
#include "qgsproviderregistry.h"
#include "qgswfssourceselect.h"
#include "qgssinglesymbolrenderer.h"
#include "qgsvectorlayer.h"
#include "qgswfsplugin.h"
+#include <QFile>
#include <QToolBar>
@@ -46,10 +48,13 @@
{
if ( mIface )
{
- mWfsDialogAction = new QAction( QIcon( ":/mIconAddWfsLayer.png" ), tr( "&Add WFS layer" ), 0 );
+ mWfsDialogAction = new QAction( QIcon(), tr( "&Add WFS layer" ), 0 );
+ setCurrentTheme( "" );
QObject::connect( mWfsDialogAction, SIGNAL( triggered() ), this, SLOT( showSourceDialog() ) );
mIface->fileToolBar()->addAction( mWfsDialogAction );
mIface->addPluginToMenu( tr( "&Add WFS layer" ), mWfsDialogAction );
+ // this is called when the icon theme is changed
+ connect( mIface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
}
}
@@ -67,6 +72,30 @@
serverDialog.exec();
}
+//! Set icons to the current theme
+void QgsWFSPlugin::setCurrentTheme( QString theThemeName )
+{
+ QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/wfs.png";
+ QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/wfs.png";
+ QString myQrcPath = ":/wfs.png";
+ if ( QFile::exists( myCurThemePath ) )
+ {
+ mWfsDialogAction->setIcon( QIcon( myCurThemePath ) );
+ }
+ else if ( QFile::exists( myDefThemePath ) )
+ {
+ mWfsDialogAction->setIcon( QIcon( myDefThemePath ) );
+ }
+ else if ( QFile::exists( myQrcPath ) )
+ {
+ mWfsDialogAction->setIcon( QIcon( myQrcPath ) );
+ }
+ else
+ {
+ mWfsDialogAction->setIcon( QIcon() );
+ }
+}
+
QGISEXTERN QgisPlugin * classFactory( QgisInterface * theQgisInterfacePointer )
{
return new QgsWFSPlugin( theQgisInterfacePointer );
Modified: trunk/qgis/src/plugins/wfs/qgswfsplugin.h
===================================================================
--- trunk/qgis/src/plugins/wfs/qgswfsplugin.h 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/wfs/qgswfsplugin.h 2009-03-22 22:55:59 UTC (rev 10403)
@@ -35,6 +35,8 @@
void initGui();
/**Unload the plugin and cleanup the GUI*/
void unload();
+ //! update the plugins theme when the app tells us its theme is changed
+ void setCurrentTheme ( QString theThemeName );
private:
QgisInterface* mIface;
Added: trunk/qgis/src/plugins/wfs/wfs.png
===================================================================
(Binary files differ)
Property changes on: trunk/qgis/src/plugins/wfs/wfs.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/qgis/src/plugins/wfs/wfsplugin.qrc
===================================================================
--- trunk/qgis/src/plugins/wfs/wfsplugin.qrc 2009-03-22 15:22:55 UTC (rev 10402)
+++ trunk/qgis/src/plugins/wfs/wfsplugin.qrc 2009-03-22 22:55:59 UTC (rev 10403)
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/" >
- <file>mIconAddWfsLayer.png</file>
+ <file>wfs.png</file>
</qresource>
</RCC>
More information about the QGIS-commit
mailing list