Skip to content

Commit

Permalink
removed PKGDATAPATH in the legend classes
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@4689 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 15, 2006
1 parent 36547f4 commit 7f74d46
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 110 deletions.
2 changes: 1 addition & 1 deletion src/gui/qgsserversourceselect.cpp
Expand Up @@ -110,7 +110,7 @@ void QgsServerSourceSelect::on_btnDelete_clicked()
int result = QMessageBox::information(this, tr("Confirm Delete"), msg, tr("Yes"), tr("No"));
if (result == 0)
{
settings.removeEntry(key + "/url");
settings.remove(key);
cmbConnections->removeItem(cmbConnections->currentItem()); // populateConnectionList();
}
}
Expand Down
20 changes: 8 additions & 12 deletions src/legend/qgslegend.cpp
Expand Up @@ -19,6 +19,7 @@
/* $Id$ */

#include "qgisapp.h"
#include "qgsapplication.h"
#include "qgslegend.h"
#include "qgslegendgroup.h"
#include "qgslegendlayer.h"
Expand Down Expand Up @@ -371,12 +372,7 @@ void QgsLegend::handleRightClickEvent(QTreeWidgetItem* item, const QPoint& posit
{
QMenu theMenu;

#if defined(Q_OS_MACX) || defined(WIN32)
QString iconsPath(QCoreApplication::applicationDirPath()+QString("/share/qgis/images/icons/"));
#else
QString iconsPath(PKGDATAPATH);
iconsPath+="/images/icons/";
#endif
QString iconsPath = QgsApplication::themePath();

if(mMapCanvas->isDrawing())
{
Expand All @@ -394,17 +390,17 @@ void QgsLegend::handleRightClickEvent(QTreeWidgetItem* item, const QPoint& posit
else if(li->type() == QgsLegendItem::LEGEND_LAYER)
{
theMenu.addAction(tr("&Properties"), this, SLOT(legendLayerShowProperties()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("inoverview.png"))), tr("&Add to overview"), this, SLOT(legendLayerAddToOverview()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("remove_from_overview.png"))), tr("&Remove from overview"), this, SLOT(legendLayerRemoveFromOverview()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("remove.png"))), tr("&Remove"), this, SLOT(legendLayerRemove()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("mActionAddAllToOverview.png"))), tr("&Add to overview"), this, SLOT(legendLayerAddToOverview()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("mActionRemoveAllFromOverview.png"))), tr("&Remove from overview"), this, SLOT(legendLayerRemoveFromOverview()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("mActionRemove.png"))), tr("&Remove"), this, SLOT(legendLayerRemove()));
if(li->parent())
{
theMenu.addAction(tr("&Make to toplevel item"), this, SLOT(makeToTopLevelItem()));
}
}
else if(li->type() == QgsLegendItem::LEGEND_GROUP)
{
theMenu.addAction(QPixmap(iconsPath+QString("remove.png")), tr("&Remove"), this, SLOT(legendGroupRemove()));
theMenu.addAction(QPixmap(iconsPath+QString("mActionRemove.png")), tr("&Remove"), this, SLOT(legendGroupRemove()));
}

if(li->type() == QgsLegendItem::LEGEND_LAYER || li->type() == QgsLegendItem::LEGEND_GROUP)
Expand All @@ -416,8 +412,8 @@ void QgsLegend::handleRightClickEvent(QTreeWidgetItem* item, const QPoint& posit
}

theMenu.addAction(QIcon(QPixmap(iconsPath+QString("folder_new.png"))), tr("&Add group"), this, SLOT(addGroup()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("expand_tree.png"))), tr("&Expand all"), this, SLOT(expandAll()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("collapse_tree.png"))), tr("&Collapse all"), this, SLOT(collapseAll()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("mActionExpandTree.png"))), tr("&Expand all"), this, SLOT(expandAll()));
theMenu.addAction(QIcon(QPixmap(iconsPath+QString("mActionCollapseTree.png"))), tr("&Collapse all"), this, SLOT(collapseAll()));

theMenu.exec(position);
}
Expand Down
22 changes: 4 additions & 18 deletions src/legend/qgslegendgroup.cpp
Expand Up @@ -17,6 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "qgsapplication.h"
#include "qgslegendgroup.h"
#include <QCoreApplication>
#include <QIcon>
Expand All @@ -25,39 +26,24 @@ QgsLegendGroup::QgsLegendGroup(QTreeWidgetItem * theItem ,QString theName)
: QgsLegendItem(theItem,theName)
{
mType=LEGEND_GROUP;
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
QIcon myIcon(pkgDataPath+QString("/images/icons/folder.png"));
QIcon myIcon(QgsApplication::themePath()+"mActionFolder.png");
setIcon(0, myIcon);
}
QgsLegendGroup::QgsLegendGroup(QTreeWidget* theListView, QString theString)
: QgsLegendItem(theListView,theString)
{
mType=LEGEND_GROUP;
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
QIcon myIcon(pkgDataPath+QString("/images/icons/folder.png"));
QIcon myIcon(QgsApplication::themePath()+"mActionFolder.png");
setIcon(0, myIcon);
}

