summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@jollamobile.com>2015-09-01 16:20:25 +1000
committerAaron McCarthy <mccarthy.aaron@gmail.com>2015-09-02 01:38:47 +0000
commit2898098f65d1ddb5f4ceeedac06786c2cda8a611 (patch)
treeb027df1a31554918075df31ea56aecfc7808b89e
parentfd3ea87861b281a54c1888a0a044517cf86f9692 (diff)
Remove incorrect string construction in QML debug output
The original string had a "%1" expecting to be replaced by the arg() function, which was not used. Removed the output altogether, silently do nothing if the coordinate is not in the path. Remove dead code trusting that QList::lastIndexOf() will returned -1 or a valid index. Change-Id: Iffa7e663a439696cff6a6aa73d714f1259f4ea69 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r--src/imports/location/error_messages.cpp2
-rw-r--r--src/imports/location/error_messages.h4
-rw-r--r--src/imports/location/qdeclarativepolygonmapitem.cpp15
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem.cpp14
4 files changed, 10 insertions, 25 deletions
diff --git a/src/imports/location/error_messages.cpp b/src/imports/location/error_messages.cpp
index 5b2c139d..a2557f79 100644
--- a/src/imports/location/error_messages.cpp
+++ b/src/imports/location/error_messages.cpp
@@ -48,7 +48,5 @@ const char PLUGIN_NOT_VALID[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin is no
const char CATEGORIES_NOT_INITIALIZED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Unable to initialize categories");
const char UNABLE_TO_MAKE_REQUEST[] = QT_TRANSLATE_NOOP("QtLocationQML", "Unable to create request");
const char INDEX_OUT_OF_RANGE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Index '%1' out of range");
-//often used but only visible to developer -> no translation required
-const char COORD_NOT_BELONG_TO[] = "Coordinate does not belong to %1";
QT_END_NAMESPACE
diff --git a/src/imports/location/error_messages.h b/src/imports/location/error_messages.h
index 357db173..81c43b34 100644
--- a/src/imports/location/error_messages.h
+++ b/src/imports/location/error_messages.h
@@ -33,10 +33,11 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef ERROR_MESSAGES_H
#define ERROR_MESSAGES_H
-#include <QString>
+#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
@@ -46,7 +47,6 @@ extern const char PLUGIN_ERROR[];
extern const char PLUGIN_PROVIDER_ERROR[];
extern const char PLUGIN_NOT_VALID[];
extern const char CATEGORIES_NOT_INITIALIZED[];
-extern const char COORD_NOT_BELONG_TO[];
extern const char UNABLE_TO_MAKE_REQUEST[];
extern const char INDEX_OUT_OF_RANGE[];
diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp
index 5b94d009..9a71614f 100644
--- a/src/imports/location/qdeclarativepolygonmapitem.cpp
+++ b/src/imports/location/qdeclarativepolygonmapitem.cpp
@@ -448,26 +448,19 @@ void QDeclarativePolygonMapItem::addCoordinate(const QGeoCoordinate &coordinate)
/*!
\qmlmethod void MapPolygon::removeCoordinate(coordinate)
- Removes a coordinate from the path. If there are multiple instances of the
+ Removes \a coordinate from the path. If there are multiple instances of the
same coordinate, the one added last is removed.
- \sa addCoordinate, path
+ If \a coordinate is not in the path this method does nothing.
+ \sa addCoordinate, path
*/
-
void QDeclarativePolygonMapItem::removeCoordinate(const QGeoCoordinate &coordinate)
{
int index = path_.lastIndexOf(coordinate);
-
- if (index == -1) {
- qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolygonMapItem");
+ if (index == -1)
return;
- }
- if (path_.count() < index + 1) {
- qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolygonMapItem");
- return;
- }
path_.removeAt(index);
geometry_.markSourceDirty();
diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp
index dd041e7e..9201701c 100644
--- a/src/imports/location/qdeclarativepolylinemapitem.cpp
+++ b/src/imports/location/qdeclarativepolylinemapitem.cpp
@@ -570,25 +570,19 @@ void QDeclarativePolylineMapItem::addCoordinate(const QGeoCoordinate &coordinate
/*!
\qmlmethod void MapPolyline::removeCoordinate(coordinate)
- Removes a coordinate from the path. If there are multiple instances of the
+ Removes \a coordinate from the path. If there are multiple instances of the
same coordinate, the one added last is removed.
+ If \a coordinate is not in the path this method does nothing.
+
\sa addCoordinate, path
*/
-
void QDeclarativePolylineMapItem::removeCoordinate(const QGeoCoordinate &coordinate)
{
int index = path_.lastIndexOf(coordinate);
-
- if (index == -1) {
- qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolylineMapItem");
+ if (index == -1)
return;
- }
- if (path_.count() < index + 1) {
- qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolylineMapItem");
- return;
- }
path_.removeAt(index);
geometry_.markSourceDirty();