Skip to content
Permalink
Browse files

Added QgsApplication::iconPath utility function (and removed its decl…

…aration from QgsSymbolLayerV2Utils)

git-svn-id: http://svn.osgeo.org/qgis/trunk@13352 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Apr 23, 2010
1 parent 863f3b3 commit b210172df4bf68a0f13093bdd26a2e422921693d
@@ -159,6 +159,18 @@ const QString QgsApplication::activeThemePath()
return ":/images/themes/" + mThemeName + "/";
}


QString QgsApplication::iconPath( QString iconFile )
{
// try active theme
QString path = activeThemePath();
if ( QFile::exists( path + iconFile ) )
return path + iconFile;

// use default theme
return defaultThemePath() + iconFile;
}

/*!
Set the theme path to the specified theme.
*/
@@ -131,6 +131,11 @@ class CORE_EXPORT QgsApplication: public QApplication
//! Returns the path to the default theme directory.
static const QString defaultThemePath();

//! Returns path to the desired icon file.
//! First it tries to use the active theme path, then default theme path
//! @note Added in 1.5
static QString iconPath( QString iconFile );

//! Returns the path to user's style. Added in QGIS 1.4
static const QString userStyleV2Path();

@@ -79,8 +79,6 @@ class CORE_EXPORT QgsSymbolLayerV2Utils
/**Creates a render context for a pixel based device*/
static QgsRenderContext createRenderContext( QPainter* p );

static QString iconPath( QString iconFile );

/**Multiplies opacity of image pixel values with a (global) transparency value*/
static void multiplyImageOpacity( QImage* image, qreal alpha );
};
@@ -19,18 +19,6 @@
#include "qgslogger.h"


static QString iconPath( QString iconFile )
{
// try active theme
QString path = QgsApplication::activeThemePath();
if ( QFile::exists( path + iconFile ) )
return path + iconFile;

// use default theme
return QgsApplication::defaultThemePath() + iconFile;
}

///////

QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent )
: QDialog( parent ), mStyle( style ), mModified( false )
@@ -39,9 +27,9 @@ QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* pa
setupUi( this );

// setup icons
btnAddItem->setIcon( QIcon( iconPath( "symbologyAdd.png" ) ) );
btnEditItem->setIcon( QIcon( iconPath( "symbologyEdit.png" ) ) );
btnRemoveItem->setIcon( QIcon( iconPath( "symbologyRemove.png" ) ) );
btnAddItem->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.png" ) ) );
btnEditItem->setIcon( QIcon( QgsApplication::iconPath( "symbologyEdit.png" ) ) );
btnRemoveItem->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.png" ) ) );

connect( this, SIGNAL( finished( int ) ), this, SLOT( onFinished() ) );

@@ -57,18 +57,6 @@ class SymbolLayerItem : public QStandardItem

//////////

static QString iconPath( QString iconFile )
{
// try active theme
QString path = QgsApplication::activeThemePath();
if ( QFile::exists( path + iconFile ) )
return path + iconFile;

// use default theme
return QgsApplication::defaultThemePath() + iconFile;
}

//////////

static bool _initWidgetFunction( QString name, QgsSymbolLayerV2WidgetFunc f )
{
@@ -119,11 +107,11 @@ QgsSymbolV2PropertiesDialog::QgsSymbolV2PropertiesDialog( QgsSymbolV2* symbol, Q
setupUi( this );

// setup icons
btnAddLayer->setIcon( QIcon( iconPath( "symbologyAdd.png" ) ) );
btnRemoveLayer->setIcon( QIcon( iconPath( "symbologyRemove.png" ) ) );
btnLock->setIcon( QIcon( iconPath( "symbologyLock.png" ) ) );
btnUp->setIcon( QIcon( iconPath( "symbologyUp.png" ) ) );
btnDown->setIcon( QIcon( iconPath( "symbologyDown.png" ) ) );
btnAddLayer->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.png" ) ) );
btnRemoveLayer->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.png" ) ) );
btnLock->setIcon( QIcon( QgsApplication::iconPath( "symbologyLock.png" ) ) );
btnUp->setIcon( QIcon( QgsApplication::iconPath( "symbologyUp.png" ) ) );
btnDown->setIcon( QIcon( QgsApplication::iconPath( "symbologyDown.png" ) ) );

// set widget functions
// (should be probably moved somewhere else)

0 comments on commit b210172

Please sign in to comment.
You can’t perform that action at this time.