More changes for Qt4 porting readiness.

git-svn-id: http://svn.osgeo.org/qgis/trunk@3910 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
morb_au 2005-09-15 21:16:10 +00:00
parent 39c1bce2c8
commit 9711ae126c
23 changed files with 316 additions and 169 deletions

View File

@ -810,7 +810,7 @@ void QgsLabel::writeXML(std::ostream& xml)
// else
if ( mLabelAttributes->textIsSet() && !mLabelField[Text].isEmpty() )
{
xml << "\t\t\t<label text=\"" << mLabelAttributes->text() << "\" field=\"" << mLabelField[Text] << "\" />\n";
xml << "\t\t\t<label text=\"" << mLabelAttributes->text() << "\" field=\"" << mLabelField[Text].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->textIsSet() )
{
@ -818,12 +818,12 @@ void QgsLabel::writeXML(std::ostream& xml)
}
else
{
xml << "\t\t\t<label text=\"" << mLabelAttributes->text() << "\" field=\"" << mLabelField[Text] << "\" />\n";
xml << "\t\t\t<label text=\"" << mLabelAttributes->text() << "\" field=\"" << mLabelField[Text].local8Bit() << "\" />\n";
}
if ( mLabelAttributes->familyIsSet() && ! mLabelAttributes->family().isNull() && mLabelField[Family].isNull())
{
xml << "\t\t\t<family name=\"" << mLabelAttributes->family() << "\" field=\"" << mLabelField[Family] << "\" />\n";
xml << "\t\t\t<family name=\"" << mLabelAttributes->family() << "\" field=\"" << mLabelField[Family].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->familyIsSet() && ! mLabelAttributes->family().isNull() )
{
@ -838,7 +838,7 @@ void QgsLabel::writeXML(std::ostream& xml)
if ( mLabelAttributes->sizeIsSet() && !mLabelField[Size].isEmpty())
{
xml << "\t\t\t<size value=\"" << mLabelAttributes->size() << "\" units=\""
<< (const char *)QgsLabelAttributes::unitsName(mLabelAttributes->sizeType()) << "\" field=\"" << mLabelField[Size] << "\" />\n";
<< (const char *)QgsLabelAttributes::unitsName(mLabelAttributes->sizeType()) << "\" field=\"" << mLabelField[Size].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->sizeIsSet() )
{
@ -855,7 +855,7 @@ void QgsLabel::writeXML(std::ostream& xml)
//bold
if ( mLabelAttributes->boldIsSet() && !mLabelField[Bold].isEmpty() )
{
xml << "\t\t\t<bold on=\"" << mLabelAttributes->bold() << "\" field=\"" << mLabelField[Bold] << "\" />\n";
xml << "\t\t\t<bold on=\"" << mLabelAttributes->bold() << "\" field=\"" << mLabelField[Bold].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->boldIsSet() )
{
@ -869,7 +869,7 @@ void QgsLabel::writeXML(std::ostream& xml)
//italics
if ( mLabelAttributes->italicIsSet() && ! mLabelField[Italic].isEmpty())
{
xml << "\t\t\t<italic on=\"" << mLabelAttributes->italic() << "\" field=\"" << mLabelField[Italic] << "\" />\n";
xml << "\t\t\t<italic on=\"" << mLabelAttributes->italic() << "\" field=\"" << mLabelField[Italic].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->italicIsSet() )
{
@ -882,7 +882,7 @@ void QgsLabel::writeXML(std::ostream& xml)
//underline
if ( mLabelAttributes->underlineIsSet() && !mLabelField[Underline].isEmpty())
{
xml << "\t\t\t<underline on=\"" << mLabelAttributes->underline() << "\" field=\"" << mLabelField[Underline] << "\" />\n";
xml << "\t\t\t<underline on=\"" << mLabelAttributes->underline() << "\" field=\"" << mLabelField[Underline].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->underlineIsSet() )
{
@ -896,7 +896,7 @@ void QgsLabel::writeXML(std::ostream& xml)
if ( mLabelAttributes->colorIsSet() && ! mLabelField[Color].isNull() )
{
xml << "\t\t\t<color red=\"" << mLabelAttributes->color().red() << "\" green=\"" << mLabelAttributes->color().green()
<< "\" blue=\"" << mLabelAttributes->color().blue() << "\" field=\"" << mLabelField[Color] << "\" />\n";
<< "\" blue=\"" << mLabelAttributes->color().blue() << "\" field=\"" << mLabelField[Color].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->colorIsSet() )
{
@ -912,7 +912,7 @@ void QgsLabel::writeXML(std::ostream& xml)
/* X */
if (! mLabelField[XCoordinate].isEmpty() )
{
xml << "\t\t\t<x field=\"" << mLabelField[XCoordinate] << "\" />\n";
xml << "\t\t\t<x field=\"" << mLabelField[XCoordinate].local8Bit() << "\" />\n";
}
else
{
@ -922,7 +922,7 @@ void QgsLabel::writeXML(std::ostream& xml)
/* Y */
if (! mLabelField[YCoordinate].isEmpty() )
{
xml << "\t\t\t<y field=\"" << mLabelField[YCoordinate] << "\" />\n";
xml << "\t\t\t<y field=\"" << mLabelField[YCoordinate].local8Bit() << "\" />\n";
}
else
{
@ -932,16 +932,16 @@ void QgsLabel::writeXML(std::ostream& xml)
// offset
if ( mLabelAttributes->offsetIsSet() )
{
xml << "\t\t\t<offset units=\"" << QgsLabelAttributes::unitsName(mLabelAttributes->offsetType())
<< "\" x=\"" << mLabelAttributes->xOffset() << "\" xfield=\"" << mLabelField[XOffset]
<< "\" y=\"" << mLabelAttributes->yOffset() << "\" yfield=\"" << mLabelField[YOffset]
xml << "\t\t\t<offset units=\"" << QgsLabelAttributes::unitsName(mLabelAttributes->offsetType()).local8Bit()
<< "\" x=\"" << mLabelAttributes->xOffset() << "\" xfield=\"" << mLabelField[XOffset].local8Bit()
<< "\" y=\"" << mLabelAttributes->yOffset() << "\" yfield=\"" << mLabelField[YOffset].local8Bit()
<< "\" />\n";
}
// Angle
if ( mLabelAttributes->angleIsSet() )
{
xml << "\t\t\t<angle value=\"" << mLabelAttributes->angle() << "\" field=\"" << mLabelField[Angle] << "\" />\n";
xml << "\t\t\t<angle value=\"" << mLabelAttributes->angle() << "\" field=\"" << mLabelField[Angle].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->angleIsSet() )
{
@ -955,15 +955,15 @@ void QgsLabel::writeXML(std::ostream& xml)
// alignment
if ( mLabelAttributes->alignmentIsSet() )
{
xml << "\t\t\t<alignment value=\"" << QgsLabelAttributes::alignmentName(mLabelAttributes->alignment())
<< "\" field=\"" << mLabelField[Alignment] << "\" />\n";
xml << "\t\t\t<alignment value=\"" << QgsLabelAttributes::alignmentName(mLabelAttributes->alignment()).local8Bit()
<< "\" field=\"" << mLabelField[Alignment].local8Bit() << "\" />\n";
}
if ( mLabelAttributes->bufferColorIsSet() && ! mLabelField[BufferColor].isNull() )
{
xml << "\t\t\t<buffercolor red=\"" << mLabelAttributes->bufferColor().red() << "\" green=\"" << mLabelAttributes->bufferColor().green()
<< "\" blue=\"" << mLabelAttributes->bufferColor().blue() << "\" field=\"" << mLabelField[BufferColor] << "\" />\n";
<< "\" blue=\"" << mLabelAttributes->bufferColor().blue() << "\" field=\"" << mLabelField[BufferColor].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->bufferColorIsSet() )
{
@ -980,7 +980,7 @@ void QgsLabel::writeXML(std::ostream& xml)
if ( mLabelAttributes->bufferSizeIsSet() && ! mLabelField[BufferSize].isNull() )
{
xml << "\t\t\t<buffersize value=\"" << mLabelAttributes->bufferSize() << "\" units=\""
<< (const char *)QgsLabelAttributes::unitsName(mLabelAttributes->bufferSizeType()) << "\" field=\"" << mLabelField[BufferSize] << "\" />\n";
<< (const char *)QgsLabelAttributes::unitsName(mLabelAttributes->bufferSizeType()) << "\" field=\"" << mLabelField[BufferSize].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->bufferSizeIsSet() )
{
@ -996,7 +996,7 @@ void QgsLabel::writeXML(std::ostream& xml)
if ( mLabelAttributes->bufferEnabled() && ! mLabelField[BufferEnabled].isNull() )
{
xml << "\t\t\t<bufferenabled on=\"" << mLabelAttributes->bufferEnabled() << "\" field=\"" << mLabelField[BufferEnabled] << "\" />\n";
xml << "\t\t\t<bufferenabled on=\"" << mLabelAttributes->bufferEnabled() << "\" field=\"" << mLabelField[BufferEnabled].local8Bit() << "\" />\n";
}
else if ( mLabelAttributes->bufferEnabled())
{

View File

@ -117,7 +117,7 @@ inline bool operator==(const QgsLine &l1, const QgsLine &l2)
//! Stream operator for writing the line
inline std::ostream& operator << (std::ostream& os, const QgsLine &l)
{
os << l.stringRep();
os << l.stringRep().local8Bit();
return os;
}

View File

@ -16,6 +16,8 @@
***************************************************************************/
/* $Id$ */
#include <qglobal.h>
#include "qgsmapcanvas.h"
#include "qgsmaplayer.h"
@ -479,7 +481,7 @@ void QgsMapCanvas::showInOverview( QgsMapLayer * maplayer, bool visible )
void QgsMapCanvas::addLayer(QgsMapLayer * lyr)
{
#ifdef QGISDEBUG
std::cout << name() << " is adding " << lyr->name() << std::endl;
std::cout << name() << " is adding " << lyr->name().local8Bit() << std::endl;
#endif
Q_CHECK_PTR( lyr );
@ -854,7 +856,7 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
std::cout << ".............................." << std::endl;
std::cout << "...........Rendering.........." << std::endl;
std::cout << ".............................." << std::endl;
std::cout << name() << " canvas is " << msg << std::endl;
std::cout << name() << " canvas is " << msg.local8Bit() << std::endl;
#endif
int myHeight=0;
@ -991,7 +993,7 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
while (li != mCanvasProperties->zOrder.end())
{
#ifdef QGISDEBUG
std::cout << "QgsMapCanvas::render: at layer item '" << *li << "'." << std::endl;
std::cout << "QgsMapCanvas::render: at layer item '" << (*li).local8Bit() << "'." << std::endl;
#endif
emit setProgress(myRenderCounter++,mCanvasProperties->zOrder.size());
@ -1001,17 +1003,17 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
{
// QgsDatabaseLayer *dbl = (QgsDatabaseLayer *)&ml;
#ifdef QGISDEBUG
std::cout << "QgsMapCanvas::render: Rendering layer " << ml->name() << '\n'
std::cout << "QgsMapCanvas::render: Rendering layer " << ml->name().local8Bit() << '\n'
<< "Layer minscale " << ml->minScale()
<< ", maxscale " << ml->maxScale() << '\n'
<< ". Scale dep. visibility enabled? "
<< ml->scaleBasedVisibility() << '\n'
<< "Input extent: " << ml->extent().stringRep()
<< "Input extent: " << ml->extent().stringRep().local8Bit()
<< std::endl;
try
{
std::cout << "Transformed extent"
<< ml->coordinateTransform()->transform(ml->extent()).stringRep()
<< ml->coordinateTransform()->transform(ml->extent()).stringRep().local8Bit()
<< std::endl;
}
catch (QgsCsException &e)
@ -1134,6 +1136,8 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
//and also the connection to mDigitMovePoint
if((mLineEditing || mPolygonEditing) && mCaptureList.size()>0)
{
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
paint->setRasterOp(Qt::XorROP);
QgsPoint digitpoint=mCanvasProperties->coordXForm->transform(mDigitMovePoint.x(), mDigitMovePoint.y());
paint->drawLine(static_cast<int>(current.x()), static_cast<int>(current.y()), static_cast<int>(digitpoint.x()),\
@ -1144,6 +1148,7 @@ void QgsMapCanvas::render(QPaintDevice * theQPaintDevice)
paint->drawLine(static_cast<int>(first.x()), static_cast<int>(first.y()), static_cast<int>(digitpoint.x()),\
static_cast<int>(digitpoint.y()));
}
#endif
}
@ -1183,7 +1188,7 @@ void QgsMapCanvas::currentScale(int thePrecision)
std::cout << "------------------------------------------ " << std::endl;
std::cout << "Current extent is "
<< mCanvasProperties->currentExtent.stringRep() << std::endl;
<< mCanvasProperties->currentExtent.stringRep().local8Bit() << std::endl;
std::cout << "MuppX is: " << muppX << "\n"
<< "MuppY is: " << muppY << std::endl;
std::cout << "Canvas width: " << width()
@ -1517,6 +1522,8 @@ void QgsMapCanvas::mousePressEvent(QMouseEvent * e)
#endif
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
// Draw initial rubber band
paint.begin(this);
paint.setPen(pen);
@ -1526,6 +1533,7 @@ void QgsMapCanvas::mousePressEvent(QMouseEvent * e)
paint.drawLine(mCanvasProperties->rubberMidPoint, mCanvasProperties->rubberStopPoint);
paint.end();
#endif
} // if snapSegmentWithContext
break;
@ -1626,6 +1634,8 @@ void QgsMapCanvas::mousePressEvent(QMouseEvent * e)
<< "." << std::endl;
#endif
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
// Draw initial rubber band
paint.begin(this);
paint.setPen(pen);
@ -1641,6 +1651,7 @@ void QgsMapCanvas::mousePressEvent(QMouseEvent * e)
}
paint.end();
#endif
} // if snapVertexWithContext
@ -1718,6 +1729,8 @@ void QgsMapCanvas::mousePressEvent(QMouseEvent * e)
<< "." << std::endl;
#endif
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
// Draw X symbol - people can feel free to pretty this up if they like
paint.begin(this);
paint.setPen(pen);
@ -1737,6 +1750,7 @@ void QgsMapCanvas::mousePressEvent(QMouseEvent * e)
mCanvasProperties->rubberMidPoint.y() - crossSize );
paint.end();
#endif
} // if snapVertexWithContext
@ -1780,12 +1794,15 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
switch (mCanvasProperties->mapTool)
{
case QGis::ZoomIn:
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
// erase the rubber band box
paint.begin(this);
paint.setPen(pen);
paint.setRasterOp(Qt::XorROP);
paint.drawRect(mCanvasProperties->zoomBox);
paint.end();
#endif
// store the rectangle
mCanvasProperties->zoomBox.setRight(e->pos().x());
mCanvasProperties->zoomBox.setBottom(e->pos().y());
@ -1807,12 +1824,15 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
break;
case QGis::ZoomOut:
{
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
// erase the rubber band box
paint.begin(this);
paint.setPen(pen);
paint.setRasterOp(Qt::XorROP);
paint.drawRect(mCanvasProperties->zoomBox);
paint.end();
#endif
// store the rectangle
mCanvasProperties->zoomBox.setRight(e->pos().x());
mCanvasProperties->zoomBox.setBottom(e->pos().y());
@ -1901,12 +1921,15 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
case QGis::Select:
{
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
// erase the rubber band box
paint.begin(this);
paint.setPen(pen);
paint.setRasterOp(Qt::XorROP);
paint.drawRect(mCanvasProperties->zoomBox);
paint.end();
#endif
QgsMapLayer *lyr = mCanvasProperties->mapLegend->currentLayer();
@ -2235,6 +2258,8 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
// TODO: Find nearest line portion of the selected line, add a node at the mouse location
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
// Undraw rubber band
paint.begin(this);
paint.setPen(pen);
@ -2244,7 +2269,7 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
paint.drawLine(mCanvasProperties->rubberStartPoint, mCanvasProperties->rubberMidPoint);
paint.drawLine(mCanvasProperties->rubberMidPoint, mCanvasProperties->rubberStopPoint);
paint.end();
#endif
// Add the new vertex
@ -2293,6 +2318,8 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
QgsVectorLayer* vlayer =
dynamic_cast<QgsVectorLayer*>(mCanvasProperties->mapLegend->currentLayer());
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
// Undraw rubber band
paint.begin(this);
paint.setPen(pen);
@ -2302,7 +2329,7 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
paint.drawLine(mCanvasProperties->rubberStartPoint, mCanvasProperties->rubberMidPoint);
paint.drawLine(mCanvasProperties->rubberMidPoint, mCanvasProperties->rubberStopPoint);
paint.end();
#endif
// Move the vertex
@ -2346,6 +2373,8 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
QgsVectorLayer* vlayer =
dynamic_cast<QgsVectorLayer*>(mCanvasProperties->mapLegend->currentLayer());
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
// Undraw X symbol - people can feel free to pretty this up if they like
paint.begin(this);
paint.setPen(pen);
@ -2365,6 +2394,7 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
mCanvasProperties->rubberMidPoint.y() - crossSize );
paint.end();
#endif
if (vlayer)
{
@ -2465,6 +2495,8 @@ void QgsMapCanvas::mouseMoveEvent(QMouseEvent * e)
// draw the rubber band box as the user drags the mouse
mCanvasProperties->dragging = true;
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
paint.begin(this);
paint.setPen(pen);
paint.setRasterOp(Qt::XorROP);
@ -2477,6 +2509,8 @@ void QgsMapCanvas::mouseMoveEvent(QMouseEvent * e)
paint.drawRect(mCanvasProperties->zoomBox);
paint.end();
#endif
break;
case QGis::Pan:
// show the pmCanvas as the user drags the mouse
@ -2557,7 +2591,9 @@ void QgsMapCanvas::mouseMoveEvent(QMouseEvent * e)
QPainter paint;
QPen pen(Qt::gray);
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
paint.begin(this);
paint.setPen(pen);
paint.setRasterOp(Qt::XorROP);
@ -2572,6 +2608,7 @@ void QgsMapCanvas::mouseMoveEvent(QMouseEvent * e)
paint.drawLine(mCanvasProperties->rubberStartPoint, mCanvasProperties->rubberStopPoint);
paint.end();
#endif
}
@ -2618,6 +2655,9 @@ void QgsMapCanvas::drawLineToDigitisingCursor(QPainter* paint, bool last)
QgsProject::instance()->readNumEntry("Digitizing","/LineColorGreenPart",0),\
QgsProject::instance()->readNumEntry("Digitizing","/LineColorBluePart",0));
paint->setPen(QPen(digitcolor,QgsProject::instance()->readNumEntry("Digitizing","/LineWidth",1),Qt::SolidLine));
// TODO: Qt4 will have to do this a different way, using QRubberBand ...
#if QT_VERSION < 0x040000
paint->setRasterOp(Qt::XorROP);
std::list<QgsPoint>::iterator it;
if(last)
@ -2633,6 +2673,8 @@ void QgsMapCanvas::drawLineToDigitisingCursor(QPainter* paint, bool last)
QgsPoint digitpoint = mCanvasProperties->coordXForm->transform(mDigitMovePoint.x(), mDigitMovePoint.y());
paint->drawLine(static_cast<int>(lastpoint.x()),static_cast<int>(lastpoint.y()),\
static_cast<int>(digitpoint.x()), static_cast<int>(digitpoint.y()));
#endif
}
/**
@ -2899,7 +2941,7 @@ void QgsMapCanvas::setZOrder(std::list <QString> theZOrder)
if (ml)
{
#ifdef QGISDEBUG
std::cout << "Adding " << ml->name() << " to zOrder" << std::endl;
std::cout << "Adding " << ml->name().local8Bit() << " to zOrder" << std::endl;
#endif
mCanvasProperties->zOrder.push_back(ml->getLayerID());
@ -2907,7 +2949,7 @@ void QgsMapCanvas::setZOrder(std::list <QString> theZOrder)
else
{
#ifdef QGISDEBUG
std::cout << "Cant add " << ml->name() << " to zOrder (it isnt in layers array)" << std::endl;
std::cout << "Cant add " << ml->name().local8Bit() << " to zOrder (it isnt in layers array)" << std::endl;
#endif
}
@ -3048,8 +3090,8 @@ void QgsMapCanvas::recalculateExtents()
{
QgsMapLayer * lyr = dynamic_cast<QgsMapLayer *>(mit->second);
#ifdef QGISDEBUG
std::cout << "Updating extent using " << lyr->name() << std::endl;
std::cout << "Input extent: " << lyr->extent().stringRep() << std::endl;
std::cout << "Updating extent using " << lyr->name().local8Bit() << std::endl;
std::cout << "Input extent: " << lyr->extent().stringRep().local8Bit() << std::endl;
try
{
std::cout << "Transformed extent" << lyr->coordinateTransform()->transform(lyr->extent(), QgsCoordinateTransform::FORWARD) << std::endl;

View File

@ -58,9 +58,17 @@ QgsMapLayer::QgsMapLayer(int type,
// used) until we learn otherwise
{
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::QgsMapLayer - lyrname is '" << lyrname.local8Bit() << "'."<< std::endl;
#endif
// Set the display name = internal name
layerName = internalName;
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::QgsMapLayer - layerName is '" << layerName.local8Bit() << "'."<< std::endl;
#endif
// Generate the unique ID of this layer
QDateTime dt = QDateTime::currentDateTime();
ID = lyrname + dt.toString("yyyyMMddhhmmsszzz");
@ -103,12 +111,18 @@ QString const & QgsMapLayer::getLayerID() const
/** Write property of QString layerName. */
void QgsMapLayer::setLayerName(const QString & _newVal)
{
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::setLayerName: new name is '" << _newVal.local8Bit() << "'."<< std::endl;
#endif
layerName = _newVal;
}
/** Read property of QString layerName. */
QString const & QgsMapLayer::name() const
{
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::name: returning name '" << layerName.local8Bit() << "'."<< std::endl;
#endif
return layerName;
}
@ -467,6 +481,8 @@ void QgsMapLayer::connectNotify( const char * signal )
void QgsMapLayer::initContextMenu(QgisApp * app)
{
popMenu = new QPopupMenu();
#if QT_VERSION < 0x040000
myPopupLabel = new QLabel( popMenu );
myPopupLabel->setFrameStyle( QFrame::Panel | QFrame::Raised );
@ -475,6 +491,12 @@ void QgsMapLayer::initContextMenu(QgisApp * app)
// myPopupLabel->setText( tr("<center><b>Vector Layer</b></center>") );
popMenu->insertItem(myPopupLabel,0);
#else
// Initialise and insert Qt4 QAction
myPopupLabel = new QAction( popMenu );
popMenu->addAction(myPopupLabel);
#endif
popMenu->insertItem(tr("&Zoom to extent of selected layer"), app, SLOT(zoomToLayerExtent()));
popMenu->insertSeparator();
@ -492,12 +514,16 @@ void QgsMapLayer::initContextMenu(QgisApp * app)
popMenu->insertItem(tr("&Properties"), this, SLOT(showLayerProperties()));
} // QgsMapLayer::initContextMenu(QgisApp * app)
void QgsMapLayer::keyPressed ( QKeyEvent * e )
{
if (e->key()==Qt::Key_Escape) mDrawingCancelled = true;
std::cout << e->ascii() << " pressed in maplayer !" << std::endl;
}
/** Accessor for the coordinate transformation object */
QgsCoordinateTransform * QgsMapLayer::coordinateTransform()
{

View File

@ -24,6 +24,11 @@
#include <qwidget.h>
#include <qobject.h>
#include <qpixmap.h>
#include <qglobal.h>
#if QT_VERSION >= 0x040000
#include <QAction>
#endif
#include <qgsrect.h>
#include <qgis.h>
@ -349,7 +354,7 @@ signals:
void setStatus(QString theStatusQString);
/** This signal should be connected with the slot QgsMapCanvas::refresh() */
virtual void repaintRequested();
void repaintRequested();
/** This is used to notify the application whether this layer should be shown in overview or not. */
//@{
@ -400,8 +405,13 @@ protected:
//! context menu
QPopupMenu *popMenu;
#if QT_VERSION < 0x040000
//! label for popMenu
QLabel * myPopupLabel;
#else
//! header for popMenu
QAction * myPopupLabel;
#endif
//! checkable item id in popmenu that sets overview status
int mShowInOverviewItemId;

View File

@ -94,7 +94,7 @@ QgsMapLayer *
QgsMapLayerRegistry::addMapLayer( QgsMapLayer * theMapLayer )
{
#ifdef QGISDEBUG
std::cout << "qgsmaplayerregistry::addMaplayer - " << theMapLayer->name() << std::endl;
std::cout << "QgsMapLayerRegistry::addMaplayer - '" << theMapLayer->name().local8Bit() << "'."<< std::endl;
#endif
//check the layer is not already registered!
std::map<QString,QgsMapLayer*>::iterator myIterator = mMapLayers.find(theMapLayer->getLayerID());
@ -113,7 +113,7 @@ QgsMapLayerRegistry::addMapLayer( QgsMapLayer * theMapLayer )
{
#ifdef QGISDEBUG
std::cout << "addMaplayer - " << theMapLayer->name() << " already registered" << std::endl;
std::cout << "addMaplayer - " << theMapLayer->name().local8Bit() << " already registered" << std::endl;
#endif
return 0x0;
}

View File

@ -91,7 +91,7 @@ void QgsMapserverExport::writeMapFile()
{
// write the map file, making massive assumptions about default values
#ifdef QGISDEBUG
std::cout << "Opening map file " << txtMapFilePath->text() << std::endl;
std::cout << "Opening map file " << txtMapFilePath->text().local8Bit() << std::endl;
#endif
std::ofstream mapFile(txtMapFilePath->text());
if (!mapFile.fail())
@ -102,10 +102,10 @@ void QgsMapserverExport::writeMapFile()
if (!chkExpLayersOnly->isChecked())
{
// header
mapFile << "NAME " << txtMapName->text() << std::endl;
mapFile << "NAME " << txtMapName->text().local8Bit() << std::endl;
mapFile << "STATUS ON" << std::endl;
mapFile << "\n# Map image size. Change size as desired" << std::endl;
mapFile << "SIZE " << txtMapWidth->text() << " " << txtMapHeight->text() << std::endl;
mapFile << "SIZE " << txtMapWidth->text().local8Bit() << " " << txtMapHeight->text().local8Bit() << std::endl;
// web interface definition - this is minimal!
mapFile << "#" << std::endl;
mapFile << "# Start of web interface definition. Only the TEMPLATE parameter" << std::endl;
@ -119,7 +119,7 @@ void QgsMapserverExport::writeMapFile()
} else
{
// header provided - write it
mapFile << " HEADER " << txtWebHeader->text() << std::endl;
mapFile << " HEADER " << txtWebHeader->text().local8Bit() << std::endl;
}
// if no template provided, write the template line but comment it out
if (txtWebTemplate->text().isEmpty())
@ -128,7 +128,7 @@ void QgsMapserverExport::writeMapFile()
} else
{
// template provided - write it
mapFile << " TEMPLATE " << txtWebTemplate->text() << std::endl;
mapFile << " TEMPLATE " << txtWebTemplate->text().local8Bit() << std::endl;
}
// if no footer provided, write the footer line but comment it out
if (txtWebFooter->text().isEmpty())
@ -136,13 +136,13 @@ void QgsMapserverExport::writeMapFile()
mapFile << " # FOOTER" << std::endl;
} else
{
mapFile << " FOOTER " << txtWebFooter->text() << std::endl;
mapFile << " FOOTER " << txtWebFooter->text().local8Bit() << std::endl;
}
QString minScale = txtMinScale->text().isEmpty()?"#MINSCALE":"MINSCALE";
QString maxScale = txtMinScale->text().isEmpty()?" #MAXSCALE ":" MAXSCALE ";
// write min and maxscale
mapFile << minScale << txtMinScale->text() << std::endl;
mapFile << maxScale << txtMaxScale->text() << std::endl;
mapFile << minScale.local8Bit() << txtMinScale->text().local8Bit() << std::endl;
mapFile << maxScale.local8Bit() << txtMaxScale->text().local8Bit() << std::endl;
// write comments about the imagepath and image url
mapFile << "# Set IMAGEPATH to the path where mapserver should\n" <<
"# write its output\n" <<
@ -159,10 +159,10 @@ void QgsMapserverExport::writeMapFile()
mapFile << extent.xMin() << " " << extent.yMin() << " ";
mapFile << extent.xMax() << " " << extent.yMax() << std::endl;
// units
mapFile << "UNITS " << cmbMapUnits->currentText() << std::endl;
mapFile << "UNITS " << cmbMapUnits->currentText().local8Bit() << std::endl;
// image info
mapFile << "IMAGECOLOR 255 255 255" << std::endl;
mapFile << "IMAGETYPE " << cmbMapImageType->currentText() << std::endl;
mapFile << "IMAGETYPE " << cmbMapImageType->currentText().local8Bit() << std::endl;
// projection information TODO: support projections :)
mapFile << "# Projection definition" << std::endl;
mapFile << "# Projections are not currenlty supported. If desired, add your own" << std::endl;
@ -191,7 +191,7 @@ void QgsMapserverExport::writeMapFile()
name.replace(QRegExp("\\."), "_");
name.replace(QRegExp("\\("), "_");
name.replace(QRegExp("\\)"), "_");
mapFile << " NAME " << name << std::endl;
mapFile << " NAME " << name.local8Bit() << std::endl;
// feature type
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export checking feature type" << std::endl;
@ -251,21 +251,21 @@ void QgsMapserverExport::writeMapFile()
{
QgsDataSourceURI *dUri =
dynamic_cast<QgsVectorLayer *>(lyr)->getDataProvider()->getURI();
mapFile << "CONNECTION \"user=" << dUri->username;
mapFile << "CONNECTION \"user=" << dUri->username.local8Bit();
if(dUri->password.length() > 0)
{
mapFile << " password="<< dUri->password;
mapFile << " password="<< dUri->password.local8Bit();
}
mapFile << " dbname=" << dUri->database
<< " host=" << dUri->host
<< " port=" << dUri->port
mapFile << " dbname=" << dUri->database.local8Bit()
<< " host=" << dUri->host.local8Bit()
<< " port=" << dUri->port.local8Bit()
<< "\"" << std::endl;
mapFile << "CONNECTIONTYPE postgis" << std::endl;
mapFile << "DATA \"" << dUri->geometryColumn << " from "
<< dUri->table << "\"" << std::endl;
mapFile << "DATA \"" << dUri->geometryColumn.local8Bit() << " from "
<< dUri->table.local8Bit() << "\"" << std::endl;
if(dUri->sql.length() > 0)
{
mapFile << "FILTER \"" << dUri->sql << "\"" << std::endl;
mapFile << "FILTER \"" << dUri->sql.local8Bit() << "\"" << std::endl;
}
}
@ -273,12 +273,12 @@ void QgsMapserverExport::writeMapFile()
{
// must be an ogr
mapFile << " DATA " << lyr->source() << std::endl;
mapFile << " DATA " << lyr->source().local8Bit() << std::endl;
}
}
break;
case QgsMapLayer::RASTER:
mapFile << " DATA " << lyr->source() << std::endl;
mapFile << " DATA " << lyr->source().local8Bit() << std::endl;
break;
}
@ -295,7 +295,7 @@ void QgsMapserverExport::writeMapFile()
#ifdef QGISDEBUG
std::cout << "\tMapsrver Export symbol name" << std::endl;
#endif
mapFile << " NAME \"" << lyr->name() << "\"" << std::endl;
mapFile << " NAME \"" << lyr->name().local8Bit() << "\"" << std::endl;
mapFile << " # TEMPLATE" << std::endl;
if (isPolygon)
{

View File

@ -23,6 +23,7 @@
#include <qpen.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qglobal.h>
#include "qgspoint.h"
#include "qgsmaptopixel.h"
@ -142,6 +143,8 @@ void QgsMeasure::drawLine(void)
std::cout << "QgsMeasure::drawLine" << std::endl;
#endif
// TODO: Qt4 uses "QRubberBand"s - need to refactor.
#if QT_VERSION < 0x040000
QPainter p;
p.begin(mPixmap);
QPen pen(Qt::gray);
@ -158,6 +161,7 @@ void QgsMeasure::drawLine(void)
}
}
p.end();
#endif
mMapCanvas->repaint(false);
}
@ -167,6 +171,8 @@ void QgsMeasure::drawDynamicLine( void )
//std::cout << "QgsMeasure::drawDynamicLine" << std::endl;
#endif
// TODO: Qt4 uses "QRubberBand"s and "QPainterPath"s - need to refactor.
#if QT_VERSION < 0x040000
QPainter p;
p.begin(mPixmap);
QPen pen(Qt::gray);
@ -179,6 +185,7 @@ void QgsMeasure::drawDynamicLine( void )
ppnt = trans->transform(mDynamicPoints[1]);
p.lineTo(static_cast<int>(ppnt.x()), static_cast<int>(ppnt.y()));
p.end();
#endif
mMapCanvas->repaint(false);
}

View File

@ -85,7 +85,7 @@ void QgsNewConnection::testConnection()
QMessageBox::information(this, tr("Test connection"), tr("Connection to %1 was successfull").arg(txtDatabase->text()));
} else
{
QMessageBox::information(this, tr("Test connection"), tr("Connection failed - Check settings and try again.\n\nExtended error information:\n") + PQerrorMessage(pd));
QMessageBox::information(this, tr("Test connection"), tr("Connection failed - Check settings and try again.\n\nExtended error information:\n") + QString(PQerrorMessage(pd)) );
}
// free pg connection resources
PQfinish(pd);

View File

@ -23,6 +23,7 @@
#include <qlayout.h>
#include <qlabel.h>
#include <qcombobox.h>
#include <qglobal.h>
#include "qgspastetransformations.h"
#include "qgsmaplayerregistry.h"
@ -41,7 +42,7 @@ QgsPasteTransformations::QgsPasteTransformations()
{
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::QgsPasteTransformations: QgsMapLayerRegistry has "
<< it->second->name() << "."
<< it->second->name().local8Bit() << "."
<< std::endl;
#endif
@ -96,7 +97,7 @@ void QgsPasteTransformations::sourceChanged(const QString& layerName)
{
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::sourceChanged: Source changed to "
<< layerName << "."
<< layerName.local8Bit() << "."
<< std::endl;
#endif
@ -109,7 +110,7 @@ void QgsPasteTransformations::destinationChanged(const QString& layerName)
{
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::destinationChanged: Destination changed to "
<< layerName << "."
<< layerName.local8Bit() << "."
<< std::endl;
#endif
@ -122,17 +123,29 @@ void QgsPasteTransformations::addTransfer(const QString& sourceSelectedFieldName
const QString& destinationSelectedFieldName)
{
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::addTransfer: From " << sourceSelectedFieldName
<< " to " << destinationSelectedFieldName << "."
std::cerr << "QgsPasteTransformations::addTransfer: From " << sourceSelectedFieldName.local8Bit()
<< " to " << destinationSelectedFieldName.local8Bit() << "."
<< std::endl;
#endif
#if QT_VERSION < 0x040000
int newRow = transferLayout->numRows();
#else
// For some reason Qt4's uic3 only outputs generic names for layout items
int newRow = gridLayout->numRows();
#endif
// TODO: Do not add the transfer if neither the sourceSelectedFieldName nor the destinationSelectedFieldName could be found.
// Build a Transfer row at the end of the grid layout.
#if QT_VERSION < 0x040000
QComboBox* newSourceFields = new QComboBox(FALSE, transferLayout->mainWidget() );
QComboBox* newDestinationFields = new QComboBox(FALSE, transferLayout->mainWidget() );
#else
// For some reason Qt4's uic3 only outputs generic names for layout items
QComboBox* newSourceFields = new QComboBox(FALSE, gridLayout->mainWidget() );
QComboBox* newDestinationFields = new QComboBox(FALSE, gridLayout->mainWidget() );
#endif
int count = 0;
@ -171,8 +184,14 @@ void QgsPasteTransformations::addTransfer(const QString& sourceSelectedFieldName
}
// Append to dialog layout
#if QT_VERSION < 0x040000
transferLayout->addWidget(newSourceFields, newRow, 0);
transferLayout->addWidget(newDestinationFields, newRow, 1);
#else
// For some reason Qt4's uic3 only outputs generic names for layout items
gridLayout->addWidget(newSourceFields, newRow, 0);
gridLayout->addWidget(newDestinationFields, newRow, 1);
#endif
// Keep a reference to them so that we can read from them
// when the dialog is dismissed
@ -191,7 +210,7 @@ void QgsPasteTransformations::layerChanged(const QString& layerName, std::vector
// Fetch the fields that will be populated into the Transfer rows.
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::layerChanged: Layer changed to "
<< layerName << "."
<< layerName.local8Bit() << "."
<< std::endl;
#endif
@ -206,7 +225,7 @@ void QgsPasteTransformations::layerChanged(const QString& layerName, std::vector
{
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::layerChanged: Got field "
<< it->name() << "."
<< it->name().local8Bit() << "."
<< std::endl;
#endif
@ -235,8 +254,8 @@ void QgsPasteTransformations::restoreTransfers(const QString& sourceLayerName,
{
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::restoreTransfers: Testing source '"
<< (*it) << "' with '"
<< sourceLayerName << "'."
<< (*it).local8Bit() << "' with '"
<< sourceLayerName.local8Bit() << "'."
<< std::endl;
#endif
if ((sourceLayerName == (*it)))
@ -249,8 +268,8 @@ void QgsPasteTransformations::restoreTransfers(const QString& sourceLayerName,
{
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::restoreTransfers: Testing destination '"
<< (*it2) << "' with '"
<< destinationLayerName << "'."
<< (*it2).local8Bit() << "' with '"
<< destinationLayerName.local8Bit() << "'."
<< std::endl;
#endif
if ((destinationLayerName == (*it2)))
@ -267,7 +286,7 @@ void QgsPasteTransformations::restoreTransfers(const QString& sourceLayerName,
{
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::restoreTransfers: setting transfer for "
<< (*it3) << "."
<< (*it3).local8Bit() << "."
<< std::endl;
#endif
QString destinationField =
@ -305,7 +324,7 @@ QString QgsPasteTransformations::pasteTo(const QString& sourceLayerName,
}
#ifdef QGISDEBUG
std::cerr << "QgsPasteTransformations::pasteTo: Returning '" << destinationField << "'."
std::cerr << "QgsPasteTransformations::pasteTo: Returning '" << destinationField.local8Bit() << "'."
<< std::endl;
#endif

View File

@ -39,7 +39,7 @@ mUri(uri)
.arg(mUri->username)
.arg(mUri->password);
#ifdef QGISDEBUG
std::cerr << "Attempting connect using: " << connInfo << std::endl;
std::cerr << "Attempting connect using: " << connInfo.local8Bit() << std::endl;
#endif
mPgConnection = PQconnectdb((const char *) connInfo);
// check the connection status
@ -109,20 +109,20 @@ void QgsPgQueryBuilder::populateFields()
QString fieldName = PQfname(result, i);
int fldtyp = PQftype(result, i);
QString typOid = QString().setNum(fldtyp);
std::cerr << "typOid is: " << typOid << std::endl;
std::cerr << "typOid is: " << typOid.local8Bit() << std::endl;
int fieldModifier = PQfmod(result, i);
QString sql = "select typelem from pg_type where typelem = " + typOid + " and typlen = -1";
// //--std::cout << sql << std::endl;
PGresult *oidResult = PQexec(mPgConnection,
(const char *) (sql.utf8()));
if (PQresultStatus(oidResult) == PGRES_TUPLES_OK)
std::cerr << "Ok fetching typelem using\n" << sql << std::endl;
std::cerr << "Ok fetching typelem using\n" << sql.local8Bit() << std::endl;
// get the oid of the "real" type
QString poid = QString::fromUtf8(PQgetvalue(oidResult, 0,
PQfnumber(oidResult,
"typelem")));
std::cerr << "poid is: " << poid << std::endl;
std::cerr << "poid is: " << poid.local8Bit() << std::endl;
PQclear(oidResult);
sql = "select typname, typlen from pg_type where oid = " + poid;
// //--std::cout << sql << std::endl;
@ -134,8 +134,8 @@ void QgsPgQueryBuilder::populateFields()
QString fieldSize = QString::fromUtf8(PQgetvalue(oidResult, 0, 1));
PQclear(oidResult);
#ifdef QGISDEBUG
std::cerr << "Field parms: Name = " + fieldName
+ ", Type = " + fieldType << std::endl;
std::cerr << "Field parms: Name = " << fieldName.local8Bit()
<< ", Type = " << fieldType.local8Bit() << std::endl;
#endif
mFieldMap[fieldName] = QgsField(fieldName, fieldType,
fieldSize.toInt(), fieldModifier);
@ -144,7 +144,7 @@ void QgsPgQueryBuilder::populateFields()
}else
{
#ifdef QGISDEBUG
std::cerr << "Error fetching a row from " + mUri->table << std::endl;
std::cerr << "Error fetching a row from " << mUri->table.local8Bit() << std::endl;
#endif
}
PQclear(result);
@ -180,7 +180,7 @@ void QgsPgQueryBuilder::getSampleValues()
}else
{
QMessageBox::warning(this, tr("Database error"), tr("Failed to get sample of field values") + PQerrorMessage(mPgConnection));
QMessageBox::warning(this, tr("Database error"), tr("Failed to get sample of field values") + QString(PQerrorMessage(mPgConnection)) );
}
// free the result set
PQclear(result);
@ -217,7 +217,7 @@ void QgsPgQueryBuilder::getAllValues()
}else
{
QMessageBox::warning(this, tr("Database error"), tr("Failed to get sample of field values") + PQerrorMessage(mPgConnection));
QMessageBox::warning(this, tr("Database error"), tr("Failed to get sample of field values") + QString(PQerrorMessage(mPgConnection)) );
}
// free the result set
PQclear(result);

View File

@ -111,29 +111,29 @@ sharedLibExtension = "*.so*";
#endif //#ifdef TESTLIB
std::cout << "Examining " << txtPluginDir->text() << "/" << pluginDir[i] << std::endl;
std::cout << "Examining " << txtPluginDir->text().local8Bit() << "/" << pluginDir[i].local8Bit() << std::endl;
QLibrary *myLib = new QLibrary(txtPluginDir->text() + "/" + pluginDir[i]);
bool loaded = myLib->load();
if (loaded)
{
std::cout << "Loaded " << myLib->library() << std::endl;
std::cout << "Loaded " << myLib->library().local8Bit() << std::endl;
name_t *pName = (name_t *) myLib->resolve("name");
description_t *pDesc = (description_t *) myLib->resolve("description");
version_t *pVersion = (version_t *) myLib->resolve("version");
#ifdef QGISDEBUG
// show the values (or lack of) for each function
if(pName){
std::cout << "Plugin name: " << pName() << std::endl;
std::cout << "Plugin name: " << pName().local8Bit() << std::endl;
}else{
std::cout << "Plugin name not returned when queried\n";
}
if(pDesc){
std::cout << "Plugin description: " << pDesc() << std::endl;
std::cout << "Plugin description: " << pDesc().local8Bit() << std::endl;
}else{
std::cout << "Plugin description not returned when queried\n";
}
if(pVersion){
std::cout << "Plugin version: " << pVersion() << std::endl;
std::cout << "Plugin version: " << pVersion().local8Bit() << std::endl;
}else{
std::cout << "Plugin version not returned when queried\n";
}
@ -168,11 +168,11 @@ sharedLibExtension = "*.so*";
}
} else
{
std::cout << "Failed to get name, description, or type for " << myLib->library() << std::endl;
std::cout << "Failed to get name, description, or type for " << myLib->library().local8Bit() << std::endl;
}
} else
{
std::cout << "Failed to load " << myLib->library() << std::endl;
std::cout << "Failed to load " << myLib->library().local8Bit() << std::endl;
}
}
}
@ -197,7 +197,7 @@ void QgsPluginManager::unload()
// its off -- see if it is loaded and if so, unload it
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();
#ifdef QGISDEBUG
std::cout << "Checking to see if " << lvi->text(0) << " is loaded" << std::endl;
std::cout << "Checking to see if " << lvi->text(0).local8Bit() << " is loaded" << std::endl;
#endif
QgisPlugin *plugin = pRegistry->plugin(lvi->text(0));
if (plugin)

View File

@ -39,7 +39,7 @@ using namespace std;
#include <qdict.h>
#include <qmessagebox.h>
#include <qwidgetlist.h>
#include <qglobal.h>
@ -72,7 +72,7 @@ QgsProject * QgsProject::theProject_;
const char * scope_str = scope.ascii(); // debugger probes
const char * key_str = key.ascii();
QStringList keyTokens = scope;
QStringList keyTokens = QStringList(scope);
keyTokens += QStringList::split('/', key);
// be sure to include the canonical root node
@ -658,7 +658,7 @@ static bool _getMapUnits(QDomDocument const &doc)
{
std::
cerr << __FILE__ << ":" << __LINE__ << " unknown map unit type " <<
element.text() << "\n";
element.text().local8Bit() << "\n";
false;
}
@ -718,6 +718,8 @@ static QgsMapCanvas * _findMapCanvas(QString const &canonicalMapCanvasName)
{
QgsMapCanvas * theMapCanvas = 0x0;
// TODO: Need to refactor for Qt4 - uses QWidgetList only (no pointer-to)
#if QT_VERSION < 0x040000
QWidgetList *list = QApplication::topLevelWidgets();
QWidgetListIt it(*list); // iterate over the widgets
QWidget *w;
@ -735,6 +737,7 @@ static QgsMapCanvas * _findMapCanvas(QString const &canonicalMapCanvasName)
}
delete list; // delete the list, not the widgets
#endif
if (theMapCanvas)
{
@ -836,7 +839,7 @@ static pair< bool, list<QDomNode> > _getMapLayers(QDomDocument const &doc)
QgsMapLayer *mapLayer;
#ifdef QGISDEBUG
std::cerr << "type is " << type << std::endl;
std::cerr << "type is " << type.local8Bit() << std::endl;
#endif
if (type == "vector")

View File

@ -215,7 +215,7 @@ void QgsProjectProperties::apply()
// write the projection's _id_ to the project settings rather
QgsProject::instance()->writeEntry("SpatialRefSys","/ProjectSRSID",(int)mySRSID);
// write the currently selected projections _proj string_ to project settings
std::cout << "SpatialRefSys/ProjectSRSProj4String: " << projectionSelector->getCurrentProj4String() << std::endl;
std::cout << "SpatialRefSys/ProjectSRSProj4String: " << projectionSelector->getCurrentProj4String().local8Bit() << std::endl;
QgsProject::instance()->writeEntry("SpatialRefSys","/ProjectSRSProj4String",projectionSelector->getCurrentProj4String());
// Set the map units to the projected coordinates if we are projecting
if (isProjected())

View File

@ -66,7 +66,7 @@ QString libDir = baseDir + "/lib"; */
QDir pluginDir(libDir, "*.so*", QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::NoSymLinks);
#endif
#ifdef QGISDEBUG
cerr << "Checking " << libDir << " for provider plugins" << endl;
std::cerr << "Checking " << libDir.local8Bit() << " for provider plugins" << std::endl;
#endif
if (pluginDir.count() == 0)
{
@ -83,7 +83,8 @@ QString libDir = baseDir + "/lib"; */
bool loaded = myLib->load();
if (loaded)
{
#ifdef QGISDEBUG
#ifdef QGISDEBUG
std::cout << "Checking " << myLib->library().local8Bit() << std::endl;
cout << "Checking " << myLib->library() << endl;
#endif
// get the description and the key for the provider plugin
@ -104,13 +105,13 @@ QString libDir = baseDir + "/lib"; */
// add this provider to the provider map
provider[pKey()] = new QgsProviderMetadata(pKey(), pDesc(), myLib->library());
#ifdef QGISDEBUG
cout << "Loaded " << pDesc() << endl;
std::cout << "Loaded " << pDesc().local8Bit() << std::endl;
#endif
} else
{
cout << myLib->
library() << " Unable to find one of the required provider functions:\n\tproviderKey() or description()" <<
endl;
std::cout << myLib->
library().local8Bit() << " Unable to find one of the required provider functions:\n\tproviderKey() or description()" <<
std::endl;
}
}
}
@ -252,7 +253,7 @@ QgsDataProvider* QgsProviderRegistry::getProvider( QString const & providerKey,
// load the data provider
QLibrary* myLib = new QLibrary((const char *) lib);
#ifdef QGISDEBUG
cout << "QgsProviderRegistry::getProvider: Library name is " << myLib->library() << endl;
std::cout << "QgsProviderRegistry::getRasterProvider: Library name is " << myLib->library().local8Bit() << std::endl;
#endif
bool loaded = myLib->load();

View File

@ -87,6 +87,7 @@ wish to see edbug messages printed to stdout.
#include <qwidget.h>
#include <qwidgetlist.h>
#include <qsettings.h>
#include <qglobal.h>
/*
@ -352,7 +353,7 @@ void QgsRasterLayer::buildSupportedRasterFileFilter(QString & theFileFiltersStri
// can't forget the default case
theFileFiltersString += catchallFilter + "All other files (*)";
#ifdef QGISDEBUG
std::cout << "Raster filter list built: " << theFileFiltersString << std::endl;
std::cout << "Raster filter list built: " << theFileFiltersString.local8Bit() << std::endl;
#endif
} // buildSupportedRasterFileFilter_()
@ -506,7 +507,7 @@ QgsRasterLayer::QgsRasterLayer(QString path, QString baseName)
QgsRasterLayer::~QgsRasterLayer()
{
if (!(providerKey))
if (providerKey.isEmpty())
{
GDALClose(gdalDataset);
}
@ -560,7 +561,7 @@ QgsRasterLayer::readFile( QString const & fileName )
QString mySourceWKT = getProjectionWKT();
#ifdef QGISDEBUG
std::cout << "--------------------------------------------------------------------------------------" << std::endl;
std::cout << "QgsRasterLayer::readFile --- using wkt\n" << mySourceWKT << std::endl;
std::cout << "QgsRasterLayer::readFile --- using wkt\n" << mySourceWKT.local8Bit() << std::endl;
std::cout << "--------------------------------------------------------------------------------------" << std::endl;
#endif
mCoordinateTransform->sourceSRS().createFromWkt(mySourceWKT);
@ -772,7 +773,7 @@ bool QgsRasterLayer::update()
QDateTime QgsRasterLayer::lastModified ( QString name )
{
#ifdef QGISDEBUG
std::cerr << "QgsRasterLayer::lastModified: " << name << std::endl;
std::cerr << "QgsRasterLayer::lastModified: " << name.local8Bit() << std::endl;
#endif
QDateTime t;
@ -806,10 +807,18 @@ QDateTime QgsRasterLayer::lastModified ( QString name )
QFile f ( name + "/REF" );
if ( f.open ( IO_ReadOnly ) )
{
QString ln;
QString dir = fi.dirPath() + "/../../../";
#if QT_VERSION < 0x040000
QString ln;
while ( f.readLine(ln,100) != -1 )
{
#else
// In Qt4, QFile::readLine now expects a bare char*
char buf[101];
while ( f.readLine(buf,100) != -1 )
{
QString ln = QString(buf);
#endif
QStringList sl = QStringList::split ( ' ', ln.stripWhiteSpace() );
QString map = sl.first();
sl.pop_front();
@ -833,7 +842,7 @@ QDateTime QgsRasterLayer::lastModified ( QString name )
}
}
#ifdef QGISDEBUG
std::cerr << "last modified = " << t.toString() << std::endl;
std::cerr << "last modified = " << t.toString().local8Bit() << std::endl;
#endif
return t;
@ -957,7 +966,7 @@ muliband layers may have more than one "Undefined" band!
bool QgsRasterLayer::hasBand(QString theBandName)
{
#ifdef QGISDEBUG
std::cout << "Looking for band : " << theBandName << std::endl;
std::cout << "Looking for band : " << theBandName.local8Bit() << std::endl;
#endif
for (int i = 1; i <= gdalDataset->GetRasterCount(); i++)
@ -973,13 +982,13 @@ bool QgsRasterLayer::hasBand(QString theBandName)
{
#ifdef QGISDEBUG
std::cout << "band : " << i << std::endl;
std::cout << "Found band : " << theBandName << std::endl;
std::cout << "Found band : " << theBandName.local8Bit() << std::endl;
#endif
return true;
}
#ifdef QGISDEBUG
std::cout << "Found unmatched band : " << i << " " << myColorQString << std::endl;
std::cout << "Found unmatched band : " << i << " " << myColorQString.local8Bit() << std::endl;
#endif
}
@ -1240,10 +1249,10 @@ void QgsRasterLayer::draw(QPainter * theQPainter,
std::cout << "QgsRasterLayer::draw: Checking for provider key." << std::endl;
#endif
if (providerKey)
if (!providerKey.isEmpty())
{
#ifdef QGISDEBUG
std::cout << "QgsRasterLayer::draw: Wanting a '" << providerKey << "' provider to draw this." << std::endl;
std::cout << "QgsRasterLayer::draw: Wanting a '" << providerKey.local8Bit() << "' provider to draw this." << std::endl;
#endif
emit setStatus(QString("Retrieving using ")+providerKey);
@ -1412,7 +1421,7 @@ void QgsRasterLayer::draw (QPainter * theQPainter, QgsRasterViewPort * myRasterV
if (grayBandNameQString == tr("Not Set"))
{
#ifdef QGISDEBUG
std::cout << "MULTI_BAND_SINGLE_BAND_GRAY Not Set detected..." << grayBandNameQString << std::endl;
std::cout << "MULTI_BAND_SINGLE_BAND_GRAY Not Set detected..." << grayBandNameQString.local8Bit() << std::endl;
#endif
break;
@ -2487,7 +2496,7 @@ void QgsRasterLayer::showDebugOverlay(QPainter * theQPainter, QgsRasterViewPort
QBrush myQBrush(qRgba(128, 128, 164, 50), Dense6Pattern); //semi transparent
theQPainter->setBrush(myQBrush); // set the yellow brush
theQPainter->drawRect(5, 5, theQPainter->window().width() - 10, 60);
theQPainter->setBrush(NoBrush); // do not fill
theQPainter->setBrush(Qt::NoBrush); // do not fill
theQPainter->drawText(10, 20, "QPainter: "
+ QString::number(theQPainter->window().width()) + " x " + QString::number(theQPainter->window().height()));
@ -2539,20 +2548,20 @@ const int QgsRasterLayer::getRasterBandNumber(QString theBandNameQString)
RasterBandStats myRasterBandStats = rasterStatsVector[myIteratorInt];
#ifdef QGISDEBUG
std::cout << "myRasterBandStats.bandName: " << myRasterBandStats.bandName << " :: theBandNameQString: " << theBandNameQString << std::endl;
std::cout << "myRasterBandStats.bandName: " << myRasterBandStats.bandName.local8Bit() << " :: theBandNameQString: " << theBandNameQString.local8Bit() << std::endl;
#endif
if (myRasterBandStats.bandName == theBandNameQString)
{
#ifdef QGISDEBUG
std::cerr << "********** band " << myRasterBandStats.bandNoInt << " was found in getRasterBandNumber " << theBandNameQString << std::endl;
std::cerr << "********** band " << myRasterBandStats.bandNoInt << " was found in getRasterBandNumber " << theBandNameQString.local8Bit() << std::endl;
#endif
return myRasterBandStats.bandNoInt;
}
}
#ifdef QGISDEBUG
std::cerr << "********** no band was found in getRasterBandNumber " << theBandNameQString << std::endl;
std::cerr << "********** no band was found in getRasterBandNumber " << theBandNameQString.local8Bit() << std::endl;
#endif
return 0; //no band was found
@ -2937,7 +2946,7 @@ const RasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNoInt)
void QgsRasterLayer::setRedBandName(QString theBandNameQString)
{
#ifdef QGISDEBUG
std::cout << "setRedBandName : " << theBandNameQString << std::endl;
std::cout << "setRedBandName : " << theBandNameQString.local8Bit() << std::endl;
#endif
//check if the band is unset
if (theBandNameQString == tr("Not Set"))
@ -3082,7 +3091,7 @@ QPixmap QgsRasterLayer::getLegendQPixmap()
QPixmap QgsRasterLayer::getLegendQPixmap(bool theWithNameFlag)
{
#ifdef QGISDEBUG
std::cout << "QgsRasterLayer::getLegendQPixmap called (" << getDrawingStyleAsQString() << ")" << std::endl;
std::cout << "QgsRasterLayer::getLegendQPixmap called (" << getDrawingStyleAsQString().local8Bit() << ")" << std::endl;
#endif
@ -3090,10 +3099,10 @@ QPixmap QgsRasterLayer::getLegendQPixmap(bool theWithNameFlag)
QPainter myQPainter;
if (providerKey)
if (!providerKey.isEmpty())
{
#ifdef QGISDEBUG
std::cout << "QgsRasterLayer::getLegendQPixmap called with provider Key (" << providerKey << ")" << std::endl;
std::cout << "QgsRasterLayer::getLegendQPixmap called with provider Key (" << providerKey.local8Bit() << ")" << std::endl;
#endif
myLegendQPixmap = QPixmap(3, 1);
@ -3649,6 +3658,8 @@ void QgsRasterLayer::initContextMenu_(QgisApp * theApp)
myTransparencyLabel->setFrameStyle( QFrame::Panel | QFrame::Raised );
myTransparencyLabel->setText( tr("<center><b>Transparency</b></center>") );
// TODO: Qt4 will have to use a QAction instead
#if QT_VERSION < 0x040000
popMenu->insertItem(myTransparencyLabel);
// XXX why GUI element here?
@ -3660,6 +3671,7 @@ void QgsRasterLayer::initContextMenu_(QgisApp * theApp)
connect(mTransparencySlider, SIGNAL(valueChanged(int)), this, SLOT(popupTransparencySliderMoved(int)));
popMenu->insertItem(mTransparencySlider);
#endif
} // QgsRasterLayer::initContextMenu
@ -4375,7 +4387,7 @@ bool QgsRasterLayer::readXML_( QDomNode & layer_node )
{
std::cerr << __FILE__ << ":" << __LINE__
<< " unable to read from raster file "
<< source() << "\n";
<< source().local8Bit() << "\n";
return false;
}
@ -4519,6 +4531,8 @@ void QgsRasterLayer::identify(QgsRect * r)
if( !mIdentifyResults)
{
// TODO: Doesn't work in Qt4 (list is now just a QWidgetList, not a pointer to one)
#if QT_VERSION < 0x040000
// TODO it is necessary to pass topLevelWidget()as parent, but there is no QWidget availabl
QWidgetList *list = QApplication::topLevelWidgets ();
QWidgetListIt it( *list );
@ -4537,6 +4551,7 @@ void QgsRasterLayer::identify(QgsRect * r)
QgsAttributeAction aa;
mIdentifyResults = new QgsIdentifyResults(aa, top);
mIdentifyResults->restorePosition();
#endif
}
else
{
@ -4787,7 +4802,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider, QStringList laye
// load the data provider
myLib = new QLibrary((const char *) ogrlib);
#ifdef QGISDEBUG
std::cout << "QgsRasterLayer::setDataProvider: Library name is " << myLib->library() << std::endl;
std::cout << "QgsRasterLayer::setDataProvider: Library name is " << myLib->library().local8Bit() << std::endl;
#endif
bool loaded = myLib->load();
@ -4815,7 +4830,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider, QStringList laye
{
#ifdef QGISDEBUG
std::cout << "QgsRasterLayer::setDataProvider: Instantiated the data provider plugin" <<
" with layer list of " << layers.join(", ") << std::endl;
" with layer list of " << layers.join(", ").local8Bit() << std::endl;
#endif
if (dataProvider->isValid())
{
@ -4829,7 +4844,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider, QStringList laye
// show the extent
QString s = mbr->stringRep();
#ifdef QGISDEBUG
std::cout << "QgsRasterLayer::setDataProvider: Extent of layer: " << s << std::endl;
std::cout << "QgsRasterLayer::setDataProvider: Extent of layer: " << s.local8Bit() << std::endl;
#endif
// store the extent
layerExtent.setXmax(mbr->xMax());
@ -4840,7 +4855,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider, QStringList laye
// upper case the first letter of the layer name
layerName = layerName.left(1).upper() + layerName.mid(1);
#ifdef QGISDEBUG
std::cout << "QgsRasterLayer::setDataProvider: layerName: " << layerName << std::endl;
std::cout << "QgsRasterLayer::setDataProvider: layerName: " << layerName.local8Bit() << std::endl;
#endif
@ -4856,7 +4871,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider, QStringList laye
// the inverese projection of the map extents of the canvas when zooming in etc. so
// that they match the coordinate system of this layer
#ifdef QGISDEBUG
std::cout << "QgsRasterLayer::setDataProvider: myDestWKT: " << myDestWKT << std::endl;
std::cout << "QgsRasterLayer::setDataProvider: myDestWKT: " << myDestWKT.local8Bit() << std::endl;
#endif
// Hard-code the source coordinate reference for now

View File

@ -180,7 +180,7 @@ const char * const ident =
QString myQString = *myIterator;
#ifdef QGISDEBUG
std::cout << "Inserting : " << myQString << std::endl;
std::cout << "Inserting : " << myQString.local8Bit() << std::endl;
#endif
cboGray->insertItem(myQString);
@ -317,8 +317,8 @@ void QgsRasterLayerProperties::apply()
#endif
#ifdef QGISDEBUG
std::cout << "Combo value : " << cboGray->currentText() << " GrayBand Mapping : " << rasterLayer->
getGrayBandName() << std::endl;
std::cout << "Combo value : " << cboGray->currentText().local8Bit() << " GrayBand Mapping : " << rasterLayer->
getGrayBandName().local8Bit() << std::endl;
#endif
rasterLayer->setDrawingStyle(QgsRasterLayer::PALETTED_SINGLE_BAND_GRAY);
@ -341,8 +341,8 @@ void QgsRasterLayerProperties::apply()
{
#ifdef QGISDEBUG
std::cout << "Setting Raster Drawing Style to :: MULTI_BAND_SINGLE_BAND_GRAY" << std::endl;
std::cout << "Combo value : " << cboGray->currentText() << " GrayBand Mapping : " << rasterLayer->
getGrayBandName() << std::endl;
std::cout << "Combo value : " << cboGray->currentText().local8Bit() << " GrayBand Mapping : " << rasterLayer->
getGrayBandName().local8Bit() << std::endl;
#endif
rasterLayer->setDrawingStyle(QgsRasterLayer::MULTI_BAND_SINGLE_BAND_GRAY);
@ -616,7 +616,7 @@ void QgsRasterLayerProperties::makeScalePreview(QString theColor)
//
QPainter myQPainter(myQPixmap);
myQPainter.rotate(-45);
myQPainter.drawImage(-70, 0, myQImage.scale(140, 140));
myQPainter.drawImage(-70, 0, myQImage.scale(140, 140)); // TODO: maybe should add ScaleMin (Qt3) / Qt::KeepAspectRatio (Qt4) ?
myQPainter.rotate(45);
QFont myQFont("arial", 18, QFont::Bold);
myQPainter.setFont(myQFont);
@ -1030,7 +1030,12 @@ void QgsRasterLayerProperties::pbnHistRefresh_clicked()
int myImageHeight = pixHistogram->height();
QPixmap myPixmap(myImageWidth,myImageHeight);
myPixmap.fill(Qt::white);
QPainter myPainter(&myPixmap, this);
// TODO: Confirm that removing the "const QWidget * copyAttributes" 2nd parameter,
// in order to make things work in Qt4, doesn't break things in Qt3.
//QPainter myPainter(&myPixmap, this);
QPainter myPainter(&myPixmap);
//determine labels sizes and draw them
QFont myQFont("arial", 8, QFont::Normal);
QFontMetrics myFontMetrics( myQFont );

View File

@ -198,7 +198,7 @@ QString QgsRect::stringRep(int thePrecision) const
QString(",") +
QString::number(ymax,'f',thePrecision) ;
#ifdef QGISDEBUG
std::cout << "Extents : " << rep << std::endl;
std::cout << "Extents : " << rep.local8Bit() << std::endl;
#endif
return rep;
}

View File

@ -124,14 +124,14 @@ void QgsServerSourceSelect::serverConnect()
if ( ! ( (part = settings.readEntry(key + "/proxyhost")).isEmpty() ) )
{
#ifdef QGISDEBUG
std::cout << "QgsServerSourceSelect::serverConnect: Got a proxyhost - '" << part << "'." << std::endl;
std::cout << "QgsServerSourceSelect::serverConnect: Got a proxyhost - '" << part.local8Bit() << "'." << std::endl;
#endif
connStringParts += part;
if ( ! ( (part = settings.readEntry(key + "/proxyport")).isEmpty() ) )
{
#ifdef QGISDEBUG
std::cout << "QgsServerSourceSelect::serverConnect: Got a proxyport - '" << part << "'." << std::endl;
std::cout << "QgsServerSourceSelect::serverConnect: Got a proxyport - '" << part.local8Bit() << "'." << std::endl;
#endif
connStringParts += part;
}
@ -141,7 +141,7 @@ void QgsServerSourceSelect::serverConnect()
m_connInfo = connStringParts.join(" "); // url ( + " " + proxyhost + " " + proxyport)
#ifdef QGISDEBUG
std::cout << "QgsServerSourceSelect::serverConnect: Connection info: '" << m_connInfo << "'." << std::endl;
std::cout << "QgsServerSourceSelect::serverConnect: Connection info: '" << m_connInfo.local8Bit() << "'." << std::endl;
#endif
@ -168,7 +168,7 @@ void QgsServerSourceSelect::serverConnect()
// QgsWmsLayerProperty layer = *it;
#ifdef QGISDEBUG
std::cout << "QgsServerSourceSelect::serverConnect: got layer name " << layer->name << " and title '" << layer->title << "'." << std::endl;
std::cout << "QgsServerSourceSelect::serverConnect: got layer name " << layer->name.local8Bit() << " and title '" << layer->title.local8Bit() << "'." << std::endl;
#endif
@ -203,7 +203,7 @@ void QgsServerSourceSelect::addLayers()
m_selectedLayers += item->text(1);
#ifdef QGISDEBUG
std::cout << "QgsServerSourceSelect::addLayers: Added " << item->text(1) << std::endl;
std::cout << "QgsServerSourceSelect::addLayers: Added " << item->text(1).local8Bit() << std::endl;
#endif
}

View File

@ -251,7 +251,7 @@ bool QgsSpatialRefSys::createFromSrid(long theSrid)
else
{
#ifdef QGISDEBUG
std::cout << " QgsSpatialRefSys::createFromSrid failed : " << mySql << std::endl;
std::cout << " QgsSpatialRefSys::createFromSrid failed : " << mySql.local8Bit() << std::endl;
#endif
mIsValidFlag==false;
}
@ -262,14 +262,14 @@ bool QgsSpatialRefSys::createFromSrid(long theSrid)
bool QgsSpatialRefSys::createFromWkt(QString theWkt)
{
if (!theWkt)
if (theWkt.isEmpty())
{
std::cout << "QgsSpatialRefSys::createFromWkt -- theWkt is uninitialised, operation failed" << std::endl;
mIsValidFlag==false;
return false;
}
#ifdef QGISDEBUG
std::cout << "QgsSpatialRefSys::createFromWkt(QString theWkt) using: \n" << theWkt << std::endl;
std::cout << "QgsSpatialRefSys::createFromWkt(QString theWkt) using: \n" << theWkt.local8Bit() << std::endl;
#endif
//this is really ugly but we need to get a QString to a char**
char *myCharArrayPointer = (char *)theWkt.latin1();
@ -294,7 +294,7 @@ bool QgsSpatialRefSys::createFromWkt(QString theWkt)
std::cout << "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"<< std::endl;
std::cout << "QgsSpatialRefSys::createFromWkt(QString theWkt) " << __FILE__ << __LINE__ << std::endl;
std::cout << "This SRS could *** NOT *** be set from the supplied WKT " << std::endl;
std::cout << "INPUT: " << std::endl << theWkt << std::endl;
std::cout << "INPUT: " << std::endl << theWkt.local8Bit() << std::endl;
std::cout << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << std::endl;
mIsValidFlag==false;
return false;
@ -377,7 +377,7 @@ bool QgsSpatialRefSys::createFromEpsg(long theEpsg)
else
{
#ifdef QGISDEBUG
std::cout << " QgsSpatialRefSys::createFromEpsg failed : " << mySql << std::endl;
std::cout << " QgsSpatialRefSys::createFromEpsg failed : " << mySql.local8Bit() << std::endl;
#endif
mIsValidFlag==false;
}
@ -468,7 +468,7 @@ bool QgsSpatialRefSys::createFromSrsId (long theSrsId)
else
{
#ifdef QGISDEBUG
std::cout << " QgsSpatialRefSys::createFromSrsId failed : " << mySql << std::endl;
std::cout << " QgsSpatialRefSys::createFromSrsId failed : " << mySql.local8Bit() << std::endl;
#endif
mIsValidFlag==false;
}
@ -616,7 +616,7 @@ QgsSpatialRefSys::RecordMap QgsSpatialRefSys::getRecord(QString theSql)
int myResult;
#ifdef QGISDEBUG
std::cout << " QgsSpatialRefSys::getRecord...running query:\n"<< theSql << "\n" << std::endl;
std::cout << " QgsSpatialRefSys::getRecord...running query:\n"<< theSql.local8Bit() << "\n" << std::endl;
std::cout << " QgsSpatialRefSys::getRecord...trying system srs.db" << std::endl;
#endif
// Get the package data path and set the full path name to the sqlite3 spatial reference
@ -699,7 +699,7 @@ QgsSpatialRefSys::RecordMap QgsSpatialRefSys::getRecord(QString theSql)
else
{
#ifdef QGISDEBUG
std::cout << " QgsSpatialRefSys::getRecord failed : " << theSql << std::endl;
std::cout << " QgsSpatialRefSys::getRecord failed : " << theSql.local8Bit() << std::endl;
#endif
}
@ -708,7 +708,7 @@ QgsSpatialRefSys::RecordMap QgsSpatialRefSys::getRecord(QString theSql)
sqlite3_close(myDatabase);
#ifdef QGISDEBUG
std::cout << " QgsSpatialRefSys::getRecord retrieved: " << theSql << std::endl;
std::cout << " QgsSpatialRefSys::getRecord retrieved: " << theSql.local8Bit() << std::endl;
RecordMap::Iterator it;
for ( it = myMap.begin(); it != myMap.end(); ++it )
{
@ -744,7 +744,7 @@ long QgsSpatialRefSys::srid() const
*/
QString QgsSpatialRefSys::description () const
{
if (!mDescription)
if (mDescription.isEmpty())
{
return "";
}
@ -758,7 +758,7 @@ QString QgsSpatialRefSys::description () const
*/
QString QgsSpatialRefSys::projectionAcronym() const
{
if (!mProjectionAcronym)
if (mProjectionAcronym.isEmpty())
{
return "";
}
@ -772,7 +772,7 @@ QString QgsSpatialRefSys::projectionAcronym() const
*/
QString QgsSpatialRefSys::ellipsoidAcronym () const
{
if (!mEllipsoidAcronym)
if (mEllipsoidAcronym.isEmpty())
{
return "";
}
@ -786,7 +786,7 @@ QString QgsSpatialRefSys::ellipsoidAcronym () const
*/
QString QgsSpatialRefSys::proj4String() const
{
if (!mProj4String)
if (mProj4String.isEmpty())
{
return "";
}
@ -897,7 +897,7 @@ void QgsSpatialRefSys::setMapUnits()
unit = "Foot";
#ifdef QGISDEBUG
std::cerr << "Projection has linear units of " << unit << '\n';
std::cerr << "Projection has linear units of " << unit.local8Bit() << '\n';
#endif
if (unit == "Meter")
@ -922,7 +922,7 @@ void QgsSpatialRefSys::setMapUnits()
mMapUnits = QGis::UNKNOWN;
}
#ifdef QGISDEBUG
std::cerr << "Projection has angular units of " << unit << '\n';
std::cerr << "Projection has angular units of " << unit.local8Bit() << '\n';
#endif
}
@ -943,7 +943,7 @@ long QgsSpatialRefSys::findMatchingProj()
#ifdef QGISDEBUG
std::cout << "QgsSpatialRefSys::findMatchingProj..." << std::endl;
#endif
if (!mEllipsoidAcronym || ! mProjectionAcronym || ! mProj4String)
if (mEllipsoidAcronym.isEmpty() || mProjectionAcronym.isEmpty() || mProj4String.isEmpty())
{
std::cout << "QgsSpatialRefSys::findMatchingProj will only work if prj acr ellipsoid acr and proj4string are set!..." << std::endl;
return 0;
@ -959,7 +959,7 @@ long QgsSpatialRefSys::findMatchingProj()
QString mySql = QString ("select srs_id,parameters from tbl_srs where projection_acronym='" +
mProjectionAcronym + "' and ellipsoid_acronym='" + mEllipsoidAcronym + "'");
#ifdef QGISDEBUG
std::cout << "QgsSpatialRefSys::findMatchingProj list sql\n" << mySql << std::endl;
std::cout << "QgsSpatialRefSys::findMatchingProj list sql\n" << mySql.local8Bit() << std::endl;
std::cout << " QgsSpatialRefSys::findMatchingProj...trying system srs.db" << std::endl;
#endif
// Get the package data path and set the full path name to the sqlite3 spatial reference
@ -992,7 +992,7 @@ long QgsSpatialRefSys::findMatchingProj()
QString myProj4String = (char *)sqlite3_column_text(myPreparedStatement, 1);
if (this->equals(myProj4String))
{
std::cout << "QgsSpatialRefSys::findMatchingProj -------> MATCH FOUND in srs.db srsid: " << mySrsId << std::endl;
std::cout << "QgsSpatialRefSys::findMatchingProj -------> MATCH FOUND in srs.db srsid: " << mySrsId.local8Bit() << std::endl;
// close the sqlite3 statement
sqlite3_finalize(myPreparedStatement);
sqlite3_close(myDatabase);
@ -1000,7 +1000,7 @@ long QgsSpatialRefSys::findMatchingProj()
}
else
{
std::cout << " Not matched : " << myProj4String << std::endl;
std::cout << " Not matched : " << myProj4String.local8Bit() << std::endl;
}
}
}
@ -1034,7 +1034,7 @@ long QgsSpatialRefSys::findMatchingProj()
QString myProj4String = (char *)sqlite3_column_text(myPreparedStatement, 1);
if (this->equals(myProj4String))
{
std::cout << "QgsSpatialRefSys::findMatchingProj -------> MATCH FOUND in user qgis.db srsid: " << mySrsId << std::endl;
std::cout << "QgsSpatialRefSys::findMatchingProj -------> MATCH FOUND in user qgis.db srsid: " << mySrsId.local8Bit() << std::endl;
// close the sqlite3 statement
sqlite3_finalize(myPreparedStatement);
sqlite3_close(myDatabase);
@ -1042,7 +1042,7 @@ long QgsSpatialRefSys::findMatchingProj()
}
else
{
std::cout << " Not matched : " << myProj4String << std::endl;
std::cout << " Not matched : " << myProj4String.local8Bit() << std::endl;
}
}
}

View File

@ -35,8 +35,8 @@
QgsVectorFileWriter::QgsVectorFileWriter(QString theOutputFileName, QgsVectorLayer * theVectorLayer)
{
std::cout << "QgsVectorFileWriter constructor called with " << theOutputFileName <<
" and vector layer : " << theVectorLayer->getLayerID() << std::endl;
std::cout << "QgsVectorFileWriter constructor called with " << theOutputFileName.local8Bit() <<
" and vector layer : " << theVectorLayer->getLayerID().local8Bit() << std::endl;
//const char *mOutputFormat = "ESRI Shapefile";
mOutputFormat = "ESRI Shapefile";
//const char *theOutputFileName = "ogrtest.shp";
@ -54,7 +54,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(QString theOutputFileName, QgsVectorLay
QgsVectorFileWriter::QgsVectorFileWriter(QString theOutputFileName, OGRwkbGeometryType theGeometryType)
{
std::cout << "QgsVectorFileWriter constructor called with " << theOutputFileName << " and no input vector layer " << std::endl;
std::cout << "QgsVectorFileWriter constructor called with " << theOutputFileName.local8Bit() << " and no input vector layer " << std::endl;
mOutputFormat = "ESRI Shapefile"; //hard coded for now!
mOutputFileName = theOutputFileName;
mGeometryType = theGeometryType;
@ -100,7 +100,7 @@ bool QgsVectorFileWriter::initialise()
if( myDriverHandle == NULL )
{
std::cout << "Unable to find format driver named " << mOutputFormat << std::endl;
std::cout << "Unable to find format driver named " << mOutputFormat.local8Bit() << std::endl;
return false;
}
@ -140,7 +140,7 @@ bool QgsVectorFileWriter::initialise()
// const char *myWKT = GDALGetProjectionRef( hBand );
if( myWKT != NULL && strlen(myWKT) != 0 )
if( !myWKT.isEmpty() )
{
mySpatialReferenceSystemHandle = OSRNewSpatialReference( myWKT );
}

View File

@ -169,6 +169,9 @@ public slots:
void triggerRepaint();
/**Shows the properties dialog*/
virtual void showLayerProperties();
public:
/**Returns a pointer to the renderer*/
const QgsRenderer* renderer() const;
/**Sets the renderer. If a renderer is already present, it is deleted*/

View File

@ -18,6 +18,7 @@
#include <qapplication.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qglobal.h>
#include "splashscreen.h"
#include "qfont.h"
#include "qgis.h"
@ -35,7 +36,12 @@ SplashScreen::SplashScreen():QWidget(0, 0, WStyle_Customize | WStyle_Splash)
//
// NOTES! the mask must be a 1 BIT IMAGE or it wont work!
//
QPixmap myMaskPixmap( 564, 300, -1, QPixmap::BestOptim );
#if QT_VERSION < 0x040000
QPixmap myMaskPixmap( 564, 300, -1, QPixmap::BestOptim );
#else
// TODO: Confirm this is all we need under Qt4
QPixmap myMaskPixmap( 564, 300 );
#endif
myMaskPixmap.load( QString(PKGDATAPATH) + QString("/images/splash/splash_mask.png"), 0, Qt::ThresholdDither | Qt::ThresholdAlphaDither | Qt::AvoidDither );
setBackgroundPixmap(splashImage);
setMask( myMaskPixmap.createHeuristicMask() );
@ -74,7 +80,12 @@ void qt_wait_for_window_manager(QWidget * widget);
void SplashScreen::finish(QWidget * mainWin)
{
#if defined(Q_WS_X11)
// TODO: Qt4 (and Qt3.3 for that matter) has a dedicated QSplashScreen class;
// this class will need to be refactored to use QSplashScreen and therefore
// avoid the following hack.
#if QT_VERSION < 0x040000
qt_wait_for_window_manager(mainWin);
#endif
#endif
close();
}
@ -87,7 +98,12 @@ void SplashScreen::mousePressEvent(QMouseEvent *)
void SplashScreen::setStatus(const QString & message, int alignment, const QColor & color)
{
QPixmap textPix = splashImage;
QPainter painter(&textPix, this);
// TODO: Confirm that removing the "const QWidget * copyAttributes" 2nd parameter,
// in order to make things work in Qt4, doesn't break things in Qt3.
//QPainter painter(&textPix, this);
QPainter painter(&textPix);
painter.setPen(color);
QFont myQFont("arial", 10, QFont::Bold);
painter.setFont(myQFont);