Use qApp->applicationDirPath() instead of PKGDATAPATH for Mac and Win

git-svn-id: http://svn.osgeo.org/qgis/trunk@3934 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
telwertowski 2005-09-20 16:59:32 +00:00
parent 470c9f1c89
commit 3759356236
8 changed files with 81 additions and 20 deletions

View File

@ -42,7 +42,6 @@
#include "qgsrasterlayerproperties.h"
#include <iostream>
#include <qlayout.h>
#include <qpushbutton.h>
static const char *const ident_ = "$Id$";
@ -302,12 +301,18 @@ void QgsLegend::handleRightClickEvent(QListViewItem* item, const QPoint& positio
{
if(!mMapCanvas->isDrawing())
{
#if defined(Q_OS_MACX) || defined(WIN32)
QString iconsPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString iconsPath(PKGDATAPATH);
#endif
iconsPath += QString("/images/icons/");
if(!item)//show list view popup menu
{
QPopupMenu pm;
pm.insertItem(QIconSet(QPixmap(QString(PKGDATAPATH)+QString("/images/icons/folder_new.png"))), tr("&Add group"), this, SLOT(addGroup()));
pm.insertItem(QIconSet(QPixmap(QString(PKGDATAPATH)+QString("/images/icons/expand_tree.png"))), tr("&Expand all"), this, SLOT(expandAll()));
pm.insertItem(QIconSet(QPixmap(QString(PKGDATAPATH)+QString("/images/icons/collapse_tree.png"))), tr("&Collapse all"), this, SLOT(collapseAll()));
pm.insertItem(QIconSet(QPixmap(iconsPath+QString("folder_new.png"))), tr("&Add group"), this, SLOT(addGroup()));
pm.insertItem(QIconSet(QPixmap(iconsPath+QString("expand_tree.png"))), tr("&Expand all"), this, SLOT(expandAll()));
pm.insertItem(QIconSet(QPixmap(iconsPath+QString("collapse_tree.png"))), tr("&Collapse all"), this, SLOT(collapseAll()));
pm.exec(position);
return;
}
@ -337,18 +342,18 @@ void QgsLegend::handleRightClickEvent(QListViewItem* item, const QPoint& positio
pm.insertItem(tr("&Properties"), this, SLOT(legendLayerShowProperties()));
pm.insertItem(tr("&Add to overview"), this, SLOT(legendLayerAddToOverview()));
pm.insertItem(tr("&Remove from overview"), this, SLOT(legendLayerRemoveFromOverview()));
pm.insertItem(QIconSet(QPixmap(QString(PKGDATAPATH)+QString("/images/icons/folder_new.png"))), tr("&Add group"), this, SLOT(addGroup()));
pm.insertItem(QIconSet(QPixmap(QString(PKGDATAPATH)+QString("/images/icons/expand_tree.png"))), tr("&Expand all"), this, SLOT(expandAll()));
pm.insertItem(QIconSet(QPixmap(QString(PKGDATAPATH)+QString("/images/icons/collapse_tree.png"))), tr("&Collapse all"), this, SLOT(collapseAll()));
pm.insertItem(QIconSet(QPixmap(iconsPath+QString("folder_new.png"))), tr("&Add group"), this, SLOT(addGroup()));
pm.insertItem(QIconSet(QPixmap(iconsPath+QString("expand_tree.png"))), tr("&Expand all"), this, SLOT(expandAll()));
pm.insertItem(QIconSet(QPixmap(iconsPath+QString("collapse_tree.png"))), tr("&Collapse all"), this, SLOT(collapseAll()));
pm.exec(position);
}
else if(li->type() == QgsLegendItem::LEGEND_GROUP)
{
QPopupMenu pm;
pm.insertItem(tr("&Remove"), this, SLOT(legendGroupRemove()));
pm.insertItem(QIconSet(QPixmap(QString(PKGDATAPATH)+QString("/images/icons/folder_new.png"))), tr("&Add group"), this, SLOT(addGroup()));
pm.insertItem(QIconSet(QPixmap(QString(PKGDATAPATH)+QString("/images/icons/expand_tree.png"))), tr("&Expand all"), this, SLOT(expandAll()));
pm.insertItem(QIconSet(QPixmap(QString(PKGDATAPATH)+QString("/images/icons/collapse_tree.png"))), tr("&Collapse all"), this, SLOT(collapseAll()));
pm.insertItem(QIconSet(QPixmap(iconsPath+QString("folder_new.png"))), tr("&Add group"), this, SLOT(addGroup()));
pm.insertItem(QIconSet(QPixmap(iconsPath+QString("expand_tree.png"))), tr("&Expand all"), this, SLOT(expandAll()));
pm.insertItem(QIconSet(QPixmap(iconsPath+QString("collapse_tree.png"))), tr("&Collapse all"), this, SLOT(collapseAll()));
pm.exec(position);
}
}

View File

@ -18,19 +18,30 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "qgslegendgroup.h"
#include <qapplication.h>
QgsLegendGroup::QgsLegendGroup(QListViewItem * theItem ,QString theName)
: QgsLegendItem(theItem,theName)
{
mType=LEGEND_GROUP;
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/folder.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/folder.png"));
setPixmap(0,myPixmap);
}
QgsLegendGroup::QgsLegendGroup(QListView * theListView, QString theString)
: QgsLegendItem(theListView,theString)
{
mType=LEGEND_GROUP;
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/folder.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/folder.png"));
setPixmap(0,myPixmap);
}

View File

@ -18,20 +18,31 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "qgslegenditem.h"
#include <qapplication.h>
#include <qpixmap.h>
#include <iostream>
QgsLegendItem::QgsLegendItem(QListViewItem * theItem ,QString theName)
: QListViewItem(theItem,theName)
{
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/group.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/group.png"));
setPixmap(0,myPixmap);
}
QgsLegendItem::QgsLegendItem(QListView * theListView,QString theString)
: QListViewItem(theListView,theString)
{
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/group.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/group.png"));
setPixmap(0,myPixmap);
}

View File

@ -20,6 +20,7 @@
#include "qgslegendlayer.h"
#include "qgslegendlayerfile.h"
#include "qgsmaplayer.h"
#include <qapplication.h>
#include <qlistview.h>
#include <qpixmap.h>
#include <qpopupmenu.h>
@ -29,14 +30,24 @@ QgsLegendLayer::QgsLegendLayer(QListViewItem * parent,QString name)
: QObject(), QgsLegendItem(parent, name)
{
mType=LEGEND_LAYER;
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/layer.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/layer.png"));
setPixmap(0,myPixmap);
}
QgsLegendLayer::QgsLegendLayer(QListView* parent, QString name): QObject(), QgsLegendItem(parent, name)
{
mType=LEGEND_LAYER;
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/layer.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/layer.png"));
setPixmap(0,myPixmap);
}

View File

@ -58,7 +58,12 @@ QgsLegendItem::DRAG_ACTION QgsLegendLayerFile::accept(LEGEND_ITEM_TYPE type)
QPixmap QgsLegendLayerFile::getOriginalPixmap() const
{
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/file.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/file.png"));
return myPixmap;
}

View File

@ -18,6 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "qgslegendpropertygroup.h"
#include <qapplication.h>
#include <qlistview.h>
#include <qstring.h>
#include <qpixmap.h>
@ -25,7 +26,12 @@ QgsLegendPropertyGroup::QgsLegendPropertyGroup(QListViewItem * theLegendItem, QS
: QgsLegendItem(theLegendItem,theString )
{
mType=LEGEND_PROPERTY_GROUP;
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/properties.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/properties.png"));
setPixmap(0,myPixmap);
}

View File

@ -18,13 +18,19 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "qgslegendpropertyitem.h"
#include <qapplication.h>
#include <qpixmap.h>
QgsLegendPropertyItem::QgsLegendPropertyItem(QListViewItem * theItem,QString theString)
: QgsLegendItem(theItem ,theString)
{
mType=LEGEND_PROPERTY_ITEM;
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/property_item.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/property_item.png"));
setPixmap(0,myPixmap);
}

View File

@ -21,13 +21,19 @@
#include "qgslegendlayerfilegroup.h"
#include "qgslegendsymbologygroup.h"
#include "qgsmaplayer.h"
#include <qapplication.h>
#include <qpixmap.h>
QgsLegendSymbologyGroup::QgsLegendSymbologyGroup(QListViewItem * theItem, QString theString)
: QgsLegendItem( theItem, theString)
{
mType = LEGEND_SYMBOL_GROUP;
QPixmap myPixmap(QString(PKGDATAPATH)+QString("/images/icons/symbology.png"));
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(qApp->applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/symbology.png"));
setPixmap(0,myPixmap);
}