QgsLegendGroup::QgsLegendGroup(QString name): QgsLegendItem()
{
mType=LEGEND_GROUP;
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
QIcon myIcon(pkgDataPath+QString("/images/icons/folder.png"));
QIcon myIcon(QgsApplication::themePath()+"mActionFolder.png");
setText(0, name);
setIcon(0, myIcon);
}
Expand Down
43 changes: 11 additions & 32 deletions src/legend/qgslegendlayer.cpp
Expand Up @@ -27,47 +27,26 @@
QgsLegendLayer::QgsLegendLayer(QTreeWidgetItem* parent,QString name)
: QObject(), QgsLegendItem(parent, name)
{
mType=LEGEND_LAYER;
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
QIcon myIcon(pkgDataPath+QString("/images/icons/layer.png"));
setCheckState (0, Qt::Checked);
setText(0, name);
setIcon(0, myIcon);
mType=LEGEND_LAYER;
setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
setCheckState (0, Qt::Checked);
setText(0, name);
}

QgsLegendLayer::QgsLegendLayer(QTreeWidget* parent, QString name): QObject(), QgsLegendItem(parent, name)
{
mType=LEGEND_LAYER;
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
setCheckState (0, Qt::Checked);
QIcon myIcon(pkgDataPath+QString("/images/icons/layer.png"));
setText(0, name);
setIcon(0, myIcon);
mType=LEGEND_LAYER;
setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
setCheckState (0, Qt::Checked);
setText(0, name);
}

