mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Tidy up #includes
Add tr() to some more user-visible text Move from std::cerr/cout to QgsLogger git-svn-id: http://svn.osgeo.org/qgis/trunk@5802 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
f0db600a35
commit
8b7c713150
@ -19,8 +19,8 @@
|
||||
|
||||
#include "qgsbabelformat.h"
|
||||
|
||||
#include <qregexp.h>
|
||||
#include <qstring.h>
|
||||
#include <QRegExp>
|
||||
#include <QString>
|
||||
|
||||
|
||||
QgsBabelFormat::QgsBabelFormat(const QString& name) :
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#include <QStringList>
|
||||
|
||||
class QString;
|
||||
|
||||
class QgsBabelFormat {
|
||||
public:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <qregexp.h>
|
||||
#include <QRegExp>
|
||||
|
||||
#include "qgsgpsdevice.h"
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
#ifndef QGSGPSDEVICE_H
|
||||
#define QGSGPSDEVICE_H
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qstringlist.h>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <qgsbabelformat.h>
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "ui_qgsgpsdevicedialogbase.h"
|
||||
#include "qgsgpsdevice.h"
|
||||
|
||||
#include <qstring.h>
|
||||
#include <QString>
|
||||
|
||||
|
||||
class QgsGPSDeviceDialog : public QDialog, private Ui::QgsGPSDeviceDialogBase
|
||||
|
@ -29,21 +29,13 @@
|
||||
#include "qgsgpsplugin.h"
|
||||
|
||||
|
||||
#include <qeventloop.h>
|
||||
#include <QFileDialog>
|
||||
#include <q3toolbar.h>
|
||||
#include <qmenubar.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <q3popupmenu.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qaction.h>
|
||||
#include <qapplication.h>
|
||||
#include <qcursor.h>
|
||||
#include <q3process.h>
|
||||
#include <q3progressdialog.h>
|
||||
#include <qsettings.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qglobal.h>
|
||||
#include <QMessageBox>
|
||||
#include <QAction>
|
||||
#include <Q3Process>
|
||||
#include <Q3ProgressDialog>
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
|
||||
//non qt includes
|
||||
#include <cassert>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "qgsbabelformat.h"
|
||||
#include "qgsgpsdevice.h"
|
||||
#include "../qgisplugin.h"
|
||||
#include <qwidget.h>
|
||||
|
||||
#include <qgisapp.h>
|
||||
|
||||
class QgsVectorLayer;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "qgsgpsdevicedialog.h"
|
||||
#include "qgsmaplayer.h"
|
||||
#include "qgsdataprovider.h"
|
||||
#include <qgslogger.h>
|
||||
|
||||
//qt includes
|
||||
#include <QFileDialog>
|
||||
@ -201,9 +202,9 @@ void QgsGPSPluginGui::on_pbnCancel_clicked()
|
||||
|
||||
void QgsGPSPluginGui::on_pbnGPXSelectFile_clicked()
|
||||
{
|
||||
std::cout << " Gps File Importer::pbnGPXSelectFile_clicked() " << std::endl;
|
||||
QgsLogger::debug(" Gps File Importer::pbnGPXSelectFile_clicked() ");
|
||||
QString myFileTypeQString;
|
||||
QString myFilterString="GPS eXchange format (*.gpx)";
|
||||
QString myFilterString=tr("GPS eXchange format (*.gpx)");
|
||||
QSettings settings("QuantumGIS", "qgis");
|
||||
QString dir = settings.readEntry("/Plugin-GPS/gpxdirectory");
|
||||
if (dir.isEmpty())
|
||||
@ -214,7 +215,7 @@ void QgsGPSPluginGui::on_pbnGPXSelectFile_clicked()
|
||||
dir, //initial dir
|
||||
myFilterString, //filters to select
|
||||
&myFileTypeQString); //the pointer to store selected filter
|
||||
std::cout << "Selected filetype filter is : " << myFileTypeQString.toLocal8Bit().data() << std::endl;
|
||||
QgsLogger::debug("Selected filetype filter is : " + myFileTypeQString);
|
||||
leGPXFile->setText(myFileNameQString);
|
||||
}
|
||||
|
||||
@ -231,11 +232,11 @@ void QgsGPSPluginGui::on_pbnIMPInput_clicked() {
|
||||
std::map<QString, QgsBabelFormat*>::const_iterator iter;
|
||||
iter = mImporters.find(mImpFormat);
|
||||
if (iter == mImporters.end()) {
|
||||
std::cerr << "Unknown file format selected: "
|
||||
<< myFileType.left(myFileType.length() - 6).toLocal8Bit().data() << std::endl;
|
||||
QgsLogger::warning("Unknown file format selected: " +
|
||||
myFileType.left(myFileType.length() - 6));
|
||||
}
|
||||
else {
|
||||
std::cerr << iter->first.toLocal8Bit().data() << " selected" << std::endl;
|
||||
QgsLogger::debug(iter->first + " selected");
|
||||
leIMPInput->setText(myFileName);
|
||||
cmbIMPFeature->clear();
|
||||
if (iter->second->supportsWaypoints())
|
||||
|
@ -20,9 +20,10 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QObject>
|
||||
|
||||
#include "gpsdata.h"
|
||||
|
||||
#include <qgslogger.h>
|
||||
|
||||
QString GPSObject::xmlify(const QString& str) {
|
||||
QString tmp = str;
|
||||
@ -311,11 +312,11 @@ GPSData* GPSData::getData(const QString& filename) {
|
||||
if (dataObjects.find(filename) == dataObjects.end()) {
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qWarning("Couldn't open the data source: " + filename);
|
||||
QgsLogger::warning(QObject::tr("Couldn't open the data source: ") + filename);
|
||||
return 0;
|
||||
}
|
||||
GPSData* data = new GPSData;
|
||||
std::cerr << "Loading file " << filename.toLocal8Bit().data() << std::endl;
|
||||
QgsLogger::debug("Loading file " + filename);
|
||||
GPXHandler handler(*data);
|
||||
bool failed = false;
|
||||
|
||||
@ -332,9 +333,10 @@ GPSData* GPSData::getData(const QString& filename) {
|
||||
if (file.atEnd())
|
||||
atEnd = 1;
|
||||
if (!XML_Parse(p, buffer, readBytes, atEnd)) {
|
||||
std::cerr<<"Parse error at line "
|
||||
<<XML_GetCurrentLineNumber(p)<<": "
|
||||
<<XML_ErrorString(XML_GetErrorCode(p))<<std::endl;
|
||||
QgsLogger::warning(QObject::tr("Parse error at line ") +
|
||||
QString("%1").arg(XML_GetCurrentLineNumber(p)) +
|
||||
" : " +
|
||||
QString(XML_ErrorString(XML_GetErrorCode(p))));
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
@ -347,7 +349,7 @@ GPSData* GPSData::getData(const QString& filename) {
|
||||
dataObjects[filename] = std::pair<GPSData*, unsigned>(data, 0);
|
||||
}
|
||||
else
|
||||
std::cerr << filename.toLocal8Bit().data() << " is already loaded"<<std::endl;
|
||||
QgsLogger::debug(filename + " is already loaded");
|
||||
|
||||
// return a pointer and increase the reference count for that filename
|
||||
DataMap::iterator iter = dataObjects.find(filename);
|
||||
@ -362,9 +364,9 @@ void GPSData::releaseData(const QString& filename) {
|
||||
it if the reference count becomes 0 */
|
||||
DataMap::iterator iter = dataObjects.find(filename);
|
||||
if (iter != dataObjects.end()) {
|
||||
std::cerr << "unrefing " << filename.toLocal8Bit().data() << std::endl;
|
||||
QgsLogger::debug("unrefing " + filename);
|
||||
if (--(iter->second.second) == 0) {
|
||||
std::cerr << "No one's using " << filename.toLocal8Bit().data() << ", I'll erase it" << std::endl;
|
||||
QgsLogger::debug("No one's using " + filename + ", I'll erase it");
|
||||
delete iter->second.first;
|
||||
dataObjects.erase(iter);
|
||||
}
|
||||
@ -379,7 +381,7 @@ GPSData::DataMap GPSData::dataObjects;
|
||||
|
||||
|
||||
bool GPXHandler::startElement(const XML_Char* qName, const XML_Char** attr) {
|
||||
//std::cerr<<"<"<<qName<<">"<<std::endl;
|
||||
|
||||
if (!std::strcmp(qName, "gpx")) {
|
||||
parseModes.push(ParsingDocument);
|
||||
mData = GPSData();
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QObject>
|
||||
|
||||
#include "qgis.h"
|
||||
#include "qgsdataprovider.h"
|
||||
@ -39,6 +40,7 @@
|
||||
#include "qgsrect.h"
|
||||
#include "qgsgpxprovider.h"
|
||||
#include "gpsdata.h"
|
||||
#include <qgslogger.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define QGISEXTERN extern "C" __declspec( dllexport )
|
||||
@ -54,7 +56,7 @@ const char* QgsGPXProvider::attr[] = { "name", "elevation", "symbol", "number",
|
||||
|
||||
const QString GPX_KEY = "gpx";
|
||||
|
||||
const QString GPX_DESCRIPTION = "GPS eXchange format provider";
|
||||
const QString GPX_DESCRIPTION = QObject::tr("GPS eXchange format provider");
|
||||
|
||||
|
||||
QgsGPXProvider::QgsGPXProvider(QString const & uri) :
|
||||
@ -71,7 +73,7 @@ QgsGPXProvider::QgsGPXProvider(QString const & uri) :
|
||||
// get the filename and the type parameter from the URI
|
||||
int fileNameEnd = uri.find('?');
|
||||
if (fileNameEnd == -1 || uri.mid(fileNameEnd + 1, 5) != "type=") {
|
||||
std::cerr<<"Bad URI - you need to specify the feature type"<<std::endl;
|
||||
QgsLogger::warning(tr("Bad URI - you need to specify the feature type."));
|
||||
return;
|
||||
}
|
||||
QString typeStr = uri.mid(fileNameEnd + 6);
|
||||
@ -130,7 +132,7 @@ QgsGPXProvider::~QgsGPXProvider() {
|
||||
|
||||
QString QgsGPXProvider::storageType()
|
||||
{
|
||||
return "GPS eXchange file";
|
||||
return tr("GPS eXchange file");
|
||||
}
|
||||
|
||||
|
||||
@ -411,8 +413,8 @@ std::vector<QgsFeature>& QgsGPXProvider::identify(QgsRect * rect) {
|
||||
// reset the data source since we need to be able to read through
|
||||
// all features
|
||||
reset();
|
||||
std::cerr << "Attempting to identify features falling within "
|
||||
<< rect->stringRep().toLocal8Bit().data() << std::endl;
|
||||
QgsLogger::debug("Attempting to identify features falling within " +
|
||||
rect->stringRep());
|
||||
// select the features
|
||||
select(rect);
|
||||
// temporary fix to get this to compile under windows
|
||||
@ -492,8 +494,8 @@ void QgsGPXProvider::reset() {
|
||||
|
||||
QString QgsGPXProvider::minValue(int position) {
|
||||
if (position >= fieldCount()) {
|
||||
std::cerr<<"Warning: access requested to invalid position "
|
||||
<<"in QgsGPXProvider::minValue(..)"<<std::endl;
|
||||
QgsLogger::warning(tr("Warning: access requested to invalid position "
|
||||
"in QgsGPXProvider::minValue(..)"));
|
||||
}
|
||||
if (mMinMaxCacheDirty) {
|
||||
fillMinMaxCash();
|
||||
@ -504,8 +506,8 @@ QString QgsGPXProvider::minValue(int position) {
|
||||
|
||||
QString QgsGPXProvider::maxValue(int position) {
|
||||
if (position >= fieldCount()) {
|
||||
std::cerr<<"Warning: access requested to invalid position "
|
||||
<<"in QgsGPXProvider::maxValue(..)"<<std::endl;
|
||||
QgsLogger::warning(tr("Warning: access requested to invalid position "
|
||||
"in QgsGPXProvider::maxValue(..)"));
|
||||
}
|
||||
if (mMinMaxCacheDirty) {
|
||||
fillMinMaxCash();
|
||||
@ -826,7 +828,7 @@ size_t QgsGPXProvider::layerCount() const
|
||||
|
||||
QString QgsGPXProvider::getDefaultValue(const QString& attr, QgsFeature* f) {
|
||||
if (attr == "source")
|
||||
return "Digitized in QGIS";
|
||||
return tr("Digitized in QGIS");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user