[Qgis-developer] Re: themes in the Grass plugin (r9900)

Tim Sutton tim at linfiniti.com
Fri Jan 2 04:04:22 EST 2009


Hi Borys

Your changes sound fine - please go ahead. 

BTW I tried your python profile generator plugin - works great!

Regards

Tim


On Sun, 2008-12-28 at 11:28 +0100, Borys Jurgiel wrote:
> Sunday 28 of December 2008 09:14:57 Tim Sutton napisał(a):
> > Hi
> >
> > When I tested with your r9862 change below, it didnt pick up my grass
> > 'gis' theme icons.
> >
> > If we are going to go the non qrc route we will need to change all the
> > plugins to install their icons into
> >
> > <CMAKE_INSTALL_PREFIX>/share/qgis/themes/<foo theme>
> >
> > The qrc approach is kinda nice in that it makes the plugins self
> > contained. Its also possible to combine the two approaches - look in the
> > qrc file for the theme icon and if its not there look in the file based
> > themes dir, and if its not there either fall back to the default icon.
> 
> My idea is to combine them too, but with different search odrer:
> 1. file-based current theme icon (in share/qgis/themes/[ACTIVE]/plugins/)
> 2. file-based default theme icon (in share/qgis/themes/default/plugins/)
> 3. qrc-based local plugin icon
> 
> 
> QIcon QgsCopyrightLabelPlugin::getThemeIcon( const QString theName )
> {
>   QString myCurThemePath = QgsApplication::activeThemePath() + "/plugins/" + theName;
>   QString myDefThemePath = QgsApplication::defaultThemePath() + "/plugins/" + theName;
>   QString myQrcPath = ":/" + theName;
>   if ( QFile::exists( myCurThemePath ) )
>   {
>     return QIcon( myCurThemePath );
>   }
>   else if ( QFile::exists( myDefThemePath ) )
>   {
>     return QIcon( myDefThemePath );
>   }
>   else if ( QFile::exists( myQrcPath ) )
>   {
>     return QIcon( myQrcPath );
>   }
>   else
>   {
>     return QIcon();
>   }
> }
> 
> 
> It should provide the most uniform look and still saves the plugin
> independence. You've written:
> 
> // Note this code is duplicated from qgisapp.cpp because
> // I didnt want to make plugins dependent on qgsapplication (...)
> 
> It's dependent on QgsApplication::activeThemePath() and ::defaultThemePath(), 
> but it's very easy to liberate by commenting them out and leaving
> only the last (qrc) path.
> 
> So if you agree, I'll aply this unified combined version to all plugins.

-- 
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Visit http://linfiniti.com to find out about:
 * QGIS programming services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting & Support Services
Skype: timlinux Irc: timlinux on #qgis at freenode.net
==============================================
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.osgeo.org/pipermail/qgis-developer/attachments/20090102/8cf051f4/attachment.bin


More information about the Qgis-developer mailing list