QgsLegendLayer::QgsLegendLayer(QString name): QObject(), QgsLegendItem()
{
mType=LEGEND_LAYER;
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
setCheckState (0, Qt::Checked);
QIcon myIcon(pkgDataPath+QString("/images/icons/layer.png"));
setText(0, name);
setIcon(0, myIcon);
setFlags(Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
setCheckState (0, Qt::Checked);
setText(0, name);
}

QgsLegendLayer::~QgsLegendLayer()
Expand Down
35 changes: 10 additions & 25 deletions src/legend/qgslegendlayerfile.cpp
Expand Up @@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#include "qgsapplication.h"
#include "qgslegend.h"
#include "qgslegendlayerfile.h"
#include "qgsmaplayer.h"
Expand All @@ -30,17 +30,12 @@ QgsLegendLayerFile::QgsLegendLayerFile(QTreeWidgetItem * theLegendItem, QString
mType = LEGEND_LAYER_FILE;
QPixmap originalPixmap = getOriginalPixmap();
//ensure the overview glasses is painted if necessary
if(mLayer->showInOverviewStatus())
/*if(mLayer->showInOverviewStatus())
{
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap inOverviewPixmap(pkgDataPath+QString("/images/icons/inoverview.png"));
QPixmap inOverviewPixmap(QgsApplication::themePath()+...);
QPainter p(&originalPixmap);
p.drawPixmap(0,0,inOverviewPixmap);
}
}*/
setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
QIcon originalIcon(originalPixmap);
setCheckState (0, Qt::Checked );
Expand All @@ -54,17 +49,12 @@ QgsLegendLayerFile::QgsLegendLayerFile(QString theString, QgsMapLayer* theLayer)
mType = LEGEND_LAYER_FILE;
QPixmap originalPixmap = getOriginalPixmap();
//ensure the overview glasses is painted if necessary
if(mLayer->showInOverviewStatus())
/*if(mLayer->showInOverviewStatus())
{
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap inOverviewPixmap(pkgDataPath+QString("/images/icons/inoverview.png"));
QPainter p(&originalPixmap);
p.drawPixmap(0,0,inOverviewPixmap);
}
QPixmap inOverviewPixmap(QgsApplication::themePath()+...);
QPainter p(&originalPixmap);
p.drawPixmap(0,0,inOverviewPixmap);
}*/
setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
QIcon originalIcon(originalPixmap);
setCheckState (0, Qt::Checked );
Expand Down Expand Up @@ -96,12 +86,7 @@ QgsLegendItem::DRAG_ACTION QgsLegendLayerFile::accept(const QgsLegendItem* li) c

QPixmap QgsLegendLayerFile::getOriginalPixmap() const
{
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QPixmap myPixmap(pkgDataPath+QString("/images/icons/file.png"));
QPixmap myPixmap(QgsApplication::themePath()+"mActionFileNew.png");
return myPixmap;
}

Expand Down
8 changes: 2 additions & 6 deletions src/legend/qgslegendpropertygroup.cpp
Expand Up @@ -17,6 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "qgsapplication.h"
#include "qgslegendpropertygroup.h"
#include <QCoreApplication>
#include <QIcon>
Expand All @@ -25,12 +26,7 @@ QgsLegendPropertyGroup::QgsLegendPropertyGroup(QTreeWidgetItem* theLegendItem, Q
: QgsLegendItem(theLegendItem,theString )
{
mType=LEGEND_PROPERTY_GROUP;
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QIcon myIcon(pkgDataPath+QString("/images/icons/properties.png"));
QIcon myIcon(QgsApplication::themePath()+"mIconProperties.png");
setText(0, theString);
setIcon(0,myIcon);
}
Expand Down
8 changes: 2 additions & 6 deletions src/legend/qgslegendsymbologygroup.cpp
Expand Up @@ -17,6 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "qgsapplication.h"
#include "qgslegendlayerfile.h"
#include "qgslegendlayerfilegroup.h"
#include "qgslegendsymbologygroup.h"
Expand All @@ -28,12 +29,7 @@ QgsLegendSymbologyGroup::QgsLegendSymbologyGroup(QTreeWidgetItem * theItem, QStr
: QgsLegendItem( theItem, theString)
{
mType = LEGEND_SYMBOL_GROUP;
#if defined(Q_OS_MACX) || defined(WIN32)
QString pkgDataPath(QCoreApplication::applicationDirPath()+QString("/share/qgis"));
#else
QString pkgDataPath(PKGDATAPATH);
#endif
QIcon myIcon(pkgDataPath+QString("/images/icons/symbology.png"));
QIcon myIcon(QgsApplication::themePath()+"mIconSymbology.png");
setText(0, theString);
setIcon(0,myIcon);
}
Expand Down
10 changes: 2 additions & 8 deletions src/providers/wms/qgshttptransaction.cpp
Expand Up @@ -83,8 +83,8 @@ QByteArray QgsHttpTransaction::getSynchronously(int redirections)
http = new Q3Http( httphost, httpport );

#ifdef QGISDEBUG
// std::cout << "QgsHttpTransaction::getSynchronously: qurl.host() is '" << qurl.host() << "'." << std::endl;
// std::cout << "QgsHttpTransaction::getSynchronously: qurl.encodedPathAndQuery() is '" << qurl.encodedPathAndQuery() << "'." << std::endl;
qWarning("QgsHttpTransaction::getSynchronously: qurl.host() is '"+qurl.host()+ "'.");
qWarning("QgsHttpTransaction::getSynchronously: qurl.encodedPathAndQuery() is '"+qurl.encodedPathAndQuery()+"'.");
#endif


Expand Down Expand Up @@ -155,12 +155,6 @@ QByteArray QgsHttpTransaction::getSynchronously(int redirections)

}



#ifdef QGISDEBUG
std::cout << "QgsHttpTransaction::getSynchronously: exiting." << std::endl;
#endif

return httpresponse;


Expand Down
13 changes: 11 additions & 2 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -460,7 +460,7 @@ void QgsWmsProvider::retrieveServerCapabilities()
if ( httpcapabilitiesresponse.isNull() )
{

QString uri = httpuri + "SERVICE=WMS&REQUEST=GetCapabilities";
QString uri = httpuri + "?SERVICE=WMS&REQUEST=GetCapabilities";

QgsHttpTransaction http(uri, httpproxyhost, httpproxyport);

Expand Down Expand Up @@ -550,6 +550,10 @@ void QgsWmsProvider::parseCapabilities(QByteArray const & xml, QgsWmsCapabiliti
{
#ifdef QGISDEBUG
std::cout << "QgsWmsProvider::parseCapabilities: entering." << std::endl;

//test the content of the QByteArray
QString responsestring(xml);
qWarning("QgsWmsProvider::parseCapabilities, received the following data: "+responsestring);

QFile file( "/tmp/qgis-wmsprovider-capabilities.xml" );
if ( file.open( QIODevice::WriteOnly ) )
Expand All @@ -560,7 +564,12 @@ void QgsWmsProvider::parseCapabilities(QByteArray const & xml, QgsWmsCapabiliti
#endif

// Convert completed document into a DOM
capabilitiesDOM.setContent(xml);
QString errormsg;
bool contentsuccess = capabilitiesDOM.setContent(xml, false, &errormsg);

#ifdef QGISDEBUG
qWarning("errormessage is: "+errormsg);
#endif

QDomElement docElem = capabilitiesDOM.documentElement();

Expand Down

0 comments on commit 7f74d46

Please sign in to comment.